@vectorize-io/hindsight-control-plane 0.7.2 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/standalone/.next/BUILD_ID +1 -1
- package/standalone/.next/app-path-routes-manifest.json +3 -0
- package/standalone/.next/build-manifest.json +9 -9
- package/standalone/.next/prerender-manifest.json +3 -3
- package/standalone/.next/required-server-files.json +1 -0
- package/standalone/.next/routes-manifest.json +22 -0
- package/standalone/.next/server/app/[locale]/banks/[bankId]/page/build-manifest.json +6 -6
- package/standalone/.next/server/app/[locale]/banks/[bankId]/page.js +13 -13
- package/standalone/.next/server/app/[locale]/banks/[bankId]/page.js.nft.json +1 -1
- package/standalone/.next/server/app/[locale]/banks/[bankId]/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/[locale]/dashboard/page/build-manifest.json +6 -6
- package/standalone/.next/server/app/[locale]/dashboard/page.js +13 -13
- package/standalone/.next/server/app/[locale]/dashboard/page.js.nft.json +1 -1
- package/standalone/.next/server/app/[locale]/dashboard/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/[locale]/login/page/build-manifest.json +6 -6
- package/standalone/.next/server/app/[locale]/login/page.js +13 -13
- package/standalone/.next/server/app/[locale]/login/page.js.nft.json +1 -1
- package/standalone/.next/server/app/[locale]/login/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/[locale]/page/build-manifest.json +6 -6
- package/standalone/.next/server/app/[locale]/page.js +13 -13
- package/standalone/.next/server/app/[locale]/page.js.nft.json +1 -1
- package/standalone/.next/server/app/[locale]/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/_global-error/page/build-manifest.json +6 -6
- package/standalone/.next/server/app/_global-error/page.js +6 -6
- package/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/_global-error.html +1 -1
- package/standalone/.next/server/app/_global-error.rsc +7 -7
- package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
- package/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/standalone/.next/server/app/_not-found/page/build-manifest.json +6 -6
- package/standalone/.next/server/app/_not-found/page.js +9 -9
- package/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/_not-found.html +1 -1
- package/standalone/.next/server/app/_not-found.rsc +9 -9
- package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/api/auth/login/route.js +4 -4
- package/standalone/.next/server/app/api/auth/login/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/auth/logout/route.js +3 -3
- package/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/audit-logs/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/audit-logs/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/audit-logs/stats/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/audit-logs/stats/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/config/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/config/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/consolidate/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/consolidate/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/consolidation-recover/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/consolidation-recover/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/directives/[directiveId]/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/directives/[directiveId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/directives/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/directives/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/export/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/export/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/import/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/import/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/route/build-manifest.json +9 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/route.js +8 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/route.js.map +5 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/route_client-reference-manifest.js +3 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/stats/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/stats/route/build-manifest.json +9 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/stats/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/stats/route.js +8 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/stats/route.js.map +5 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/stats/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/banks/[bankId]/llm-requests/stats/route_client-reference-manifest.js +3 -0
- package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/clear/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/clear/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/history/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/history/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/refresh/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/refresh/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/mental-models/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/mental-models/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/observations/[modelId]/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/observations/[modelId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/observations/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/observations/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/operations/[operationId]/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/operations/[operationId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/tags/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/tags/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/webhooks/[webhookId]/deliveries/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/webhooks/[webhookId]/deliveries/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/webhooks/[webhookId]/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/webhooks/[webhookId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/[bankId]/webhooks/route.js +5 -5
- package/standalone/.next/server/app/api/banks/[bankId]/webhooks/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/banks/route.js +5 -5
- package/standalone/.next/server/app/api/banks/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/chunks/[chunkId]/route.js +5 -5
- package/standalone/.next/server/app/api/chunks/[chunkId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/documents/[documentId]/chunks/route.js +5 -5
- package/standalone/.next/server/app/api/documents/[documentId]/chunks/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/documents/[documentId]/reprocess/route.js +5 -5
- package/standalone/.next/server/app/api/documents/[documentId]/reprocess/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/documents/[documentId]/route.js +5 -5
- package/standalone/.next/server/app/api/documents/[documentId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/documents/route.js +5 -5
- package/standalone/.next/server/app/api/documents/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/documents/transfer/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/documents/transfer/route/build-manifest.json +9 -0
- package/standalone/.next/server/app/api/documents/transfer/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/documents/transfer/route.js +8 -0
- package/standalone/.next/server/app/api/documents/transfer/route.js.map +5 -0
- package/standalone/.next/server/app/api/documents/transfer/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/documents/transfer/route_client-reference-manifest.js +3 -0
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route.js +5 -5
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/entities/[entityId]/route.js +5 -5
- package/standalone/.next/server/app/api/entities/[entityId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/entities/graph/route.js +5 -5
- package/standalone/.next/server/app/api/entities/graph/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/entities/route.js +5 -5
- package/standalone/.next/server/app/api/entities/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/files/retain/route.js +5 -5
- package/standalone/.next/server/app/api/files/retain/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/graph/route.js +5 -5
- package/standalone/.next/server/app/api/graph/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/health/route.js +4 -4
- package/standalone/.next/server/app/api/health/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/list/route.js +5 -5
- package/standalone/.next/server/app/api/list/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/memories/[memoryId]/history/route.js +5 -5
- package/standalone/.next/server/app/api/memories/[memoryId]/history/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/memories/[memoryId]/route.js +5 -5
- package/standalone/.next/server/app/api/memories/[memoryId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/memories/retain/route.js +5 -5
- package/standalone/.next/server/app/api/memories/retain/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/memories/retain_async/route.js +5 -5
- package/standalone/.next/server/app/api/memories/retain_async/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/operations/[agentId]/route.js +5 -5
- package/standalone/.next/server/app/api/operations/[agentId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/profile/[bankId]/route.js +5 -5
- package/standalone/.next/server/app/api/profile/[bankId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/recall/route.js +5 -5
- package/standalone/.next/server/app/api/recall/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/reflect/route.js +5 -5
- package/standalone/.next/server/app/api/reflect/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/stats/[agentId]/memories-timeseries/route.js +5 -5
- package/standalone/.next/server/app/api/stats/[agentId]/memories-timeseries/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/stats/[agentId]/route.js +5 -5
- package/standalone/.next/server/app/api/stats/[agentId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/version/route.js +5 -5
- package/standalone/.next/server/app/api/version/route.js.nft.json +1 -1
- package/standalone/.next/server/app/de/dashboard.html +1 -1
- package/standalone/.next/server/app/de/dashboard.rsc +17 -17
- package/standalone/.next/server/app/de/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/de/dashboard.segments/$d$locale/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/de/dashboard.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/de/dashboard.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/de/dashboard.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/de/dashboard.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/de/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/de/login.html +1 -1
- package/standalone/.next/server/app/de/login.rsc +17 -17
- package/standalone/.next/server/app/de/login.segments/$d$locale/login/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/de/login.segments/$d$locale/login.segment.rsc +3 -3
- package/standalone/.next/server/app/de/login.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/de/login.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/de/login.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/de/login.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/de/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/en/dashboard.html +1 -1
- package/standalone/.next/server/app/en/dashboard.rsc +17 -17
- package/standalone/.next/server/app/en/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/en/dashboard.segments/$d$locale/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/en/dashboard.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/en/dashboard.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/en/dashboard.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/en/dashboard.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/en/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/en/login.html +1 -1
- package/standalone/.next/server/app/en/login.rsc +17 -17
- package/standalone/.next/server/app/en/login.segments/$d$locale/login/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/en/login.segments/$d$locale/login.segment.rsc +3 -3
- package/standalone/.next/server/app/en/login.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/en/login.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/en/login.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/en/login.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/en/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/es/dashboard.html +1 -1
- package/standalone/.next/server/app/es/dashboard.rsc +17 -17
- package/standalone/.next/server/app/es/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/es/dashboard.segments/$d$locale/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/es/dashboard.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/es/dashboard.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/es/dashboard.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/es/dashboard.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/es/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/es/login.html +1 -1
- package/standalone/.next/server/app/es/login.rsc +17 -17
- package/standalone/.next/server/app/es/login.segments/$d$locale/login/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/es/login.segments/$d$locale/login.segment.rsc +3 -3
- package/standalone/.next/server/app/es/login.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/es/login.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/es/login.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/es/login.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/es/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/fr/dashboard.html +1 -1
- package/standalone/.next/server/app/fr/dashboard.rsc +17 -17
- package/standalone/.next/server/app/fr/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/fr/dashboard.segments/$d$locale/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/fr/dashboard.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/fr/dashboard.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/fr/dashboard.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/fr/dashboard.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/fr/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/fr/login.html +1 -1
- package/standalone/.next/server/app/fr/login.rsc +17 -17
- package/standalone/.next/server/app/fr/login.segments/$d$locale/login/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/fr/login.segments/$d$locale/login.segment.rsc +3 -3
- package/standalone/.next/server/app/fr/login.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/fr/login.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/fr/login.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/fr/login.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/fr/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/ja/dashboard.html +1 -1
- package/standalone/.next/server/app/ja/dashboard.rsc +17 -17
- package/standalone/.next/server/app/ja/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/ja/dashboard.segments/$d$locale/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/ja/dashboard.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/ja/dashboard.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/ja/dashboard.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/ja/dashboard.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/ja/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/ja/login.html +1 -1
- package/standalone/.next/server/app/ja/login.rsc +17 -17
- package/standalone/.next/server/app/ja/login.segments/$d$locale/login/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/ja/login.segments/$d$locale/login.segment.rsc +3 -3
- package/standalone/.next/server/app/ja/login.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/ja/login.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/ja/login.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/ja/login.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/ja/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/ko/dashboard.html +1 -1
- package/standalone/.next/server/app/ko/dashboard.rsc +17 -17
- package/standalone/.next/server/app/ko/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/ko/dashboard.segments/$d$locale/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/ko/dashboard.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/ko/dashboard.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/ko/dashboard.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/ko/dashboard.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/ko/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/ko/login.html +1 -1
- package/standalone/.next/server/app/ko/login.rsc +17 -17
- package/standalone/.next/server/app/ko/login.segments/$d$locale/login/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/ko/login.segments/$d$locale/login.segment.rsc +3 -3
- package/standalone/.next/server/app/ko/login.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/ko/login.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/ko/login.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/ko/login.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/ko/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/pt/dashboard.html +1 -1
- package/standalone/.next/server/app/pt/dashboard.rsc +17 -17
- package/standalone/.next/server/app/pt/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/pt/dashboard.segments/$d$locale/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/pt/dashboard.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/pt/dashboard.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/pt/dashboard.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/pt/dashboard.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/pt/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/pt/login.html +1 -1
- package/standalone/.next/server/app/pt/login.rsc +17 -17
- package/standalone/.next/server/app/pt/login.segments/$d$locale/login/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/pt/login.segments/$d$locale/login.segment.rsc +3 -3
- package/standalone/.next/server/app/pt/login.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/pt/login.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/pt/login.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/pt/login.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/pt/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/yue-Hant/dashboard.html +1 -1
- package/standalone/.next/server/app/yue-Hant/dashboard.rsc +17 -17
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/$d$locale/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/yue-Hant/login.html +1 -1
- package/standalone/.next/server/app/yue-Hant/login.rsc +17 -17
- package/standalone/.next/server/app/yue-Hant/login.segments/$d$locale/login/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/yue-Hant/login.segments/$d$locale/login.segment.rsc +3 -3
- package/standalone/.next/server/app/yue-Hant/login.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/yue-Hant/login.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/yue-Hant/login.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/yue-Hant/login.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/yue-Hant/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-CN/dashboard.html +1 -1
- package/standalone/.next/server/app/zh-CN/dashboard.rsc +17 -17
- package/standalone/.next/server/app/zh-CN/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-CN/dashboard.segments/$d$locale/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/zh-CN/dashboard.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/zh-CN/dashboard.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/zh-CN/dashboard.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-CN/dashboard.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-CN/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-CN/login.html +1 -1
- package/standalone/.next/server/app/zh-CN/login.rsc +17 -17
- package/standalone/.next/server/app/zh-CN/login.segments/$d$locale/login/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-CN/login.segments/$d$locale/login.segment.rsc +3 -3
- package/standalone/.next/server/app/zh-CN/login.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/zh-CN/login.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/zh-CN/login.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-CN/login.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-CN/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-TW/dashboard.html +1 -1
- package/standalone/.next/server/app/zh-TW/dashboard.rsc +17 -17
- package/standalone/.next/server/app/zh-TW/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-TW/dashboard.segments/$d$locale/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/zh-TW/dashboard.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/zh-TW/dashboard.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/zh-TW/dashboard.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-TW/dashboard.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-TW/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-TW/login.html +1 -1
- package/standalone/.next/server/app/zh-TW/login.rsc +17 -17
- package/standalone/.next/server/app/zh-TW/login.segments/$d$locale/login/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-TW/login.segments/$d$locale/login.segment.rsc +3 -3
- package/standalone/.next/server/app/zh-TW/login.segments/$d$locale.segment.rsc +8 -8
- package/standalone/.next/server/app/zh-TW/login.segments/_full.segment.rsc +17 -17
- package/standalone/.next/server/app/zh-TW/login.segments/_head.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-TW/login.segments/_index.segment.rsc +4 -4
- package/standalone/.next/server/app/zh-TW/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app-paths-manifest.json +3 -0
- package/standalone/.next/server/chunks/0_py_indsight-control-plane__next-internal_server_app_api_banks_route_actions_18gm282.js +3 -0
- package/standalone/.next/server/chunks/0_py_indsight-control-plane__next-internal_server_app_api_graph_route_actions_00kh_49.js +3 -0
- package/standalone/.next/server/chunks/0n5q_ndsight-control-plane__next-internal_server_app_api_health_route_actions_19pdram.js +3 -0
- package/standalone/.next/server/chunks/0n5q_ndsight-control-plane__next-internal_server_app_api_recall_route_actions_06ghfqb.js +3 -0
- package/standalone/.next/server/chunks/0pqf_dsight-control-plane__next-internal_server_app_api_reflect_route_actions_03in8gn.js +3 -0
- package/standalone/.next/server/chunks/0pqf_dsight-control-plane__next-internal_server_app_api_version_route_actions_0czf09-.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_banks_[bankId]_audit-logs_stats_route_actions_0kej0_w.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_banks_[bankId]_consolidation-recover_route_actions_1c6qw27.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_banks_[bankId]_directives_[directiveId]_route_actions_1llwjvu.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_banks_[bankId]_llm-requests_stats_route_actions_1nl8qfa.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_banks_[bankId]_observations_[modelId]_route_actions_094nmat.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_banks_[bankId]_operations_[operationId]_route_actions_00nrqy6.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_banks_[bankId]_webhooks_[webhookId]_route_actions_0pks3-k.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_documents_[documentId]_chunks_route_actions_15qsk-j.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_documents_[documentId]_reprocess_route_actions_1jvv7ef.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_entities_[entityId]_regenerate_route_actions_0f7mrlt.js +3 -0
- package/standalone/.next/server/chunks/1cfs_server_app_api_stats_[agentId]_memories-timeseries_route_actions_1ea9p4r.js +3 -0
- package/standalone/.next/server/chunks/1m-g_api_banks_[bankId]_mental-models_[mentalModelId]_clear_route_actions_0cfkd1q.js +3 -0
- package/standalone/.next/server/chunks/1m-g_api_banks_[bankId]_mental-models_[mentalModelId]_history_route_actions_0p2lz3h.js +3 -0
- package/standalone/.next/server/chunks/1m-g_api_banks_[bankId]_mental-models_[mentalModelId]_refresh_route_actions_0nkogx6.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_auth_login_route_actions_05dbez1.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_auth_logout_route_actions_20jwqu9.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_audit-logs_route_actions_1zahwyi.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_config_route_actions_14pbba7.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_consolidate_route_actions_0xtt3hf.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_directives_route_actions_1gsxpe9.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_export_route_actions_0pc0op6.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_import_route_actions_0k2bma5.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_llm-requests_route_actions_0npnngk.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_observations_route_actions_1g60scb.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_route_actions_1uph6b1.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_tags_route_actions_07-xy-8.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_banks_[bankId]_webhooks_route_actions_1n5hno4.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_chunks_[chunkId]_route_actions_014_6z-.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_documents_[documentId]_route_actions_00r8gnm.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_documents_route_actions_20bkouh.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_documents_transfer_route_actions_1cc07kl.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_entities_[entityId]_route_actions_1k_oel6.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_entities_graph_route_actions_1w_zta8.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_entities_route_actions_1_ahjhw.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_files_retain_route_actions_0ha6-e-.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_memories_[memoryId]_history_route_actions_06u8tqi.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_memories_[memoryId]_route_actions_0l6w488.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_memories_retain_async_route_actions_1k5zo_v.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_memories_retain_route_actions_1p5hvj2.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_operations_[agentId]_route_actions_09je5kw.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_profile_[bankId]_route_actions_0ak68ag.js +3 -0
- package/standalone/.next/server/chunks/1v7m__next-internal_server_app_api_stats_[agentId]_route_actions_073tt6f.js +3 -0
- package/standalone/.next/server/chunks/1ygy_next-internal_server_app_api_banks_[bankId]_mental-models_route_actions_1gbn3y7.js +3 -0
- package/standalone/.next/server/chunks/21bd_app_api_banks_[bankId]_mental-models_[mentalModelId]_route_actions_0b3-fig.js +3 -0
- package/standalone/.next/server/chunks/21bd_app_api_banks_[bankId]_webhooks_[webhookId]_deliveries_route_actions_091234d.js +3 -0
- package/standalone/.next/server/chunks/{[root-of-the-server]__01dmrt.._.js → [root-of-the-server]__02dhsqm._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__02szboy._.js → [root-of-the-server]__04twg40._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__034t-5b._.js → [root-of-the-server]__05ideqf._.js} +1 -1
- package/standalone/.next/server/chunks/[root-of-the-server]__074_yom._.js +3 -0
- package/standalone/.next/server/chunks/{[root-of-the-server]__045is_g._.js → [root-of-the-server]__07adslc._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__04f8yge._.js → [root-of-the-server]__07qotdb._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0kpvc5m._.js → [root-of-the-server]__0_b7xy0._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0ksao0s._.js → [root-of-the-server]__0_fdgwx._.js} +1 -1
- package/standalone/.next/server/chunks/[root-of-the-server]__0bbkous._.js +3 -0
- package/standalone/.next/server/chunks/{[root-of-the-server]__09o6ecb._.js → [root-of-the-server]__0gxnexj._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__09wzap6._.js → [root-of-the-server]__0ha6-ug._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0bj66gx._.js → [root-of-the-server]__0k6x3t5._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0c6gzxo._.js → [root-of-the-server]__0lefs4t._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0dm~zm5._.js → [root-of-the-server]__0nwwtu8._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0dqqhi5._.js → [root-of-the-server]__0o10x_o._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0eelqcs._.js → [root-of-the-server]__0p9mepv._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0g6ttz_._.js → [root-of-the-server]__0sg6v_r._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0g-k5nf._.js → [root-of-the-server]__0ttl2rp._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0h-un1o._.js → [root-of-the-server]__0vkubrf._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0ie0vnh._.js → [root-of-the-server]__0w9z-gl._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0i_ddhv._.js → [root-of-the-server]__0x986a6._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0j_3g3q._.js → [root-of-the-server]__0y-n32k._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0jrleac._.js → [root-of-the-server]__0yncdx-._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0kfe-s3._.js → [root-of-the-server]__0zvv9--._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__134m13c._.js → [root-of-the-server]__1-ub_49._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0lxho.q._.js → [root-of-the-server]__10eumwe._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0nglzhr._.js → [root-of-the-server]__1367tnw._.js} +2 -2
- package/standalone/.next/server/chunks/{[root-of-the-server]__0nlcx8c._.js → [root-of-the-server]__13e6sct._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0opgsb1._.js → [root-of-the-server]__15bvgu8._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0ow3d9r._.js → [root-of-the-server]__15m_ijy._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0qhbr0h._.js → [root-of-the-server]__18hx2_l._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0qlh00e._.js → [root-of-the-server]__18ote-y._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0qn6ojb._.js → [root-of-the-server]__18rpw5j._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0qtmdr8._.js → [root-of-the-server]__190dn0v._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0qxre7i._.js → [root-of-the-server]__1979g8n._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0rrr9x1._.js → [root-of-the-server]__1aq14zo._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0ti9a8y._.js → [root-of-the-server]__1dtws1u._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0ugd9zh._.js → [root-of-the-server]__1fhiu-0._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0wdo5wh._.js → [root-of-the-server]__1iwl2c6._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0x~pclg._.js → [root-of-the-server]__1lr6a3a._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0_522se._.js → [root-of-the-server]__1pjj08a._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0_85hy3._.js → [root-of-the-server]__1poot5x._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0_lg09a._.js → [root-of-the-server]__1q8umiq._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0_nmf28._.js → [root-of-the-server]__1qcfo38._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0-01_nh._.js → [root-of-the-server]__1r1_40m._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0-ensby._.js → [root-of-the-server]__1rq98ev._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__0-ykzc0._.js → [root-of-the-server]__1slk2zq._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__10swise._.js → [root-of-the-server]__1xmfq8o._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__10vi3mt._.js → [root-of-the-server]__1xqvaj-._.js} +1 -1
- package/standalone/.next/server/chunks/[root-of-the-server]__1y9mvlb._.js +3 -0
- package/standalone/.next/server/chunks/{[root-of-the-server]__11doxv0._.js → [root-of-the-server]__1ypwa6v._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__13jqxg3._.js → [root-of-the-server]__20hlm5z._.js} +1 -1
- package/standalone/.next/server/chunks/{[root-of-the-server]__13w-r-z._.js → [root-of-the-server]__211rxvl._.js} +1 -1
- package/standalone/.next/server/chunks/{hindsight-control-plane__next-internal_server_app_api_list_route_actions_0p70zng.js → hindsight-control-plane__next-internal_server_app_api_list_route_actions_169yni3.js} +1 -1
- package/standalone/.next/server/chunks/hindsight-control-plane_src_0xk6y3c._.js +3 -0
- package/standalone/.next/server/chunks/{hindsight-control-plane_src_instrumentation_ts_0kj3bik._.js → hindsight-control-plane_src_instrumentation_ts_0_00o7d._.js} +1 -1
- package/standalone/.next/server/chunks/hindsight-control-plane_src_lib_hindsight-client_ts_0eje3tr._.js +3 -0
- package/standalone/.next/server/chunks/ssr/0_py_indsight-control-plane__next-internal_server_app__not-found_page_actions_1ce-i9s.js +3 -0
- package/standalone/.next/server/chunks/ssr/1v7m__next-internal_server_app_[locale]_banks_[bankId]_page_actions_1fdx12y.js +3 -0
- package/standalone/.next/server/chunks/ssr/1v7m__next-internal_server_app_[locale]_dashboard_page_actions_0nyy54m.js +3 -0
- package/standalone/.next/server/chunks/ssr/1v7m__next-internal_server_app_[locale]_login_page_actions_0xd8-ab.js +3 -0
- package/standalone/.next/server/chunks/ssr/1v7m__next-internal_server_app__global-error_page_actions_097gs_e.js +3 -0
- package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0l4klq3._.js → [root-of-the-server]__0-4iq52._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0_x23ke._.js +11 -0
- package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__09358ph._.js → [root-of-the-server]__0f_itg3._.js} +2 -2
- package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0cbmrds._.js → [root-of-the-server]__0ln09ua._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0hb_hxc._.js → [root-of-the-server]__0ufnibd._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0n_awzr._.js → [root-of-the-server]__1415lg8._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0sqm5sc._.js → [root-of-the-server]__1ce_9a0._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0tcyn68._.js → [root-of-the-server]__1dky4g0._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0y7gibh._.js → [root-of-the-server]__1m3vfum._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0y7riw8._.js → [root-of-the-server]__1m4axv1._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0~c-ivw._.js → [root-of-the-server]__1teaugm._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{_04wviei._.js → _08h-ll3._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{_0a1en~h._.js → _0hodfg4._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{_0b.ev0c._.js → _0l2o41x._.js} +2 -2
- package/standalone/.next/server/chunks/ssr/{_0d_o1xx._.js → _0ohntay._.js} +2 -2
- package/standalone/.next/server/chunks/ssr/{_0ge9j1.._.js → _0ssqfqa._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{_0htg~ae._.js → _0v6w_mw._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{_0xgpb1t._.js → _1ksfzi4._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{_0-~wj-r._.js → _1ssqeay._.js} +2 -2
- package/standalone/.next/server/chunks/ssr/{_13p-5vn._.js → _20s0s8m._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{hindsight-control-plane__next-internal_server_app_[locale]_page_actions_0914.k-.js → hindsight-control-plane__next-internal_server_app_[locale]_page_actions_0fx5i7n.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{hindsight-control-plane_src_app_layout_tsx_0r-lo1z._.js → hindsight-control-plane_src_app_layout_tsx_1b4iw1w._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_components_bank-selector_tsx_0b8_8lw._.js +7 -0
- package/standalone/.next/server/chunks/ssr/{hindsight-control-plane_src_messages_0gwl2zz._.js → hindsight-control-plane_src_messages_1k79b1m._.js} +2 -2
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_de_json_[json]_cjs_1ch1-23._.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_en_json_[json]_cjs_08qm708._.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_es_json_[json]_cjs_05p52ht._.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_fr_json_[json]_cjs_1vp4nco._.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_ja_json_[json]_cjs_0mldp7p._.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_ko_json_[json]_cjs_0epqzja._.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_pt_json_[json]_cjs_0d_3joa._.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_yue-Hant_json_[json]_cjs_1i7xoui._.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_zh-CN_json_[json]_cjs_14wtgi5._.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_zh-TW_json_[json]_cjs_05oa_ni._.js +3 -0
- package/standalone/.next/server/chunks/ssr/{node_modules_09w7yel._.js → node_modules_0h91jdk._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_0eytjwn._.js → node_modules_next_dist_0q5c63s._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_0h9llsw._.js → node_modules_next_dist_0uboya6._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_client_components_0inhx6q._.js → node_modules_next_dist_client_components_0wpq8j3._.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_forbidden_0ghu-f7.js → node_modules_next_dist_client_components_builtin_forbidden_0symwr9.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js → node_modules_next_dist_client_components_builtin_global-error_0-o-goa.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js → node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0x.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_esm_build_templates_app-page_05dtw8y.js → node_modules_next_dist_esm_build_templates_app-page_09e-si4.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_esm_build_templates_app-page_0a365-r.js → node_modules_next_dist_esm_build_templates_app-page_0hrczfa.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_esm_build_templates_app-page_0rc3ul_.js → node_modules_next_dist_esm_build_templates_app-page_19--w_z.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_esm_build_templates_app-page_0sh8shx.js → node_modules_next_dist_esm_build_templates_app-page_1b-drry.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_esm_build_templates_app-page_0vji4h-.js → node_modules_next_dist_esm_build_templates_app-page_1hdjn8g.js} +1 -1
- package/standalone/.next/server/chunks/ssr/{node_modules_next_dist_esm_build_templates_app-page_0xu7a4..js → node_modules_next_dist_esm_build_templates_app-page_1ld1x8b.js} +1 -1
- package/standalone/.next/server/edge/chunks/[root-of-the-server]__0idnhrz._.js +11 -0
- package/standalone/.next/server/edge/chunks/{_078chv~._.js → _0cpk8jp._.js} +2 -2
- package/standalone/.next/server/edge/chunks/node_modules_next_dist_esm_build_templates_edge-wrapper_08ss7ew.js +3 -0
- package/standalone/.next/server/edge/chunks/{turbopack-node_modules_next_dist_esm_build_templates_edge-wrapper_0q-a.hc.js → turbopack-node_modules_next_dist_esm_build_templates_edge-wrapper_10zadvt.js} +2 -2
- package/standalone/.next/server/edge/chunks/{turbopack-node_modules_next_dist_esm_build_templates_edge-wrapper_0n3wwyw.js → turbopack-node_modules_next_dist_esm_build_templates_edge-wrapper_1cypvda.js} +2 -2
- package/standalone/.next/server/instrumentation.js +1 -1
- package/standalone/.next/server/middleware-build-manifest.js +9 -9
- package/standalone/.next/server/middleware-manifest.json +12 -12
- package/standalone/.next/server/pages/404.html +1 -1
- package/standalone/.next/server/pages/500.html +1 -1
- package/standalone/.next/server/server-reference-manifest.js +1 -1
- package/standalone/.next/server/server-reference-manifest.json +1 -1
- package/standalone/.next/static/{la8Xw6GifJsnCNJ8clTVL → WNhovd8iAfbSzOLjWZbeD}/_clientMiddlewareManifest.js +1 -1
- package/standalone/.next/static/chunks/16x7s96e_7nzf.js +3 -0
- package/standalone/.next/static/chunks/{02_j4-hqudffh.js → 1r7gd36us-7gm.js} +1 -1
- package/standalone/.next/static/chunks/28t56shiu70y3.css +2 -0
- package/standalone/.next/static/chunks/2fiw5cr18t7wg.js +5 -0
- package/standalone/.next/static/chunks/{0__s~pguswdqe.js → 2glbol2hp_ttg.js} +1 -1
- package/standalone/.next/static/chunks/37w_hzg2bcmwe.js +3 -0
- package/standalone/.next/static/chunks/{11tqqi8rxondo.js → 3uu0u_efb3qj0.js} +1 -1
- package/standalone/.next/static/chunks/3yi06qp6e0hek.js +9 -0
- package/standalone/.next/static/chunks/{turbopack-0nr0jrmes2s-g.js → turbopack-2cuxzdi-q-g57.js} +1 -1
- package/standalone/node_modules/@next/env/package.json +1 -1
- package/standalone/node_modules/next/dist/build/swc/index.js +1 -1
- package/standalone/node_modules/next/dist/client/dev/debug-channel.js +102 -2
- package/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +11 -11
- package/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +13 -13
- package/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +2 -2
- package/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
- package/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
- package/standalone/node_modules/next/dist/server/app-render/action-handler.js +18 -8
- package/standalone/node_modules/next/dist/server/config-schema.js +1 -0
- package/standalone/node_modules/next/dist/server/config.js +1 -1
- package/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +2 -2
- package/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
- package/standalone/node_modules/next/dist/server/lib/encode-cache-tag.js +45 -0
- package/standalone/node_modules/next/dist/server/lib/implicit-tags.js +6 -3
- package/standalone/node_modules/next/dist/server/lib/patch-fetch.js +5 -1
- package/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
- package/standalone/node_modules/next/dist/server/web/spec-extension/revalidate.js +4 -3
- package/standalone/node_modules/next/dist/server/web/spec-extension/unstable-cache.js +6 -2
- package/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
- package/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- package/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
- package/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
- package/standalone/node_modules/next/package.json +15 -15
- package/standalone/package.json +2 -2
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_auth_login_route_actions_031s_~r.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_auth_logout_route_actions_13l1tt_.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_banks_[bankId]_audit-logs_route_actions_11r6o8_.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_banks_[bankId]_config_route_actions_0oat8_h.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_banks_[bankId]_consolidate_route_actions_0j8pkmz.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_banks_[bankId]_directives_route_actions_0v5_5bz.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_banks_[bankId]_export_route_actions_0ef.wad.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_banks_[bankId]_import_route_actions_0bggw6d.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_banks_[bankId]_observations_route_actions_0uw8jve.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_banks_[bankId]_route_actions_0.2f08z.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_banks_[bankId]_tags_route_actions_04l~2w5.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_banks_[bankId]_webhooks_route_actions_0yv5ts8.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_chunks_[chunkId]_route_actions_00psrbo.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_documents_[documentId]_route_actions_00gb~5r.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_documents_route_actions_13g2m2z.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_entities_[entityId]_route_actions_0xlm7zj.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_entities_graph_route_actions_10eudh4.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_entities_route_actions_129_ikm.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_files_retain_route_actions_09wzaef.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_memories_[memoryId]_history_route_actions_03yoj.n.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_memories_[memoryId]_route_actions_0c1zoso.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_memories_retain_async_route_actions_0x36yu3.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_memories_retain_route_actions_0z_q1dh.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_operations_[agentId]_route_actions_05ger32.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_profile_[bankId]_route_actions_05.nsfp.js +0 -3
- package/standalone/.next/server/chunks/0.eh__next-internal_server_app_api_stats_[agentId]_route_actions_041l6wu.js +0 -3
- package/standalone/.next/server/chunks/0d6s_ndsight-control-plane__next-internal_server_app_api_health_route_actions_0r4l5.b.js +0 -3
- package/standalone/.next/server/chunks/0d6s_ndsight-control-plane__next-internal_server_app_api_recall_route_actions_03qepz9.js +0 -3
- package/standalone/.next/server/chunks/0eoo_dsight-control-plane__next-internal_server_app_api_reflect_route_actions_01.f~qt.js +0 -3
- package/standalone/.next/server/chunks/0eoo_dsight-control-plane__next-internal_server_app_api_version_route_actions_07e8q2l.js +0 -3
- package/standalone/.next/server/chunks/0kyn_indsight-control-plane__next-internal_server_app_api_banks_route_actions_0qgkv8~.js +0 -3
- package/standalone/.next/server/chunks/0kyn_indsight-control-plane__next-internal_server_app_api_graph_route_actions_00cac4e.js +0 -3
- package/standalone/.next/server/chunks/0sr1_server_app_api_banks_[bankId]_audit-logs_stats_route_actions_0bnszid.js +0 -3
- package/standalone/.next/server/chunks/0sr1_server_app_api_banks_[bankId]_consolidation-recover_route_actions_0sloozz.js +0 -3
- package/standalone/.next/server/chunks/0sr1_server_app_api_banks_[bankId]_directives_[directiveId]_route_actions_0xzi6nm.js +0 -3
- package/standalone/.next/server/chunks/0sr1_server_app_api_banks_[bankId]_observations_[modelId]_route_actions_057lffb.js +0 -3
- package/standalone/.next/server/chunks/0sr1_server_app_api_banks_[bankId]_operations_[operationId]_route_actions_00e8c1e.js +0 -3
- package/standalone/.next/server/chunks/0sr1_server_app_api_banks_[bankId]_webhooks_[webhookId]_route_actions_0el8sa7.js +0 -3
- package/standalone/.next/server/chunks/0sr1_server_app_api_documents_[documentId]_chunks_route_actions_0oye54l.js +0 -3
- package/standalone/.next/server/chunks/0sr1_server_app_api_documents_[documentId]_reprocess_route_actions_0wz_qjt.js +0 -3
- package/standalone/.next/server/chunks/0sr1_server_app_api_entities_[entityId]_regenerate_route_actions_08px6y7.js +0 -3
- package/standalone/.next/server/chunks/0sr1_server_app_api_stats_[agentId]_memories-timeseries_route_actions_0tt9u29.js +0 -3
- package/standalone/.next/server/chunks/0yrl_api_banks_[bankId]_mental-models_[mentalModelId]_clear_route_actions_072d10i.js +0 -3
- package/standalone/.next/server/chunks/0yrl_api_banks_[bankId]_mental-models_[mentalModelId]_history_route_actions_0eadsvw.js +0 -3
- package/standalone/.next/server/chunks/0yrl_api_banks_[bankId]_mental-models_[mentalModelId]_refresh_route_actions_0dfq9m1.js +0 -3
- package/standalone/.next/server/chunks/118a_next-internal_server_app_api_banks_[bankId]_mental-models_route_actions_0uzmdc9.js +0 -3
- package/standalone/.next/server/chunks/13~r_app_api_banks_[bankId]_mental-models_[mentalModelId]_route_actions_06cqc9v.js +0 -3
- package/standalone/.next/server/chunks/13~r_app_api_banks_[bankId]_webhooks_[webhookId]_deliveries_route_actions_055f.ct.js +0 -3
- package/standalone/.next/server/chunks/hindsight-control-plane_src_0j2z.a1._.js +0 -3
- package/standalone/.next/server/chunks/hindsight-control-plane_src_lib_hindsight-client_ts_08a51-e._.js +0 -3
- package/standalone/.next/server/chunks/ssr/0.eh__next-internal_server_app_[locale]_banks_[bankId]_page_actions_0ue6gbf.js +0 -3
- package/standalone/.next/server/chunks/ssr/0.eh__next-internal_server_app_[locale]_dashboard_page_actions_0do7pmi.js +0 -3
- package/standalone/.next/server/chunks/ssr/0.eh__next-internal_server_app_[locale]_login_page_actions_0i~tp-7.js +0 -3
- package/standalone/.next/server/chunks/ssr/0.eh__next-internal_server_app__global-error_page_actions_0598-b3.js +0 -3
- package/standalone/.next/server/chunks/ssr/0kyn_indsight-control-plane__next-internal_server_app__not-found_page_actions_0sqm_zd.js +0 -3
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ef0i39._.js +0 -11
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_components_bank-selector_tsx_06fpcdx._.js +0 -7
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_de_json_[json]_cjs_0srwftc._.js +0 -3
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_en_json_[json]_cjs_04--cex._.js +0 -3
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_es_json_[json]_cjs_038wd7u._.js +0 -3
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_fr_json_[json]_cjs_0.o-707._.js +0 -3
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_ja_json_[json]_cjs_0cxdclo._.js +0 -3
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_ko_json_[json]_cjs_08d_xf1._.js +0 -3
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_pt_json_[json]_cjs_07-fhnd._.js +0 -3
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_yue-Hant_json_[json]_cjs_0v~xdus._.js +0 -3
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_zh-CN_json_[json]_cjs_0of8c00._.js +0 -3
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_zh-TW_json_[json]_cjs_038c3_x._.js +0 -3
- package/standalone/.next/server/edge/chunks/[root-of-the-server]__0ahrn18._.js +0 -11
- package/standalone/.next/server/edge/chunks/node_modules_next_dist_esm_build_templates_edge-wrapper_04.8.xv.js +0 -3
- package/standalone/.next/static/chunks/0_32-x9jwivwx.js +0 -5
- package/standalone/.next/static/chunks/0d2r~epeihfd-.js +0 -3
- package/standalone/.next/static/chunks/0e4o_talkhvxs.js +0 -3
- package/standalone/.next/static/chunks/0tk3z.k-81i8w.css +0 -2
- package/standalone/.next/static/chunks/17uw~~tnvu9pw.js +0 -9
- /package/standalone/.next/static/{la8Xw6GifJsnCNJ8clTVL → WNhovd8iAfbSzOLjWZbeD}/_buildManifest.js +0 -0
- /package/standalone/.next/static/{la8Xw6GifJsnCNJ8clTVL → WNhovd8iAfbSzOLjWZbeD}/_ssgManifest.js +0 -0
- /package/standalone/.next/static/chunks/{00x4cox9vcf2c.js → 02qcnokfyslyv.js} +0 -0
- /package/standalone/.next/static/chunks/{01xlw8hd842-c.js → 05-c3ty_6dwfk.js} +0 -0
- /package/standalone/.next/static/chunks/{03~yq9q893hmn.js → 0cz1d0mv5g_q7.js} +0 -0
- /package/standalone/.next/static/chunks/{0a8ypqn_dfey6.css → 0x9slcrj4xzgu.css} +0 -0
- /package/standalone/.next/static/chunks/{0b.234u8uc4ul.js → 10_q471aky8q9.js} +0 -0
- /package/standalone/.next/static/chunks/{0cxu7qr5divs~.js → 13t_2hd-hwsk2.js} +0 -0
- /package/standalone/.next/static/chunks/{0equ8vbwlrzt1.js → 19rm8b-79rseb.js} +0 -0
- /package/standalone/.next/static/chunks/{0k8fcq_tsf70-.js → 1rsn1dago3cd5.js} +0 -0
- /package/standalone/.next/static/chunks/{0rm0ctgl_-347.js → 2do678_8a6ogr.js} +0 -0
- /package/standalone/.next/static/chunks/{0roluhgciupg2.js → 2dw028qzq2vdu.js} +0 -0
- /package/standalone/.next/static/chunks/{0xe7gt3~du.d0.js → 2wju5i79r7bll.js} +0 -0
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,51273,(e,t,n)=>{e.e,t.exports=function(){var e=[function(e,t,n){"use strict";function r(){}r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(8),a=n(9);function o(e,t,n){r.call(this,n),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=n,this.bendpoints=[],this.source=e,this.target=t}for(var s in o.prototype=Object.create(r.prototype),r)o[s]=r[s];o.prototype.getSource=function(){return this.source},o.prototype.getTarget=function(){return this.target},o.prototype.isInterGraph=function(){return this.isInterGraph},o.prototype.getLength=function(){return this.length},o.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},o.prototype.getBendpoints=function(){return this.bendpoints},o.prototype.getLca=function(){return this.lca},o.prototype.getSourceInLca=function(){return this.sourceInLca},o.prototype.getTargetInLca=function(){return this.targetInLca},o.prototype.getOtherEnd=function(e){if(this.source===e)return this.target;if(this.target===e)return this.source;throw"Node is not incident with this edge"},o.prototype.getOtherEndInGraph=function(e,t){for(var n=this.getOtherEnd(e),r=t.getGraphManager().getRoot();;){if(n.getOwner()==t)return n;if(n.getOwner()==r)break;n=n.getOwner().getParent()}return null},o.prototype.updateLength=function(){var e=[,,,,];this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),e),this.isOverlapingSourceAndTarget||(this.lengthX=e[0]-e[2],this.lengthY=e[1]-e[3],1>Math.abs(this.lengthX)&&(this.lengthX=a.sign(this.lengthX)),1>Math.abs(this.lengthY)&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},o.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),1>Math.abs(this.lengthX)&&(this.lengthX=a.sign(this.lengthX)),1>Math.abs(this.lengthY)&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=o},function(e,t,n){"use strict";e.exports=function(e){this.vGraphObject=e}},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(13),o=n(0),s=n(16),l=n(5);function c(e,t,n,o){null==n&&null==o&&(o=t),r.call(this,o),null!=e.graphManager&&(e=e.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=o,this.edges=[],this.graphManager=e,null!=n&&null!=t?this.rect=new a(t.x,t.y,n.width,n.height):this.rect=new a}for(var u in c.prototype=Object.create(r.prototype),r)c[u]=r[u];c.prototype.getEdges=function(){return this.edges},c.prototype.getChild=function(){return this.child},c.prototype.getOwner=function(){return this.owner},c.prototype.getWidth=function(){return this.rect.width},c.prototype.setWidth=function(e){this.rect.width=e},c.prototype.getHeight=function(){return this.rect.height},c.prototype.setHeight=function(e){this.rect.height=e},c.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},c.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},c.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},c.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},c.prototype.getRect=function(){return this.rect},c.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},c.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},c.prototype.setRect=function(e,t){this.rect.x=e.x,this.rect.y=e.y,this.rect.width=t.width,this.rect.height=t.height},c.prototype.setCenter=function(e,t){this.rect.x=e-this.rect.width/2,this.rect.y=t-this.rect.height/2},c.prototype.setLocation=function(e,t){this.rect.x=e,this.rect.y=t},c.prototype.moveBy=function(e,t){this.rect.x+=e,this.rect.y+=t},c.prototype.getEdgeListToNode=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.target==e){if(r.source!=n)throw"Incorrect edge source!";t.push(r)}}),t},c.prototype.getEdgesBetween=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.source!=n&&r.target!=n)throw"Incorrect edge source and/or target";(r.target==e||r.source==e)&&t.push(r)}),t},c.prototype.getNeighborsList=function(){var e=new Set,t=this;return t.edges.forEach(function(n){if(n.source==t)e.add(n.target);else{if(n.target!=t)throw"Incorrect incidency!";e.add(n.source)}}),e},c.prototype.withChildren=function(){var e=new Set;if(e.add(this),null!=this.child)for(var t=this.child.getNodes(),n=0;n<t.length;n++)t[n].withChildren().forEach(function(t){e.add(t)});return e},c.prototype.getNoOfChildren=function(){var e=0;if(null==this.child)e=1;else for(var t=this.child.getNodes(),n=0;n<t.length;n++)e+=t[n].getNoOfChildren();return 0==e&&(e=1),e},c.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},c.prototype.calcEstimatedSize=function(){return null==this.child?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},c.prototype.scatter=function(){var e,t,n=-o.INITIAL_WORLD_BOUNDARY,r=o.INITIAL_WORLD_BOUNDARY;e=o.WORLD_CENTER_X+s.nextDouble()*(r-n)+n;var i=-o.INITIAL_WORLD_BOUNDARY,a=o.INITIAL_WORLD_BOUNDARY;t=o.WORLD_CENTER_Y+s.nextDouble()*(a-i)+i,this.rect.x=e,this.rect.y=t},c.prototype.updateBounds=function(){if(null==this.getChild())throw"assert failed";if(0!=this.getChild().getNodes().length){var e=this.getChild();if(e.updateBounds(!0),this.rect.x=e.getLeft(),this.rect.y=e.getTop(),this.setWidth(e.getRight()-e.getLeft()),this.setHeight(e.getBottom()-e.getTop()),o.NODE_DIMENSIONS_INCLUDE_LABELS){var t=e.getRight()-e.getLeft(),n=e.getBottom()-e.getTop();this.labelWidth&&("left"==this.labelPosHorizontal?(this.rect.x-=this.labelWidth,this.setWidth(t+this.labelWidth)):"center"==this.labelPosHorizontal&&this.labelWidth>t?(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)):"right"==this.labelPosHorizontal&&this.setWidth(t+this.labelWidth)),this.labelHeight&&("top"==this.labelPosVertical?(this.rect.y-=this.labelHeight,this.setHeight(n+this.labelHeight)):"center"==this.labelPosVertical&&this.labelHeight>n?(this.rect.y-=(this.labelHeight-n)/2,this.setHeight(this.labelHeight)):"bottom"==this.labelPosVertical&&this.setHeight(n+this.labelHeight))}}},c.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},c.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new l(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},c.prototype.getLeft=function(){return this.rect.x},c.prototype.getRight=function(){return this.rect.x+this.rect.width},c.prototype.getTop=function(){return this.rect.y},c.prototype.getBottom=function(){return this.rect.y+this.rect.height},c.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},e.exports=c},function(e,t,n){"use strict";var r=n(0);function i(){}for(var a in r)i[a]=r[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=3*i.MAX_NODE_DISPLACEMENT_INCREMENTAL,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=i},function(e,t,n){"use strict";function r(e,t){null==e&&null==t?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(0),o=n(7),s=n(3),l=n(1),c=n(13),u=n(12),d=n(11);function h(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,null!=t&&t instanceof o?this.graphManager=t:null!=t&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var f in h.prototype=Object.create(r.prototype),r)h[f]=r[f];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(e,t,n){if(null==t&&null==n){if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(e)>-1)throw"Node already in graph!";return e.owner=this,this.getNodes().push(e),e}if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw"Source or target not in graph!";if(t.owner!=n.owner||t.owner!=this)throw"Both owners must be this graph!";return t.owner!=n.owner?null:(e.source=t,e.target=n,e.isInterGraph=!1,this.getEdges().push(e),t.edges.push(e),n!=t&&n.edges.push(e),e)},h.prototype.remove=function(e){if(e instanceof s){if(null==e)throw"Node is null!";if(null==e.owner||e.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var t,n=e.edges.slice(),r=n.length,i=0;i<r;i++)(t=n[i]).isInterGraph?this.graphManager.remove(t):t.source.owner.remove(t);var a=this.nodes.indexOf(e);if(-1==a)throw"Node not in owner node list!";this.nodes.splice(a,1)}else if(e instanceof l){var t=e;if(null==t)throw"Edge is null!";if(null==t.source||null==t.target)throw"Source and/or target is null!";if(null==t.source.owner||null==t.target.owner||t.source.owner!=this||t.target.owner!=this)throw"Source and/or target owner is invalid!";var o=t.source.edges.indexOf(t),c=t.target.edges.indexOf(t);if(!(o>-1&&c>-1))throw"Source and/or target doesn't know this edge!";t.source.edges.splice(o,1),t.target!=t.source&&t.target.edges.splice(c,1);var a=t.source.owner.getEdges().indexOf(t);if(-1==a)throw"Not in owner's edge list!";t.source.owner.getEdges().splice(a,1)}},h.prototype.updateLeftTop=function(){for(var e,t,n,r=i.MAX_VALUE,a=i.MAX_VALUE,o=this.getNodes(),s=o.length,l=0;l<s;l++){var c=o[l];e=c.getTop(),t=c.getLeft(),r>e&&(r=e),a>t&&(a=t)}return r==i.MAX_VALUE?null:(n=void 0!=o[0].getParent().paddingLeft?o[0].getParent().paddingLeft:this.margin,this.left=a-n,this.top=r-n,new u(this.left,this.top))},h.prototype.updateBounds=function(e){for(var t,n,r,a,o,s=i.MAX_VALUE,l=-i.MAX_VALUE,u=i.MAX_VALUE,d=-i.MAX_VALUE,h=this.nodes,f=h.length,p=0;p<f;p++){var g=h[p];e&&null!=g.child&&g.updateBounds(),t=g.getLeft(),n=g.getRight(),r=g.getTop(),a=g.getBottom(),s>t&&(s=t),l<n&&(l=n),u>r&&(u=r),d<a&&(d=a)}var v=new c(s,u,l-s,d-u);s==i.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),o=void 0!=h[0].getParent().paddingLeft?h[0].getParent().paddingLeft:this.margin,this.left=v.x-o,this.right=v.x+v.width+o,this.top=v.y-o,this.bottom=v.y+v.height+o},h.calculateBounds=function(e){for(var t,n,r,a,o=i.MAX_VALUE,s=-i.MAX_VALUE,l=i.MAX_VALUE,u=-i.MAX_VALUE,d=e.length,h=0;h<d;h++){var f=e[h];t=f.getLeft(),n=f.getRight(),r=f.getTop(),a=f.getBottom(),o>t&&(o=t),s<n&&(s=n),l>r&&(l=r),u<a&&(u=a)}return new c(o,l,s-o,u-l)},h.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},h.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},h.prototype.calcEstimatedSize=function(){for(var e=0,t=this.nodes,n=t.length,r=0;r<n;r++)e+=t[r].calcEstimatedSize();return 0==e?this.estimatedSize=a.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=e/Math.sqrt(this.nodes.length),this.estimatedSize},h.prototype.updateConnected=function(){var e,t,n=this;if(0==this.nodes.length){this.isConnected=!0;return}var r=new d,i=new Set,a=this.nodes[0];for(a.withChildren().forEach(function(e){r.push(e),i.add(e)});0!==r.length;)for(var o=(e=(a=r.shift()).getEdges()).length,s=0;s<o;s++)null==(t=e[s].getOtherEndInGraph(a,this))||i.has(t)||t.withChildren().forEach(function(e){r.push(e),i.add(e)});if(this.isConnected=!1,i.size>=this.nodes.length){var l=0;i.forEach(function(e){e.owner==n&&l++}),l==this.nodes.length&&(this.isConnected=!0)}},e.exports=h},function(e,t,n){"use strict";var r,i=n(1);function a(e){r=n(6),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(null==n&&null==r&&null==i){if(null==e)throw"Graph is null!";if(null==t)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),null!=e.parent)throw"Already has a parent!";if(null!=t.child)throw"Already has a child!";return e.parent=t,t.child=e,e}i=n,r=t,n=e;var a=r.getOwner(),o=i.getOwner();if(null==a||a.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==o||o.getGraphManager()!=this)throw"Target not in this graph mgr!";if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),null==n.source||null==n.target)throw"Edge source and/or target is null!";if(-1!=n.source.edges.indexOf(n)||-1!=n.target.edges.indexOf(n))throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},a.prototype.remove=function(e){if(e instanceof r){if(e.getGraphManager()!=this)throw"Graph not in this graph mgr";if(e!=this.rootGraph&&(null==e.parent||e.parent.graphManager!=this))throw"Invalid parent node!";for(var t,n,a=[],o=(a=a.concat(e.getEdges())).length,s=0;s<o;s++)t=a[s],e.remove(t);var l=[];o=(l=l.concat(e.getNodes())).length;for(var s=0;s<o;s++)n=l[s],e.remove(n);e==this.rootGraph&&this.setRootGraph(null);var c=this.graphs.indexOf(e);this.graphs.splice(c,1),e.parent=null}else if(e instanceof i){if(null==(t=e))throw"Edge is null!";if(!t.isInterGraph)throw"Not an inter-graph edge!";if(null==t.source||null==t.target)throw"Source and/or target is null!";if(-1==t.source.edges.indexOf(t)||-1==t.target.edges.indexOf(t))throw"Source and/or target doesn't know this edge!";var c=t.source.edges.indexOf(t);if(t.source.edges.splice(c,1),c=t.target.edges.indexOf(t),t.target.edges.splice(c,1),null==t.source.owner||null==t.source.owner.getGraphManager())throw"Edge owner graph or owner graph manager is null!";if(-1==t.source.owner.getGraphManager().edges.indexOf(t))throw"Not in owner graph manager's edge list!";var c=t.source.owner.getGraphManager().edges.indexOf(t);t.source.owner.getGraphManager().edges.splice(c,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(null==this.allNodes){for(var e=[],t=this.getGraphs(),n=t.length,r=0;r<n;r++)e=e.concat(t[r].getNodes());this.allNodes=e}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(null==this.allEdges){var e=[],t=this.getGraphs();t.length;for(var n=0;n<t.length;n++)e=e.concat(t[n].getEdges());e=e.concat(this.edges),this.allEdges=e}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(e){if(null!=this.allNodesToApplyGravitation)throw"assert failed";this.allNodesToApplyGravitation=e},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(e){if(e.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=e,null==e.parent&&(e.parent=this.layout.newNode("Root node"))},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(e,t){if(null==e||null==t)throw"assert failed";if(e==t)return!0;for(var n,r=e.getOwner();null!=(n=r.getParent());){if(n==t)return!0;if(null==(r=n.getOwner()))break}for(r=t.getOwner();null!=(n=r.getParent());){if(n==e)return!0;if(null==(r=n.getOwner()))break}return!1},a.prototype.calcLowestCommonAncestors=function(){for(var e,t,n,r,i,a=this.getAllEdges(),o=a.length,s=0;s<o;s++){if(t=(e=a[s]).source,n=e.target,e.lca=null,e.sourceInLca=t,e.targetInLca=n,t==n){e.lca=t.getOwner();continue}for(r=t.getOwner();null==e.lca;){for(e.targetInLca=n,i=n.getOwner();null==e.lca;){if(i==r){e.lca=i;break}if(i==this.rootGraph)break;if(null!=e.lca)throw"assert failed";e.targetInLca=i.getParent(),i=e.targetInLca.getOwner()}if(r==this.rootGraph)break;null==e.lca&&(e.sourceInLca=r.getParent(),r=e.sourceInLca.getOwner())}if(null==e.lca)throw"assert failed"}},a.prototype.calcLowestCommonAncestor=function(e,t){if(e==t)return e.getOwner();for(var n=e.getOwner();null!=n;){for(var r=t.getOwner();null!=r;){if(r==n)return r;r=r.getParent().getOwner()}n=n.getParent().getOwner()}return n},a.prototype.calcInclusionTreeDepths=function(e,t){null==e&&null==t&&(e=this.rootGraph,t=1);for(var n,r=e.getNodes(),i=r.length,a=0;a<i;a++)(n=r[a]).inclusionTreeDepth=t,null!=n.child&&this.calcInclusionTreeDepths(n.child,t+1)},a.prototype.includesInvalidEdge=function(){for(var e,t=[],n=this.edges.length,r=0;r<n;r++)e=this.edges[r],this.isOneAncestorOfOther(e.source,e.target)&&t.push(e);for(var r=0;r<t.length;r++)this.remove(t[r]);return!1},e.exports=a},function(e,t,n){"use strict";var r=n(12);function i(){}i.calcSeparationAmount=function(e,t,n,r){if(!e.intersects(t))throw"assert failed";var i=[,,];this.decideDirectionsForOverlappingNodes(e,t,i),n[0]=Math.min(e.getRight(),t.getRight())-Math.max(e.x,t.x),n[1]=Math.min(e.getBottom(),t.getBottom())-Math.max(e.y,t.y),e.getX()<=t.getX()&&e.getRight()>=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]<s?s=n[0]:o=n[1],n[0]=-1*i[0]*(s/2+r),n[1]=-1*i[1]*(o/2+r)},i.decideDirectionsForOverlappingNodes=function(e,t,n){e.getCenterX()<t.getCenterX()?n[0]=-1:n[0]=1,e.getCenterY()<t.getCenterY()?n[1]=-1:n[1]=1},i.getIntersection2=function(e,t,n){var r=e.getCenterX(),i=e.getCenterY(),a=t.getCenterX(),o=t.getCenterY();if(e.intersects(t))return n[0]=r,n[1]=i,n[2]=a,n[3]=o,!0;var s=e.getX(),l=e.getY(),c=e.getRight(),u=e.getX(),d=e.getBottom(),h=e.getRight(),f=e.getWidthHalf(),p=e.getHeightHalf(),g=t.getX(),v=t.getY(),x=t.getRight(),y=t.getX(),b=t.getBottom(),w=t.getRight(),N=t.getWidthHalf(),j=t.getHeightHalf(),k=!1,S=!1;if(r===a)i>o?(n[0]=r,n[1]=l,n[2]=a,n[3]=b):i<o&&(n[0]=r,n[1]=d,n[2]=a,n[3]=v);else if(i===o)r>a?(n[0]=s,n[1]=i,n[2]=x,n[3]=o):r<a&&(n[0]=c,n[1]=i,n[2]=g,n[3]=o);else{var C=e.height/e.width,_=t.height/t.width,E=(o-i)/(a-r),T=void 0,M=void 0,O=void 0,A=void 0,D=void 0,P=void 0;if(-C===E?(r>a?(n[0]=u,n[1]=d):(n[0]=c,n[1]=l),k=!0):C===E&&(r>a?(n[0]=s,n[1]=l):(n[0]=h,n[1]=d),k=!0),-_===E?(a>r?(n[2]=y,n[3]=b):(n[2]=x,n[3]=v),S=!0):_===E&&(a>r?(n[2]=g,n[3]=v):(n[2]=w,n[3]=b),S=!0),k&&S)return!1;if(r>a?i>o?(T=this.getCardinalDirection(C,E,4),M=this.getCardinalDirection(_,E,2)):(T=this.getCardinalDirection(-C,E,3),M=this.getCardinalDirection(-_,E,1)):i>o?(T=this.getCardinalDirection(-C,E,1),M=this.getCardinalDirection(-_,E,3)):(T=this.getCardinalDirection(C,E,2),M=this.getCardinalDirection(_,E,4)),!k)switch(T){case 1:A=l,O=r+-p/E,n[0]=O,n[1]=A;break;case 2:O=h,A=i+f*E,n[0]=O,n[1]=A;break;case 3:A=d,O=r+p/E,n[0]=O,n[1]=A;break;case 4:O=u,A=i+-f*E,n[0]=O,n[1]=A}if(!S)switch(M){case 1:P=v,D=a+-j/E,n[2]=D,n[3]=P;break;case 2:D=w,P=o+N*E,n[2]=D,n[3]=P;break;case 3:P=b,D=a+j/E,n[2]=D,n[3]=P;break;case 4:D=y,P=o+-N*E,n[2]=D,n[3]=P}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(null==i)return this.getIntersection2(e,t,n);var a=e.x,o=e.y,s=t.x,l=t.y,c=n.x,u=n.y,d=i.x,h=i.y,f=void 0,p=void 0,g=void 0,v=void 0,x=void 0,y=void 0,b=void 0;return(f=l-o,g=a-s,x=s*o-a*l,p=h-u,v=c-d,y=d*u-c*h,0==(b=f*v-p*g))?null:new r((g*y-v*x)/b,(p*x-f*y)/b)},i.angleOfVector=function(e,t,n,r){var i=void 0;return e!==n?(i=Math.atan((r-t)/(n-e)),n<e?i+=Math.PI:r<t&&(i+=this.TWO_PI)):i=r<t?this.ONE_AND_HALF_PI:this.HALF_PI,i},i.doIntersect=function(e,t,n,r){var i=e.x,a=e.y,o=t.x,s=t.y,l=n.x,c=n.y,u=r.x,d=r.y,h=(o-i)*(d-c)-(u-l)*(s-a);if(0===h)return!1;var f=((d-c)*(u-i)+(l-u)*(d-a))/h,p=((a-s)*(u-i)+(o-i)*(d-a))/h;return 0<f&&f<1&&0<p&&p<1},i.findCircleLineIntersections=function(e,t,n,r,i,a,o){var s=(n-e)*(n-e)+(r-t)*(r-t),l=2*((e-i)*(n-e)+(t-a)*(r-t)),c=(e-i)*(e-i)+(t-a)*(t-a)-o*o;if(!(l*l-4*s*c>=0))return null;var u=(-l+Math.sqrt(l*l-4*s*c))/(2*s),d=(-l-Math.sqrt(l*l-4*s*c))/(2*s);return u>=0&&u<=1?[u]:d>=0&&d<=1?[d]:null},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,e.exports=i},function(e,t,n){"use strict";function r(){}r.sign=function(e){return e>0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r},function(e,t,n){"use strict";function r(){}r.MAX_VALUE=0x7fffffff,r.MIN_VALUE=-0x80000000,e.exports=r},function(e,t,n){"use strict";var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(e){return{value:e,next:null,prev:null}},a=function(e,t,n,r){return null!==e?e.next=t:r.head=t,null!==n?n.prev=t:r.tail=t,t.prev=e,t.next=n,r.length++,t},o=function(e,t){var n=e.prev,r=e.next;return null!==n?n.next=r:t.head=r,null!==r?r.prev=n:t.tail=n,e.prev=e.next=null,t.length--,e};e.exports=function(){function e(t){var n=this;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.length=0,this.head=null,this.tail=null,null!=t&&t.forEach(function(e){return n.push(e)})}return r(e,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(e,t){return a(t.prev,i(e),t,this)}},{key:"insertAfter",value:function(e,t){return a(t,i(e),t.next,this)}},{key:"insertNodeBefore",value:function(e,t){return a(t.prev,e,t,this)}},{key:"insertNodeAfter",value:function(e,t){return a(t,e,t.next,this)}},{key:"push",value:function(e){return a(this.tail,i(e),null,this)}},{key:"unshift",value:function(e){return a(null,i(e),this.head,this)}},{key:"remove",value:function(e){return o(e,this)}},{key:"pop",value:function(){return o(this.tail,this).value}},{key:"popNode",value:function(){return o(this.tail,this)}},{key:"shift",value:function(){return o(this.head,this).value}},{key:"shiftNode",value:function(){return o(this.head,this)}},{key:"get_object_at",value:function(e){if(e<=this.length()){for(var t=1,n=this.head;t<e;)n=n.next,t++;return n.value}}},{key:"set_object_at",value:function(e,t){if(e<=this.length()){for(var n=1,r=this.head;n<e;)r=r.next,n++;r.value=t}}}]),e}()},function(e,t,n){"use strict";function r(e,t,n){this.x=null,this.y=null,null==e&&null==t&&null==n?(this.x=0,this.y=0):"number"==typeof e&&"number"==typeof t&&null==n?(this.x=e,this.y=t):"Point"==e.constructor.name&&null==t&&null==n&&(n=e,this.x=n.x,this.y=n.y)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(e,t,n){"Point"==e.constructor.name&&null==t&&null==n?(n=e,this.setLocation(n.x,n.y)):"number"==typeof e&&"number"==typeof t&&null==n&&(parseInt(e)==e&&parseInt(t)==t?this.move(e,t):(this.x=Math.floor(e+.5),this.y=Math.floor(t+.5)))},r.prototype.move=function(e,t){this.x=e,this.y=t},r.prototype.translate=function(e,t){this.x+=e,this.y+=t},r.prototype.equals=function(e){return"Point"==e.constructor.name?this.x==e.x&&this.y==e.y:this==e},r.prototype.toString=function(){return new r().constructor.name+"[x="+this.x+",y="+this.y+"]"},e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){this.x=0,this.y=0,this.width=0,this.height=0,null!=e&&null!=t&&null!=n&&null!=r&&(this.x=e,this.y=t,this.width=n,this.height=r)}r.prototype.getX=function(){return this.x},r.prototype.setX=function(e){this.x=e},r.prototype.getY=function(){return this.y},r.prototype.setY=function(e){this.y=e},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(e){return!(this.getRight()<e.x||this.getBottom()<e.y||e.getRight()<this.x||e.getBottom()<this.y)},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},e.exports=r},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(){}i.lastID=0,i.createID=function(e){return i.isPrimitive(e)?e:(null!=e.uniqueID||(e.uniqueID=i.getString(),i.lastID++),e.uniqueID)},i.getString=function(e){return null==e&&(e=i.lastID),"Object#"+e},i.isPrimitive=function(e){var t=void 0===e?"undefined":r(e);return null==e||"object"!=t&&"function"!=t},e.exports=i},function(e,t,n){"use strict";function r(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}var i=n(0),a=n(7),o=n(3),s=n(1),l=n(6),c=n(5),u=n(17),d=n(29);function h(e){d.call(this),this.layoutQuality=i.QUALITY,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=i.DEFAULT_INCREMENTAL,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,null!=e&&(this.isRemoteUse=e)}h.RANDOM_SEED=1,h.prototype=Object.create(d.prototype),h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},h.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},h.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},h.prototype.newGraphManager=function(){var e=new a(this);return this.graphManager=e,e},h.prototype.newGraph=function(e){return new l(null,this.graphManager,e)},h.prototype.newNode=function(e){return new o(this.graphManager,e)},h.prototype.newEdge=function(e){return new s(null,null,e)},h.prototype.checkLayoutSuccess=function(){return null==this.graphManager.getRoot()||0==this.graphManager.getRoot().getNodes().length||this.graphManager.includesInvalidEdge()},h.prototype.runLayout=function(){var e;return this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters(),e=!this.checkLayoutSuccess()&&this.layout(),"during"!==i.ANIMATE&&(e&&!this.isSubLayout&&this.doPostLayout(),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,e)},h.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},h.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var e=this.graphManager.getAllEdges(),t=0;t<e.length;t++)e[t];for(var n=this.graphManager.getRoot().getNodes(),t=0;t<n.length;t++)n[t];this.update(this.graphManager.getRoot())}},h.prototype.update=function(e){if(null==e)this.update2();else if(e instanceof o){if(null!=e.getChild())for(var t=e.getChild().getNodes(),n=0;n<t.length;n++)update(t[n]);null!=e.vGraphObject&&e.vGraphObject.update(e)}else e instanceof s?null!=e.vGraphObject&&e.vGraphObject.update(e):e instanceof l&&null!=e.vGraphObject&&e.vGraphObject.update(e)},h.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=i.QUALITY,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=i.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},h.prototype.transform=function(e){if(void 0==e)this.transform(new c(0,0));else{var t=new u,n=this.graphManager.getRoot().updateLeftTop();if(null!=n){t.setWorldOrgX(e.x),t.setWorldOrgY(e.y),t.setDeviceOrgX(n.x),t.setDeviceOrgY(n.y);for(var r=this.getAllNodes(),i=0;i<r.length;i++)r[i].transform(t)}}},h.prototype.positionNodesRandomly=function(e){if(void 0==e)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var t,n,r=e.getNodes(),i=0;i<r.length;i++)null==(n=(t=r[i]).getChild())||0==n.getNodes().length?t.scatter():(this.positionNodesRandomly(n),t.updateBounds())},h.prototype.getFlatForest=function(){for(var e=[],t=!0,n=this.graphManager.getRoot().getNodes(),i=!0,a=0;a<n.length;a++)null!=n[a].getChild()&&(i=!1);if(!i)return e;var o=new Set,s=[],l=new Map,c=[];for(c=c.concat(n);c.length>0&&t;){for(s.push(c[0]);s.length>0&&t;){var u=s[0];s.splice(0,1),o.add(u);for(var d=u.getEdges(),a=0;a<d.length;a++){var h=d[a].getOtherEnd(u);if(l.get(u)!=h)if(o.has(h)){t=!1;break}else s.push(h),l.set(h,u)}}if(t){var f=[].concat(r(o));e.push(f);for(var a=0;a<f.length;a++){var p=f[a],g=c.indexOf(p);g>-1&&c.splice(g,1)}o=new Set,l=new Map}else e=[]}return e},h.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i<e.bendpoints.length;i++){var a=this.newNode(null);a.setRect(new Point(0,0),new Dimension(1,1)),r.add(a);var o=this.newEdge(null);this.graphManager.add(o,n,a),t.add(a),n=a}var o=this.newEdge(null);return this.graphManager.add(o,n,e.target),this.edgeToDummyNodes.set(e,t),e.isInterGraph()?this.graphManager.remove(e):r.remove(e),t},h.prototype.createBendpointsFromDummyNodes=function(){var e=[];e=e.concat(this.graphManager.getAllEdges()),e=[].concat(r(this.edgeToDummyNodes.keys())).concat(e);for(var t=0;t<e.length;t++){var n=e[t];if(n.bendpoints.length>0){for(var i=this.edgeToDummyNodes.get(n),a=0;a<i.length;a++){var o=i[a],s=new c(o.getCenterX(),o.getCenterY()),l=n.bendpoints.get(a);l.x=s.x,l.y=s.y,o.getOwner().remove(o)}this.graphManager.add(n,n.source,n.target)}}},h.transform=function(e,t,n,r){if(void 0==n||void 0==r)return e<=50?(i=9*t/500,a=t/10):(i=9*t/50,a=-8*t),i*e+a;var i,a,o=t;return e<=50?o-=(t-t/n)/50*(50-e):o+=(t*r-t)/50*(e-50),o},h.findCenterOfTree=function(e){var t=[];t=t.concat(e);var n=[],r=new Map,i=!1,a=null;(1==t.length||2==t.length)&&(i=!0,a=t[0]);for(var o=0;o<t.length;o++){var s=t[o],l=s.getNeighborsList().size;r.set(s,s.getNeighborsList().size),1==l&&n.push(s)}var c=[];for(c=c.concat(n);!i;){var u=[];u=u.concat(c),c=[];for(var o=0;o<t.length;o++){var s=t[o],d=t.indexOf(s);d>=0&&t.splice(d,1),s.getNeighborsList().forEach(function(e){if(0>n.indexOf(e)){var t=r.get(e)-1;1==t&&c.push(e),r.set(e,t)}})}n=n.concat(c),(1==t.length||2==t.length)&&(i=!0,a=t[0])}return a},h.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=h},function(e,t,n){"use strict";function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},e.exports=r},function(e,t,n){"use strict";var r=n(5);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return 0!=n&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return 0!=n&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return 0!=n&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return 0!=n&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){return new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y))},e.exports=i},function(e,t,n){"use strict";var r=n(15),i=n(4),a=n(0),o=n(8),s=n(9);function l(){r.call(this),this.useSmartIdealEdgeLengthCalculation=i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=i.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=i.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=i.MAX_ITERATIONS}for(var c in l.prototype=Object.create(r.prototype),r)l[c]=r[c];l.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,o,s,l,c=this.getGraphManager().getAllEdges(),u=0;u<c.length;u++)t=(e=c[u]).idealLength,e.isInterGraph&&(r=e.getSource(),o=e.getTarget(),s=e.getSourceInLca().getEstimatedSize(),l=e.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(e.idealLength+=s+l-2*a.SIMPLE_NODE_SIZE),n=e.getLca().getInclusionTreeDepth(),e.idealLength+=t*i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(r.getInclusionTreeDepth()+o.getInclusionTreeDepth()-2*n))},l.prototype.initSpringEmbedder=function(){var e=this.getAllNodes().length;this.incremental?(e>i.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(e>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var e,t=this.getAllEdges(),n=0;n<t.length;n++)e=t[n],this.calcSpringForce(e,e.idealLength)},l.prototype.calcRepulsionForces=function(){var e,t,n,r,a,o=!(arguments.length>0)||void 0===arguments[0]||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&o&&this.updateGrid(),a=new Set,e=0;e<l.length;e++)n=l[e],this.calculateRepulsionForceOfANode(n,a,o,s),a.add(n);else for(e=0;e<l.length;e++)for(n=l[e],t=e+1;t<l.length;t++)r=l[t],n.getOwner()==r.getOwner()&&this.calcRepulsionForce(n,r)},l.prototype.calcGravitationalForces=function(){for(var e,t=this.getAllNodesToApplyGravitation(),n=0;n<t.length;n++)e=t[n],this.calcGravitationalForce(e)},l.prototype.moveNodes=function(){for(var e=this.getAllNodes(),t=0;t<e.length;t++)e[t].move()},l.prototype.calcSpringForce=function(e,t){var n,r,i,a,o=e.getSource(),s=e.getTarget();if(this.uniformLeafNodeSizes&&null==o.getChild()&&null==s.getChild())e.updateLengthSimple();else if(e.updateLength(),e.isOverlapingSourceAndTarget)return;0!=(n=e.getLength())&&(i=(r=e.edgeElasticity*(n-t))*(e.lengthX/n),a=r*(e.lengthY/n),o.springForceX+=i,o.springForceY+=a,s.springForceX-=i,s.springForceY-=a)},l.prototype.calcRepulsionForce=function(e,t){var n,r,a,l,c,u,d,h=e.getRect(),f=t.getRect(),p=[,,],g=[,,,,];if(h.intersects(f)){o.calcSeparationAmount(h,f,p,i.DEFAULT_EDGE_LENGTH/2),u=2*p[0],d=2*p[1];var v=e.noOfChildren*t.noOfChildren/(e.noOfChildren+t.noOfChildren);e.repulsionForceX-=v*u,e.repulsionForceY-=v*d,t.repulsionForceX+=v*u,t.repulsionForceY+=v*d}else this.uniformLeafNodeSizes&&null==e.getChild()&&null==t.getChild()?(n=f.getCenterX()-h.getCenterX(),r=f.getCenterY()-h.getCenterY()):(o.getIntersection(h,f,g),n=g[2]-g[0],r=g[3]-g[1]),Math.abs(n)<i.MIN_REPULSION_DIST&&(n=s.sign(n)*i.MIN_REPULSION_DIST),Math.abs(r)<i.MIN_REPULSION_DIST&&(r=s.sign(r)*i.MIN_REPULSION_DIST),l=Math.sqrt(a=n*n+r*r),u=(c=(e.nodeRepulsion/2+t.nodeRepulsion/2)*e.noOfChildren*t.noOfChildren/a)*n/l,d=c*r/l,e.repulsionForceX-=u,e.repulsionForceY-=d,t.repulsionForceX+=u,t.repulsionForceY+=d},l.prototype.calcGravitationalForce=function(e){var t,n,r,i,a,o,s,l;n=((t=e.getOwner()).getRight()+t.getLeft())/2,r=(t.getTop()+t.getBottom())/2,i=e.getCenterX()-n,a=e.getCenterY()-r,o=Math.abs(i)+e.getWidth()/2,s=Math.abs(a)+e.getHeight()/2,e.getOwner()==this.graphManager.getRoot()?(o>(l=t.getEstimatedSize()*this.gravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a):(o>(l=t.getEstimatedSize()*this.compoundGravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant)},l.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=2>Math.abs(this.totalDisplacement-this.oldTotalDisplacement)),e=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,e||t},l.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},l.prototype.calcNoOfChildrenForAllNodes=function(){for(var e,t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)(e=t[n]).noOfChildren=e.getNoOfChildren()},l.prototype.calcGrid=function(e){var t=0,n=0;t=parseInt(Math.ceil((e.getRight()-e.getLeft())/this.repulsionRange)),n=parseInt(Math.ceil((e.getBottom()-e.getTop())/this.repulsionRange));for(var r=Array(t),i=0;i<t;i++)r[i]=Array(n);for(var i=0;i<t;i++)for(var a=0;a<n;a++)r[i][a]=[];return r},l.prototype.addNodeToGrid=function(e,t,n){var r=0,i=0,a=0,o=0;r=parseInt(Math.floor((e.getRect().x-t)/this.repulsionRange)),i=parseInt(Math.floor((e.getRect().width+e.getRect().x-t)/this.repulsionRange)),a=parseInt(Math.floor((e.getRect().y-n)/this.repulsionRange)),o=parseInt(Math.floor((e.getRect().height+e.getRect().y-n)/this.repulsionRange));for(var s=r;s<=i;s++)for(var l=a;l<=o;l++)this.grid[s][l].push(e),e.setGridCoordinates(r,i,a,o)},l.prototype.updateGrid=function(){var e,t,n=this.getAllNodes();for(e=0,this.grid=this.calcGrid(this.graphManager.getRoot());e<n.length;e++)t=n[e],this.addNodeToGrid(t,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},l.prototype.calculateRepulsionForceOfANode=function(e,t,n,r){if(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&n||r){var a,o=new Set;e.surrounding=[];for(var s=this.grid,l=e.startX-1;l<e.finishX+2;l++)for(var c=e.startY-1;c<e.finishY+2;c++)if(!(l<0||c<0||l>=s.length||c>=s[0].length)){for(var u=0;u<s[l][c].length;u++)if(a=s[l][c][u],e.getOwner()==a.getOwner()&&e!=a&&!t.has(a)&&!o.has(a)){var d=Math.abs(e.getCenterX()-a.getCenterX())-(e.getWidth()/2+a.getWidth()/2),h=Math.abs(e.getCenterY()-a.getCenterY())-(e.getHeight()/2+a.getHeight()/2);d<=this.repulsionRange&&h<=this.repulsionRange&&o.add(a)}}e.surrounding=[].concat(function(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}(o))}for(l=0;l<e.surrounding.length;l++)this.calcRepulsionForce(e,e.surrounding[l])},l.prototype.calcRepulsionRange=function(){return 0},e.exports=l},function(e,t,n){"use strict";var r=n(1),i=n(4);function a(e,t,n){r.call(this,e,t,n),this.idealLength=i.DEFAULT_EDGE_LENGTH,this.edgeElasticity=i.DEFAULT_SPRING_STRENGTH}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];e.exports=a},function(e,t,n){"use strict";var r=n(3),i=n(4);function a(e,t,n,a){r.call(this,e,t,n,a),this.nodeRepulsion=i.DEFAULT_REPULSION_STRENGTH,this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.setGridCoordinates=function(e,t,n,r){this.startX=e,this.finishX=t,this.startY=n,this.finishY=r},e.exports=a},function(e,t,n){"use strict";function r(e,t){this.width=0,this.height=0,null!==e&&null!==t&&(this.height=t,this.width=e)}r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},e.exports=r},function(e,t,n){"use strict";var r=n(14);function i(){this.map={},this.keys=[]}i.prototype.put=function(e,t){var n=r.createID(e);this.contains(n)||(this.map[n]=t,this.keys.push(e))},i.prototype.contains=function(e){return r.createID(e),null!=this.map[e]},i.prototype.get=function(e){var t=r.createID(e);return this.map[t]},i.prototype.keySet=function(){return this.keys},e.exports=i},function(e,t,n){"use strict";var r=n(14);function i(){this.set={}}i.prototype.add=function(e){var t=r.createID(e);this.contains(t)||(this.set[t]=e)},i.prototype.remove=function(e){delete this.set[r.createID(e)]},i.prototype.clear=function(){this.set={}},i.prototype.contains=function(e){return this.set[r.createID(e)]==e},i.prototype.isEmpty=function(){return 0===this.size()},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAllTo=function(e){for(var t=Object.keys(this.set),n=t.length,r=0;r<n;r++)e.push(this.set[t[r]])},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAll=function(e){for(var t=e.length,n=0;n<t;n++){var r=e[n];this.add(r)}},e.exports=i},function(e,t,n){"use strict";function r(){}r.multMat=function(e,t){for(var n=[],r=0;r<e.length;r++){n[r]=[];for(var i=0;i<t[0].length;i++){n[r][i]=0;for(var a=0;a<e[0].length;a++)n[r][i]+=e[r][a]*t[a][i]}}return n},r.transpose=function(e){for(var t=[],n=0;n<e[0].length;n++){t[n]=[];for(var r=0;r<e.length;r++)t[n][r]=e[r][n]}return t},r.multCons=function(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=e[r]*t;return n},r.minusOp=function(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=e[r]-t[r];return n},r.dotProduct=function(e,t){for(var n=0,r=0;r<e.length;r++)n+=e[r]*t[r];return n},r.mag=function(e){return Math.sqrt(this.dotProduct(e,e))},r.normalize=function(e){for(var t=[],n=this.mag(e),r=0;r<e.length;r++)t[r]=e[r]/n;return t},r.multGamma=function(e){for(var t=[],n=0,r=0;r<e.length;r++)n+=e[r];n*=-1/e.length;for(var i=0;i<e.length;i++)t[i]=n+e[i];return t},r.multL=function(e,t,n){for(var r=[],i=[],a=[],o=0;o<t[0].length;o++){for(var s=0,l=0;l<t.length;l++)s+=-.5*t[l][o]*e[l];i[o]=s}for(var c=0;c<n.length;c++){for(var u=0,d=0;d<n.length;d++)u+=n[c][d]*i[d];a[c]=u}for(var h=0;h<t.length;h++){for(var f=0,p=0;p<t[0].length;p++)f+=t[h][p]*a[p];r[h]=f}return r},e.exports=r},function(e,t,n){"use strict";var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(11);e.exports=function(){function e(t,n){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");(null!==n||void 0!==n)&&(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=t instanceof i?t.size():t.length,this._quicksort(t,0,r-1)}return r(e,[{key:"_quicksort",value:function(e,t,n){if(t<n){var r=this._partition(e,t,n);this._quicksort(e,t,r),this._quicksort(e,r+1,n)}}},{key:"_partition",value:function(e,t,n){for(var r=this._get(e,t),i=t,a=n;;){for(;this.compareFunction(r,this._get(e,a));)a--;for(;this.compareFunction(this._get(e,i),r);)i++;if(!(i<a))return a;this._swap(e,i,a),i++,a--}}},{key:"_get",value:function(e,t){return e instanceof i?e.get_object_at(t):e[t]}},{key:"_set",value:function(e,t,n){e instanceof i?e.set_object_at(t,n):e[t]=n}},{key:"_swap",value:function(e,t,n){var r=this._get(e,t);this._set(e,t,this._get(e,n)),this._set(e,n,r)}},{key:"_defaultCompareFunction",value:function(e,t){return t>e}}]),e}()},function(e,t,n){"use strict";function r(){}r.svd=function(e){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=e.length,this.n=e[0].length;var t=Math.min(this.m,this.n);this.s=function(e){for(var t=[];e-- >0;)t.push(0);return t}(Math.min(this.m+1,this.n)),this.U=function e(t){if(0==t.length)return 0;for(var n=[],r=0;r<t[0];r++)n.push(e(t.slice(1)));return n}([this.m,t]),this.V=function e(t){if(0==t.length)return 0;for(var n=[],r=0;r<t[0];r++)n.push(e(t.slice(1)));return n}([this.n,this.n]);for(var n=function(e){for(var t=[];e-- >0;)t.push(0);return t}(this.n),i=function(e){for(var t=[];e-- >0;)t.push(0);return t}(this.m),a=Math.min(this.m-1,this.n),o=Math.max(0,Math.min(this.n-2,this.m)),s=0;s<Math.max(a,o);s++){if(s<a){this.s[s]=0;for(var l=s;l<this.m;l++)this.s[s]=r.hypot(this.s[s],e[l][s]);if(0!==this.s[s]){e[s][s]<0&&(this.s[s]=-this.s[s]);for(var c=s;c<this.m;c++)e[c][s]/=this.s[s];e[s][s]+=1}this.s[s]=-this.s[s]}for(var u=s+1;u<this.n;u++){if(g=s<a,v=0!==this.s[s],g&&v){for(var d=0,h=s;h<this.m;h++)d+=e[h][s]*e[h][u];d=-d/e[s][s];for(var f=s;f<this.m;f++)e[f][u]+=d*e[f][s]}n[u]=e[s][u]}if(x=s<a)for(var p=s;p<this.m;p++)this.U[p][s]=e[p][s];if(s<o){n[s]=0;for(var g,v,x,y,b,w=s+1;w<this.n;w++)n[s]=r.hypot(n[s],n[w]);if(0!==n[s]){n[s+1]<0&&(n[s]=-n[s]);for(var N=s+1;N<this.n;N++)n[N]/=n[s];n[s+1]+=1}if(n[s]=-n[s],y=s+1<this.m,b=0!==n[s],y&&b){for(var j=s+1;j<this.m;j++)i[j]=0;for(var k=s+1;k<this.n;k++)for(var S=s+1;S<this.m;S++)i[S]+=n[k]*e[S][k];for(var C=s+1;C<this.n;C++)for(var _=-n[C]/n[s+1],E=s+1;E<this.m;E++)e[E][C]+=_*i[E]}for(var T=s+1;T<this.n;T++)this.V[T][s]=n[T]}}var M=Math.min(this.n,this.m+1);a<this.n&&(this.s[a]=e[a][a]),this.m<M&&(this.s[M-1]=0),o+1<M&&(n[o]=e[o][M-1]),n[M-1]=0;for(var O=a;O<t;O++){for(var A=0;A<this.m;A++)this.U[A][O]=0;this.U[O][O]=1}for(var D=a-1;D>=0;D--)if(0!==this.s[D]){for(var P=D+1;P<t;P++){for(var I=0,L=D;L<this.m;L++)I+=this.U[L][D]*this.U[L][P];I=-I/this.U[D][D];for(var R=D;R<this.m;R++)this.U[R][P]+=I*this.U[R][D]}for(var B=D;B<this.m;B++)this.U[B][D]=-this.U[B][D];this.U[D][D]=1+this.U[D][D];for(var F=0;F<D-1;F++)this.U[F][D]=0}else{for(var z=0;z<this.m;z++)this.U[z][D]=0;this.U[D][D]=1}for(var V=this.n-1;V>=0;V--){if(ed=V<o,eh=0!==n[V],ed&&eh)for(var H=V+1;H<t;H++){for(var U=0,W=V+1;W<this.n;W++)U+=this.V[W][V]*this.V[W][H];U=-U/this.V[V+1][V];for(var Y=V+1;Y<this.n;Y++)this.V[Y][H]+=U*this.V[Y][V]}for(var G=0;G<this.n;G++)this.V[G][V]=0;this.V[V][V]=1}for(var X=M-1,$=0;M>0;){var q=void 0,K=void 0;for(q=M-2;q>=-1&&-1!==q;q--)if(Math.abs(n[q])<=16033346880071782e-307+2220446049250313e-31*(Math.abs(this.s[q])+Math.abs(this.s[q+1]))){n[q]=0;break}if(q===M-2)K=4;else{var Z=void 0;for(Z=M-1;Z>=q&&Z!==q;Z--){var Q=(Z!==M?Math.abs(n[Z]):0)+(Z!==q+1?Math.abs(n[Z-1]):0);if(Math.abs(this.s[Z])<=16033346880071782e-307+2220446049250313e-31*Q){this.s[Z]=0;break}}Z===q?K=3:Z===M-1?K=1:(K=2,q=Z)}switch(q++,K){case 1:var J=n[M-2];n[M-2]=0;for(var ee=M-2;ee>=q;ee--){var et=r.hypot(this.s[ee],J),en=this.s[ee]/et,er=J/et;this.s[ee]=et,ee!==q&&(J=-er*n[ee-1],n[ee-1]=en*n[ee-1]);for(var ei=0;ei<this.n;ei++)et=en*this.V[ei][ee]+er*this.V[ei][M-1],this.V[ei][M-1]=-er*this.V[ei][ee]+en*this.V[ei][M-1],this.V[ei][ee]=et}break;case 2:var ea=n[q-1];n[q-1]=0;for(var eo=q;eo<M;eo++){var es=r.hypot(this.s[eo],ea),el=this.s[eo]/es,ec=ea/es;this.s[eo]=es,ea=-ec*n[eo],n[eo]=el*n[eo];for(var eu=0;eu<this.m;eu++)es=el*this.U[eu][eo]+ec*this.U[eu][q-1],this.U[eu][q-1]=-ec*this.U[eu][eo]+el*this.U[eu][q-1],this.U[eu][eo]=es}break;case 3:var ed,eh,ef,ep,em=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[M-1]),Math.abs(this.s[M-2])),Math.abs(n[M-2])),Math.abs(this.s[q])),Math.abs(n[q])),eg=this.s[M-1]/em,ev=this.s[M-2]/em,ex=n[M-2]/em,ey=this.s[q]/em,eb=n[q]/em,ew=((ev+eg)*(ev-eg)+ex*ex)/2,eN=eg*ex*(eg*ex),ej=0;ef=0!==ew,ep=0!==eN,(ef||ep)&&(ej=Math.sqrt(ew*ew+eN),ew<0&&(ej=-ej),ej=eN/(ew+ej));for(var ek=(ey+eg)*(ey-eg)+ej,eS=ey*eb,eC=q;eC<M-1;eC++){var e_=r.hypot(ek,eS),eE=ek/e_,eT=eS/e_;eC!==q&&(n[eC-1]=e_),ek=eE*this.s[eC]+eT*n[eC],n[eC]=eE*n[eC]-eT*this.s[eC],eS=eT*this.s[eC+1],this.s[eC+1]=eE*this.s[eC+1];for(var eM=0;eM<this.n;eM++)e_=eE*this.V[eM][eC]+eT*this.V[eM][eC+1],this.V[eM][eC+1]=-eT*this.V[eM][eC]+eE*this.V[eM][eC+1],this.V[eM][eC]=e_;if(e_=r.hypot(ek,eS),eE=ek/e_,eT=eS/e_,this.s[eC]=e_,ek=eE*n[eC]+eT*this.s[eC+1],this.s[eC+1]=-eT*n[eC]+eE*this.s[eC+1],eS=eT*n[eC+1],n[eC+1]=eE*n[eC+1],eC<this.m-1)for(var eO=0;eO<this.m;eO++)e_=eE*this.U[eO][eC]+eT*this.U[eO][eC+1],this.U[eO][eC+1]=-eT*this.U[eO][eC]+eE*this.U[eO][eC+1],this.U[eO][eC]=e_}n[M-2]=ek;break;case 4:if(this.s[q]<=0){this.s[q]=this.s[q]<0?-this.s[q]:0;for(var eA=0;eA<=X;eA++)this.V[eA][q]=-this.V[eA][q]}for(;q<X&&!(this.s[q]>=this.s[q+1]);){var eD=this.s[q];if(this.s[q]=this.s[q+1],this.s[q+1]=eD,q<this.n-1)for(var eP=0;eP<this.n;eP++)eD=this.V[eP][q+1],this.V[eP][q+1]=this.V[eP][q],this.V[eP][q]=eD;if(q<this.m-1)for(var eI=0;eI<this.m;eI++)eD=this.U[eI][q+1],this.U[eI][q+1]=this.U[eI][q],this.U[eI][q]=eD;q++}M--}}return{U:this.U,V:this.V,S:this.s}},r.hypot=function(e,t){var n=void 0;return Math.abs(e)>Math.abs(t)?(n=t/e,n=Math.abs(e)*Math.sqrt(1+n*n)):0!=t?(n=e/t,n=Math.abs(t)*Math.sqrt(1+n*n)):n=0,n},e.exports=r},function(e,t,n){"use strict";var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();e.exports=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=i,this.gap_penalty=a,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=Array(this.iMax);for(var o=0;o<this.iMax;o++){this.grid[o]=Array(this.jMax);for(var s=0;s<this.jMax;s++)this.grid[o][s]=0}this.tracebackGrid=Array(this.iMax);for(var l=0;l<this.iMax;l++){this.tracebackGrid[l]=Array(this.jMax);for(var c=0;c<this.jMax;c++)this.tracebackGrid[l][c]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return r(e,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var e=1;e<this.jMax;e++)this.grid[0][e]=this.grid[0][e-1]+this.gap_penalty,this.tracebackGrid[0][e]=[!1,!1,!0];for(var t=1;t<this.iMax;t++)this.grid[t][0]=this.grid[t-1][0]+this.gap_penalty,this.tracebackGrid[t][0]=[!1,!0,!1];for(var n=1;n<this.iMax;n++)for(var r=1;r<this.jMax;r++){var i=[this.sequence1[n-1]===this.sequence2[r-1]?this.grid[n-1][r-1]+this.match_score:this.grid[n-1][r-1]+this.mismatch_penalty,this.grid[n-1][r]+this.gap_penalty,this.grid[n][r-1]+this.gap_penalty],a=this.arrayAllMaxIndexes(i);this.grid[n][r]=i[a[0]],this.tracebackGrid[n][r]=[a.includes(0),a.includes(1),a.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var e=[];for(e.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});e[0];){var t=e[0],n=this.tracebackGrid[t.pos[0]][t.pos[1]];n[0]&&e.push({pos:[t.pos[0]-1,t.pos[1]-1],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),n[1]&&e.push({pos:[t.pos[0]-1,t.pos[1]],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:"-"+t.seq2}),n[2]&&e.push({pos:[t.pos[0],t.pos[1]-1],seq1:"-"+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),0===t.pos[0]&&0===t.pos[1]&&this.alignments.push({sequence1:t.seq1,sequence2:t.seq2}),e.shift()}return this.alignments}},{key:"getAllIndexes",value:function(e,t){for(var n=[],r=-1;-1!==(r=e.indexOf(t,r+1));)n.push(r);return n}},{key:"arrayAllMaxIndexes",value:function(e){return this.getAllIndexes(e,Math.max.apply(null,e))}}]),e}()},function(e,t,n){"use strict";var r=function(){};r.FDLayout=n(18),r.FDLayoutConstants=n(4),r.FDLayoutEdge=n(19),r.FDLayoutNode=n(20),r.DimensionD=n(21),r.HashMap=n(22),r.HashSet=n(23),r.IGeometry=n(8),r.IMath=n(9),r.Integer=n(10),r.Point=n(12),r.PointD=n(5),r.RandomSeed=n(16),r.RectangleD=n(13),r.Transform=n(17),r.UniqueIDGeneretor=n(14),r.Quicksort=n(25),r.LinkedList=n(11),r.LGraphObject=n(2),r.LGraph=n(6),r.LEdge=n(1),r.LGraphManager=n(7),r.LNode=n(3),r.Layout=n(15),r.LayoutConstants=n(0),r.NeedlemanWunsch=n(27),r.Matrix=n(24),r.SVD=n(26),e.exports=r},function(e,t,n){"use strict";function r(){this.listeners=[]}var i=r.prototype;i.addListener=function(e,t){this.listeners.push({event:e,callback:t})},i.removeListener=function(e,t){for(var n=this.listeners.length;n>=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;n<this.listeners.length;n++){var r=this.listeners[n];e===r.event&&r.callback(t)}},e.exports=r}],t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=28)}()},97659,(e,t,n)=>{var r;e.e,r=e.r(51273),t.exports=(()=>{"use strict";var e={45:(e,t,n)=>{var r={};r.layoutBase=n(551),r.CoSEConstants=n(806),r.CoSEEdge=n(767),r.CoSEGraph=n(880),r.CoSEGraphManager=n(578),r.CoSELayout=n(765),r.CoSENode=n(991),r.ConstraintHandler=n(902),e.exports=r},806:(e,t,n)=>{var r=n(551).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0,i.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,i.TREE_REDUCTION_ON_INCREMENTAL=!0,i.PURE_INCREMENTAL=i.DEFAULT_INCREMENTAL,e.exports=i},767:(e,t,n)=>{var r=n(551).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},880:(e,t,n)=>{var r=n(551).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},578:(e,t,n)=>{var r=n(551).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},765:(e,t,n)=>{var r=n(551).FDLayout,i=n(578),a=n(880),o=n(991),s=n(767),l=n(806),c=n(902),u=n(551).FDLayoutConstants,d=n(551).LayoutConstants,h=n(551).Point,f=n(551).PointD,p=n(551).DimensionD,g=n(551).Layout,v=n(551).Integer,x=n(551).IGeometry,y=n(551).LGraph,b=n(551).Transform,w=n(551).LinkedList;function N(){r.call(this),this.toBeTiled={},this.constraints={}}for(var j in N.prototype=Object.create(r.prototype),r)N[j]=r[j];N.prototype.newGraphManager=function(){var e=new i(this);return this.graphManager=e,e},N.prototype.newGraph=function(e){return new a(null,this.graphManager,e)},N.prototype.newNode=function(e){return new o(this.graphManager,e)},N.prototype.newEdge=function(e){return new s(null,null,e)},N.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(l.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=l.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=u.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=u.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=u.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},N.prototype.initSpringEmbedder=function(){r.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/u.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},N.prototype.layout=function(){return d.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},N.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(l.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t)}}else{var n=this.getFlatForest();if(n.length>0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),l.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},N.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(!(this.prunedNodesAll.length>0))return!0;else this.isTreeGrowing=!0;if(this.totalIterations%u.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(!(this.prunedNodesAll.length>0))return!0;else this.isTreeGrowing=!0;this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),l.PURE_INCREMENTAL?this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),l.PURE_INCREMENTAL?this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},N.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n<e.length;n++){var r=e[n].rect,i=e[n].id;t[i]={id:i,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return t},N.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var e=!1;if("during"===u.ANIMATE)this.emit("layoutstarted");else{for(;!e;)e=this.tick();this.graphManager.updateBounds()}},N.prototype.moveNodes=function(){for(var e,t=this.getAllNodes(),n=0;n<t.length;n++)t[n].calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var n=0;n<t.length;n++)t[n].move()},N.prototype.initConstraintVariables=function(){var e=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var t=this.graphManager.getAllNodes(),n=0;n<t.length;n++){var r=t[n];this.idToNodeMap.set(r.id,r)}if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(t){e.fixedNodeSet.add(t.nodeId)});for(var r,t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)if(null!=(r=t[n]).getChild()){var i=function t(n){for(var r,i=n.getChild().getNodes(),a=0,o=0;o<i.length;o++)null==(r=i[o]).getChild()?e.fixedNodeSet.has(r.id)&&(a+=100):a+=t(r);return a}(r);i>0&&(r.fixedNodeWeight=i)}}if(this.constraints.relativePlacementConstraint){var a=new Map,o=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(t){e.fixedNodesOnHorizontal.add(t),e.fixedNodesOnVertical.add(t)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var s=this.constraints.alignmentConstraint.vertical,n=0;n<s.length;n++)this.dummyToNodeForVerticalAlignment.set("dummy"+n,[]),s[n].forEach(function(t){a.set(t,"dummy"+n),e.dummyToNodeForVerticalAlignment.get("dummy"+n).push(t),e.fixedNodeSet.has(t)&&e.fixedNodesOnHorizontal.add("dummy"+n)});if(this.constraints.alignmentConstraint.horizontal)for(var c=this.constraints.alignmentConstraint.horizontal,n=0;n<c.length;n++)this.dummyToNodeForHorizontalAlignment.set("dummy"+n,[]),c[n].forEach(function(t){o.set(t,"dummy"+n),e.dummyToNodeForHorizontalAlignment.get("dummy"+n).push(t),e.fixedNodeSet.has(t)&&e.fixedNodesOnVertical.add("dummy"+n)})}if(l.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(e){var t,n,r;for(r=e.length-1;r>=2*e.length/3;r--)t=Math.floor(Math.random()*(r+1)),n=e[r],e[r]=e[t],e[t]=n;return e},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(t){if(t.left){var n=a.has(t.left)?a.get(t.left):t.left,r=a.has(t.right)?a.get(t.right):t.right;e.nodesInRelativeHorizontal.includes(n)||(e.nodesInRelativeHorizontal.push(n),e.nodeToRelativeConstraintMapHorizontal.set(n,[]),e.dummyToNodeForVerticalAlignment.has(n)?e.nodeToTempPositionMapHorizontal.set(n,e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(n)[0]).getCenterX()):e.nodeToTempPositionMapHorizontal.set(n,e.idToNodeMap.get(n).getCenterX())),e.nodesInRelativeHorizontal.includes(r)||(e.nodesInRelativeHorizontal.push(r),e.nodeToRelativeConstraintMapHorizontal.set(r,[]),e.dummyToNodeForVerticalAlignment.has(r)?e.nodeToTempPositionMapHorizontal.set(r,e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(r)[0]).getCenterX()):e.nodeToTempPositionMapHorizontal.set(r,e.idToNodeMap.get(r).getCenterX())),e.nodeToRelativeConstraintMapHorizontal.get(n).push({right:r,gap:t.gap}),e.nodeToRelativeConstraintMapHorizontal.get(r).push({left:n,gap:t.gap})}else{var i=o.has(t.top)?o.get(t.top):t.top,s=o.has(t.bottom)?o.get(t.bottom):t.bottom;e.nodesInRelativeVertical.includes(i)||(e.nodesInRelativeVertical.push(i),e.nodeToRelativeConstraintMapVertical.set(i,[]),e.dummyToNodeForHorizontalAlignment.has(i)?e.nodeToTempPositionMapVertical.set(i,e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(i)[0]).getCenterY()):e.nodeToTempPositionMapVertical.set(i,e.idToNodeMap.get(i).getCenterY())),e.nodesInRelativeVertical.includes(s)||(e.nodesInRelativeVertical.push(s),e.nodeToRelativeConstraintMapVertical.set(s,[]),e.dummyToNodeForHorizontalAlignment.has(s)?e.nodeToTempPositionMapVertical.set(s,e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(s)[0]).getCenterY()):e.nodeToTempPositionMapVertical.set(s,e.idToNodeMap.get(s).getCenterY())),e.nodeToRelativeConstraintMapVertical.get(i).push({bottom:s,gap:t.gap}),e.nodeToRelativeConstraintMapVertical.get(s).push({top:i,gap:t.gap})}});else{var u=new Map,d=new Map;this.constraints.relativePlacementConstraint.forEach(function(e){if(e.left){var t=a.has(e.left)?a.get(e.left):e.left,n=a.has(e.right)?a.get(e.right):e.right;u.has(t)?u.get(t).push(n):u.set(t,[n]),u.has(n)?u.get(n).push(t):u.set(n,[t])}else{var r=o.has(e.top)?o.get(e.top):e.top,i=o.has(e.bottom)?o.get(e.bottom):e.bottom;d.has(r)?d.get(r).push(i):d.set(r,[i]),d.has(i)?d.get(i).push(r):d.set(i,[r])}});var h=function(e,t){var n=[],r=[],i=new w,a=new Set,o=0;return e.forEach(function(s,l){if(!a.has(l)){n[o]=[],r[o]=!1;var c=l;for(i.push(c),a.add(c),n[o].push(c);0!=i.length;)c=i.shift(),t.has(c)&&(r[o]=!0),e.get(c).forEach(function(e){a.has(e)||(i.push(e),a.add(e),n[o].push(e))});o++}}),{components:n,isFixed:r}},f=h(u,e.fixedNodesOnHorizontal);this.componentsOnHorizontal=f.components,this.fixedComponentsOnHorizontal=f.isFixed;var p=h(d,e.fixedNodesOnVertical);this.componentsOnVertical=p.components,this.fixedComponentsOnVertical=p.isFixed}}},N.prototype.updateDisplacements=function(){var e=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(t){var n=e.idToNodeMap.get(t.nodeId);n.displacementX=0,n.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var t=this.constraints.alignmentConstraint.vertical,n=0;n<t.length;n++){for(var r=0,i=0;i<t[n].length;i++){if(this.fixedNodeSet.has(t[n][i])){r=0;break}r+=this.idToNodeMap.get(t[n][i]).displacementX}for(var a=r/t[n].length,i=0;i<t[n].length;i++)this.idToNodeMap.get(t[n][i]).displacementX=a}if(this.constraints.alignmentConstraint.horizontal)for(var o=this.constraints.alignmentConstraint.horizontal,n=0;n<o.length;n++){for(var s=0,i=0;i<o[n].length;i++){if(this.fixedNodeSet.has(o[n][i])){s=0;break}s+=this.idToNodeMap.get(o[n][i]).displacementY}for(var c=s/o[n].length,i=0;i<o[n].length;i++)this.idToNodeMap.get(o[n][i]).displacementY=c}}if(this.constraints.relativePlacementConstraint)if(l.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(t){if(!e.fixedNodesOnHorizontal.has(t)){var n=0;n=e.dummyToNodeForVerticalAlignment.has(t)?e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(t)[0]).displacementX:e.idToNodeMap.get(t).displacementX,e.nodeToRelativeConstraintMapHorizontal.get(t).forEach(function(r){if(r.right){var i=e.nodeToTempPositionMapHorizontal.get(r.right)-e.nodeToTempPositionMapHorizontal.get(t)-n;i<r.gap&&(n-=r.gap-i)}else{var i=e.nodeToTempPositionMapHorizontal.get(t)-e.nodeToTempPositionMapHorizontal.get(r.left)+n;i<r.gap&&(n+=r.gap-i)}}),e.nodeToTempPositionMapHorizontal.set(t,e.nodeToTempPositionMapHorizontal.get(t)+n),e.dummyToNodeForVerticalAlignment.has(t)?e.dummyToNodeForVerticalAlignment.get(t).forEach(function(t){e.idToNodeMap.get(t).displacementX=n}):e.idToNodeMap.get(t).displacementX=n}}),this.nodesInRelativeVertical.forEach(function(t){if(!e.fixedNodesOnHorizontal.has(t)){var n=0;n=e.dummyToNodeForHorizontalAlignment.has(t)?e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(t)[0]).displacementY:e.idToNodeMap.get(t).displacementY,e.nodeToRelativeConstraintMapVertical.get(t).forEach(function(r){if(r.bottom){var i=e.nodeToTempPositionMapVertical.get(r.bottom)-e.nodeToTempPositionMapVertical.get(t)-n;i<r.gap&&(n-=r.gap-i)}else{var i=e.nodeToTempPositionMapVertical.get(t)-e.nodeToTempPositionMapVertical.get(r.top)+n;i<r.gap&&(n+=r.gap-i)}}),e.nodeToTempPositionMapVertical.set(t,e.nodeToTempPositionMapVertical.get(t)+n),e.dummyToNodeForHorizontalAlignment.has(t)?e.dummyToNodeForHorizontalAlignment.get(t).forEach(function(t){e.idToNodeMap.get(t).displacementY=n}):e.idToNodeMap.get(t).displacementY=n}});else{for(var n=0;n<this.componentsOnHorizontal.length;n++){var u=this.componentsOnHorizontal[n];if(this.fixedComponentsOnHorizontal[n])for(var i=0;i<u.length;i++)this.dummyToNodeForVerticalAlignment.has(u[i])?this.dummyToNodeForVerticalAlignment.get(u[i]).forEach(function(t){e.idToNodeMap.get(t).displacementX=0}):this.idToNodeMap.get(u[i]).displacementX=0;else{for(var d=0,h=0,i=0;i<u.length;i++)if(this.dummyToNodeForVerticalAlignment.has(u[i])){var f=this.dummyToNodeForVerticalAlignment.get(u[i]);d+=f.length*this.idToNodeMap.get(f[0]).displacementX,h+=f.length}else d+=this.idToNodeMap.get(u[i]).displacementX,h++;for(var p=d/h,i=0;i<u.length;i++)this.dummyToNodeForVerticalAlignment.has(u[i])?this.dummyToNodeForVerticalAlignment.get(u[i]).forEach(function(t){e.idToNodeMap.get(t).displacementX=p}):this.idToNodeMap.get(u[i]).displacementX=p}}for(var n=0;n<this.componentsOnVertical.length;n++){var u=this.componentsOnVertical[n];if(this.fixedComponentsOnVertical[n])for(var i=0;i<u.length;i++)this.dummyToNodeForHorizontalAlignment.has(u[i])?this.dummyToNodeForHorizontalAlignment.get(u[i]).forEach(function(t){e.idToNodeMap.get(t).displacementY=0}):this.idToNodeMap.get(u[i]).displacementY=0;else{for(var d=0,h=0,i=0;i<u.length;i++)if(this.dummyToNodeForHorizontalAlignment.has(u[i])){var f=this.dummyToNodeForHorizontalAlignment.get(u[i]);d+=f.length*this.idToNodeMap.get(f[0]).displacementY,h+=f.length}else d+=this.idToNodeMap.get(u[i]).displacementY,h++;for(var p=d/h,i=0;i<u.length;i++)this.dummyToNodeForHorizontalAlignment.has(u[i])?this.dummyToNodeForHorizontalAlignment.get(u[i]).forEach(function(t){e.idToNodeMap.get(t).displacementY=p}):this.idToNodeMap.get(u[i]).displacementY=p}}}},N.prototype.calculateNodesToApplyGravitationTo=function(){var e,t,n=[],r=this.graphManager.getGraphs(),i=r.length;for(t=0;t<i;t++)(e=r[t]).updateConnected(),e.isConnected||(n=n.concat(e.getNodes()));return n},N.prototype.createBendpoints=function(){var e=[];e=e.concat(this.graphManager.getAllEdges());var t=new Set;for(a=0;a<e.length;a++){var n=e[a];if(!t.has(n)){var r=n.getSource(),i=n.getTarget();if(r==i)n.getBendpoints().push(new f),n.getBendpoints().push(new f),this.createDummyNodesForBendpoints(n),t.add(n);else{var a,o,s=[];if(s=(s=s.concat(r.getEdgeListToNode(i))).concat(i.getEdgeListToNode(r)),!t.has(s[0])){if(s.length>1)for(o=0;o<s.length;o++){var l=s[o];l.getBendpoints().push(new f),this.createDummyNodesForBendpoints(l)}s.forEach(function(e){t.add(e)})}}}if(t.size==e.length)break}},N.prototype.positionNodesRadially=function(e){for(var t=new h(0,0),n=Math.ceil(Math.sqrt(e.length)),r=0,i=0,a=0,o=new f(0,0),s=0;s<e.length;s++){s%n==0&&(a=0,i=r,0!=s&&(i+=l.DEFAULT_COMPONENT_SEPERATION),r=0);var c=e[s],u=g.findCenterOfTree(c);t.x=a,t.y=i,(o=N.radialLayout(c,u,t)).y>r&&(r=Math.floor(o.y)),a=Math.floor(o.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new f(d.WORLD_CENTER_X-o.x/2,d.WORLD_CENTER_Y-o.y/2))},N.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),l.DEFAULT_RADIAL_SEPARATION);N.branchRadialLayout(t,null,0,359,0,r);var i=y.calculateBounds(e),a=new b;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o<e.length;o++)e[o].transform(a);var s=new f(i.getMaxX(),i.getMaxY());return a.inverseTransformPoint(s)},N.branchRadialLayout=function(e,t,n,r,i,a){var o,s=(r-n+1)/2;s<0&&(s+=180);var l=(s+n)%360*x.TWO_PI/360,c=i*Math.cos(l),u=i*Math.sin(l);e.setCenter(c,u);var d=[],h=(d=d.concat(e.getEdges())).length;null!=t&&h--;for(var f=0,p=d.length,g=e.getEdgesBetween(t);g.length>1;){var v=g[0];g.splice(0,1);var y=d.indexOf(v);y>=0&&d.splice(y,1),p--,h--}o=null!=t?(d.indexOf(g[0])+1)%p:0;for(var b=Math.abs(r-n)/h,w=o;f!=h;w=++w%p){var j=d[w].getOtherEnd(e);if(j!=t){var k=(n+f*b)%360,S=(k+b)%360;N.branchRadialLayout(j,e,k,S,i+a,a),f++}}},N.maxDiagonalInTree=function(e){for(var t=v.MIN_VALUE,n=0;n<e.length;n++){var r=e[n].getDiagonal();r>t&&(t=r)}return t},N.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},N.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i<r.length;i++){var a=r[i],s=a.getParent();0!==this.getNodeDegreeWithChildren(a)||void 0!=s.id&&this.getToBeTiled(s)||n.push(a)}for(var i=0;i<n.length;i++){var a=n[i],l=a.getParent().id;void 0===t[l]&&(t[l]=[]),t[l]=t[l].concat(a)}Object.keys(t).forEach(function(n){if(t[n].length>1){var r="DummyCompound_"+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),l=i.getChild();l.add(a);for(var c=0;c<t[n].length;c++){var u=t[n][c];l.remove(u),s.add(u)}}})},N.prototype.clearCompounds=function(){var e={},t={};this.performDFSOnCompounds();for(var n=0;n<this.compoundOrder.length;n++)t[this.compoundOrder[n].id]=this.compoundOrder[n],e[this.compoundOrder[n].id]=[].concat(this.compoundOrder[n].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[n].getChild()),this.compoundOrder[n].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(e,t)},N.prototype.clearZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(n){var r=e.idToDummyNode[n];if(t[n]=e.tileNodes(e.memberGroups[n],r.paddingLeft+r.paddingRight),r.rect.width=t[n].width,r.rect.height=t[n].height,r.setCenter(t[n].centerX,t[n].centerY),r.labelMarginLeft=0,r.labelMarginTop=0,l.NODE_DIMENSIONS_INCLUDE_LABELS){var i=r.rect.width,a=r.rect.height;r.labelWidth&&("left"==r.labelPosHorizontal?(r.rect.x-=r.labelWidth,r.setWidth(i+r.labelWidth),r.labelMarginLeft=r.labelWidth):"center"==r.labelPosHorizontal&&r.labelWidth>i?(r.rect.x-=(r.labelWidth-i)/2,r.setWidth(r.labelWidth),r.labelMarginLeft=(r.labelWidth-i)/2):"right"==r.labelPosHorizontal&&r.setWidth(i+r.labelWidth)),r.labelHeight&&("top"==r.labelPosVertical?(r.rect.y-=r.labelHeight,r.setHeight(a+r.labelHeight),r.labelMarginTop=r.labelHeight):"center"==r.labelPosVertical&&r.labelHeight>a?(r.rect.y-=(r.labelHeight-a)/2,r.setHeight(r.labelHeight),r.labelMarginTop=(r.labelHeight-a)/2):"bottom"==r.labelPosVertical&&r.setHeight(a+r.labelHeight))}})},N.prototype.repopulateCompounds=function(){for(var e=this.compoundOrder.length-1;e>=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop,a=t.labelMarginLeft,o=t.labelMarginTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i,a,o)}},N.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach(function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop,o=r.labelMarginLeft,s=r.labelMarginTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a,o,s)})},N.prototype.getToBeTiled=function(e){var t=e.id;if(null!=this.toBeTiled[t])return this.toBeTiled[t];var n=e.getChild();if(null==n)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i<r.length;i++){var a=r[i];if(this.getNodeDegree(a)>0)return this.toBeTiled[t]=!1,!1;if(null==a.getChild()){this.toBeTiled[a.id]=!1;continue}if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}return this.toBeTiled[t]=!0,!0},N.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;r<t.length;r++){var i=t[r];i.getSource().id!==i.getTarget().id&&(n+=1)}return n},N.prototype.getNodeDegreeWithChildren=function(e){var t=this.getNodeDegree(e);if(null==e.getChild())return t;for(var n=e.getChild().getNodes(),r=0;r<n.length;r++){var i=n[r];t+=this.getNodeDegreeWithChildren(i)}return t},N.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},N.prototype.fillCompexOrderByDFS=function(e){for(var t=0;t<e.length;t++){var n=e[t];null!=n.getChild()&&this.fillCompexOrderByDFS(n.getChild().getNodes()),this.getToBeTiled(n)&&this.compoundOrder.push(n)}},N.prototype.adjustLocations=function(e,t,n,r,i,a,o){t+=r+a,n+=i+o;for(var s=t,l=0;l<e.rows.length;l++){var c=e.rows[l];t=s;for(var u=0,d=0;d<c.length;d++){var h=c[d];h.rect.x=t,h.rect.y=n,t+=h.rect.width+e.horizontalPadding,h.rect.height>u&&(u=h.rect.height)}n+=u+e.verticalPadding}},N.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach(function(r){var i=t[r];if(n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height,i.setCenter(n.tiledMemberPack[r].centerX,n.tiledMemberPack[r].centerY),i.labelMarginLeft=0,i.labelMarginTop=0,l.NODE_DIMENSIONS_INCLUDE_LABELS){var a=i.rect.width,o=i.rect.height;i.labelWidth&&("left"==i.labelPosHorizontal?(i.rect.x-=i.labelWidth,i.setWidth(a+i.labelWidth),i.labelMarginLeft=i.labelWidth):"center"==i.labelPosHorizontal&&i.labelWidth>a?(i.rect.x-=(i.labelWidth-a)/2,i.setWidth(i.labelWidth),i.labelMarginLeft=(i.labelWidth-a)/2):"right"==i.labelPosHorizontal&&i.setWidth(a+i.labelWidth)),i.labelHeight&&("top"==i.labelPosVertical?(i.rect.y-=i.labelHeight,i.setHeight(o+i.labelHeight),i.labelMarginTop=i.labelHeight):"center"==i.labelPosVertical&&i.labelHeight>o?(i.rect.y-=(i.labelHeight-o)/2,i.setHeight(i.labelHeight),i.labelMarginTop=(i.labelHeight-o)/2):"bottom"==i.labelPosVertical&&i.setHeight(o+i.labelHeight))}})},N.prototype.tileNodes=function(e,t){var n=this.tileNodesByFavoringDim(e,t,!0),r=this.tileNodesByFavoringDim(e,t,!1),i=this.getOrgRatio(n);return this.getOrgRatio(r)<i?r:n},N.prototype.getOrgRatio=function(e){var t=e.width/e.height;return t<1&&(t=1/t),t},N.prototype.calcIdealRowWidth=function(e,t){var n,r=l.TILING_PADDING_VERTICAL,i=l.TILING_PADDING_HORIZONTAL,a=e.length,o=0,s=0,c=0;e.forEach(function(e){o+=e.getWidth(),s+=e.getHeight(),e.getWidth()>c&&(c=e.getWidth())});var u=o/a,d=Math.pow(r-i,2)+4*(u+i)*(s/a+r)*a,h=(i-r+Math.sqrt(d))/(2*(u+i));t?(n=Math.ceil(h))==h&&n++:n=Math.floor(h);var f=n*(u+i)-i;return c>f&&(f=c),f+=2*i},N.prototype.tileNodesByFavoringDim=function(e,t,n){var r=l.TILING_PADDING_VERTICAL,i=l.TILING_PADDING_HORIZONTAL,a=l.TILING_COMPARE_BY,o={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:r,horizontalPadding:i,centerX:0,centerY:0};a&&(o.idealRowWidth=this.calcIdealRowWidth(e,n));var s=function(e){return e.rect.width*e.rect.height},c=function(e,t){return s(t)-s(e)};e.sort(function(e,t){var n=c;return o.idealRowWidth?(n=a)(e.id,t.id):n(e,t)});for(var u=0,d=0,h=0;h<e.length;h++){var f=e[h];u+=f.getCenterX(),d+=f.getCenterY()}o.centerX=u/e.length,o.centerY=d/e.length;for(var h=0;h<e.length;h++){var f=e[h];if(0==o.rows.length)this.insertNodeToRow(o,f,0,t);else if(this.canAddHorizontal(o,f.rect.width,f.rect.height)){var p=o.rows.length-1;o.idealRowWidth||(p=this.getShortestRowIndex(o)),this.insertNodeToRow(o,f,p,t)}else this.insertNodeToRow(o,f,o.rows.length,t);this.shiftToLastRow(o)}return o},N.prototype.insertNodeToRow=function(e,t,n,r){n==e.rows.length&&(e.rows.push([]),e.rowWidth.push(r),e.rowHeight.push(0));var i=e.rowWidth[n]+t.rect.width;e.rows[n].length>0&&(i+=e.horizontalPadding),e.rowWidth[n]=i,e.width<i&&(e.width=i);var a=t.rect.height;n>0&&(a+=e.verticalPadding);var o=0;a>e.rowHeight[n]&&(o=e.rowHeight[n],e.rowHeight[n]=a,o=e.rowHeight[n]-o),e.height+=o,e.rows[n].push(t)},N.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]<n&&(t=r,n=e.rowWidth[r]);return t},N.prototype.getLongestRowIndex=function(e){for(var t=-1,n=5e-324,r=0;r<e.rows.length;r++)e.rowWidth[r]>n&&(t=r,n=e.rowWidth[r]);return t},N.prototype.canAddHorizontal=function(e,t,n){if(e.idealRowWidth){var r,i,a=e.rows.length-1;return e.rowWidth[a]+t+e.horizontalPadding<=e.idealRowWidth}var o=this.getShortestRowIndex(e);if(o<0)return!0;var s=e.rowWidth[o];if(s+e.horizontalPadding+t<=e.width)return!0;var l=0;return e.rowHeight[o]<n&&o>0&&(l=n+e.verticalPadding-e.rowHeight[o]),r=e.width-s>=t+e.horizontalPadding?(e.height+l)/(s+t+e.horizontalPadding):(e.height+l)/e.width,l=n+e.verticalPadding,(i=e.width<t?(e.height+l)/t:(e.height+l)/e.width)<1&&(i=1/i),r<1&&(r=1/r),r<i},N.prototype.shiftToLastRow=function(e){var t=this.getLongestRowIndex(e),n=e.rowWidth.length-1,r=e.rows[t],i=r[r.length-1],a=i.width+e.horizontalPadding;if(e.width-e.rowWidth[n]>a&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=5e-324,s=0;s<r.length;s++)r[s].height>o&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]<i.height+e.verticalPadding&&(e.rowHeight[n]=i.height+e.verticalPadding);var c=e.rowHeight[t]+e.rowHeight[n];e.height+=c-l,this.shiftToLastRow(e)}},N.prototype.tilingPreLayout=function(){l.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},N.prototype.tilingPostLayout=function(){l.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},N.prototype.reduceTrees=function(){for(var e,t=[],n=!0;n;){var r=this.graphManager.getAllNodes(),i=[];n=!1;for(var a=0;a<r.length;a++)if(1==(e=r[a]).getEdges().length&&!e.getEdges()[0].isInterGraph&&null==e.getChild()){if(l.PURE_INCREMENTAL){var o=e.getEdges()[0].getOtherEnd(e),s=new p(e.getCenterX()-o.getCenterX(),e.getCenterY()-o.getCenterY());i.push([e,e.getEdges()[0],e.getOwner(),s])}else i.push([e,e.getEdges()[0],e.getOwner()]);n=!0}if(!0==n){for(var c=[],u=0;u<i.length;u++)1==i[u][0].getEdges().length&&(c.push(i[u]),i[u][0].getOwner().remove(i[u][0]));t.push(c),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=t},N.prototype.growTree=function(e){for(var t,n=e.length,r=e[n-1],i=0;i<r.length;i++)t=r[i],this.findPlaceforPrunedNode(t),t[2].add(t[0]),t[2].add(t[1],t[1].source,t[1].target);e.splice(e.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},N.prototype.findPlaceforPrunedNode=function(e){var t=e[0];if(r=t==e[1].source?e[1].target:e[1].source,l.PURE_INCREMENTAL)t.setCenter(r.getCenterX()+e[3].getWidth(),r.getCenterY()+e[3].getHeight());else{var n,r,i,a,o=r.startX,s=r.finishX,c=r.startY,d=r.finishY,h=[0,0,0,0];if(c>0)for(var f=o;f<=s;f++)h[0]+=this.grid[f][c-1].length+this.grid[f][c].length-1;if(s<this.grid.length-1)for(var f=c;f<=d;f++)h[1]+=this.grid[s+1][f].length+this.grid[s][f].length-1;if(d<this.grid[0].length-1)for(var f=o;f<=s;f++)h[2]+=this.grid[f][d+1].length+this.grid[f][d].length-1;if(o>0)for(var f=c;f<=d;f++)h[3]+=this.grid[o-1][f].length+this.grid[o][f].length-1;for(var p=v.MAX_VALUE,g=0;g<h.length;g++)h[g]<p?(p=h[g],i=1,a=g):h[g]==p&&i++;if(3==i&&0==p)0==h[0]&&0==h[1]&&0==h[2]?n=1:0==h[0]&&0==h[1]&&0==h[3]?n=0:0==h[0]&&0==h[2]&&0==h[3]?n=3:0==h[1]&&0==h[2]&&0==h[3]&&(n=2);else if(2==i&&0==p){var x=Math.floor(2*Math.random());n=0==h[0]&&0==h[1]?+(0!=x):0==h[0]&&0==h[2]?2*(0!=x):0==h[0]&&0==h[3]?3*(0!=x):0==h[1]&&0==h[2]?0==x?1:2:0==h[1]&&0==h[3]?0==x?1:3:0==x?2:3}else if(4==i&&0==p){var x=Math.floor(4*Math.random());n=x}else n=a;0==n?t.setCenter(r.getCenterX(),r.getCenterY()-r.getHeight()/2-u.DEFAULT_EDGE_LENGTH-t.getHeight()/2):1==n?t.setCenter(r.getCenterX()+r.getWidth()/2+u.DEFAULT_EDGE_LENGTH+t.getWidth()/2,r.getCenterY()):2==n?t.setCenter(r.getCenterX(),r.getCenterY()+r.getHeight()/2+u.DEFAULT_EDGE_LENGTH+t.getHeight()/2):t.setCenter(r.getCenterX()-r.getWidth()/2-u.DEFAULT_EDGE_LENGTH-t.getWidth()/2,r.getCenterY())}},e.exports=N},991:(e,t,n)=>{var r=n(551).FDLayoutNode,i=n(551).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.calculateDisplacement=function(){var e=this.graphManager.getLayout();null!=this.getChild()&&this.fixedNodeWeight?(this.displacementX+=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n,r=this.getChild().getNodes(),i=0;i<r.length;i++)null==(n=r[i]).getChild()?(n.displacementX+=e,n.displacementY+=t):n.propogateDisplacementToChildren(e,t)},a.prototype.move=function(){var e=this.graphManager.getLayout();(null==this.child||0==this.child.getNodes().length)&&(this.moveBy(this.displacementX,this.displacementY),e.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},a.prototype.setPred1=function(e){this.pred1=e},a.prototype.getPred1=function(){return pred1},a.prototype.getPred2=function(){return pred2},a.prototype.setNext=function(e){this.next=e},a.prototype.getNext=function(){return next},a.prototype.setProcessed=function(e){this.processed=e},a.prototype.isProcessed=function(){return processed},e.exports=a},902:(e,t,n)=>{function r(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}var i=n(806),a=n(551).LinkedList,o=n(551).Matrix,s=n(551).SVD;function l(){}l.handleConstraints=function(e){var t={};t.fixedNodeConstraint=e.constraints.fixedNodeConstraint,t.alignmentConstraint=e.constraints.alignmentConstraint,t.relativePlacementConstraint=e.constraints.relativePlacementConstraint;for(var n=new Map,l=new Map,c=[],u=[],d=e.getAllNodes(),h=0,f=0;f<d.length;f++){var p=d[f];null==p.getChild()&&(l.set(p.id,h++),c.push(p.getCenterX()),u.push(p.getCenterY()),n.set(p.id,p))}t.relativePlacementConstraint&&t.relativePlacementConstraint.forEach(function(e){e.gap||0==e.gap||(e.left?e.gap=i.DEFAULT_EDGE_LENGTH+n.get(e.left).getWidth()/2+n.get(e.right).getWidth()/2:e.gap=i.DEFAULT_EDGE_LENGTH+n.get(e.top).getHeight()/2+n.get(e.bottom).getHeight()/2)});var g=function(e){var t=0,n=0;return e.forEach(function(e){t+=c[l.get(e)],n+=u[l.get(e)]}),{x:t/e.size,y:n/e.size}},v=function(e,t,n,i,o){var s=new Map;e.forEach(function(e,t){s.set(t,0)}),e.forEach(function(e,t){e.forEach(function(e){s.set(e.id,s.get(e.id)+1)})});var d=new Map,h=new Map,f=new a;for(s.forEach(function(e,r){0==e?(f.push(r),n||("horizontal"==t?d.set(r,l.has(r)?c[l.get(r)]:i.get(r)):d.set(r,l.has(r)?u[l.get(r)]:i.get(r)))):d.set(r,-1/0),n&&h.set(r,new Set([r]))}),n&&o.forEach(function(e){var r=[];if(e.forEach(function(e){n.has(e)&&r.push(e)}),r.length>0){var a=0;r.forEach(function(e){"horizontal"==t?d.set(e,l.has(e)?c[l.get(e)]:i.get(e)):d.set(e,l.has(e)?u[l.get(e)]:i.get(e)),a+=d.get(e)}),a/=r.length,e.forEach(function(e){n.has(e)||d.set(e,a)})}else{var o=0;e.forEach(function(e){"horizontal"==t?o+=l.has(e)?c[l.get(e)]:i.get(e):o+=l.has(e)?u[l.get(e)]:i.get(e)}),o/=e.length,e.forEach(function(e){d.set(e,o)})}});0!=f.length;)!function(){var r=f.shift();e.get(r).forEach(function(e){if(d.get(e.id)<d.get(r)+e.gap)if(n&&n.has(e.id)){var a=void 0;if(a="horizontal"==t?l.has(e.id)?c[l.get(e.id)]:i.get(e.id):l.has(e.id)?u[l.get(e.id)]:i.get(e.id),d.set(e.id,a),a<d.get(r)+e.gap){var o=d.get(r)+e.gap-a;h.get(r).forEach(function(e){d.set(e,d.get(e)-o)})}}else d.set(e.id,d.get(r)+e.gap);s.set(e.id,s.get(e.id)-1),0==s.get(e.id)&&f.push(e.id),n&&h.set(e.id,function(e,t){var n=new Set(e),r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value;n.add(l)}}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(h.get(r),h.get(e.id)))})}();if(n){var p=new Set;e.forEach(function(e,t){0==e.length&&p.add(t)});var g=[];h.forEach(function(e,t){if(p.has(t)){var i=!1,a=!0,o=!1,s=void 0;try{for(var l,c=e[Symbol.iterator]();!(a=(l=c.next()).done);a=!0){var u=l.value;n.has(u)&&(i=!0)}}catch(e){o=!0,s=e}finally{try{!a&&c.return&&c.return()}finally{if(o)throw s}}if(!i){var d=!1,h=void 0;g.forEach(function(t,n){t.has([].concat(r(e))[0])&&(d=!0,h=n)}),d?e.forEach(function(e){g[h].add(e)}):g.push(new Set(e))}}}),g.forEach(function(e,n){var r=1/0,a=1/0,o=-1/0,s=-1/0,h=!0,f=!1,p=void 0;try{for(var g,v=e[Symbol.iterator]();!(h=(g=v.next()).done);h=!0){var x=g.value,y=void 0;y="horizontal"==t?l.has(x)?c[l.get(x)]:i.get(x):l.has(x)?u[l.get(x)]:i.get(x);var b=d.get(x);y<r&&(r=y),y>o&&(o=y),b<a&&(a=b),b>s&&(s=b)}}catch(e){f=!0,p=e}finally{try{!h&&v.return&&v.return()}finally{if(f)throw p}}var w=(r+o)/2-(a+s)/2,N=!0,j=!1,k=void 0;try{for(var S,C=e[Symbol.iterator]();!(N=(S=C.next()).done);N=!0){var _=S.value;d.set(_,d.get(_)+w)}}catch(e){j=!0,k=e}finally{try{!N&&C.return&&C.return()}finally{if(j)throw k}}})}return d},x=function(e){var t=0,n=0,r=0,i=0;if(e.forEach(function(e){e.left?c[l.get(e.left)]-c[l.get(e.right)]>=0?t++:n++:u[l.get(e.top)]-u[l.get(e.bottom)]>=0?r++:i++}),t>n&&r>i)for(var a=0;a<l.size;a++)c[a]=-1*c[a],u[a]=-1*u[a];else if(t>n)for(var o=0;o<l.size;o++)c[o]=-1*c[o];else if(r>i)for(var s=0;s<l.size;s++)u[s]=-1*u[s]},y=function(e){var t=[],n=new a,r=new Set,i=0;return e.forEach(function(a,o){if(!r.has(o)){t[i]=[];var s=o;for(n.push(s),r.add(s),t[i].push(s);0!=n.length;)s=n.shift(),e.get(s).forEach(function(e){r.has(e.id)||(n.push(e.id),r.add(e.id),t[i].push(e.id))});i++}}),t},b=function(e){var t=new Map;return e.forEach(function(e,n){t.set(n,[])}),e.forEach(function(e,n){e.forEach(function(e){t.get(n).push(e),t.get(e.id).push({id:n,gap:e.gap,direction:e.direction})})}),t},w=function(e){var t=new Map;return e.forEach(function(e,n){t.set(n,[])}),e.forEach(function(e,n){e.forEach(function(e){t.get(e.id).push({id:n,gap:e.gap,direction:e.direction})})}),t},N=[],j=[],k=!1,S=!1,C=new Set,_=new Map,E=new Map,T=[];if(t.fixedNodeConstraint&&t.fixedNodeConstraint.forEach(function(e){C.add(e.nodeId)}),t.relativePlacementConstraint&&(t.relativePlacementConstraint.forEach(function(e){e.left?(_.has(e.left)?_.get(e.left).push({id:e.right,gap:e.gap,direction:"horizontal"}):_.set(e.left,[{id:e.right,gap:e.gap,direction:"horizontal"}]),_.has(e.right)||_.set(e.right,[])):(_.has(e.top)?_.get(e.top).push({id:e.bottom,gap:e.gap,direction:"vertical"}):_.set(e.top,[{id:e.bottom,gap:e.gap,direction:"vertical"}]),_.has(e.bottom)||_.set(e.bottom,[]))}),T=y(E=b(_))),i.TRANSFORM_ON_CONSTRAINT_HANDLING){if(t.fixedNodeConstraint&&t.fixedNodeConstraint.length>1)t.fixedNodeConstraint.forEach(function(e,t){N[t]=[e.position.x,e.position.y],j[t]=[c[l.get(e.nodeId)],u[l.get(e.nodeId)]]}),k=!0;else if(t.alignmentConstraint)!function(){var e=0;if(t.alignmentConstraint.vertical){for(var n=t.alignmentConstraint.vertical,i=0;i<n.length;i++)!function(t){var i=new Set;n[t].forEach(function(e){i.add(e)});var a=new Set([].concat(r(i)).filter(function(e){return C.has(e)})),o=void 0;o=a.size>0?c[l.get(a.values().next().value)]:g(i).x,n[t].forEach(function(t){N[e]=[o,u[l.get(t)]],j[e]=[c[l.get(t)],u[l.get(t)]],e++})}(i);k=!0}if(t.alignmentConstraint.horizontal){for(var a=t.alignmentConstraint.horizontal,o=0;o<a.length;o++)!function(t){var n=new Set;a[t].forEach(function(e){n.add(e)});var i=new Set([].concat(r(n)).filter(function(e){return C.has(e)})),o=void 0;o=i.size>0?c[l.get(i.values().next().value)]:g(n).y,a[t].forEach(function(t){N[e]=[c[l.get(t)],o],j[e]=[c[l.get(t)],u[l.get(t)]],e++})}(o);k=!0}t.relativePlacementConstraint&&(S=!0)}();else if(t.relativePlacementConstraint){for(var M=0,O=0,A=0;A<T.length;A++)T[A].length>M&&(M=T[A].length,O=A);if(M<E.size/2)x(t.relativePlacementConstraint),k=!1,S=!1;else{var D=new Map,P=new Map,I=[];T[O].forEach(function(e){_.get(e).forEach(function(t){"horizontal"==t.direction?(D.has(e)?D.get(e).push(t):D.set(e,[t]),D.has(t.id)||D.set(t.id,[]),I.push({left:e,right:t.id})):(P.has(e)?P.get(e).push(t):P.set(e,[t]),P.has(t.id)||P.set(t.id,[]),I.push({top:e,bottom:t.id}))})}),x(I),S=!1;var L=v(D,"horizontal"),R=v(P,"vertical");T[O].forEach(function(e,t){j[t]=[c[l.get(e)],u[l.get(e)]],N[t]=[],L.has(e)?N[t][0]=L.get(e):N[t][0]=c[l.get(e)],R.has(e)?N[t][1]=R.get(e):N[t][1]=u[l.get(e)]}),k=!0}}if(k){for(var B=void 0,F=o.transpose(N),z=o.transpose(j),V=0;V<F.length;V++)F[V]=o.multGamma(F[V]),z[V]=o.multGamma(z[V]);var H=o.multMat(F,o.transpose(z)),U=s.svd(H);B=o.multMat(U.V,o.transpose(U.U));for(var W=0;W<l.size;W++){var Y=[c[W],u[W]],G=[B[0][0],B[1][0]],X=[B[0][1],B[1][1]];c[W]=o.dotProduct(Y,G),u[W]=o.dotProduct(Y,X)}S&&x(t.relativePlacementConstraint)}}if(i.ENFORCE_CONSTRAINTS){if(t.fixedNodeConstraint&&t.fixedNodeConstraint.length>0){var $={x:0,y:0};t.fixedNodeConstraint.forEach(function(e,t){var n,r={x:c[l.get(e.nodeId)],y:u[l.get(e.nodeId)]},i=(n=e.position,{x:n.x-r.x,y:n.y-r.y});$.x+=i.x,$.y+=i.y}),$.x/=t.fixedNodeConstraint.length,$.y/=t.fixedNodeConstraint.length,c.forEach(function(e,t){c[t]+=$.x}),u.forEach(function(e,t){u[t]+=$.y}),t.fixedNodeConstraint.forEach(function(e){c[l.get(e.nodeId)]=e.position.x,u[l.get(e.nodeId)]=e.position.y})}if(t.alignmentConstraint){if(t.alignmentConstraint.vertical)for(var q=t.alignmentConstraint.vertical,K=0;K<q.length;K++)!function(e){var t=new Set;q[e].forEach(function(e){t.add(e)});var n=new Set([].concat(r(t)).filter(function(e){return C.has(e)})),i=void 0;i=n.size>0?c[l.get(n.values().next().value)]:g(t).x,t.forEach(function(e){C.has(e)||(c[l.get(e)]=i)})}(K);if(t.alignmentConstraint.horizontal)for(var Z=t.alignmentConstraint.horizontal,Q=0;Q<Z.length;Q++)!function(e){var t=new Set;Z[e].forEach(function(e){t.add(e)});var n=new Set([].concat(r(t)).filter(function(e){return C.has(e)})),i=void 0;i=n.size>0?u[l.get(n.values().next().value)]:g(t).y,t.forEach(function(e){C.has(e)||(u[l.get(e)]=i)})}(Q)}t.relativePlacementConstraint&&function(){var e=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,s=new Set,d=new Set;if(C.forEach(function(e){s.add(e),d.add(e)}),t.alignmentConstraint){if(t.alignmentConstraint.vertical)for(var h=t.alignmentConstraint.vertical,f=function(t){r.set("dummy"+t,[]),h[t].forEach(function(n){e.set(n,"dummy"+t),r.get("dummy"+t).push(n),C.has(n)&&s.add("dummy"+t)}),a.set("dummy"+t,c[l.get(h[t][0])])},p=0;p<h.length;p++)f(p);if(t.alignmentConstraint.horizontal)for(var g=t.alignmentConstraint.horizontal,x=function(e){i.set("dummy"+e,[]),g[e].forEach(function(t){n.set(t,"dummy"+e),i.get("dummy"+e).push(t),C.has(t)&&d.add("dummy"+e)}),o.set("dummy"+e,u[l.get(g[e][0])])},N=0;N<g.length;N++)x(N)}var j=new Map,k=new Map,S=function(t){_.get(t).forEach(function(r){var i=void 0,a=void 0;"horizontal"==r.direction?(i=e.get(t)?e.get(t):t,a=e.get(r.id)?{id:e.get(r.id),gap:r.gap,direction:r.direction}:r,j.has(i)?j.get(i).push(a):j.set(i,[a]),j.has(a.id)||j.set(a.id,[])):(i=n.get(t)?n.get(t):t,a=n.get(r.id)?{id:n.get(r.id),gap:r.gap,direction:r.direction}:r,k.has(i)?k.get(i).push(a):k.set(i,[a]),k.has(a.id)||k.set(a.id,[]))})},E=!0,T=!1,M=void 0;try{for(var O,A=_.keys()[Symbol.iterator]();!(E=(O=A.next()).done);E=!0){var D=O.value;S(D)}}catch(e){T=!0,M=e}finally{try{!E&&A.return&&A.return()}finally{if(T)throw M}}var P=b(j),I=b(k),L=y(P),R=y(I),B=w(j),F=w(k),z=[],V=[];L.forEach(function(e,t){z[t]=[],e.forEach(function(e){0==B.get(e).length&&z[t].push(e)})}),R.forEach(function(e,t){V[t]=[],e.forEach(function(e){0==F.get(e).length&&V[t].push(e)})});var H=v(j,"horizontal",s,a,z),U=v(k,"vertical",d,o,V),W=function(e){r.get(e)?r.get(e).forEach(function(t){c[l.get(t)]=H.get(e)}):c[l.get(e)]=H.get(e)},Y=!0,G=!1,X=void 0;try{for(var $,q=H.keys()[Symbol.iterator]();!(Y=($=q.next()).done);Y=!0){var K=$.value;W(K)}}catch(e){G=!0,X=e}finally{try{!Y&&q.return&&q.return()}finally{if(G)throw X}}var Z=function(e){i.get(e)?i.get(e).forEach(function(t){u[l.get(t)]=U.get(e)}):u[l.get(e)]=U.get(e)},Q=!0,J=!1,ee=void 0;try{for(var et,en=U.keys()[Symbol.iterator]();!(Q=(et=en.next()).done);Q=!0){var K=et.value;Z(K)}}catch(e){J=!0,ee=e}finally{try{!Q&&en.return&&en.return()}finally{if(J)throw ee}}}()}for(var J=0;J<d.length;J++){var ee=d[J];null==ee.getChild()&&ee.setCenter(c[l.get(ee.id)],u[l.get(ee.id)])}},e.exports=l},551:e=>{e.exports=r}},t={};return function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(45)})()},45108,(e,t,n)=>{var r;e.e,r=e.r(97659),t.exports=(()=>{"use strict";var e={658:e=>{e.exports=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.forEach(function(t){Object.keys(t).forEach(function(n){return e[n]=t[n]})}),e}},548:(e,t,n)=>{var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=n(140).layoutBase.LinkedList,a={};a.getTopMostNodes=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].id()]=!0;return e.filter(function(e,n){"number"==typeof e&&(e=n);for(var r=e.parent()[0];null!=r;){if(t[r.id()])return!1;r=r.parent()[0]}return!0})},a.connectComponents=function(e,t,n,r){var a=new i,o=new Set,s=[],l=void 0,c=void 0,u=void 0,d=!1,h=1,f=[],p=[];do!function(){var r=e.collection();p.push(r);var i=n[0],g=e.collection();for(g.merge(i).merge(i.descendants().intersection(t)),s.push(i),g.forEach(function(e){a.push(e),o.add(e),r.merge(e)});0!=a.length;)!function(){i=a.shift();var c=e.collection();i.neighborhood().nodes().forEach(function(e){t.intersection(i.edgesWith(e)).length>0&&c.merge(e)});for(var u=0;u<c.length;u++){var d=c[u];null==(l=n.intersection(d.union(d.ancestors())))||o.has(l[0])||l.union(l.descendants()).forEach(function(e){a.push(e),o.add(e),r.merge(e),n.has(e)&&s.push(e)})}}();if(r.forEach(function(e){t.intersection(e.connectedEdges()).forEach(function(e){r.has(e.source())&&r.has(e.target())&&r.merge(e)})}),s.length==n.length&&(d=!0),!d||d&&h>1){u=(c=s[0]).connectedEdges().length,s.forEach(function(e){e.connectedEdges().length<u&&(u=e.connectedEdges().length,c=e)}),f.push(c.id());var v=e.collection();v.merge(s[0]),s.forEach(function(e){v.merge(e)}),s=[],n=n.difference(v),h++}}();while(!d)return r&&f.length>0&&r.set("dummy"+(r.size+1),f),p},a.relocateComponent=function(e,t,n){if(!n.fixedNodeConstraint){var i=1/0,a=-1/0,o=1/0,s=-1/0;if("draft"==n.quality){var l=!0,c=!1,u=void 0;try{for(var d,h=t.nodeIndexes[Symbol.iterator]();!(l=(d=h.next()).done);l=!0){var f=d.value,p=r(f,2),g=p[0],v=p[1],x=n.cy.getElementById(g);if(x){var y=x.boundingBox(),b=t.xCoords[v]-y.w/2,w=t.xCoords[v]+y.w/2,N=t.yCoords[v]-y.h/2,j=t.yCoords[v]+y.h/2;b<i&&(i=b),w>a&&(a=w),N<o&&(o=N),j>s&&(s=j)}}}catch(e){c=!0,u=e}finally{try{!l&&h.return&&h.return()}finally{if(c)throw u}}var k=e.x-(a+i)/2,S=e.y-(s+o)/2;t.xCoords=t.xCoords.map(function(e){return e+k}),t.yCoords=t.yCoords.map(function(e){return e+S})}else{Object.keys(t).forEach(function(e){var n=t[e],r=n.getRect().x,l=n.getRect().x+n.getRect().width,c=n.getRect().y,u=n.getRect().y+n.getRect().height;r<i&&(i=r),l>a&&(a=l),c<o&&(o=c),u>s&&(s=u)});var C=e.x-(a+i)/2,_=e.y-(s+o)/2;Object.keys(t).forEach(function(e){var n=t[e];n.setCenter(n.getCenterX()+C,n.getCenterY()+_)})}}},a.calcBoundingBox=function(e,t,n,r){for(var i=Number.MAX_SAFE_INTEGER,a=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER,l=void 0,c=void 0,u=void 0,d=void 0,h=e.descendants().not(":parent"),f=h.length,p=0;p<f;p++){var g=h[p];l=t[r.get(g.id())]-g.width()/2,c=t[r.get(g.id())]+g.width()/2,u=n[r.get(g.id())]-g.height()/2,d=n[r.get(g.id())]+g.height()/2,i>l&&(i=l),a<c&&(a=c),o>u&&(o=u),s<d&&(s=d)}var v={};return v.topLeftX=i,v.topLeftY=o,v.width=a-i,v.height=s-o,v},a.calcParentsWithoutChildren=function(e,t){var n=e.collection();return t.nodes(":parent").forEach(function(e){var t=!1;e.children().forEach(function(e){"none"!=e.css("display")&&(t=!0)}),t||n.merge(e)}),n},e.exports=a},816:(e,t,n)=>{var r=n(548),i=n(140).CoSELayout,a=n(140).CoSENode,o=n(140).layoutBase.PointD,s=n(140).layoutBase.DimensionD,l=n(140).layoutBase.LayoutConstants,c=n(140).layoutBase.FDLayoutConstants,u=n(140).CoSEConstants;e.exports={coseLayout:function(e,t){var n=e.cy,d=e.eles,h=d.nodes(),f=d.edges(),p=void 0,g=void 0,v=void 0,x={};e.randomize&&(p=t.nodeIndexes,g=t.xCoords,v=t.yCoords);var y=function(e){return"function"==typeof e},b=function(e,t){return y(e)?e(t):e},w=r.calcParentsWithoutChildren(n,d);null!=e.nestingFactor&&(u.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor),null!=e.gravity&&(u.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=e.gravity),null!=e.numIter&&(u.MAX_ITERATIONS=c.MAX_ITERATIONS=e.numIter),null!=e.gravityRange&&(u.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange),null!=e.gravityCompound&&(u.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound),null!=e.gravityRangeCompound&&(u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound),null!=e.initialEnergyOnIncremental&&(u.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental),null!=e.tilingCompareBy&&(u.TILING_COMPARE_BY=e.tilingCompareBy),"proof"==e.quality?l.QUALITY=2:l.QUALITY=0,u.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=l.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,u.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=!e.randomize,u.ANIMATE=c.ANIMATE=l.ANIMATE=e.animate,u.TILE=e.tile,u.TILING_PADDING_VERTICAL="function"==typeof e.tilingPaddingVertical?e.tilingPaddingVertical.call():e.tilingPaddingVertical,u.TILING_PADDING_HORIZONTAL="function"==typeof e.tilingPaddingHorizontal?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal,u.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=!0,u.PURE_INCREMENTAL=!e.randomize,l.DEFAULT_UNIFORM_LEAF_NODE_SIZES=e.uniformNodeDimensions,"transformed"==e.step&&(u.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,u.ENFORCE_CONSTRAINTS=!1,u.APPLY_LAYOUT=!1),"enforced"==e.step&&(u.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,u.ENFORCE_CONSTRAINTS=!0,u.APPLY_LAYOUT=!1),"cose"==e.step&&(u.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,u.ENFORCE_CONSTRAINTS=!1,u.APPLY_LAYOUT=!0),"all"==e.step&&(e.randomize?u.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:u.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,u.ENFORCE_CONSTRAINTS=!0,u.APPLY_LAYOUT=!0),e.fixedNodeConstraint||e.alignmentConstraint||e.relativePlacementConstraint?u.TREE_REDUCTION_ON_INCREMENTAL=!1:u.TREE_REDUCTION_ON_INCREMENTAL=!0;var N=new i,j=N.newGraphManager();return!function e(t,n,i,l){for(var c=n.length,u=0;u<c;u++){var d=n[u],h=null;0==d.intersection(w).length&&(h=d.children());var f=void 0,y=d.layoutDimensions({nodeDimensionsIncludeLabels:l.nodeDimensionsIncludeLabels});if(null!=d.outerWidth()&&null!=d.outerHeight())if(l.randomize)if(d.isParent()){var N=r.calcBoundingBox(d,g,v,p);f=0==d.intersection(w).length?t.add(new a(i.graphManager,new o(N.topLeftX,N.topLeftY),new s(N.width,N.height))):t.add(new a(i.graphManager,new o(N.topLeftX,N.topLeftY),new s(parseFloat(y.w),parseFloat(y.h))))}else f=t.add(new a(i.graphManager,new o(g[p.get(d.id())]-y.w/2,v[p.get(d.id())]-y.h/2),new s(parseFloat(y.w),parseFloat(y.h))));else f=t.add(new a(i.graphManager,new o(d.position("x")-y.w/2,d.position("y")-y.h/2),new s(parseFloat(y.w),parseFloat(y.h))));else f=t.add(new a(this.graphManager));(f.id=d.data("id"),f.nodeRepulsion=b(l.nodeRepulsion,d),f.paddingLeft=parseInt(d.css("padding")),f.paddingTop=parseInt(d.css("padding")),f.paddingRight=parseInt(d.css("padding")),f.paddingBottom=parseInt(d.css("padding")),l.nodeDimensionsIncludeLabels&&(f.labelWidth=d.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,f.labelHeight=d.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,f.labelPosVertical=d.css("text-valign"),f.labelPosHorizontal=d.css("text-halign")),x[d.data("id")]=f,isNaN(f.rect.x)&&(f.rect.x=0),isNaN(f.rect.y)&&(f.rect.y=0),null!=h&&h.length>0)&&e(i.getGraphManager().add(i.newGraph(),f),h,i,l)}}(j.addRoot(),r.getTopMostNodes(h),N,e),!function(t,n,r){for(var i=0,a=0,o=0;o<r.length;o++){var s=r[o],l=x[s.data("source")],d=x[s.data("target")];if(l&&d&&l!==d&&0==l.getEdgesBetween(d).length){var h=n.add(t.newEdge(),l,d);h.id=s.id(),h.idealLength=b(e.idealEdgeLength,s),h.edgeElasticity=b(e.edgeElasticity,s),i+=h.idealLength,a++}}null!=e.idealEdgeLength&&(a>0?u.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=i/a:y(e.idealEdgeLength)?u.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:u.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=e.idealEdgeLength,u.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,u.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)}(N,j,f),e.fixedNodeConstraint&&(N.constraints.fixedNodeConstraint=e.fixedNodeConstraint),e.alignmentConstraint&&(N.constraints.alignmentConstraint=e.alignmentConstraint),e.relativePlacementConstraint&&(N.constraints.relativePlacementConstraint=e.relativePlacementConstraint),N.runLayout(),x}}},212:(e,t,n)=>{var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(658),a=n(548),o=n(657).spectralLayout,s=n(816).coseLayout,l=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(e){return 4500},idealEdgeLength:function(e){return 50},edgeElasticity:function(e){return .45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}});e.exports=function(){function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.options=i({},l,t)}return r(e,[{key:"run",value:function(){var e=this.options,t=e.cy,n=e.eles,r=[],i=[],l=void 0,c=[];e.fixedNodeConstraint&&(!Array.isArray(e.fixedNodeConstraint)||0==e.fixedNodeConstraint.length)&&(e.fixedNodeConstraint=void 0),e.alignmentConstraint&&(e.alignmentConstraint.vertical&&(!Array.isArray(e.alignmentConstraint.vertical)||0==e.alignmentConstraint.vertical.length)&&(e.alignmentConstraint.vertical=void 0),e.alignmentConstraint.horizontal&&(!Array.isArray(e.alignmentConstraint.horizontal)||0==e.alignmentConstraint.horizontal.length)&&(e.alignmentConstraint.horizontal=void 0)),e.relativePlacementConstraint&&(!Array.isArray(e.relativePlacementConstraint)||0==e.relativePlacementConstraint.length)&&(e.relativePlacementConstraint=void 0),(e.fixedNodeConstraint||e.alignmentConstraint||e.relativePlacementConstraint)&&(e.tile=!1,e.packComponents=!1);var u=void 0,d=!1;if(t.layoutUtilities&&e.packComponents&&((u=t.layoutUtilities("get"))||(u=t.layoutUtilities()),d=!0),n.nodes().length>0)if(d){var h=a.getTopMostNodes(e.eles.nodes());if((l=a.connectComponents(t,e.eles,h)).forEach(function(e){var t=e.boundingBox();c.push({x:t.x1+t.w/2,y:t.y1+t.h/2})}),e.randomize&&l.forEach(function(t){e.eles=t,r.push(o(e))}),"default"==e.quality||"proof"==e.quality){var f=t.collection();if(e.tile){var p=new Map,g=0,v={nodeIndexes:p,xCoords:[],yCoords:[]},x=[];if(l.forEach(function(e,t){0==e.edges().length&&(e.nodes().forEach(function(t,n){f.merge(e.nodes()[n]),t.isParent()||(v.nodeIndexes.set(e.nodes()[n].id(),g++),v.xCoords.push(e.nodes()[0].position().x),v.yCoords.push(e.nodes()[0].position().y))}),x.push(t))}),f.length>1){var y=f.boundingBox();c.push({x:y.x1+y.w/2,y:y.y1+y.h/2}),l.push(f),r.push(v);for(var b=x.length-1;b>=0;b--)l.splice(x[b],1),r.splice(x[b],1),c.splice(x[b],1)}}l.forEach(function(t,n){e.eles=t,i.push(s(e,r[n])),a.relocateComponent(c[n],i[n],e)})}else l.forEach(function(t,n){a.relocateComponent(c[n],r[n],e)});var w=new Set;if(l.length>1){var N=[],j=n.filter(function(e){return"none"==e.css("display")});l.forEach(function(t,n){var o=void 0;if("draft"==e.quality&&(o=r[n].nodeIndexes),t.nodes().not(j).length>0){var s={};s.edges=[],s.nodes=[];var l=void 0;t.nodes().not(j).forEach(function(t){if("draft"==e.quality)if(t.isParent()){var c=a.calcBoundingBox(t,r[n].xCoords,r[n].yCoords,o);s.nodes.push({x:c.topLeftX,y:c.topLeftY,width:c.width,height:c.height})}else l=o.get(t.id()),s.nodes.push({x:r[n].xCoords[l]-t.boundingbox().w/2,y:r[n].yCoords[l]-t.boundingbox().h/2,width:t.boundingbox().w,height:t.boundingbox().h});else i[n][t.id()]&&s.nodes.push({x:i[n][t.id()].getLeft(),y:i[n][t.id()].getTop(),width:i[n][t.id()].getWidth(),height:i[n][t.id()].getHeight()})}),t.edges().forEach(function(t){var l=t.source(),c=t.target();if("none"!=l.css("display")&&"none"!=c.css("display"))if("draft"==e.quality){var u=o.get(l.id()),d=o.get(c.id()),h=[],f=[];if(l.isParent()){var p=a.calcBoundingBox(l,r[n].xCoords,r[n].yCoords,o);h.push(p.topLeftX+p.width/2),h.push(p.topLeftY+p.height/2)}else h.push(r[n].xCoords[u]),h.push(r[n].yCoords[u]);if(c.isParent()){var g=a.calcBoundingBox(c,r[n].xCoords,r[n].yCoords,o);f.push(g.topLeftX+g.width/2),f.push(g.topLeftY+g.height/2)}else f.push(r[n].xCoords[d]),f.push(r[n].yCoords[d]);s.edges.push({startX:h[0],startY:h[1],endX:f[0],endY:f[1]})}else i[n][l.id()]&&i[n][c.id()]&&s.edges.push({startX:i[n][l.id()].getCenterX(),startY:i[n][l.id()].getCenterY(),endX:i[n][c.id()].getCenterX(),endY:i[n][c.id()].getCenterY()})}),s.nodes.length>0&&(N.push(s),w.add(n))}});var k=u.packComponents(N,e.randomize).shifts;if("draft"==e.quality)r.forEach(function(e,t){var n=e.xCoords.map(function(e){return e+k[t].dx}),r=e.yCoords.map(function(e){return e+k[t].dy});e.xCoords=n,e.yCoords=r});else{var S=0;w.forEach(function(e){Object.keys(i[e]).forEach(function(t){var n=i[e][t];n.setCenter(n.getCenterX()+k[S].dx,n.getCenterY()+k[S].dy)}),S++})}}}else{var C=e.eles.boundingBox();if(c.push({x:C.x1+C.w/2,y:C.y1+C.h/2}),e.randomize){var _=o(e);r.push(_)}"default"==e.quality||"proof"==e.quality?(i.push(s(e,r[0])),a.relocateComponent(c[0],i[0],e)):a.relocateComponent(c[0],r[0],e)}var E=function(t,n){if("default"==e.quality||"proof"==e.quality){"number"==typeof t&&(t=n);var a=void 0,o=void 0,s=t.data("id");return i.forEach(function(e){s in e&&(a={x:e[s].getRect().getCenterX(),y:e[s].getRect().getCenterY()},o=e[s])}),e.nodeDimensionsIncludeLabels&&(o.labelWidth&&("left"==o.labelPosHorizontal?a.x+=o.labelWidth/2:"right"==o.labelPosHorizontal&&(a.x-=o.labelWidth/2)),o.labelHeight&&("top"==o.labelPosVertical?a.y+=o.labelHeight/2:"bottom"==o.labelPosVertical&&(a.y-=o.labelHeight/2))),void 0==a&&(a={x:t.position("x"),y:t.position("y")}),{x:a.x,y:a.y}}var l=void 0;return r.forEach(function(e){var n=e.nodeIndexes.get(t.id());void 0!=n&&(l={x:e.xCoords[n],y:e.yCoords[n]})}),void 0==l&&(l={x:t.position("x"),y:t.position("y")}),{x:l.x,y:l.y}};if("default"==e.quality||"proof"==e.quality||e.randomize){var T=a.calcParentsWithoutChildren(t,n),M=n.filter(function(e){return"none"==e.css("display")});e.eles=n.not(M),n.nodes().not(":parent").not(M).layoutPositions(this,e,E),T.length>0&&T.forEach(function(e){e.position(E(e))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),e}()},657:(e,t,n)=>{var r=n(548),i=n(140).layoutBase.Matrix,a=n(140).layoutBase.SVD;e.exports={spectralLayout:function(e){var t=e.cy,n=e.eles,o=n.nodes(),s=n.nodes(":parent"),l=new Map,c=new Map,u=new Map,d=[],h=[],f=[],p=[],g=[],v=[],x=[],y=[],b=void 0,w=e.piTol,N=e.samplingType,j=e.nodeSeparation,k=void 0,S=function(){for(var e=0,t=0,n=!1;t<k;){e=Math.floor(Math.random()*b),n=!1;for(var r=0;r<t;r++)if(p[r]==e){n=!0;break}!n&&(p[t]=e,t++)}},C=function(e,t,n){for(var r=[],i=0,a=0,o=0,s=void 0,l=[],u=0,h=1,f=0;f<b;f++)l[f]=1e8;for(r[a]=e,l[e]=0;a>=i;){for(var p=d[o=r[i++]],x=0;x<p.length;x++)1e8==l[s=c.get(p[x])]&&(l[s]=l[o]+1,r[++a]=s);v[o][t]=l[o]*j}if(n){for(var y=0;y<b;y++)v[y][t]<g[y]&&(g[y]=v[y][t]);for(var w=0;w<b;w++)g[w]>u&&(u=g[w],h=w)}return h};r.connectComponents(t,n,r.getTopMostNodes(o),l),s.forEach(function(e){r.connectComponents(t,n,r.getTopMostNodes(e.descendants().intersection(n)),l)});for(var _=0,E=0;E<o.length;E++)o[E].isParent()||c.set(o[E].id(),_++);var T=!0,M=!1,O=void 0;try{for(var A,D=l.keys()[Symbol.iterator]();!(T=(A=D.next()).done);T=!0){var P=A.value;c.set(P,_++)}}catch(e){M=!0,O=e}finally{try{!T&&D.return&&D.return()}finally{if(M)throw O}}for(var I=0;I<c.size;I++)d[I]=[];s.forEach(function(e){for(var t=e.children().intersection(n);0==t.nodes(":childless").length;)t=t.nodes()[0].children().intersection(n);var r=0,i=t.nodes(":childless")[0].connectedEdges().length;t.nodes(":childless").forEach(function(e,t){e.connectedEdges().length<i&&(i=e.connectedEdges().length,r=t)}),u.set(e.id(),t.nodes(":childless")[r].id())}),o.forEach(function(e){var t=void 0;t=e.isParent()?c.get(u.get(e.id())):c.get(e.id()),e.neighborhood().nodes().forEach(function(r){n.intersection(e.edgesWith(r)).length>0&&(r.isParent()?d[t].push(u.get(r.id())):d[t].push(r.id()))})});var L=function(e){var n=c.get(e),r=void 0;l.get(e).forEach(function(i){r=t.getElementById(i).isParent()?u.get(i):i,d[n].push(r),d[c.get(r)].push(e)})},R=!0,B=!1,F=void 0;try{for(var z,V=l.keys()[Symbol.iterator]();!(R=(z=V.next()).done);R=!0){var H=z.value;L(H)}}catch(e){B=!0,F=e}finally{try{!R&&V.return&&V.return()}finally{if(B)throw F}}b=c.size;if(b>2){k=b<e.sampleSize?b:e.sampleSize;for(var U=0;U<b;U++)v[U]=[];for(var W=0;W<k;W++)y[W]=[];return"draft"==e.quality||"all"==e.step?(!function(e){var t=void 0;if(e){t=Math.floor(Math.random()*b);for(var n=0;n<b;n++)g[n]=1e8;for(var r=0;r<k;r++)p[r]=t,t=C(t,r,e)}else{S();for(var i=0;i<k;i++)C(p[i],i,e,!1)}for(var a=0;a<b;a++)for(var o=0;o<k;o++)v[a][o]*=v[a][o];for(var s=0;s<k;s++)x[s]=[];for(var l=0;l<k;l++)for(var c=0;c<k;c++)x[l][c]=v[p[c]][l]}(N),!function(){for(var e=a.svd(x),t=e.S,n=e.U,r=e.V,o=t[0]*t[0]*t[0],s=[],l=0;l<k;l++){s[l]=[];for(var c=0;c<k;c++)s[l][c]=0,l==c&&(s[l][c]=t[l]/(t[l]*t[l]+o/(t[l]*t[l])))}y=i.multMat(i.multMat(r,s),i.transpose(n))}(),!function(){for(var e=void 0,t=void 0,n=[],r=[],a=[],o=[],s=0;s<b;s++)n[s]=Math.random(),r[s]=Math.random();n=i.normalize(n),r=i.normalize(r);for(var l=0,c=1e-9,u=1e-9,d=void 0;;){l++;for(var p=0;p<b;p++)a[p]=n[p];if(n=i.multGamma(i.multL(i.multGamma(a),v,y)),e=i.dotProduct(a,n),n=i.normalize(n),(d=Math.abs((c=i.dotProduct(a,n))/u))<=1+w&&d>=1)break;u=c}for(var g=0;g<b;g++)a[g]=n[g];for(l=0,u=1e-9;;){l++;for(var x=0;x<b;x++)o[x]=r[x];if(o=i.minusOp(o,i.multCons(a,i.dotProduct(a,o))),r=i.multGamma(i.multL(i.multGamma(o),v,y)),t=i.dotProduct(o,r),r=i.normalize(r),(d=Math.abs((c=i.dotProduct(o,r))/u))<=1+w&&d>=1)break;u=c}for(var N=0;N<b;N++)o[N]=r[N];h=i.multCons(a,Math.sqrt(Math.abs(e))),f=i.multCons(o,Math.sqrt(Math.abs(t)))}()):c.forEach(function(e,n){h.push(t.getElementById(n).position("x")),f.push(t.getElementById(n).position("y"))}),{nodeIndexes:c,xCoords:h,yCoords:f}}var Y=c.keys(),G=t.getElementById(Y.next().value),X=G.position(),$=G.outerWidth();if(h.push(X.x),f.push(X.y),2==b){var q=t.getElementById(Y.next().value).outerWidth();h.push(X.x+$/2+q/2+e.idealEdgeLength),f.push(X.y)}return{nodeIndexes:c,xCoords:h,yCoords:f}}}},579:(e,t,n)=>{var r=n(212),i=function(e){e&&e("layout","fcose",r)};"u">typeof cytoscape&&i(cytoscape),e.exports=i},140:e=>{e.exports=r}},t={};return function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(579)})()},26568,(e,t,n)=>{"use strict";var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,a=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g;function d(e){return e?e.replace(u,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,u=1;function h(e){var t=e.match(i);t&&(n+=t.length);var r=e.lastIndexOf("\n");u=~r?e.length-r:u+e.length}function f(){var e={line:n,column:u};return function(t){return t.position=new p(e),v(a),t}}function p(e){this.start=e,this.end={line:n,column:u},this.source=t.source}function g(r){var i=Error(t.source+":"+n+":"+u+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=u,i.source=e,t.silent);else throw i}function v(t){var n=t.exec(e);if(n){var r=n[0];return h(r),e=e.slice(r.length),n}}function x(e){var t;for(e=e||[];t=y();)!1!==t&&e.push(t);return e}function y(){var t=f();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return g("End of comment missing");var r=e.slice(2,n-2);return u+=2,h(r),e=e.slice(n),u+=2,t({type:"comment",comment:r})}}p.prototype.content=e,v(a);var b,w=[];for(x(w);b=function(){var e=f(),t=v(o);if(t){if(y(),!v(s))return g("property missing ':'");var n=v(l),i=e({type:"declaration",property:d(t[0].replace(r,"")),value:n?d(n[0].replace(r,"")):""});return v(c),i}}();)!1!==b&&(w.push(b),x(w));return w}},70454,(e,t,n)=>{"use strict";var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t){let n=null;if(!e||"string"!=typeof e)return n;let r=(0,i.default)(e),a="function"==typeof t;return r.forEach(e=>{if("declaration"!==e.type)return;let{property:r,value:i}=e;a?t(r,i,e):i&&((n=n||{})[r]=i)}),n};let i=r(e.r(26568))},65185,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.camelCase=void 0;var r=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,a=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(e,t){return t.toUpperCase()},c=function(e,t){return"".concat(t,"-")};n.camelCase=function(e,t){var n;return(void 0===t&&(t={}),!(n=e)||a.test(n)||r.test(n))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(s,c):e.replace(o,c)).replace(i,l))}},15511,(e,t,n)=>{"use strict";var r=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(70454)),i=e.r(65185);function a(e,t){var n={};return e&&"string"==typeof e&&(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a},4100,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},l=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!a)return!1;for(t in e);return void 0===t||r.call(e,t)},c=function(e,t){a&&"__proto__"===t.name?a(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},u=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(o)return o(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,o,d=arguments[0],h=1,f=arguments.length,p=!1;for("boolean"==typeof d&&(p=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<f;++h)if(t=arguments[h],null!=t)for(n in t)r=u(d,n),d!==(i=u(t,n))&&(p&&i&&(l(i)||(a=s(i)))?(a?(a=!1,o=r&&s(r)?r:[]):o=r&&l(r)?r:{},c(d,{name:n,newValue:e(p,o,i)})):void 0!==i&&c(d,{name:n,newValue:i}));return d}},78756,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isUnsafeProperty=function(e){return"__proto__"===e}},33858,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isDeepKey=function(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}},96736,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.toKey=function(e){return"string"==typeof e||"symbol"==typeof e?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}},48018,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.toString=function e(t){if(null==t)return"";if("string"==typeof t)return t;if(Array.isArray(t))return t.map(e).join(",");let n=String(t);return"0"===n&&Object.is(Number(t),-0)?"-0":n}},79232,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(48018),i=e.r(96736);n.toPath=function(e){if(Array.isArray(e))return e.map(i.toKey);if("symbol"==typeof e)return[e];e=r.toString(e);let t=[],n=e.length;if(0===n)return t;let a=0,o="",s="",l=!1;for(46===e.charCodeAt(0)&&(t.push(""),a++);a<n;){let r=e[a];s?"\\"===r&&a+1<n?o+=e[++a]:r===s?s="":o+=r:l?'"'===r||"'"===r?s=r:"]"===r?(l=!1,t.push(o),o=""):o+=r:"["===r?(l=!0,o&&(t.push(o),o="")):"."===r?o&&(t.push(o),o=""):o+=r,a++}return o&&t.push(o),t}},18915,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(78756),i=e.r(33858),a=e.r(96736),o=e.r(79232);n.get=function e(t,n,s){if(null==t)return s;switch(typeof n){case"string":{if(r.isUnsafeProperty(n))return s;let a=t[n];if(void 0===a)if(i.isDeepKey(n))return e(t,o.toPath(n),s);else return s;return a}case"number":case"symbol":{"number"==typeof n&&(n=a.toKey(n));let e=t[n];if(void 0===e)return s;return e}default:{if(Array.isArray(n)){var l=t,c=n,u=s;if(0===c.length)return u;let e=l;for(let t=0;t<c.length;t++){if(null==e||r.isUnsafeProperty(c[t]))return u;e=e[c[t]]}return void 0===e?u:e}if(n=Object.is(n?.valueOf(),-0)?"-0":String(n),r.isUnsafeProperty(n))return s;let e=t[n];if(void 0===e)return s;return e}}}},92068,(e,t,n)=>{t.exports=e.r(18915).get},14595,(e,t,n)=>{"use strict";var r=e.r(71645),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useSyncExternalStore,o=r.useRef,s=r.useEffect,l=r.useMemo,c=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;var f=a(e,(d=l(function(){function e(e){if(!s){if(s=!0,a=e,e=r(e),void 0!==u&&h.hasValue){var t=h.value;if(u(t,e))return o=t}return o=e}if(t=o,i(a,e))return t;var n=r(e);return void 0!==u&&u(t,n)?(a=e,t):(a=e,o=n)}var a,o,s=!1,l=void 0===n?null:n;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]},[t,n,r,u]))[0],d[1]);return s(function(){h.hasValue=!0,h.value=f},[f]),c(f),f}},13027,(e,t,n)=>{"use strict";t.exports=e.r(14595)},55838,(e,t,n)=>{"use strict";var r=e.r(71645),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,o=r.useEffect,s=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var u="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,u=r[1];return s(function(){i.value=n,i.getSnapshot=t,c(i)&&u({inst:i})},[e,n,t]),o(function(){return c(i)&&u({inst:i}),e(function(){c(i)&&u({inst:i})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},2239,(e,t,n)=>{"use strict";t.exports=e.r(55838)},52822,(e,t,n)=>{"use strict";var r=e.r(71645),i=e.r(2239),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=i.useSyncExternalStore,s=r.useRef,l=r.useEffect,c=r.useMemo,u=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;var f=o(e,(d=c(function(){function e(e){if(!l){if(l=!0,o=e,e=r(e),void 0!==i&&h.hasValue){var t=h.value;if(i(t,e))return s=t}return s=e}if(t=s,a(o,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(o=e,t):(o=e,s=n)}var o,s,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]))[0],d[1]);return l(function(){h.hasValue=!0,h.value=f},[f]),u(f),f}},30224,(e,t,n)=>{"use strict";t.exports=e.r(52822)},45403,(e,t,n)=>{"use strict";function r(e){return"symbol"==typeof e?1:null===e?2:void 0===e?3:4*(e!=e)}Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.compareValues=(e,t,n)=>{if(e!==t){let i=r(e),a=r(t);if(i===a&&0===i){if(e<t)return"desc"===n?1:-1;if(e>t)return"desc"===n?-1:1}return"desc"===n?a-i:i-a}return 0}},9542,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isSymbol=function(e){return"symbol"==typeof e||e instanceof Symbol}},38104,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(9542),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;n.isKey=function(e,t){return!Array.isArray(e)&&(!!("number"==typeof e||"boolean"==typeof e||null==e||r.isSymbol(e))||"string"==typeof e&&(a.test(e)||!i.test(e))||null!=t&&Object.hasOwn(t,e))}},910,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(45403),i=e.r(38104),a=e.r(79232);n.orderBy=function(e,t,n,o){if(null==e)return[];n=o?void 0:n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=null==t?[null]:[t]),0===t.length&&(t=[null]),Array.isArray(n)||(n=null==n?[]:[n]),n=n.map(e=>String(e));let s=(e,t)=>{let n=e;for(let e=0;e<t.length&&null!=n;++e)n=n[t[e]];return n},l=t.map(e=>(Array.isArray(e)&&1===e.length&&(e=e[0]),null==e||"function"==typeof e||Array.isArray(e)||i.isKey(e))?e:{key:e,path:a.toPath(e)});return e.map(e=>({original:e,criteria:l.map(t=>{var n,r;return n=t,null==(r=e)||null==n?r:"object"==typeof n&&"key"in n?Object.hasOwn(r,n.key)?r[n.key]:s(r,n.path):"function"==typeof n?n(r):Array.isArray(n)?s(r,n):"object"==typeof r?r[n]:r})})).slice().sort((e,t)=>{for(let i=0;i<l.length;i++){let a=r.compareValues(e.criteria[i],t.criteria[i],n[i]);if(0!==a)return a}return 0}).map(e=>e.original)}},44647,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.flatten=function(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}},5257,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=/^(?:0|[1-9]\d*)$/;n.isIndex=function(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return r.test(e)}}},70871,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isLength=function(e){return Number.isSafeInteger(e)&&e>=0}},69642,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(70871);n.isArrayLike=function(e){return null!=e&&"function"!=typeof e&&r.isLength(e.length)}},90820,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isObject=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}},93363,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isEqualsSameValueZero=function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}},15111,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(5257),i=e.r(69642),a=e.r(90820),o=e.r(93363);n.isIterateeCall=function(e,t,n){return!!a.isObject(n)&&(!!("number"==typeof t&&i.isArrayLike(n)&&r.isIndex(t))&&t<n.length||"string"==typeof t&&t in n)&&o.isEqualsSameValueZero(n[t],e)}},69955,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(910),i=e.r(44647),a=e.r(15111);n.sortBy=function(e,...t){let n=t.length;return n>1&&a.isIterateeCall(e,t[0],t[1])?t=[]:n>2&&a.isIterateeCall(t[0],t[1],t[2])&&(t=[t[0]]),r.orderBy(e,i.flatten(t),["asc"])}},42342,(e,t,n)=>{t.exports=e.r(69955).sortBy},24798,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.debounce=function(e,t,{signal:n,edges:r}={}){let i,a=null,o=null!=r&&r.includes("leading"),s=null==r||r.includes("trailing"),l=()=>{null!==a&&(e.apply(i,a),i=void 0,a=null)},c=null,u=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,s&&l(),d()},t)},d=()=>{null!==c&&(clearTimeout(c),c=null),i=void 0,a=null},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=null==c;u(),o&&t&&l()};return h.schedule=u,h.cancel=d,h.flush=()=>{l()},n?.addEventListener("abort",d,{once:!0}),h}},96074,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(24798);n.debounce=function(e,t=0,n={}){let i;"object"!=typeof n&&(n={});let{leading:a=!1,trailing:o=!0,maxWait:s}=n,l=[,,];a&&(l[0]="leading"),o&&(l[1]="trailing");let c=null,u=r.debounce(function(...t){i=e.apply(this,t),c=null},t,{edges:l}),d=function(...t){return null!=s&&(null===c&&(c=Date.now()),Date.now()-c>=s)?(i=e.apply(this,t),c=Date.now(),u.cancel(),u.schedule(),i):(u.apply(this,t),i)};return d.cancel=u.cancel,d.flush=()=>(u.flush(),i),d}},46508,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(96074);n.throttle=function(e,t=0,n={}){let{leading:i=!0,trailing:a=!0}=n;return r.debounce(e,t,{leading:i,maxWait:t,trailing:a})}},58723,(e,t,n)=>{t.exports=e.r(46508).throttle},41015,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(9542);n.toNumber=function(e){return r.isSymbol(e)?NaN:Number(e)}},89793,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(41015);n.toFinite=function(e){return e?(e=r.toNumber(e))===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e==e?e:0:0===e?e:0}},45264,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(15111),i=e.r(89793);n.range=function(e,t,n){n&&"number"!=typeof n&&r.isIterateeCall(e,t,n)&&(t=n=void 0),e=i.toFinite(e),void 0===t?(t=e,e=0):t=i.toFinite(t),n=void 0===n?e<t?1:-1:i.toFinite(n);let a=Math.max(Math.ceil((t-e)/(n||1)),0),o=Array(a);for(let t=0;t<a;t++)o[t]=e,e+=n;return o}},66814,(e,t,n)=>{t.exports=e.r(45264).range},51655,(e,t,n)=>{!function(n){"use strict";var r,i={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},a=!0,o="[DecimalError] ",s=o+"Invalid argument: ",l=o+"Exponent out of range: ",c=Math.floor,u=Math.pow,d=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,h=c(1286742750677284.5),f={};function p(e,t){var n,r,i,o,s,l,c,u,d=e.constructor,h=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),a?S(t,h):t;if(c=e.d,u=t.d,s=e.e,i=t.e,c=c.slice(),o=s-i){for(o<0?(r=c,o=-o,l=u.length):(r=u,i=s,l=c.length),o>(l=(s=Math.ceil(h/7))>l?s+1:l+1)&&(o=l,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for((l=c.length)-(o=u.length)<0&&(o=l,r=u,u=c,c=r),n=0;o;)n=(c[--o]=c[o]+u[o]+n)/1e7|0,c[o]%=1e7;for(n&&(c.unshift(n),++i),l=c.length;0==c[--l];)c.pop();return t.d=c,t.e=i,a?S(t,h):t}function g(e,t,n){if(e!==~~e||e<t||e>n)throw Error(s+e)}function v(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)(n=7-(r=e[t]+"").length)&&(a+=N(n)),a+=r;(n=7-(r=(o=e[t])+"").length)&&(a+=N(n))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}f.absoluteValue=f.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e},f.comparedTo=f.cmp=function(e){var t,n,r,i;if(e=new this.constructor(e),this.s!==e.s)return this.s||-e.s;if(this.e!==e.e)return this.e>e.e^this.s<0?1:-1;for(t=0,n=(r=this.d.length)<(i=e.d.length)?r:i;t<n;++t)if(this.d[t]!==e.d[t])return this.d[t]>e.d[t]^this.s<0?1:-1;return r===i?0:r>i^this.s<0?1:-1},f.decimalPlaces=f.dp=function(){var e=this.d.length-1,t=(e-this.e)*7;if(e=this.d[e])for(;e%10==0;e/=10)t--;return t<0?0:t},f.dividedBy=f.div=function(e){return x(this,new this.constructor(e))},f.dividedToIntegerBy=f.idiv=function(e){var t=this.constructor;return S(x(this,new t(e),0,1),t.precision)},f.equals=f.eq=function(e){return!this.cmp(e)},f.exponent=function(){return b(this)},f.greaterThan=f.gt=function(e){return this.cmp(e)>0},f.greaterThanOrEqualTo=f.gte=function(e){return this.cmp(e)>=0},f.isInteger=f.isint=function(){return this.e>this.d.length-2},f.isNegative=f.isneg=function(){return this.s<0},f.isPositive=f.ispos=function(){return this.s>0},f.isZero=function(){return 0===this.s},f.lessThan=f.lt=function(e){return 0>this.cmp(e)},f.lessThanOrEqualTo=f.lte=function(e){return 1>this.cmp(e)},f.logarithm=f.log=function(e){var t,n=this.constructor,i=n.precision,s=i+5;if(void 0===e)e=new n(10);else if((e=new n(e)).s<1||e.eq(r))throw Error(o+"NaN");if(this.s<1)throw Error(o+(this.s?"NaN":"-Infinity"));return this.eq(r)?new n(0):(a=!1,t=x(j(this,s),j(e,s),s),a=!0,S(t,i))},f.minus=f.sub=function(e){return e=new this.constructor(e),this.s==e.s?C(this,e):p(this,(e.s=-e.s,e))},f.modulo=f.mod=function(e){var t,n=this.constructor,r=n.precision;if(!(e=new n(e)).s)throw Error(o+"NaN");return this.s?(a=!1,t=x(this,e,0,1).times(e),a=!0,this.minus(t)):S(new n(this),r)},f.naturalExponential=f.exp=function(){return y(this)},f.naturalLogarithm=f.ln=function(){return j(this)},f.negated=f.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},f.plus=f.add=function(e){return e=new this.constructor(e),this.s==e.s?p(this,e):C(this,(e.s=-e.s,e))},f.precision=f.sd=function(e){var t,n,r;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(s+e);if(t=b(this)+1,n=7*(r=this.d.length-1)+1,r=this.d[r]){for(;r%10==0;r/=10)n--;for(r=this.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},f.squareRoot=f.sqrt=function(){var e,t,n,r,i,s,l,u=this.constructor;if(this.s<1){if(!this.s)return new u(0);throw Error(o+"NaN")}for(e=b(this),a=!1,0==(i=Math.sqrt(+this))||i==1/0?(((t=v(this.d)).length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),r=new u(t=i==1/0?"5e"+e:(t=i.toExponential()).slice(0,t.indexOf("e")+1)+e)):r=new u(i.toString()),i=l=(n=u.precision)+3;;)if(r=(s=r).plus(x(this,s,l+2)).times(.5),v(s.d).slice(0,l)===(t=v(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),i==l&&"4999"==t){if(S(s,n+1,0),s.times(s).eq(this)){r=s;break}}else if("9999"!=t)break;l+=4}return a=!0,S(r,n)},f.times=f.mul=function(e){var t,n,r,i,o,s,l,c,u,d=this.constructor,h=this.d,f=(e=new d(e)).d;if(!this.s||!e.s)return new d(0);for(e.s*=this.s,n=this.e+e.e,(c=h.length)<(u=f.length)&&(o=h,h=f,f=o,s=c,c=u,u=s),o=[],r=s=c+u;r--;)o.push(0);for(r=u;--r>=0;){for(t=0,i=c+r;i>r;)l=o[i]+f[r]*h[i-r-1]+t,o[i--]=l%1e7|0,t=l/1e7|0;o[i]=(o[i]+t)%1e7|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,a?S(e,d.precision):e},f.toDecimalPlaces=f.todp=function(e,t){var n=this,r=n.constructor;return(n=new r(n),void 0===e)?n:(g(e,0,1e9),void 0===t?t=r.rounding:g(t,0,8),S(n,e+b(n)+1,t))},f.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=_(r,!0):(g(e,0,1e9),void 0===t?t=i.rounding:g(t,0,8),n=_(r=S(new i(r),e+1,t),!0,e+1)),n},f.toFixed=function(e,t){var n,r,i=this.constructor;return void 0===e?_(this):(g(e,0,1e9),void 0===t?t=i.rounding:g(t,0,8),n=_((r=S(new i(this),e+b(this)+1,t)).abs(),!1,e+b(r)+1),this.isneg()&&!this.isZero()?"-"+n:n)},f.toInteger=f.toint=function(){var e=this.constructor;return S(new e(this),b(this)+1,e.rounding)},f.toNumber=function(){return+this},f.toPower=f.pow=function(e){var t,n,i,s,l,u,d=this,h=d.constructor,f=+(e=new h(e));if(!e.s)return new h(r);if(!(d=new h(d)).s){if(e.s<1)throw Error(o+"Infinity");return d}if(d.eq(r))return d;if(i=h.precision,e.eq(r))return S(d,i);if(u=(t=e.e)>=(n=e.d.length-1),l=d.s,u){if((n=f<0?-f:f)<=0x1fffffffffffff){for(s=new h(r),t=Math.ceil(i/7+4),a=!1;n%2&&E((s=s.times(d)).d,t),0!==(n=c(n/2));)E((d=d.times(d)).d,t);return a=!0,e.s<0?new h(r).div(s):S(s,i)}}else if(l<0)throw Error(o+"NaN");return l=l<0&&1&e.d[Math.max(t,n)]?-1:1,d.s=1,a=!1,s=e.times(j(d,i+12)),a=!0,(s=y(s)).s=l,s},f.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return void 0===e?(n=b(i),r=_(i,n<=a.toExpNeg||n>=a.toExpPos)):(g(e,1,1e9),void 0===t?t=a.rounding:g(t,0,8),n=b(i=S(new a(i),e,t)),r=_(i,e<=n||n<=a.toExpNeg,e)),r},f.toSignificantDigits=f.tosd=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(g(e,1,1e9),void 0===t?t=n.rounding:g(t,0,8)),S(new n(this),e,t)},f.toString=f.valueOf=f.val=f.toJSON=function(){var e=b(this),t=this.constructor;return _(this,e<=t.toExpNeg||e>=t.toExpPos)};var x=function(){function e(e,t){var n,r=0,i=e.length;for(e=e.slice();i--;)n=e[i]*t+r,e[i]=n%1e7|0,r=n/1e7|0;return r&&e.unshift(r),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]<t[n]),e[n]=1e7*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,a,s){var l,c,u,d,h,f,p,g,v,x,y,w,N,j,k,C,_,E,T=r.constructor,M=r.s==i.s?1:-1,O=r.d,A=i.d;if(!r.s)return new T(r);if(!i.s)throw Error(o+"Division by zero");for(u=0,c=r.e-i.e,_=A.length,k=O.length,g=(p=new T(M)).d=[];A[u]==(O[u]||0);)++u;if(A[u]>(O[u]||0)&&--c,(w=null==a?a=T.precision:s?a+(b(r)-b(i))+1:a)<0)return new T(0);if(w=w/7+2|0,u=0,1==_)for(d=0,A=A[0],w++;(u<k||d)&&w--;u++)N=1e7*d+(O[u]||0),g[u]=N/A|0,d=N%A|0;else{for((d=1e7/(A[0]+1)|0)>1&&(A=e(A,d),O=e(O,d),_=A.length,k=O.length),j=_,x=(v=O.slice(0,_)).length;x<_;)v[x++]=0;(E=A.slice()).unshift(0),C=A[0],A[1]>=1e7/2&&++C;do d=0,(l=t(A,v,_,x))<0?(y=v[0],_!=x&&(y=1e7*y+(v[1]||0)),(d=y/C|0)>1?(d>=1e7&&(d=1e7-1),f=(h=e(A,d)).length,x=v.length,1==(l=t(h,v,f,x))&&(d--,n(h,_<f?E:A,f))):(0==d&&(l=d=1),h=A.slice()),(f=h.length)<x&&h.unshift(0),n(v,h,x),-1==l&&(x=v.length,(l=t(A,v,_,x))<1&&(d++,n(v,_<x?E:A,x))),x=v.length):0===l&&(d++,v=[0]),g[u++]=d,l&&v[0]?v[x++]=O[j]||0:(v=[O[j]],x=1);while((j++<k||void 0!==v[0])&&w--)}return g[0]||g.shift(),p.e=c,S(p,s?a+b(p)+1:a)}}();function y(e,t){var n,i,o,s,c,d=0,h=0,f=e.constructor,p=f.precision;if(b(e)>16)throw Error(l+b(e));if(!e.s)return new f(r);for(null==t?(a=!1,c=p):c=t,s=new f(.03125);e.abs().gte(.1);)e=e.times(s),h+=5;for(c+=Math.log(u(2,h))/Math.LN10*2+5|0,n=i=o=new f(r),f.precision=c;;){if(i=S(i.times(e),c),n=n.times(++d),v((s=o.plus(x(i,n,c))).d).slice(0,c)===v(o.d).slice(0,c)){for(;h--;)o=S(o.times(o),c);return f.precision=p,null==t?(a=!0,S(o,p)):o}o=s}}function b(e){for(var t=7*e.e,n=e.d[0];n>=10;n/=10)t++;return t}function w(e,t,n){if(t>e.LN10.sd())throw a=!0,n&&(e.precision=n),Error(o+"LN10 precision limit exceeded");return S(new e(e.LN10),t)}function N(e){for(var t="";e--;)t+="0";return t}function j(e,t){var n,i,s,l,c,u,d,h,f,p=1,g=e,y=g.d,N=g.constructor,k=N.precision;if(g.s<1)throw Error(o+(g.s?"NaN":"-Infinity"));if(g.eq(r))return new N(0);if(null==t?(a=!1,h=k):h=t,g.eq(10))return null==t&&(a=!0),w(N,h);if(N.precision=h+=10,i=(n=v(y)).charAt(0),!(15e14>Math.abs(l=b(g))))return d=w(N,h+2,k).times(l+""),g=j(new N(i+"."+n.slice(1)),h-10).plus(d),N.precision=k,null==t?(a=!0,S(g,k)):g;for(;i<7&&1!=i||1==i&&n.charAt(1)>3;)i=(n=v((g=g.times(e)).d)).charAt(0),p++;for(l=b(g),i>1?(g=new N("0."+n),l++):g=new N(i+"."+n.slice(1)),u=c=g=x(g.minus(r),g.plus(r),h),f=S(g.times(g),h),s=3;;){if(c=S(c.times(f),h),v((d=u.plus(x(c,new N(s),h))).d).slice(0,h)===v(u.d).slice(0,h))return u=u.times(2),0!==l&&(u=u.plus(w(N,h+2,k).times(l+""))),u=x(u,new N(p),h),N.precision=k,null==t?(a=!0,S(u,k)):u;u=d,s+=2}}function k(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);)++r;for(i=t.length;48===t.charCodeAt(i-1);)--i;if(t=t.slice(r,i)){if(i-=r,e.e=c((n=n-r-1)/7),e.d=[],r=(n+1)%7,n<0&&(r+=7),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=7;r<i;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=i;for(;r--;)t+="0";if(e.d.push(+t),a&&(e.e>h||e.e<-h))throw Error(l+n)}else e.s=0,e.e=0,e.d=[0];return e}function S(e,t,n){var r,i,o,s,d,f,p,g,v=e.d;for(s=1,o=v[0];o>=10;o/=10)s++;if((r=t-s)<0)r+=7,i=t,p=v[g=0];else{if((g=Math.ceil((r+1)/7))>=(o=v.length))return e;for(s=1,p=o=v[g];o>=10;o/=10)s++;r%=7,i=r-7+s}if(void 0!==n&&(d=p/(o=u(10,s-i-1))%10|0,f=t<0||void 0!==v[g+1]||p%o,f=n<4?(d||f)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||f||6==n&&(r>0?i>0?p/u(10,s-i):0:v[g-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return f?(o=b(e),v.length=1,t=t-o-1,v[0]=u(10,(7-t%7)%7),e.e=c(-t/7)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(0==r?(v.length=g,o=1,g--):(v.length=g+1,o=u(10,7-r),v[g]=i>0?(p/u(10,s-i)%u(10,i)|0)*o:0),f)for(;;)if(0==g){1e7==(v[0]+=o)&&(v[0]=1,++e.e);break}else{if(v[g]+=o,1e7!=v[g])break;v[g--]=0,o=1}for(r=v.length;0===v[--r];)v.pop();if(a&&(e.e>h||e.e<-h))throw Error(l+b(e));return e}function C(e,t){var n,r,i,o,s,l,c,u,d,h,f=e.constructor,p=f.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new f(e),a?S(t,p):t;if(c=e.d,h=t.d,r=t.e,u=e.e,c=c.slice(),s=u-r){for((d=s<0)?(n=c,s=-s,l=h.length):(n=h,r=u,l=c.length),s>(i=Math.max(Math.ceil(p/7),l)+2)&&(s=i,n.length=1),n.reverse(),i=s;i--;)n.push(0);n.reverse()}else{for((d=(i=c.length)<(l=h.length))&&(l=i),i=0;i<l;i++)if(c[i]!=h[i]){d=c[i]<h[i];break}s=0}for(d&&(n=c,c=h,h=n,t.s=-t.s),l=c.length,i=h.length-l;i>0;--i)c[l++]=0;for(i=h.length;i>s;){if(c[--i]<h[i]){for(o=i;o&&0===c[--o];)c[o]=1e7-1;--c[o],c[i]+=1e7}c[i]-=h[i]}for(;0===c[--l];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(t.d=c,t.e=r,a?S(t,p):t):new f(0)}function _(e,t,n){var r,i=b(e),a=v(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+"."+a.slice(1)+N(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+N(-i-1)+a,n&&(r=n-o)>0&&(a+=N(r))):i>=o?(a+=N(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+N(r))):((r=i+1)<o&&(a=a.slice(0,r)+"."+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+="."),a+=N(r))),e.s<0?"-"+a:a}function E(e,t){if(e.length>t)return e.length=t,!0}function T(e){if(!e||"object"!=typeof e)throw Error(o+"Object expected");var t,n,r,i=["precision",1,1e9,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<i.length;t+=3)if(void 0!==(r=e[n=i[t]]))if(c(r)===r&&r>=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(s+n+": "+r);if(void 0!==(r=e[n="LN10"]))if(r==Math.LN10)this[n]=new this(r);else throw Error(s+n+": "+r);return this}if((i=function e(t){var n,r,i;function a(e){if(!(this instanceof a))return new a(e);if(this.constructor=a,e instanceof a){this.s=e.s,this.e=e.e,this.d=(e=e.d)?e.slice():e;return}if("number"==typeof e){if(0*e!=0)throw Error(s+e);if(e>0)this.s=1;else if(e<0)e=-e,this.s=-1;else{this.s=0,this.e=0,this.d=[0];return}if(e===~~e&&e<1e7){this.e=0,this.d=[e];return}return k(this,e.toString())}if("string"!=typeof e)throw Error(s+e);if(45===e.charCodeAt(0)?(e=e.slice(1),this.s=-1):this.s=1,d.test(e))k(this,e);else throw Error(s+e)}if(a.prototype=f,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=e,a.config=a.set=T,void 0===t&&(t={}),t)for(n=0,i=["precision","rounding","toExpNeg","toExpPos","LN10"];n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return a.config(t),a}(i)).default=i.Decimal=i,r=new i(1),"function"==typeof define&&define.amd){let t;e.r,void 0!==(t=i)&&e.v(t)}else t.exports?t.exports=i:(n||(n="u">typeof self&&self&&self.self==self?self:Function("return this")()),n.Decimal=i)}(e.e)},29942,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i="~";function a(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,a){if("function"!=typeof n)throw TypeError("The listener must be a function");var s=new o(n,r||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function c(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(i=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,a=n.length,o=Array(a);r<a;r++)o[r]=n[r].fn;return o},c.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,r,a,o){var s=i?i+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,r),!0;case 5:return u.fn.call(u.context,t,n,r,a),!0;case 6:return u.fn.call(u.context,t,n,r,a,o),!0}for(c=1,l=Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,r);break;default:if(!l)for(h=1,l=Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},c.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,r){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return l(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||r&&!o.once||n&&o.context!==n||l(this,a);else{for(var s=0,c=[],u=o.length;s<u;s++)(o[s].fn!==t||r&&!o[s].once||n&&o[s].context!==n)&&c.push(o[s]);c.length?this._events[a]=1===c.length?c[0]:c:l(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&l(this,t)):(this._events=new a,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=i,c.EventEmitter=c,t.exports=c},43210,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.last=function(e){return e[e.length-1]}},75576,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.toArray=function(e){return Array.isArray(e)?e:Array.from(e)}},5518,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(43210),i=e.r(75576),a=e.r(69642);n.last=function(e){if(a.isArrayLike(e))return r.last(i.toArray(e))}},4178,(e,t,n)=>{t.exports=e.r(5518).last},78804,(e,t,n)=>{"use strict";var r=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),v=Symbol.for("react.client.reference");function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case a:case s:case o:case d:case h:case g:return e;default:switch(e=e&&e.$$typeof){case c:case u:case p:case f:case l:return e;default:return t}}case i:return t}}}n.ContextConsumer=l,n.ContextProvider=c,n.Element=r,n.ForwardRef=u,n.Fragment=a,n.Lazy=p,n.Memo=f,n.Portal=i,n.Profiler=s,n.StrictMode=o,n.Suspense=d,n.SuspenseList=h,n.isContextConsumer=function(e){return x(e)===l},n.isContextProvider=function(e){return x(e)===c},n.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},n.isForwardRef=function(e){return x(e)===u},n.isFragment=function(e){return x(e)===a},n.isLazy=function(e){return x(e)===p},n.isMemo=function(e){return x(e)===f},n.isPortal=function(e){return x(e)===i},n.isProfiler=function(e){return x(e)===s},n.isStrictMode=function(e){return x(e)===o},n.isSuspense=function(e){return x(e)===d},n.isSuspenseList=function(e){return x(e)===h},n.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===s||e===o||e===d||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===c||e.$$typeof===l||e.$$typeof===u||e.$$typeof===v||void 0!==e.getModuleId)||!1},n.typeOf=x},79684,(e,t,n)=>{"use strict";t.exports=e.r(78804)},10185,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.uniqBy=function(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}},17139,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.ary=function(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}},36074,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.identity=function(e){return e}},52603,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isObjectLike=function(e){return"object"==typeof e&&null!==e}},44936,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(69642),i=e.r(52603);n.isArrayLikeObject=function(e){return i.isObjectLike(e)&&r.isArrayLike(e)}},77473,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(18915);n.property=function(e){return function(t){return r.get(t,e)}}},75234,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isPrimitive=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e}},44695,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(90820),i=e.r(75234),a=e.r(93363);function o(e,t,n,c){if(t===e)return!0;switch(typeof t){case"object":return function(e,t,n,r){if(null==t)return!0;if(Array.isArray(t))return s(e,t,n,r);if(t instanceof Map){var a=e,o=t,c=n,u=r;if(0===o.size)return!0;if(!(a instanceof Map))return!1;for(let[e,t]of o.entries())if(!1===c(a.get(e),t,e,a,o,u))return!1;return!0}if(t instanceof Set)return l(e,t,n,r);let d=Object.keys(t);if(null==e||i.isPrimitive(e))return 0===d.length;if(0===d.length)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let a=0;a<d.length;a++){let o=d[a];if(!i.isPrimitive(e)&&!(o in e)||void 0===t[o]&&void 0!==e[o]||null===t[o]&&null!==e[o]||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}(e,t,n,c);case"function":if(Object.keys(t).length>0)return o(e,{...t},n,c);return a.isEqualsSameValueZero(e,t);default:if(!r.isObject(e))return a.isEqualsSameValueZero(e,t);if("string"==typeof t)return""===t;return!0}}function s(e,t,n,r){if(0===t.length)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let l=0;l<e.length;l++){if(i.has(l))continue;let c=e[l],u=!1;if(n(c,o,a,e,t,r)&&(u=!0),u){i.add(l),s=!0;break}}if(!s)return!1}return!0}function l(e,t,n,r){return 0===t.size||e instanceof Set&&s([...e],[...t],n,r)}n.isMatchWith=function e(t,n,r){return"function"!=typeof r?e(t,n,()=>void 0):o(t,n,function e(t,n,i,a,s,l){let c=r(t,n,i,a,s,l);return void 0!==c?!!c:o(t,n,e,l)},new Map)},n.isSetMatch=l},3450,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(44695);n.isMatch=function(e,t){return r.isMatchWith(e,t,()=>void 0)}},9866,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.getSymbols=function(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}},23678,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.getTag=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}},55813,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.argumentsTag="[object Arguments]",n.arrayBufferTag="[object ArrayBuffer]",n.arrayTag="[object Array]",n.bigInt64ArrayTag="[object BigInt64Array]",n.bigUint64ArrayTag="[object BigUint64Array]",n.booleanTag="[object Boolean]",n.dataViewTag="[object DataView]",n.dateTag="[object Date]",n.errorTag="[object Error]",n.float32ArrayTag="[object Float32Array]",n.float64ArrayTag="[object Float64Array]",n.functionTag="[object Function]",n.int16ArrayTag="[object Int16Array]",n.int32ArrayTag="[object Int32Array]",n.int8ArrayTag="[object Int8Array]",n.mapTag="[object Map]",n.numberTag="[object Number]",n.objectTag="[object Object]",n.regexpTag="[object RegExp]",n.setTag="[object Set]",n.stringTag="[object String]",n.symbolTag="[object Symbol]",n.uint16ArrayTag="[object Uint16Array]",n.uint32ArrayTag="[object Uint32Array]",n.uint8ArrayTag="[object Uint8Array]",n.uint8ClampedArrayTag="[object Uint8ClampedArray]"},35071,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.globalThis="object"==typeof globalThis&&globalThis||"object"==typeof window&&window||"object"==typeof self&&self||e.g||function(){return this}()||Function("return this")()},25810,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(35071);n.isBuffer=function(e){return void 0!==r.globalThis.Buffer&&r.globalThis.Buffer.isBuffer(e)}},55424,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isTypedArray=function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}},92348,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(9866),i=e.r(23678),a=e.r(55813),o=e.r(25810),s=e.r(75234),l=e.r(55424);function c(e,t,n,r=new Map,d){let h=d?.(e,t,n,r);if(void 0!==h)return h;if(s.isPrimitive(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let i=0;i<e.length;i++)t[i]=c(e[i],i,n,r,d);return Object.hasOwn(e,"index")&&(t.index=e.index),Object.hasOwn(e,"input")&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;for(let[i,a]of(r.set(e,t),e))t.set(i,c(a,i,n,r,d));return t}if(e instanceof Set){let t=new Set;for(let i of(r.set(e,t),e))t.add(c(i,void 0,n,r,d));return t}if(o.isBuffer(e))return e.subarray();if(l.isTypedArray(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let i=0;i<e.length;i++)t[i]=c(e[i],i,n,r,d);return t}if(e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),u(t,e,n,r,d),t}if("u">typeof File&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),u(t,e,n,r,d),t}if("u">typeof Blob&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),u(t,e,n,r,d),t}if(e instanceof Error){let t=structuredClone(e);return r.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,t.constructor=e.constructor,u(t,e,n,r,d),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return r.set(e,t),u(t,e,n,r,d),t}if(e instanceof Number){let t=new Number(e.valueOf());return r.set(e,t),u(t,e,n,r,d),t}if(e instanceof String){let t=new String(e.valueOf());return r.set(e,t),u(t,e,n,r,d),t}if("object"==typeof e&&function(e){switch(i.getTag(e)){case a.argumentsTag:case a.arrayTag:case a.arrayBufferTag:case a.dataViewTag:case a.booleanTag:case a.dateTag:case a.float32ArrayTag:case a.float64ArrayTag:case a.int8ArrayTag:case a.int16ArrayTag:case a.int32ArrayTag:case a.mapTag:case a.numberTag:case a.objectTag:case a.regexpTag:case a.setTag:case a.stringTag:case a.symbolTag:case a.uint8ArrayTag:case a.uint8ClampedArrayTag:case a.uint16ArrayTag:case a.uint32ArrayTag:return!0;default:return!1}}(e)){let t=Object.create(Object.getPrototypeOf(e));return r.set(e,t),u(t,e,n,r,d),t}return e}function u(e,t,n=e,i,a){let o=[...Object.keys(t),...r.getSymbols(t)];for(let r=0;r<o.length;r++){let s=o[r],l=Object.getOwnPropertyDescriptor(e,s);(null==l||l.writable)&&(e[s]=c(t[s],s,n,i,a))}}n.cloneDeepWith=function(e,t){return c(e,void 0,e,new Map,t)},n.cloneDeepWithImpl=c,n.copyProperties=u},99510,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(92348);n.cloneDeep=function(e){return r.cloneDeepWithImpl(e,void 0,e,new Map,void 0)}},67284,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(3450),i=e.r(99510);n.matches=function(e){return e=i.cloneDeep(e),t=>r.isMatch(t,e)}},68110,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(92348),i=e.r(23678),a=e.r(55813);n.cloneDeepWith=function(e,t){return r.cloneDeepWith(e,(n,o,s,l)=>{let c=t?.(n,o,s,l);if(void 0!==c)return c;if("object"==typeof e){if(i.getTag(e)===a.objectTag&&"function"!=typeof e.constructor){let t={};return l.set(e,t),r.copyProperties(t,e,s,l),t}switch(Object.prototype.toString.call(e)){case a.numberTag:case a.stringTag:case a.booleanTag:{let t=new e.constructor(e?.valueOf());return r.copyProperties(t,e),t}case a.argumentsTag:{let t={};return r.copyProperties(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}},93141,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(68110);n.cloneDeep=function(e){return r.cloneDeepWith(e)}},17858,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(23678);n.isArguments=function(e){return null!==e&&"object"==typeof e&&"[object Arguments]"===r.getTag(e)}},56518,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(33858),i=e.r(5257),a=e.r(17858),o=e.r(79232);n.has=function(e,t){let n;if(0===(n=Array.isArray(t)?t:"string"==typeof t&&r.isDeepKey(t)&&e?.[t]==null?o.toPath(t):[t]).length)return!1;let s=e;for(let e=0;e<n.length;e++){let t=n[e];if((null==s||!Object.hasOwn(s,t))&&!((Array.isArray(s)||a.isArguments(s))&&i.isIndex(t)&&t<s.length))return!1;s=s[t]}return!0}},40656,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(3450),i=e.r(96736),a=e.r(93141),o=e.r(18915),s=e.r(56518);n.matchesProperty=function(e,t){switch(typeof e){case"object":Object.is(e?.valueOf(),-0)&&(e="-0");break;case"number":e=i.toKey(e)}return t=a.cloneDeep(t),function(n){let i=o.get(n,e);return void 0===i?s.has(n,e):void 0===t?void 0===i:r.isMatch(i,t)}}},27519,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(36074),i=e.r(77473),a=e.r(67284),o=e.r(40656);n.iteratee=function(e){if(null==e)return r.identity;switch(typeof e){case"function":return e;case"object":if(Array.isArray(e)&&2===e.length)return o.matchesProperty(e[0],e[1]);return a.matches(e);case"string":case"symbol":case"number":return i.property(e)}}},77008,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(10185),i=e.r(17139),a=e.r(36074),o=e.r(44936),s=e.r(27519);n.uniqBy=function(e,t=a.identity){return o.isArrayLikeObject(e)?r.uniqBy(Array.from(e),i.ary(s.iteratee(t),1)):[]}},92809,(e,t,n)=>{t.exports=e.r(77008).uniqBy},18256,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isPlainObject=function(e){if("object"!=typeof e||null==e)return!1;if(null===Object.getPrototypeOf(e))return!0;if("[object Object]"!==Object.prototype.toString.call(e)){let t=e[Symbol.toStringTag];return null!=t&&!!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable&&e.toString()===`[object ${t}]`}let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}},7328,(e,t,n)=>{t.exports=e.r(18256).isPlainObject},8004,e=>{"use strict";let t,n,r;var i,a,o,s,l,c,u,d,h,f,p,g,v,x,y,b,w,N,j,k,S,C,_,E,T,M,O,A,D,P,I,L,R,B,F,z,V,H,U,W,Y,G,X,$,q,K,Z,Q,J,ee,et,en,er,ei,ea,eo,es,el,ec,eu,ed=e.i(18050),eh=e.i(71645),ef=e.i(18566),ep=e.i(48148),em=e.i(46696),eg=e.i(99729),ev=e.i(59321),ex=e.i(29929),ey=e.i(55436),eb=e.i(75254);let ew=(0,eb.default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),eN=(0,eb.default)("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"}]]);var ej=e.i(78583);let ek=(0,eb.default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),eS=(0,eb.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var eC=e.i(63059);let e_=(0,eb.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var eE=e.i(68373),eT=e.i(22016);function eM({currentTab:e,onTabChange:t}){let n=(0,ep.useTranslations)("bank.sidebar"),r=(0,ep.useTranslations)("bank"),{currentBank:i}=(0,ev.useBank)(),[a,o]=(0,eh.useState)(!0);if(!i)return null;let s=[{id:"data",label:n("memories"),icon:eN},{id:"recall",label:n("recall"),icon:ey.Search},{id:"reflect",label:n("reflect"),icon:ew},{id:"documents",label:n("documents"),icon:ej.FileText},{id:"entities",label:n("entities"),icon:ek},{id:"profile",label:r("bankConfiguration"),icon:e_}];return(0,ed.jsxs)("aside",{className:(0,eE.cn)("bg-card border-r border-border flex flex-col transition-all duration-300",a?"w-16":"w-64"),children:[(0,ed.jsx)("nav",{className:"flex-1 p-3 pt-4",children:(0,ed.jsx)("ul",{className:"space-y-1",children:s.map(n=>{let r=n.icon,o=e===n.id,s=(0,ex.bankRoute)(i,`?view=${n.id}`);return(0,ed.jsx)("li",{children:(0,ed.jsxs)(eT.default,{href:s,onClick:e=>{0!==e.button||e.ctrlKey||e.metaKey||(e.preventDefault(),t(n.id))},className:(0,eE.cn)("w-full flex items-center gap-3 px-4 py-3 rounded-lg text-sm font-medium transition-all",o?"bg-primary-gradient text-white shadow-sm":"text-muted-foreground hover:bg-accent hover:text-accent-foreground",a&&"justify-center px-0"),title:a?n.label:void 0,children:[(0,ed.jsx)(r,{className:"w-5 h-5 flex-shrink-0"}),!a&&(0,ed.jsx)("span",{children:n.label})]})},n.id)})})}),(0,ed.jsx)("div",{className:"p-3 border-t border-border",children:(0,ed.jsx)("button",{onClick:()=>o(!a),className:(0,eE.cn)("w-full flex items-center gap-3 px-4 py-2 rounded-lg text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",a&&"justify-center px-0"),title:n(a?"expandSidebar":"collapseSidebar"),children:a?(0,ed.jsx)(eC.ChevronRight,{className:"w-5 h-5"}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(eS,{className:"w-5 h-5"}),(0,ed.jsx)("span",{children:n("collapse")})]})})})]})}var eO=e.i(7122),eA=e.i(88029),eD=e.i(80208);let eP=(0,eb.default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),eI=(0,eb.default)("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),eL=(0,eb.default)("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),eR=(0,eb.default)("chevrons-left",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]),eB=(0,eb.default)("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]),eF=(0,eb.default)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),ez=(0,eb.default)("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"}]]),eV=(0,eb.default)("refresh-cw",[["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"}]]),eH=(0,eb.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),eU=(0,eb.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),eW=(0,eb.default)("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"}]]),eY=(0,eb.default)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),eG=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)("div",{className:"relative w-full overflow-auto rounded-xl ring-1 ring-border/60 bg-card",children:(0,ed.jsx)("table",{ref:n,className:(0,eE.cn)("w-full caption-bottom text-sm border-separate border-spacing-0",e),...t})}));eG.displayName="Table";let eX=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)("thead",{ref:n,className:(0,eE.cn)("bg-muted/40",e),...t}));eX.displayName="TableHeader";let e$=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)("tbody",{ref:n,className:(0,eE.cn)("[&>tr:last-child>td]:border-b-0",e),...t}));e$.displayName="TableBody",eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)("tfoot",{ref:n,className:(0,eE.cn)("bg-muted/30 font-medium",e),...t})).displayName="TableFooter";let eq=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)("tr",{ref:n,className:(0,eE.cn)("transition-colors hover:bg-muted/40 data-[state=selected]:bg-muted/60",e),...t}));eq.displayName="TableRow";let eK=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)("th",{ref:n,className:(0,eE.cn)("h-9 px-4 text-left align-middle text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border/60 [&:has([role=checkbox])]:pr-0",e),...t}));eK.displayName="TableHead";let eZ=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)("td",{ref:n,className:(0,eE.cn)("px-4 py-3 align-middle border-b border-border/40 [&:has([role=checkbox])]:pr-0",e),...t}));eZ.displayName="TableCell",eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)("caption",{ref:n,className:(0,eE.cn)("mt-4 text-sm text-muted-foreground",e),...t})).displayName="TableCaption";var eQ=e.i(74080),eJ=e.i(91918),e0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,eJ.createSlot)(`Primitive.${t}`),r=eh.forwardRef((e,r)=>{let{asChild:i,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ed.jsx)(i?n:t,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),e1=eh.forwardRef((e,t)=>(0,ed.jsx)(e0.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));e1.displayName="Label";var e2=e.i(25913);let e5=(0,e2.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),e3=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)(e1,{ref:n,className:(0,eE.cn)(e5(),e),...t}));e3.displayName=e1.displayName;var e4=e.i(70152),e6=e.i(81140),e7=e.i(20783),e9=e.i(30030),e8=e.i(69340),te=e.i(86318),tt=e.i(99682),tn=e.i(35804),tr=e.i(48425),ti=e.i(75830),ta=["PageUp","PageDown"],to=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ts={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},tl="Slider",[tc,tu,td]=(0,ti.createCollection)(tl),[th,tf]=(0,e9.createContextScope)(tl,[td]),[tp,tm]=th(tl),tg=eh.forwardRef((e,t)=>{let{name:n,min:r=0,max:i=100,step:a=1,orientation:o="horizontal",disabled:s=!1,minStepsBetweenThumbs:l=0,defaultValue:c=[r],value:u,onValueChange:d=()=>{},onValueCommit:h=()=>{},inverted:f=!1,form:p,...g}=e,v=eh.useRef(new Set),x=eh.useRef(0),y="horizontal"===o,[b=[],w]=(0,e8.useControllableState)({prop:u,defaultProp:c,onChange:e=>{let t=[...v.current];t[x.current]?.focus(),d(e)}}),N=eh.useRef(b);function j(e,t,{commit:n}={commit:!1}){let o,s=(String(a).split(".")[1]||"").length,c=Math.round((Math.round((e-r)/a)*a+r)*(o=Math.pow(10,s)))/o,u=(0,e4.clamp)(c,[r,i]);w((e=[])=>{let r=function(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}(e,u,t);if(!function(e,t){if(t>0)return Math.min(...e.slice(0,-1).map((t,n)=>e[n+1]-t))>=t;return!0}(r,l*a))return e;{x.current=r.indexOf(u);let t=String(r)!==String(e);return t&&n&&h(r),t?r:e}})}return(0,ed.jsx)(tp,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:x,thumbs:v.current,values:b,orientation:o,form:p,children:(0,ed.jsx)(tc.Provider,{scope:e.__scopeSlider,children:(0,ed.jsx)(tc.Slot,{scope:e.__scopeSlider,children:(0,ed.jsx)(y?ty:tb,{"aria-disabled":s,"data-disabled":s?"":void 0,...g,ref:t,onPointerDown:(0,e6.composeEventHandlers)(g.onPointerDown,()=>{s||(N.current=b)}),min:r,max:i,inverted:f,onSlideStart:s?void 0:function(e){let t=function(e,t){if(1===e.length)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}(b,e);j(e,t)},onSlideMove:s?void 0:function(e){j(e,x.current)},onSlideEnd:s?void 0:function(){let e=N.current[x.current];b[x.current]!==e&&h(b)},onHomeKeyDown:()=>!s&&j(r,0,{commit:!0}),onEndKeyDown:()=>!s&&j(i,b.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!s){let n=ta.includes(e.key)||e.shiftKey&&to.includes(e.key),r=x.current;j(b[r]+a*(n?10:1)*t,r,{commit:!0})}}})})})})});tg.displayName=tl;var[tv,tx]=th(tl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ty=eh.forwardRef((e,t)=>{let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:l,onStepKeyDown:c,...u}=e,[d,h]=eh.useState(null),f=(0,e7.useComposedRefs)(t,e=>h(e)),p=eh.useRef(void 0),g=(0,te.useDirection)(i),v="ltr"===g,x=v&&!a||!v&&a;function y(e){let t=p.current||d.getBoundingClientRect(),i=tO([0,t.width],x?[n,r]:[r,n]);return p.current=t,i(e-t.left)}return(0,ed.jsx)(tv,{scope:e.__scopeSlider,startEdge:x?"left":"right",endEdge:x?"right":"left",direction:x?1:-1,size:"width",children:(0,ed.jsx)(tw,{dir:g,"data-orientation":"horizontal",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{let t=y(e.clientX);o?.(t)},onSlideMove:e=>{let t=y(e.clientX);s?.(t)},onSlideEnd:()=>{p.current=void 0,l?.()},onStepKeyDown:e=>{let t=ts[x?"from-left":"from-right"].includes(e.key);c?.({event:e,direction:t?-1:1})}})})}),tb=eh.forwardRef((e,t)=>{let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:l,...c}=e,u=eh.useRef(null),d=(0,e7.useComposedRefs)(t,u),h=eh.useRef(void 0),f=!i;function p(e){let t=h.current||u.current.getBoundingClientRect(),i=tO([0,t.height],f?[r,n]:[n,r]);return h.current=t,i(e-t.top)}return(0,ed.jsx)(tv,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:(0,ed.jsx)(tw,{"data-orientation":"vertical",...c,ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{let t=p(e.clientY);a?.(t)},onSlideMove:e=>{let t=p(e.clientY);o?.(t)},onSlideEnd:()=>{h.current=void 0,s?.()},onStepKeyDown:e=>{let t=ts[f?"from-bottom":"from-top"].includes(e.key);l?.({event:e,direction:t?-1:1})}})})}),tw=eh.forwardRef((e,t)=>{let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:l,...c}=e,u=tm(tl,n);return(0,ed.jsx)(tr.Primitive.span,{...c,ref:t,onKeyDown:(0,e6.composeEventHandlers)(e.onKeyDown,e=>{"Home"===e.key?(o(e),e.preventDefault()):"End"===e.key?(s(e),e.preventDefault()):ta.concat(to).includes(e.key)&&(l(e),e.preventDefault())}),onPointerDown:(0,e6.composeEventHandlers)(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus():r(e)}),onPointerMove:(0,e6.composeEventHandlers)(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:(0,e6.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})}),tN="SliderTrack",tj=eh.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=tm(tN,n);return(0,ed.jsx)(tr.Primitive.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:t})});tj.displayName=tN;var tk="SliderRange",tS=eh.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=tm(tk,n),a=tx(tk,n),o=eh.useRef(null),s=(0,e7.useComposedRefs)(t,o),l=i.values.length,c=i.values.map(e=>tM(e,i.min,i.max)),u=l>1?Math.min(...c):0,d=100-Math.max(...c);return(0,ed.jsx)(tr.Primitive.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:s,style:{...e.style,[a.startEdge]:u+"%",[a.endEdge]:d+"%"}})});tS.displayName=tk;var tC="SliderThumb",t_=eh.forwardRef((e,t)=>{let n=tu(e.__scopeSlider),[r,i]=eh.useState(null),a=(0,e7.useComposedRefs)(t,e=>i(e)),o=eh.useMemo(()=>r?n().findIndex(e=>e.ref.current===r):-1,[n,r]);return(0,ed.jsx)(tE,{...e,ref:a,index:o})}),tE=eh.forwardRef((e,t)=>{var n,r,i,a,o;let s,l,{__scopeSlider:c,index:u,name:d,...h}=e,f=tm(tC,c),p=tx(tC,c),[g,v]=eh.useState(null),x=(0,e7.useComposedRefs)(t,e=>v(e)),y=!g||f.form||!!g.closest("form"),b=(0,tn.useSize)(g),w=f.values[u],N=void 0===w?0:tM(w,f.min,f.max),j=(n=u,(r=f.values.length)>2?`Value ${n+1} of ${r}`:2===r?["Minimum","Maximum"][n]:void 0),k=b?.[p.size],S=k?(i=k,a=N,o=p.direction,l=tO([0,50],[0,s=i/2]),(s-l(a)*o)*o):0;return eh.useEffect(()=>{if(g)return f.thumbs.add(g),()=>{f.thumbs.delete(g)}},[g,f.thumbs]),(0,ed.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[p.startEdge]:`calc(${N}% + ${S}px)`},children:[(0,ed.jsx)(tc.ItemSlot,{scope:e.__scopeSlider,children:(0,ed.jsx)(tr.Primitive.span,{role:"slider","aria-label":e["aria-label"]||j,"aria-valuemin":f.min,"aria-valuenow":w,"aria-valuemax":f.max,"aria-orientation":f.orientation,"data-orientation":f.orientation,"data-disabled":f.disabled?"":void 0,tabIndex:f.disabled?void 0:0,...h,ref:x,style:void 0===w?{display:"none"}:e.style,onFocus:(0,e6.composeEventHandlers)(e.onFocus,()=>{f.valueIndexToChangeRef.current=u})})}),y&&(0,ed.jsx)(tT,{name:d??(f.name?f.name+(f.values.length>1?"[]":""):void 0),form:f.form,value:w},u)]})});t_.displayName=tC;var tT=eh.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{let i=eh.useRef(null),a=(0,e7.useComposedRefs)(i,r),o=(0,tt.usePrevious)(t);return eh.useEffect(()=>{let e=i.current;if(!e)return;let n=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(o!==t&&n){let r=new Event("input",{bubbles:!0});n.call(e,t),e.dispatchEvent(r)}},[o,t]),(0,ed.jsx)(tr.Primitive.input,{style:{display:"none"},...n,ref:a,defaultValue:t})});function tM(e,t,n){return(0,e4.clamp)(100/(n-t)*(e-t),[0,100])}function tO(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}tT.displayName="RadioBubbleInput";let tA=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsxs)(tg,{ref:n,className:(0,eE.cn)("relative flex w-full touch-none select-none items-center",e),...t,children:[(0,ed.jsx)(tj,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary/50 border border-border",children:(0,ed.jsx)(tS,{className:"absolute h-full bg-primary"})}),(0,ed.jsx)(t_,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));tA.displayName=tg.displayName;var tD=e.i(22757),tP=e.i(53489);let tI=(0,eb.default)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);function tL({tags:e,size:t="sm",showLabel:n=!1}){if(!e||0===e.length)return null;let r="xs"===t?"text-[10px] px-1.5 py-0.5 rounded gap-0.5":"md"===t?"text-sm px-3 py-1 rounded-full gap-1 font-medium":"text-xs px-2 py-0.5 rounded-md gap-1 font-medium";return(0,ed.jsxs)("div",{children:[n&&(0,ed.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2 flex items-center gap-1",children:[(0,ed.jsx)(tI,{className:"w-3 h-3"}),"Tags"]}),(0,ed.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.map((e,t)=>(0,ed.jsxs)("span",{className:`inline-flex items-center ${r} bg-primary/10 text-primary border border-primary/20 leading-none`,children:[(0,ed.jsx)("span",{className:"opacity-50 select-none font-mono",children:"#"}),e]},t))})]})}let tR=(0,eb.default)("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"}]]);var tB=e.i(43531),tF=e.i(37727),tz=e.i(17521),tz=tz;let tV=(0,eb.default)("history",[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);var tH=e.i(76223);function tU({type:e,id:t,onClose:n}){let r=(0,ep.useTranslations)("documentChunkModal"),{currentBank:i}=(0,ev.useBank)(),[a,o]=(0,eh.useState)(null),[s,l]=(0,eh.useState)(!1),[c,u]=(0,eh.useState)(null);(0,eh.useEffect)(()=>{t&&(async()=>{l(!0),u(null);try{if("document"===e){if(!i)return void u(r("noBankSelected"));let e=await eO.client.getDocument(t,i);o(e)}else{let e=await eO.client.getChunk(t);o(e)}}catch(t){console.error(`Error loading ${e}:`,t),u(t.message)}finally{l(!1)}})()},[t,e,i]);let d=null!==t;return(0,ed.jsx)(tH.Dialog,{open:d,onOpenChange:e=>!e&&n(),children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsx)(tH.DialogTitle,{children:"document"===e?r("documentTitle"):r("chunkTitle")}),(0,ed.jsx)(tH.DialogDescription,{children:"document"===e?r("documentDescription"):r("chunkDescription")})]}),(0,ed.jsx)("div",{className:"flex-1 overflow-y-auto",children:s?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:r("loadingType",{type:e})})]})}):c?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center text-destructive",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"❌"}),(0,ed.jsx)("div",{className:"text-sm",children:r("errorPrefix",{message:c})})]})}):a?(0,ed.jsx)("div",{className:"space-y-4",children:"document"===e?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:"space-y-3",children:[(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionDocumentId")}),(0,ed.jsx)("div",{className:"text-sm font-mono break-all text-foreground",children:a.id})]}),a.created_at&&(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionCreated")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:new Date(a.created_at).toLocaleString()})]}),(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionMemoryUnits")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:a.memory_unit_count})]})]}),a.original_text&&(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionTextLength")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:r("textLengthChars",{count:a.original_text.length})})]})]}),a.original_text&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-sm font-bold text-foreground mb-2",children:r("sectionOriginalText")}),(0,ed.jsx)("div",{className:"p-4 bg-muted rounded-lg border border-border max-h-[300px] overflow-y-auto",children:(0,ed.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono text-foreground",children:a.original_text})})]})]}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:"space-y-3",children:[(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionChunkId")}),(0,ed.jsx)("div",{className:"text-sm font-mono break-all text-foreground",children:a.chunk_id})]}),(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionChunkDocumentId")}),(0,ed.jsx)("div",{className:"text-sm font-mono break-all text-foreground",children:a.document_id})]}),(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionChunkIndex")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:a.chunk_index})]})]}),a.created_at&&(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionCreated")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:new Date(a.created_at).toLocaleString()})]}),a.chunk_text&&(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionTextLength")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:r("textLengthChars",{count:a.chunk_text.length})})]})]}),a.chunk_text&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-sm font-bold text-foreground mb-2",children:r("sectionChunkText")}),(0,ed.jsx)("div",{className:"p-4 bg-muted rounded-lg border border-border max-h-[300px] overflow-y-auto",children:(0,ed.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono text-foreground",children:a.chunk_text})})]})]})}):null})]})})}var tW=e.i(63738),tz=tz;let tY=(0,eb.default)("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:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);function tG({before:e,after:t}){let n=(0,ep.useTranslations)("observationHistory"),r=function(e,t){let n=e.split(/(\s+)/),r=t.split(/(\s+)/),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=n[e-1]===r[t-1]?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=i,l=a,c=[];for(;s>0||l>0;)s>0&&l>0&&n[s-1]===r[l-1]?(c.push({type:"same",text:n[s-1]}),s--,l--):l>0&&(0===s||o[s][l-1]>=o[s-1][l])?(c.push({type:"added",text:r[l-1]}),l--):(c.push({type:"removed",text:n[s-1]}),s--);return c.reverse()}(e,t);return r.some(e=>"same"!==e.type)?(0,ed.jsx)("span",{className:"text-sm leading-relaxed",children:r.map((e,t)=>"same"===e.type?(0,ed.jsx)("span",{children:e.text},t):"removed"===e.type?(0,ed.jsx)("span",{className:"bg-red-500/15 text-red-700 dark:text-red-400 line-through rounded-sm px-0.5",children:e.text},t):(0,ed.jsx)("span",{className:"bg-green-500/15 text-green-700 dark:text-green-400 rounded-sm px-0.5",children:e.text},t))}):(0,ed.jsx)("span",{className:"text-sm text-muted-foreground italic",children:n("unchanged")})}function tX({before:e,after:t}){let n=(0,ep.useTranslations)("observationHistory"),r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t)),a=e.filter(e=>t.includes(e));return 0===r.length&&0===i.length?(0,ed.jsx)("span",{className:"text-sm text-muted-foreground italic",children:n("unchanged")}):(0,ed.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[a.map((e,t)=>(0,ed.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-amber-500/10 text-amber-700 border border-amber-500/20 font-mono",children:["#",e]},t)),r.map((e,t)=>(0,ed.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-red-500/15 text-red-700 dark:text-red-400 border border-red-500/20 font-mono line-through",children:["#",e]},t)),i.map((e,t)=>(0,ed.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-green-500/15 text-green-700 dark:text-green-400 border border-green-500/20 font-mono",children:["+#",e]},t))]})}function t$({label:e,before:t,after:n}){return t||n?(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e,": "]}),t!==n?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("span",{className:"text-xs bg-red-500/15 text-red-700 dark:text-red-400 line-through rounded-sm px-0.5",children:t?new Date(t).toLocaleString():"—"})," → ",(0,ed.jsx)("span",{className:"text-xs bg-green-500/15 text-green-700 dark:text-green-400 rounded-sm px-0.5",children:n?new Date(n).toLocaleString():"—"})]}):(0,ed.jsx)("span",{className:"text-xs",children:n?new Date(n).toLocaleString():"—"})]}):null}function tq({fact:e}){let t=(0,ep.useTranslations)("observationHistory"),n="experience"===e.type?"bg-green-500/10 text-green-700 dark:text-green-400":"bg-blue-500/10 text-blue-700 dark:text-blue-400";return(0,ed.jsxs)("div",{className:`p-2 rounded border space-y-1 ${e.is_new?"border-green-500/40 bg-green-500/5":"border-border/50 bg-muted/30"}`,children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[e.type&&(0,ed.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium flex-shrink-0 ${n}`,children:e.type}),e.is_new&&(0,ed.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-green-500/15 text-green-700 dark:text-green-400 border border-green-500/30",children:t("new")}),e.context&&(0,ed.jsx)("span",{className:"text-[10px] text-muted-foreground italic truncate",children:e.context})]}),e.text?(0,ed.jsx)("p",{className:"text-xs text-foreground leading-relaxed",children:e.text}):(0,ed.jsx)("p",{className:"text-xs text-muted-foreground italic",children:t("memoryNoLongerAvailable")})]})}function tK({history:e,current:t}){let n=(0,ep.useTranslations)("observationHistory"),r=[...e].reverse(),[i,a]=(0,eh.useState)(0),o=r[i],s=0===i,l=s?t.text:r[i-1].previous_text,c=s?t.tags:r[i-1].previous_tags,u=s?t.occurred_start:r[i-1].previous_occurred_start,d=s?t.occurred_end:r[i-1].previous_occurred_end,h=s?t.mentioned_at:r[i-1].previous_mentioned_at;return(0,ed.jsxs)("div",{className:"space-y-3",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsxs)("span",{className:"text-xs text-muted-foreground",children:[n("changeOf",{current:e.length-i,total:e.length})," ·"," ",new Date(o.changed_at).toLocaleString()]}),(0,ed.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:i===r.length-1,onClick:()=>a(i+1),children:(0,ed.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:0===i,onClick:()=>a(i-1),children:(0,ed.jsx)(eC.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),(0,ed.jsxs)("div",{className:"border border-border rounded-lg p-3 space-y-3",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:n("sectionText")}),(0,ed.jsx)(tG,{before:o.previous_text,after:l})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:n("sectionTags")}),(0,ed.jsx)(tX,{before:o.previous_tags,after:c})]}),(0,ed.jsxs)("div",{className:"space-y-1",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:n("sectionDates")}),(0,ed.jsx)(t$,{label:n("occurredStart"),before:o.previous_occurred_start,after:u}),(0,ed.jsx)(t$,{label:n("occurredEnd"),before:o.previous_occurred_end,after:d}),(0,ed.jsx)(t$,{label:n("mentionedAt"),before:o.previous_mentioned_at,after:h})]}),o.source_facts&&o.source_facts.length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:n("sourceFacts",{count:o.source_facts.length})}),(0,ed.jsx)("div",{className:"space-y-1.5",children:o.source_facts.map(e=>(0,ed.jsx)(tq,{fact:e},e.id))})]})]})]})}function tZ({memoryId:e,onClose:t,initialTab:n}){let r=(0,ep.useTranslations)("memoryDetailModal"),{currentBank:i}=(0,ev.useBank)(),[a,o]=(0,eh.useState)(null),[s,l]=(0,eh.useState)(!1),[c,u]=(0,eh.useState)(null),[d,h]=(0,eh.useState)(n??"memory"),[f,p]=(0,eh.useState)(null),[g,v]=(0,eh.useState)(null),[x,y]=(0,eh.useState)(!1),[b,w]=(0,eh.useState)(!1),[N,j]=(0,eh.useState)(null),[k,S]=(0,eh.useState)(!1),[C,_]=(0,eh.useState)(null);(0,eh.useEffect)(()=>{e&&i&&(async()=>{l(!0),u(null),o(null),p(null),v(null),j(null),h(n??"memory");try{let t=await eO.client.getMemory(e,i);o(t)}catch(e){console.error("Error loading memory:",e),u(e.message)}finally{l(!1)}})()},[e,i]),(0,eh.useEffect)(()=>{"history"===d&&a&&"observation"===a.type&&i&&null===N&&(async()=>{S(!0);try{let e=await eO.client.getObservationHistory(a.id,i);j(e)}catch(e){console.error("Error loading history:",e),j([])}finally{S(!1)}})()},[d,a,i,N]),(0,eh.useEffect)(()=>{"document"===d&&a?.document_id&&i&&!f&&(async()=>{y(!0);try{let e=await eO.client.getDocument(a.document_id,i);p(e)}catch(e){console.error("Error loading document:",e)}finally{y(!1)}})()},[d,a?.document_id,i,f]),(0,eh.useEffect)(()=>{"chunk"!==d||!a?.chunk_id||g||(async()=>{w(!0);try{let e=await eO.client.getChunk(a.chunk_id);v(e)}catch(e){console.error("Error loading chunk:",e)}finally{w(!1)}})()},[d,a?.chunk_id,g]);let E=null!==e,T=a?.type==="observation";return(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tH.Dialog,{open:E,onOpenChange:e=>!e&&t(),children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[(0,ed.jsx)(tH.DialogHeader,{children:(0,ed.jsx)(tH.DialogTitle,{children:a?a?.type==="observation"?r("typeObservation"):a?.type==="world"?r("typeWorldFact"):a?.type==="experience"?r("typeExperience"):r("defaultTitle"):r("defaultTitle")})}),s?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsx)(tz.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):c?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsx)("div",{className:"text-center text-destructive",children:(0,ed.jsx)("div",{className:"text-sm",children:r("errorPrefix",{message:c})})})}):a?T?(0,ed.jsxs)(tW.Tabs,{value:d,onValueChange:h,className:"flex-1 flex flex-col overflow-hidden",children:[(0,ed.jsxs)(tW.TabsList,{className:"grid w-full grid-cols-2",children:[(0,ed.jsxs)(tW.TabsTrigger,{value:"memory",className:"flex items-center gap-1.5",children:[(0,ed.jsx)(ej.FileText,{className:"w-3.5 h-3.5"}),r("tabObservation")]}),(0,ed.jsxs)(tW.TabsTrigger,{value:"history",className:"flex items-center gap-1.5",children:[(0,ed.jsx)(tV,{className:"w-3.5 h-3.5"}),N&&N.length>0?r("tabHistoryWithCount",{count:N.length}):r("tabHistory")]})]}),(0,ed.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ed.jsxs)(tW.TabsContent,{value:"memory",className:"mt-0 space-y-4",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:r("sectionText")}),(0,ed.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:a.text})]}),a.occurred_start&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:r("sectionOccurred")}),(0,ed.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ed.jsx)(eP,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ed.jsxs)("span",{children:[new Date(a.occurred_start).toLocaleString(),a.occurred_end&&a.occurred_end!==a.occurred_start&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("span",{className:"text-muted-foreground mx-1",children:"→"}),new Date(a.occurred_end).toLocaleString()]})]})]})]}),a.mentioned_at&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:r("sectionMentioned")}),(0,ed.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ed.jsx)(eP,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ed.jsx)("span",{children:new Date(a.mentioned_at).toLocaleString()})]})]}),a.entities&&a.entities.length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2 flex items-center gap-1",children:[(0,ed.jsx)(ek,{className:"w-3 h-3"}),r("sectionEntities")]}),(0,ed.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.entities.map((e,t)=>(0,ed.jsx)("span",{className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-xs",children:e},t))})]}),(0,ed.jsx)(tL,{tags:a.tags,showLabel:!0}),a.observation_scopes&&(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2 flex items-center gap-1",children:[(0,ed.jsx)(tI,{className:"w-3 h-3"}),r("sectionObservationScopes")]}),"string"==typeof a.observation_scopes?(0,ed.jsx)("span",{className:"text-xs font-mono bg-muted px-1.5 py-0.5 rounded",children:a.observation_scopes}):(0,ed.jsx)("div",{className:"space-y-1.5",children:a.observation_scopes.map((e,t)=>(0,ed.jsx)(tL,{tags:e},t))})]}),a.source_memories&&a.source_memories.length>0&&(0,ed.jsxs)("div",{className:"border-t border-border pt-4",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:r("sectionSourceMemories",{count:a.source_memories.length})}),(0,ed.jsx)("div",{className:"space-y-3",children:a.source_memories.map((e,t)=>(0,ed.jsxs)("div",{className:"p-3 bg-muted/50 rounded-lg border border-border/50",children:[(0,ed.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,ed.jsx)("span",{className:`px-2 py-0.5 rounded text-xs flex-shrink-0 ${"experience"===e.type?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-blue-500/10 text-blue-600 dark:text-blue-400"}`,children:e.type}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",className:"h-6 text-xs",onClick:()=>_(e.id),children:r("sourceMemoryViewButton")})]}),(0,ed.jsx)("p",{className:"text-sm text-foreground mb-2",children:e.text}),e.context&&(0,ed.jsx)("p",{className:"text-xs text-muted-foreground mb-2 italic",children:r("sourceContextPrefix",{context:e.context})}),(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.occurred_start&&(0,ed.jsxs)("div",{className:"p-2 bg-background/50 rounded",children:[(0,ed.jsx)("div",{className:"text-muted-foreground mb-0.5",children:r("sourceOccurred")}),(0,ed.jsx)("div",{className:"font-medium",children:new Date(e.occurred_start).toLocaleString()})]}),e.mentioned_at&&(0,ed.jsxs)("div",{className:"p-2 bg-background/50 rounded",children:[(0,ed.jsx)("div",{className:"text-muted-foreground mb-0.5",children:r("sourceMentioned")}),(0,ed.jsx)("div",{className:"font-medium",children:new Date(e.mentioned_at).toLocaleString()})]})]})]},e.id||t))})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionMemoryId")}),(0,ed.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:a.id})]})]}),(0,ed.jsx)(tW.TabsContent,{value:"history",className:"mt-0",children:k?(0,ed.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ed.jsx)(tz.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):N&&N.length>0?(0,ed.jsx)(tK,{history:N,current:{text:a.text,tags:a.tags,occurred_start:a.occurred_start,occurred_end:a.occurred_end,mentioned_at:a.mentioned_at}}):(0,ed.jsx)("p",{className:"text-sm text-muted-foreground italic",children:r("noHistoryYet")})})]})]}):(0,ed.jsxs)(tW.Tabs,{value:d,onValueChange:h,className:"flex-1 flex flex-col overflow-hidden",children:[(0,ed.jsxs)(tW.TabsList,{className:"grid w-full grid-cols-3",children:[(0,ed.jsxs)(tW.TabsTrigger,{value:"memory",className:"flex items-center gap-1.5",children:[(0,ed.jsx)(ej.FileText,{className:"w-3.5 h-3.5"}),"world"===a.type?r("tabWorldFact"):r("tabExperience")]}),(0,ed.jsxs)(tW.TabsTrigger,{value:"chunk",disabled:!a.chunk_id,className:"flex items-center gap-1.5",children:[(0,ed.jsx)(tY,{className:"w-3.5 h-3.5"}),r("tabChunk")]}),(0,ed.jsxs)(tW.TabsTrigger,{value:"document",disabled:!a.document_id,className:"flex items-center gap-1.5",children:[(0,ed.jsx)(ej.FileText,{className:"w-3.5 h-3.5"}),r("tabDocument")]})]}),(0,ed.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ed.jsxs)(tW.TabsContent,{value:"memory",className:"mt-0 space-y-4",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:r("sectionMemoryText")}),(0,ed.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:a.text})]}),a.context&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionContext")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:a.context})]}),a.occurred_start&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:r("sectionOccurred")}),(0,ed.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ed.jsx)(eP,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ed.jsxs)("span",{children:[new Date(a.occurred_start).toLocaleString(),a.occurred_end&&a.occurred_end!==a.occurred_start&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("span",{className:"text-muted-foreground mx-1",children:"→"}),new Date(a.occurred_end).toLocaleString()]})]})]})]}),a.mentioned_at&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:r("sectionMentionedAt")}),(0,ed.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ed.jsx)(eP,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ed.jsx)("span",{children:new Date(a.mentioned_at).toLocaleString()})]})]}),a.entities&&a.entities.length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2 flex items-center gap-1",children:[(0,ed.jsx)(ek,{className:"w-3 h-3"}),r("sectionEntities")]}),(0,ed.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.entities.map((e,t)=>(0,ed.jsx)("span",{className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-xs",children:e},t))})]}),(0,ed.jsx)(tL,{tags:a.tags,showLabel:!0}),a.observation_scopes&&(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2 flex items-center gap-1",children:[(0,ed.jsx)(tI,{className:"w-3 h-3"}),r("sectionObservationScopes")]}),"string"==typeof a.observation_scopes?(0,ed.jsx)("span",{className:"text-xs font-mono bg-muted px-1.5 py-0.5 rounded",children:a.observation_scopes}):(0,ed.jsx)("div",{className:"space-y-1.5",children:a.observation_scopes.map((e,t)=>(0,ed.jsx)(tL,{tags:e},t))})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionMemoryId")}),(0,ed.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:a.id})]})]}),(0,ed.jsx)(tW.TabsContent,{value:"chunk",className:"mt-0 space-y-4",children:b?(0,ed.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ed.jsx)(tz.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):g?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionChunkIndex")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:g.chunk_index})]}),g.chunk_text&&(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionTextLength")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:r("textLengthValue",{count:g.chunk_text.length})})]})]}),g.chunk_text&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:r("sectionChunkText")}),(0,ed.jsx)("div",{className:"p-4 bg-muted rounded-lg border border-border max-h-[300px] overflow-y-auto",children:(0,ed.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono text-foreground",children:g.chunk_text})})]}),(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionChunkId")}),(0,ed.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:g.chunk_id})]})]}):(0,ed.jsx)("div",{className:"text-center py-12 text-muted-foreground",children:r("noChunkData")})}),(0,ed.jsx)(tW.TabsContent,{value:"document",className:"mt-0 space-y-4",children:x?(0,ed.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ed.jsx)(tz.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):f?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[f.created_at&&(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionCreated")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:new Date(f.created_at).toLocaleString()})]}),(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionMemoryUnits")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:f.memory_unit_count})]})]}),f.original_text&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionTextLength")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:r("textLengthValue",{count:f.original_text.length})})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:r("sectionOriginalText")}),(0,ed.jsx)("div",{className:"p-4 bg-muted rounded-lg border border-border max-h-[300px] overflow-y-auto",children:(0,ed.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono text-foreground",children:f.original_text})})]})]}),f.tags&&f.tags.length>0&&(0,ed.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ed.jsx)(tL,{tags:f.tags,showLabel:!0})}),(0,ed.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:r("sectionDocumentId")}),(0,ed.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:f.id})]})]}):(0,ed.jsx)("div",{className:"text-center py-12 text-muted-foreground",children:r("noDocumentData")})})]})]}):null]})}),C&&(0,ed.jsx)(tZ,{memoryId:C,onClose:()=>_(null)})]})}function tQ({memory:e,onClose:t,compact:n=!1,inPanel:r=!1,bankId:i}){let a,o=(0,ep.useTranslations)("memoryDetailPanel"),s=(0,ep.useTranslations)("memoryDetailModal"),[l,c]=(0,eh.useState)(null),[u,d]=(0,eh.useState)(null),[h,f]=(0,eh.useState)(null),[p,g]=(0,eh.useState)(null),[v,x]=(0,eh.useState)(!1),[y,b]=(0,eh.useState)(null),[w,N]=(0,eh.useState)(!1);(0,eh.useEffect)(()=>{let t=e?.id||e?.node_id;t&&i?(x(!0),eO.client.getMemory(t,i).then(e=>{g(e)}).catch(e=>{console.error("Failed to fetch memory details:",e),g(null)}).finally(()=>{x(!1)})):g(null)},[e?.id,e?.node_id,e?.fact_type,e?.type,i]);let j=p||e,k=j?.fact_type==="observation"||j?.type==="observation",S="observation"===(a=j?.fact_type||j?.type)?s("typeObservation"):"world"===a?s("typeWorldFact"):"experience"===a?s("typeExperience"):o("title"),C=async e=>{try{await navigator.clipboard.writeText(e),c(e),setTimeout(()=>c(null),2e3)}catch(e){console.error("Failed to copy:",e)}},_=e=>{d("document"),f(e)},E=e=>{d("chunk"),f(e)},T=()=>{d(null),f(null)};if(!e)return null;let M=j.id||j.node_id,O=n?"text-[10px]":"text-xs",A=n?"text-xs":"text-sm";return r?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:"p-5",children:[(0,ed.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,ed.jsx)("h3",{className:"text-xl font-bold text-foreground",children:S}),(0,ed.jsx)(eA.Button,{variant:"secondary",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ed.jsx)(tF.X,{className:"h-5 w-5"})})]}),v?(0,ed.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,ed.jsx)(tz.default,{className:"h-6 w-6 animate-spin text-muted-foreground"}),(0,ed.jsx)("span",{className:"ml-2 text-muted-foreground",children:o("loadingDetails")})]}):(0,ed.jsxs)("div",{className:"space-y-5",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:o("sectionFullText")}),(0,ed.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-relaxed text-foreground",children:j.text})]}),j.context&&!k&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:o("sectionContext")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:j.context})]}),j.occurred_start&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:o("sectionOccurred")}),(0,ed.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ed.jsx)(eP,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ed.jsxs)("span",{children:[new Date(j.occurred_start).toLocaleString(),j.occurred_end&&j.occurred_end!==j.occurred_start&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("span",{className:"text-muted-foreground mx-1",children:"→"}),new Date(j.occurred_end).toLocaleString()]})]})]})]}),j.mentioned_at&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:o("sectionMentioned")}),(0,ed.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ed.jsx)(eP,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ed.jsx)("span",{children:new Date(j.mentioned_at).toLocaleString()})]})]}),j.entities&&(Array.isArray(j.entities)?j.entities.length>0:j.entities)&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:o("sectionEntities")}),(0,ed.jsx)("div",{className:"flex flex-wrap gap-2",children:(Array.isArray(j.entities)?j.entities:String(j.entities).split(", ")).map((e,t)=>{let n="string"==typeof e?e:e?.name||JSON.stringify(e);return(0,ed.jsx)("span",{className:"text-sm px-3 py-1.5 rounded-full bg-primary/10 text-primary font-medium",children:n},t)})})]}),(0,ed.jsx)(tL,{tags:j.tags,size:"md",showLabel:!0}),j.source_memories&&j.source_memories.length>0&&(0,ed.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:o("sectionSourceMemories",{count:j.source_memories.length})}),(0,ed.jsx)("div",{className:"space-y-3",children:j.source_memories.map((e,t)=>(0,ed.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg border border-border/50",children:[(0,ed.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,ed.jsx)("span",{className:`px-2 py-0.5 rounded text-xs flex-shrink-0 ${"experience"===e.type?"bg-green-500/10 text-green-600":"bg-blue-500/10 text-blue-600"}`,children:e.type}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",className:"h-6 text-xs",onClick:()=>b(e.id),children:o("sourceViewButton")})]}),(0,ed.jsx)("p",{className:"text-sm text-foreground mb-3",children:e.text}),e.context&&(0,ed.jsx)("p",{className:"text-xs text-muted-foreground mb-3 italic",children:o("sourceContextPrefix",{context:e.context})}),(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[(0,ed.jsxs)("div",{className:"p-2 bg-background/50 rounded",children:[(0,ed.jsx)("div",{className:"text-muted-foreground mb-0.5",children:o("sourceOccurred")}),(0,ed.jsx)("div",{className:"font-medium",children:e.occurred_start?new Date(e.occurred_start).toLocaleString():o("notAvailable")})]}),(0,ed.jsxs)("div",{className:"p-2 bg-background/50 rounded",children:[(0,ed.jsx)("div",{className:"text-muted-foreground mb-0.5",children:o("sourceMentioned")}),(0,ed.jsx)("div",{className:"font-medium",children:e.mentioned_at?new Date(e.mentioned_at).toLocaleString():o("notAvailable")})]})]})]},e.id||t))})]}),(j.document_id||j.chunk_id)&&(0,ed.jsxs)("div",{className:"flex gap-3 pt-2",children:[j.document_id&&(0,ed.jsx)(eA.Button,{onClick:()=>_(j.document_id),variant:"secondary",className:"flex-1",children:o("viewDocumentButton")}),j.chunk_id&&(0,ed.jsx)(eA.Button,{onClick:()=>E(j.chunk_id),variant:"secondary",className:"flex-1",children:o("viewChunkButton")})]}),k&&(0,ed.jsx)("div",{className:"border-t border-border pt-5",children:(0,ed.jsxs)(eA.Button,{variant:"outline",className:"w-full flex items-center gap-2",onClick:()=>N(!0),children:[(0,ed.jsx)(tV,{className:"h-4 w-4"}),o("viewHistory")]})}),M&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:o("sectionMemoryId")}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:M}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>C(M),children:l===M?(0,ed.jsx)(tB.Check,{className:"h-3 w-3 text-green-600"}):(0,ed.jsx)(tR,{className:"h-3 w-3 text-muted-foreground"})})]})]})]})]}),u&&h&&(0,ed.jsx)(tU,{type:u,id:h,onClose:T}),(0,ed.jsx)(tZ,{memoryId:y,onClose:()=>b(null)}),w&&M&&i&&(0,ed.jsx)(tZ,{memoryId:M,onClose:()=>N(!1),initialTab:"history"})]}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:`bg-card border-2 border-primary rounded-lg ${n?"p-3":"p-4"} sticky top-4 max-h-[calc(100vh-120px)] overflow-y-auto`,children:[(0,ed.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,ed.jsx)("h3",{className:`${n?"text-sm":"text-lg"} font-bold text-card-foreground`,children:S}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",onClick:t,className:n?"h-6 w-6 p-0":"h-8 w-8 p-0",children:(0,ed.jsx)(tF.X,{className:n?"h-3 w-3":"h-4 w-4"})})]}),v?(0,ed.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,ed.jsx)(tz.default,{className:"h-5 w-5 animate-spin text-muted-foreground"}),(0,ed.jsx)("span",{className:"ml-2 text-sm text-muted-foreground",children:o("loading")})]}):(0,ed.jsxs)("div",{className:n?"space-y-2":"space-y-4",children:[(0,ed.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ed.jsx)("div",{className:`${O} font-bold text-muted-foreground uppercase mb-1`,children:o("sectionFullText")}),(0,ed.jsx)("div",{className:`${A} whitespace-pre-wrap`,children:j.text})]}),j.context&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:`${O} font-bold text-muted-foreground uppercase mb-1`,children:o("sectionContext")}),(0,ed.jsx)("div",{className:A,children:j.context})]}),j.occurred_start&&(0,ed.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ed.jsx)("div",{className:`${O} font-bold text-muted-foreground uppercase mb-1`,children:o("sectionOccurred")}),(0,ed.jsxs)("div",{className:`flex items-center gap-2 ${A}`,children:[(0,ed.jsx)(eP,{className:`${n?"h-3 w-3":"h-4 w-4"} text-muted-foreground flex-shrink-0`}),(0,ed.jsxs)("span",{children:[new Date(j.occurred_start).toLocaleString(),j.occurred_end&&j.occurred_end!==j.occurred_start&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("span",{className:"text-muted-foreground mx-1",children:"→"}),new Date(j.occurred_end).toLocaleString()]})]})]})]}),j.mentioned_at&&(0,ed.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ed.jsx)("div",{className:`${O} font-bold text-muted-foreground uppercase mb-1`,children:o("sectionMentioned")}),(0,ed.jsxs)("div",{className:`flex items-center gap-2 ${A}`,children:[(0,ed.jsx)(eP,{className:`${n?"h-3 w-3":"h-4 w-4"} text-muted-foreground flex-shrink-0`}),(0,ed.jsx)("span",{children:new Date(j.mentioned_at).toLocaleString()})]})]}),j.entities&&(Array.isArray(j.entities)?j.entities.length>0:j.entities)&&(0,ed.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ed.jsx)("div",{className:`${O} font-bold text-muted-foreground uppercase mb-2`,children:o("sectionEntities")}),(0,ed.jsx)("div",{className:"flex flex-wrap gap-1",children:(Array.isArray(j.entities)?j.entities:String(j.entities).split(", ")).map((e,t)=>{let r="string"==typeof e?e:e?.name||JSON.stringify(e);return(0,ed.jsx)("span",{className:`${n?"text-[10px] px-1.5 py-0.5":"text-xs px-2 py-1"} rounded bg-secondary text-secondary-foreground`,children:r},t)})})]}),j.tags&&j.tags.length>0&&(0,ed.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ed.jsx)("div",{className:`${O} font-bold text-muted-foreground uppercase mb-2`,children:o("sectionTags")}),(0,ed.jsx)(tL,{tags:j.tags,size:n?"xs":"sm"})]}),(j.document_id||j.chunk_id)&&(0,ed.jsxs)("div",{className:`flex gap-2 ${n?"pt-1":""}`,children:[j.document_id&&(0,ed.jsx)(eA.Button,{onClick:()=>_(j.document_id),size:"sm",variant:"secondary",className:`flex-1 ${n?"h-7 text-xs":""}`,children:o("viewDocumentButton")}),j.chunk_id&&(0,ed.jsx)(eA.Button,{onClick:()=>E(j.chunk_id),size:"sm",variant:"secondary",className:`flex-1 ${n?"h-7 text-xs":""}`,children:o("viewChunkButton")})]}),j.source_memories&&j.source_memories.length>0&&(0,ed.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ed.jsx)("div",{className:`${O} font-bold text-muted-foreground uppercase mb-2`,children:o("sectionSourceMemories",{count:j.source_memories.length})}),(0,ed.jsx)("div",{className:"space-y-2",children:j.source_memories.map((e,t)=>(0,ed.jsxs)("div",{className:"p-2 bg-background/50 rounded border border-border/50",children:[(0,ed.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-1",children:[(0,ed.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] flex-shrink-0 ${"experience"===e.type?"bg-green-500/10 text-green-600":"bg-blue-500/10 text-blue-600"}`,children:e.type}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",className:"h-5 text-[10px] px-2",onClick:()=>b(e.id),children:o("sourceViewButton")})]}),(0,ed.jsx)("p",{className:`${A} mb-1`,children:e.text}),e.context&&(0,ed.jsx)("p",{className:"text-[10px] text-muted-foreground italic",children:o("sourceContextPrefix",{context:e.context})})]},e.id||t))})]}),M&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:`${O} font-bold text-muted-foreground uppercase mb-1`,children:o("sectionMemoryId")}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("code",{className:`${n?"text-[9px]":"text-xs"} font-mono text-muted-foreground`,children:M}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",className:`${n?"h-4 w-4":"h-5 w-5"} p-0`,onClick:()=>C(M),children:l===M?(0,ed.jsx)(tB.Check,{className:`${n?"h-2.5 w-2.5":"h-3 w-3"} text-green-600`}):(0,ed.jsx)(tR,{className:`${n?"h-2.5 w-2.5":"h-3 w-3"} text-muted-foreground`})})]})]})]})]}),u&&h&&(0,ed.jsx)(tU,{type:u,id:h,onClose:T}),(0,ed.jsx)(tZ,{memoryId:y,onClose:()=>b(null)})]})}function tJ(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t0(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function t1(e,t,n){return t&&function(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,t6(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function t2(e,t){var n="u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=t9(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function t5(e,t,n){return(t=t6(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t3(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||t9(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t4(e){return function(e){if(Array.isArray(e))return tJ(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||t9(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t6(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function t7(e){return(t7="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function t9(e,t){if(e){if("string"==typeof e)return tJ(e,t);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tJ(e,t):void 0}}var t8="u"<typeof window?null:window,ne=t8?t8.navigator:null;t8&&t8.document;var nt=t7(""),nn=t7({}),nr=t7(function(){}),ni="u"<typeof HTMLElement?"undefined":t7(HTMLElement),na=function(e){return e&&e.instanceString&&ns(e.instanceString)?e.instanceString():null},no=function(e){return null!=e&&t7(e)==nt},ns=function(e){return null!=e&&t7(e)===nr},nl=function(e){return!nh(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},nc=function(e){return null!=e&&t7(e)===nn&&!nl(e)&&e.constructor===Object},nu=function(e){return null!=e&&t7(e)===t7(1)&&!isNaN(e)},nd=function(e){if("undefined"!==ni)return null!=e&&e instanceof HTMLElement},nh=function(e){return nf(e)||np(e)},nf=function(e){return"collection"===na(e)&&e._private.single},np=function(e){return"collection"===na(e)&&!e._private.single},nm=function(e){return"core"===na(e)},ng=function(e){return"stylesheet"===na(e)},nv=function(e){return null==e||!!(""===e||e.match(/^\s+$/))},nx=function(e){return null!=e&&t7(e)===nn&&ns(e.then)},ny=function(e,t){t||(t=function(){if(1==arguments.length)return arguments[0];if(0==arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function(){var r,i=arguments,a=t.apply(this,i),o=n.cache;return(r=o[a])||(r=o[a]=e.apply(this,i)),r};return n.cache={},n},nb=ny(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),nw=ny(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),nN=ny(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),nj=function(e){return nv(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},nk=function(e,t){return e.slice(-1*t.length)===t},nS="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",nC="rgb[a]?\\(("+nS+"[%]?)\\s*,\\s*("+nS+"[%]?)\\s*,\\s*("+nS+"[%]?)(?:\\s*,\\s*("+nS+"))?\\)",n_="rgb[a]?\\((?:"+nS+"[%]?)\\s*,\\s*(?:"+nS+"[%]?)\\s*,\\s*(?:"+nS+"[%]?)(?:\\s*,\\s*(?:"+nS+"))?\\)",nE="hsl[a]?\\(("+nS+")\\s*,\\s*("+nS+"[%])\\s*,\\s*("+nS+"[%])(?:\\s*,\\s*("+nS+"))?\\)",nT="hsl[a]?\\((?:"+nS+")\\s*,\\s*(?:"+nS+"[%])\\s*,\\s*(?:"+nS+"[%])(?:\\s*,\\s*(?:"+nS+"))?\\)",nM=function(e,t){return e<t?-1:+(e>t)},nO=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e},nA=function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r;return 4===e.length?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),r=parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),r=parseInt(e[5]+e[6],16)),[t,n,r]}},nD=function(e){function t(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var n,r,i,a,o,s,l,c,u=RegExp("^"+nE+"$").exec(e);if(u){if((r=parseInt(u[1]))<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(i=parseFloat(u[2]))<0||i>100||(i/=100,(a=parseFloat(u[3]))<0||a>100)||(a/=100,void 0!==(o=u[4])&&((o=parseFloat(o))<0||o>1)))return;if(0===i)s=l=c=Math.round(255*a);else{var d=a<.5?a*(1+i):a+i-a*i,h=2*a-d;s=Math.round(255*t(h,d,r+1/3)),l=Math.round(255*t(h,d,r)),c=Math.round(255*t(h,d,r-1/3))}n=[s,l,c,o]}return n},nP=function(e){var t,n=RegExp("^"+nC+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},nI=function(e){return(nl(e)?e:null)||nL[e.toLowerCase()]||nA(e)||nP(e)||nD(e)},nL={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]},nR=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(nc(a))throw Error("Tried to set map with object key");i<n.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},nB=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(nc(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))break}return t},nF="u">typeof globalThis?globalThis:"u">typeof window?window:e.g;function nz(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function nV(){return lA?lO:(lA=1,lO=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)})}function nH(){if(lL)return lI;lL=1;var e=lP?lD:(lP=1,lD="object"==typeof nF&&nF&&nF.Object===Object&&nF),t="object"==typeof self&&self&&self.Object===Object&&self;return lI=e||t||Function("return this")()}function nU(){return lW?lU:(lW=1,lU=nH().Symbol)}function nW(){if(lK)return lq;lK=1;var e=nU(),t=function(){if(lG)return lY;lG=1;var e=nU(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;return lY=function(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch(e){}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}}(),n=function(){if(l$)return lX;l$=1;var e=Object.prototype.toString;return lX=function(t){return e.call(t)}}(),r=e?e.toStringTag:void 0;return lq=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?t(e):n(e)}}function nY(){if(l0)return lJ;l0=1;var e=nW(),t=lQ?lZ:(lQ=1,lZ=function(e){return null!=e&&"object"==typeof e});return lJ=function(n){return"symbol"==typeof n||t(n)&&"[object Symbol]"==e(n)}}var nG=nz(function(){if(l3)return l5;l3=1;var e=nV(),t=function(){if(lB)return lR;lB=1;var e=nH();return lR=function(){return e.Date.now()}}(),n=function(){if(l2)return l1;l2=1;var e=function(){if(lH)return lV;lH=1;var e=function(){if(lz)return lF;lz=1;var e=/\s/;return lF=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}}(),t=/^\s+/;return lV=function(n){return n?n.slice(0,e(n)+1).replace(t,""):n}}(),t=nV(),n=nY(),r=0/0,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;return l1=function(l){if("number"==typeof l)return l;if(n(l))return r;if(t(l)){var c="function"==typeof l.valueOf?l.valueOf():l;l=t(c)?c+"":c}if("string"!=typeof l)return 0===l?l:+l;l=e(l);var u=a.test(l);return u||o.test(l)?s(l.slice(2),u?2:8):i.test(l)?r:+l}}(),r=Math.max,i=Math.min;return l5=function(a,o,s){var l,c,u,d,h,f,p=0,g=!1,v=!1,x=!0;if("function"!=typeof a)throw TypeError("Expected a function");function y(e){var t=l,n=c;return l=c=void 0,p=e,d=a.apply(n,t)}function b(e){var t=e-f,n=e-p;return void 0===f||t>=o||t<0||v&&n>=u}function w(){var e,n,r,a=t();if(b(a))return N(a);h=setTimeout(w,(e=a-f,n=a-p,r=o-e,v?i(r,u-n):r))}function N(e){return(h=void 0,x&&l)?y(e):(l=c=void 0,d)}function j(){var e,n=t(),r=b(n);if(l=arguments,c=this,f=n,r){if(void 0===h)return p=e=f,h=setTimeout(w,o),g?y(e):d;if(v)return clearTimeout(h),h=setTimeout(w,o),y(f)}return void 0===h&&(h=setTimeout(w,o)),d}return o=n(o)||0,e(s)&&(g=!!s.leading,u=(v="maxWait"in s)?r(n(s.maxWait)||0,o):u,x="trailing"in s?!!s.trailing:x),j.cancel=function(){void 0!==h&&clearTimeout(h),p=0,l=f=c=h=void 0},j.flush=function(){return void 0===h?d:N(t())},j}}()),nX=t8?t8.performance:null,n$=nX&&nX.now?function(){return nX.now()}:function(){return Date.now()},nq=function(){if(t8){if(t8.requestAnimationFrame)return function(e){t8.requestAnimationFrame(e)};else if(t8.mozRequestAnimationFrame)return function(e){t8.mozRequestAnimationFrame(e)};else if(t8.webkitRequestAnimationFrame)return function(e){t8.webkitRequestAnimationFrame(e)};else if(t8.msRequestAnimationFrame)return function(e){t8.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(n$())},1e3/60)}}(),nK=function(e){return nq(e)},nZ=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=65599*r+t.value|0;return r},nQ=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return 65599*t+e|0},nJ=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},n0=function(e){return 2097152*e[0]+e[1]},n1=function(e,t){return[nQ(e[0],t[0]),nJ(e[1],t[1])]},n2=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return nZ({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},n5=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return nZ({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},n3=function(){return n4(arguments)},n4=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?n5(r):n5(r,t)}return t},n6=!0,n7=null!=console.warn,n9=null!=console.trace,n8=Number.MAX_SAFE_INTEGER||0x1fffffffffffff,re=function(){return!0},rt=function(){return!1},rn=function(){return 0},rr=function(){},ri=function(e){throw Error(e)},ra=function(e){if(void 0===e)return n6;n6=!!e},ro=function(e){ra()&&(n7?console.warn(e):(console.log(e),n9&&console.trace()))},rs=function(e){return null==e?e:nl(e)?e.slice():nc(e)?nO({},e):e},rl=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},rc={},ru=function(){return rc},rd=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=null==n?void 0:n[a];r[a]=void 0===o?e[a]:o}return r}},rh=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},rf=function(e){e.splice(0,e.length)},rp=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},rm=function(e,t,n){return n&&(t=nN(n,t)),e[t]},rg=function(e,t,n,r){n&&(t=nN(n,t)),e[t]=r},rv=t1(function e(){t0(this,e),this._obj={}},[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),rx="u">typeof Map?Map:rv,ry=t1(function e(t){if(t0(this,e),this._obj=Object.create(null),this.size=0,null!=t){var n;n=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r<n.length;r++)this.add(n[r])}},[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),rb=("u"<typeof Set?"undefined":t7(Set))!=="undefined"?Set:ry,rw=function(e,t){var n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(void 0===e||void 0===t||!nm(e))return void ri("An element must have a core reference and parameters set");var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"!==r&&"edges"!==r)return void ri("An element must be of type `nodes` or `edges`; you specified `"+r+"`");this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new rb,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.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(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];nl(t.classes)?l=t.classes:no(t.classes)&&(l=t.classes.split(/\s+/));for(var c=0,u=l.length;c<u;c++){var d=l[c];d&&""!==d&&i.classes.add(d)}this.createEmitter(),(void 0===n||n)&&this.restore();var h=t.style||t.css;h&&(ro("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))},rN=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){nc(t)&&!nh(t)&&(t=(i=t).roots||i.root,n=i.visit,r=i.directed),r=2!=arguments.length||ns(n)?r:n,n=ns(n)?n:function(){};for(var i,a,o,s=this._private.cy,l=t=no(t)?this.filter(t):t,c=[],u=[],d={},h={},f={},p=0,g=this.byGroup(),v=g.nodes,x=g.edges,y=0;y<l.length;y++){var b=l[y],w=b.id();b.isNode()&&(c.unshift(b),e.bfs&&(f[w]=!0,u.push(b)),h[w]=0)}for(;0!==c.length&&(0===(o=function(){var t,i=e.bfs?c.shift():c.pop(),o=i.id();if(e.dfs){if(f[o])return 0;f[o]=!0,u.push(i)}var s=h[o],l=d[o],g=null!=l?l.source():null,y=null!=l?l.target():null,b=null==l?void 0:i.same(g)?y[0]:g[0];if(!0===(t=n(i,l,b,p++,s)))return a=i,1;if(!1===t)return 1;for(var w=i.connectedEdges().filter(function(e){return(!r||e.source().same(i))&&x.has(e)}),N=0;N<w.length;N++){var j=w[N],k=j.connectedNodes().filter(function(e){return!e.same(i)&&v.has(e)}),S=k.id();0===k.length||f[S]||(k=k[0],c.push(k),e.bfs&&(f[S]=!0,u.push(k)),d[S]=j,h[S]=h[o]+1)}}())||1!==o););for(var N=s.collection(),j=0;j<u.length;j++){var k=u[j],S=d[k.id()];null!=S&&N.push(S),N.push(k)}return{path:s.collection(N),found:s.collection(a)}}},rj={breadthFirstSearch:rN({bfs:!0}),depthFirstSearch:rN({dfs:!0})};rj.bfs=rj.breadthFirstSearch,rj.dfs=rj.depthFirstSearch;var rk={exports:{}},rS=rk.exports,rC=nz(l7?l6:(l7=1,l6=function(){return l4?rk.exports:(l4=1,(function(){var e,t,n,r,i,a,o,s,l,c,u,d,h,f;t=Math.floor,l=Math.min,e=function(e,t){return e<t?-1:+(e>t)},s=function(n,r,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=e),i<0)throw Error("lo must be non-negative");for(null==a&&(a=n.length);i<a;)0>o(r,n[s=t((i+a)/2)])?a=s:i=s+1;return[].splice.apply(n,[i,i-i].concat(r)),r},i=function(t,n,r){return null==r&&(r=e),t.push(n),h(t,0,t.length-1,r)},r=function(t,n){var r,i;return null==n&&(n=e),r=t.pop(),t.length?(i=t[0],t[0]=r,f(t,0,n)):i=r,i},o=function(t,n,r){var i;return null==r&&(r=e),i=t[0],t[0]=n,f(t,0,r),i},a=function(t,n,r){var i;return null==r&&(r=e),t.length&&0>r(t[0],n)&&(n=(i=[t[0],n])[0],t[0]=i[1],f(t,0,r)),n},n=function(n,r){var i,a,o,s,l,c;for(null==r&&(r=e),s=(function(){c=[];for(var e=0,r=t(n.length/2);0<=r?e<r:e>r;0<=r?e++:e--)c.push(e);return c}).apply(this).reverse(),l=[],a=0,o=s.length;a<o;a++)i=s[a],l.push(f(n,i,r));return l},d=function(t,n,r){var i;if(null==r&&(r=e),-1!==(i=t.indexOf(n)))return h(t,0,i,r),f(t,i,r)},c=function(t,r,i){var o,s,l,c;if(null==i&&(i=e),!(o=t.slice(0,r)).length)return o;for(n(o,i),s=0,l=(c=t.slice(r)).length;s<l;s++)a(o,c[s],i);return o.sort(i).reverse()},u=function(t,i,a){var o,c,u,d,h,f,p,g,v;if(null==a&&(a=e),10*i<=t.length){if(!(u=t.slice(0,i).sort(a)).length)return u;for(d=0,c=u[u.length-1],f=(p=t.slice(i)).length;d<f;d++)0>a(o=p[d],c)&&(s(u,o,0,null,a),u.pop(),c=u[u.length-1]);return u}for(n(t,a),v=[],h=0,g=l(i,t.length);0<=g?h<g:h>g;0<=g?++h:--h)v.push(r(t,a));return v},h=function(t,n,r,i){var a,o,s;for(null==i&&(i=e),a=t[r];r>n;){if(0>i(a,o=t[s=r-1>>1])){t[r]=o,r=s;continue}break}return t[r]=a},f=function(t,n,r){var i,a,o,s,l;for(null==r&&(r=e),a=t.length,l=n,o=t[n],i=2*n+1;i<a;)(s=i+1)<a&&!(0>r(t[i],t[s]))&&(i=s),t[n]=t[i],i=2*(n=i)+1;return t[n]=o,h(t,l,n,r)},rk.exports=function(){function t(t){this.cmp=null!=t?t:e,this.nodes=[]}return t.push=i,t.pop=r,t.replace=o,t.pushpop=a,t.heapify=n,t.updateItem=d,t.nlargest=c,t.nsmallest=u,t.prototype.push=function(e){return i(this.nodes,e,this.cmp)},t.prototype.pop=function(){return r(this.nodes,this.cmp)},t.prototype.peek=function(){return this.nodes[0]},t.prototype.contains=function(e){return -1!==this.nodes.indexOf(e)},t.prototype.replace=function(e){return o(this.nodes,e,this.cmp)},t.prototype.pushpop=function(e){return a(this.nodes,e,this.cmp)},t.prototype.heapify=function(){return n(this.nodes,this.cmp)},t.prototype.updateItem=function(e){return d(this.nodes,e,this.cmp)},t.prototype.clear=function(){return this.nodes=[]},t.prototype.empty=function(){return 0===this.nodes.length},t.prototype.size=function(){return this.nodes.length},t.prototype.clone=function(){var e;return(e=new t).nodes=this.nodes.slice(0),e},t.prototype.toArray=function(){return this.nodes.slice(0)},t.prototype.insert=t.prototype.push,t.prototype.top=t.prototype.peek,t.prototype.front=t.prototype.peek,t.prototype.has=t.prototype.contains,t.prototype.copy=t.prototype.clone,t}()}).call(rS),rk.exports)}())),r_=rd({root:null,weight:function(e){return 1},directed:!1}),rE=rd({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),rT=rd({weight:function(e){return 1},directed:!1}),rM=rd({weight:function(e){return 1},directed:!1,root:null}),rO=Math.sqrt(2),rA=function(e,t,n){0===n.length&&ri("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n.length-1;l>=0;l--){var c=n[l],u=c[1],d=c[2];(t[u]===o&&t[d]===s||t[u]===s&&t[d]===o)&&n.splice(l,1)}for(var h=0;h<n.length;h++){var f=n[h];f[1]===s?(n[h]=f.slice(),n[h][1]=o):f[2]===s&&(n[h]=f.slice(),n[h][2]=o)}for(var p=0;p<t.length;p++)t[p]===s&&(t[p]=o);return n},rD=function(e,t,n,r){for(;n>r;)t=rA(Math.floor(Math.random()*t.length),e,t),n--;return t},rP=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},rI=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},rL=function(e){return{x:e[0],y:e[1]}},rR=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},rB=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},rF=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},rz=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=!(arguments.length>5)||void 0===arguments[5]||arguments[5];r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?!isFinite(l)&&(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var c=e.length,u=Math.floor(c/2);return c%2!=0?e[u+1+o]:(e[u-1+o]+e[u+o])/2},rV=function(e,t){return Math.atan2(t,e)-Math.PI/2},rH=Math.log2||function(e){return Math.log(e)/Math.log(2)},rU=function(e){return e>0?1:e<0?-1:0},rW=function(e,t){return Math.sqrt(rY(e,t))},rY=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},rG=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},rX=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},r$=function(e,t,n,r){return{x:rX(e.x,t.x,n.x,r),y:rX(e.y,t.y,n.y,r)}},rq=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},a=rW(e,t),o={x:i.x/a,y:i.y/a};return n=null==n?0:n,r=null!=r?r:n*a,{x:e.x+o.x*r,y:e.y+o.y*r}},rK=function(e,t,n){return Math.max(e,Math.min(n,t))},rZ=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};else if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},rQ=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},rJ=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},r0=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},r1=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},r2=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=t3(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},r5=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},r3=function(e,t){return!(e.x1>t.x2)&&!(t.x1>e.x2)&&!(e.x2<t.x1)&&!(t.x2<e.x1)&&!(e.y2<t.y1)&&!(t.y2<e.y1)&&!(e.y1>t.y2)&&!(t.y1>e.y2)&&!0},r4=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},r6=function(e,t){return r4(e,t.x,t.y)},r7=function(e,t){return r4(e,t.x1,t.y1)&&r4(e,t.x2,t.y2)},r9=null!=(l9=Math.hypot)?l9:function(e,t){return Math.sqrt(e*e+t*t)},r8=function(e,t,n,r,i,a,o){var s,l,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",u="auto"===c?iS(i,a):c,d=i/2,h=a/2,f=(u=Math.min(u,d,h))!==d,p=u!==h;if(f){var g=n-d+u-o,v=r-h-o,x=n+d-u+o;if((s=iv(e,t,n,r,g,v,x,v,!1)).length>0)return s}if(p){var y=n+d+o,b=r-h+u-o,w=r+h-u+o;if((s=iv(e,t,n,r,y,b,y,w,!1)).length>0)return s}if(f){var N=n-d+u-o,j=r+h+o,k=n+d-u+o;if((s=iv(e,t,n,r,N,j,k,j,!1)).length>0)return s}if(p){var S=n-d-o,C=r-h+u-o,_=r+h-u+o;if((s=iv(e,t,n,r,S,C,S,_,!1)).length>0)return s}var E=n-d+u,T=r-h+u;if((l=im(e,t,n,r,E,T,u+o)).length>0&&l[0]<=E&&l[1]<=T)return[l[0],l[1]];var M=n+d-u,O=r-h+u;if((l=im(e,t,n,r,M,O,u+o)).length>0&&l[0]>=M&&l[1]<=O)return[l[0],l[1]];var A=n+d-u,D=r+h-u;if((l=im(e,t,n,r,A,D,u+o)).length>0&&l[0]>=A&&l[1]>=D)return[l[0],l[1]];var P=n-d+u,I=r+h-u;return(l=im(e,t,n,r,P,I,u+o)).length>0&&l[0]<=P&&l[1]>=I?[l[0],l[1]]:[]},ie=function(e,t,n,r,i,a,o){var s=Math.min(n,i),l=Math.max(n,i),c=Math.min(r,a),u=Math.max(r,a);return s-o<=e&&e<=l+o&&c-o<=t&&t<=u+o},it=function(e,t,n,r,i,a,o,s,l){var c={x1:Math.min(n,o,i)-l,x2:Math.max(n,o,i)+l,y1:Math.min(r,s,a)-l,y2:Math.max(r,s,a)+l};return!(e<c.x1)&&!(e>c.x2)&&!(t<c.y1)&&!(t>c.y2)},ir=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},ii=function(e,t,n,r,i){var a,o,s,l,c,u,d,h;if(0===e&&(e=1e-5),t/=e,n/=e,r/=e,a=(o=(3*n-t*t)/9)*o*o+(s=(-(27*r)+t*(9*n-t*t*2))/54)*s,i[1]=0,d=t/3,a>0){c=(c=s+Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),u=(u=s-Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-d+c+u,d+=(c+u)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-u+c)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,0===a){h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=-d+2*h,i[4]=i[2]=-(h+d);return}l=Math.acos(s/Math.sqrt(l=(o=-o)*o*o)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),i[4]=-d+h*Math.cos((l+4*Math.PI)/3)},ia=function(e,t,n,r,i,a,o,s){var l,c=[];ii(n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,c);for(var u=[],d=0;d<6;d+=2)1e-7>Math.abs(c[d+1])&&c[d]>=0&&c[d]<=1&&u.push(c[d]);u.push(1),u.push(0);for(var h=-1,f=0;f<u.length;f++)l=Math.pow(Math.pow(1-u[f],2)*n+2*(1-u[f])*u[f]*i+u[f]*u[f]*o-e,2)+Math.pow(Math.pow(1-u[f],2)*r+2*(1-u[f])*u[f]*a+u[f]*u[f]*s-t,2),h>=0?l<h&&(h=l):h=l;return h},io=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],l=s[0]*s[0]+s[1]*s[1],c=o[0]*o[0]+o[1]*o[1],u=o[0]*s[0]+o[1]*s[1],d=u*u/l;return u<0?c:d>l?(e-i)*(e-i)+(t-a)*(t-a):c-d},is=function(e,t,n){for(var r,i,a,o,s=0,l=0;l<n.length/2;l++)if(r=n[2*l],i=n[2*l+1],l+1<n.length/2?(a=n[(l+1)*2],o=n[(l+1)*2+1]):(a=n[(l+1-n.length/2)*2],o=n[(l+1-n.length/2)*2+1]),r==e&&a==e);else{if((!(r>=e)||!(e>=a))&&(!(r<=e)||!(e<=a)))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},il=function(e,t,n,r,i,a,o,s,l){var c,u=Array(n.length);null!=s[0]?(c=Math.atan(s[1]/s[0]),s[0]<0?c+=Math.PI/2:c=-c-Math.PI/2):c=s;for(var d=Math.cos(-c),h=Math.sin(-c),f=0;f<u.length/2;f++)u[2*f]=a/2*(n[2*f]*d-n[2*f+1]*h),u[2*f+1]=o/2*(n[2*f+1]*d+n[2*f]*h),u[2*f]+=r,u[2*f+1]+=i;return is(e,t,l>0?iu(id(u,-l)):u)},ic=function(e,t,n,r,i,a,o,s){for(var l=Array(2*n.length),c=0;c<s.length;c++){var u=s[c];if(l[4*c+0]=u.startX,l[4*c+1]=u.startY,l[4*c+2]=u.stopX,l[4*c+3]=u.stopY,Math.pow(u.cx-e,2)+Math.pow(u.cy-t,2)<=Math.pow(u.radius,2))return!0}return is(e,t,l)},iu=function(e){for(var t,n,r,i,a,o,s,l,c=Array(e.length/2),u=0;u<e.length/4;u++){t=e[4*u],n=e[4*u+1],r=e[4*u+2],i=e[4*u+3],u<e.length/4-1?(a=e[(u+1)*4],o=e[(u+1)*4+1],s=e[(u+1)*4+2],l=e[(u+1)*4+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var d=iv(t,n,r,i,a,o,s,l,!0);c[2*u]=d[0],c[2*u+1]=d[1]}return c},id=function(e,t){for(var n,r,i,a,o=Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(i=e[(s+1)*2],a=e[(s+1)*2+1]):(i=e[0],a=e[1]);var l=a-r,c=-(i-n),u=Math.sqrt(l*l+c*c),d=l/u,h=c/u;o[4*s]=n+d*t,o[4*s+1]=r+h*t,o[4*s+2]=i+d*t,o[4*s+3]=a+h*t}return o},ih=function(e,t,n,r,i,a){var o=n-e,s=r-t,l=Math.sqrt((o/=i)*o+(s/=a)*s),c=l-1;if(c<0)return[];var u=c/l;return[(n-e)*u+e,(r-t)*u+t]},ip=function(e,t,n,r,i,a,o){return e-=i,t-=a,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},im=function(e,t,n,r,i,a,o){var s=[n-e,r-t],l=[e-i,t-a],c=s[0]*s[0]+s[1]*s[1],u=2*(l[0]*s[0]+l[1]*s[1]),d=u*u-4*c*(l[0]*l[0]+l[1]*l[1]-o*o);if(d<0)return[];var h=(-u+Math.sqrt(d))/(2*c),f=(-u-Math.sqrt(d))/(2*c),p=Math.min(h,f),g=Math.max(h,f),v=[];if(p>=0&&p<=1&&v.push(p),g>=0&&g<=1&&v.push(g),0===v.length)return[];var x=v[0]*s[0]+e,y=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[x,y]:[x,y,v[1]*s[0]+e,v[1]*s[1]+t]:[x,y]},ig=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},iv=function(e,t,n,r,i,a,o,s,l){var c=e-i,u=n-e,d=o-i,h=t-a,f=r-t,p=s-a,g=d*h-p*c,v=u*h-f*c,x=p*u-d*f;if(0!==x){var y=g/x,b=v/x;return -.001<=y&&y<=1.001&&-.001<=b&&b<=1.001||l?[e+y*u,t+y*f]:[]}return 0!==g&&0!==v?[]:ig(e,n,o)===o?[o,s]:ig(e,n,i)===i?[i,a]:ig(i,o,n)===n?[n,r]:[]},ix=function(e,t,n,r,i){var a=[],o=r/2,s=i/2;a.push({x:t+o*e[0],y:n+s*e[1]});for(var l=1;l<e.length/2;l++)a.push({x:t+o*e[2*l],y:n+s*e[2*l+1]});return a},iy=function(e,t,n,r,i,a,o,s){var l,c,u,d,h,f,p=[],g=Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var x=0;x<g.length/2;x++)g[2*x]=n[2*x]*a+r,g[2*x+1]=n[2*x+1]*o+i;c=s>0?iu(id(g,-s)):g}else c=n;for(var y=0;y<c.length/2;y++)u=c[2*y],d=c[2*y+1],y<c.length/2-1?(h=c[(y+1)*2],f=c[(y+1)*2+1]):(h=c[0],f=c[1]),0!==(l=iv(e,t,r,i,u,d,h,f)).length&&p.push(l[0],l[1]);return p},ib=function(e,t,n,r,i,a,o,s,l){var c,u=[],d=Array(2*n.length);l.forEach(function(n,a){0===a?(d[d.length-2]=n.startX,d[d.length-1]=n.startY):(d[4*a-2]=n.startX,d[4*a-1]=n.startY),d[4*a]=n.stopX,d[4*a+1]=n.stopY,0!==(c=im(e,t,r,i,n.cx,n.cy,n.radius)).length&&u.push(c[0],c[1])});for(var h=0;h<d.length/4;h++)0!==(c=iv(e,t,r,i,d[4*h],d[4*h+1],d[4*h+2],d[4*h+3],!1)).length&&u.push(c[0],c[1]);if(u.length>2){for(var f=[u[0],u[1]],p=Math.pow(f[0]-e,2)+Math.pow(f[1]-t,2),g=1;g<u.length/2;g++){var v=Math.pow(u[2*g]-e,2)+Math.pow(u[2*g+1]-t,2);v<=p&&(f[0]=u[2*g],f[1]=u[2*g+1],p=v)}return f}return u},iw=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},iN=function(e,t){var n=ik(e,t);return ij(n)},ij=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var c=2/(o-i),u=2/(s-a),d=0;d<r;d++)t=e[2*d]=e[2*d]*c,n=e[2*d+1]=e[2*d+1]*u,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var h=0;h<r;h++)n=e[2*h+1]=e[2*h+1]+(-1-a);return e},ik=function(e,t){var n,r=1/e*2*Math.PI,i=e%2==0?Math.PI/2+r/2:Math.PI/2;i+=t;for(var a=Array(2*e),o=0;o<e;o++)n=o*r+i,a[2*o]=Math.cos(n),a[2*o+1]=Math.sin(-n);return a},iS=function(e,t){return Math.min(e/4,t/4,8)},iC=function(e,t){return Math.min(e/10,t/10,8)},i_=function(){return 8},iE=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function iT(e,t){function n(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length],a={x:i.x-r.x,y:i.y-r.y},o={x:-a.y,y:a.x},s=Math.sqrt(o.x*o.x+o.y*o.y);t.push({x:o.x/s,y:o.y/s})}return t}function r(e,t){var n,r=1/0,i=-1/0,a=t2(e);try{for(a.s();!(n=a.n()).done;){var o=n.value,s=o.x*t.x+o.y*t.y;r=Math.min(r,s),i=Math.max(i,s)}}catch(e){a.e(e)}finally{a.f()}return{min:r,max:i}}var i,a=t2([].concat(t4(n(e)),t4(n(t))));try{for(a.s();!(i=a.n()).done;){var o=i.value,s=r(e,o),l=r(t,o);if(s.max<l.min||l.max<s.min)return!1}}catch(e){a.e(e)}finally{a.f()}return!0}var iM=rd({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),iO=rd({root:null,weight:function(e){return 1},directed:!1,alpha:0}),iA={degreeCentralityNormalized:function(e){e=iO(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<r;l++){var c=n[l],u=c.id();e.root=c;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),i[u]=d.indegree,a[u]=d.outdegree}return{indegree:function(e){return 0==o?0:(no(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(no(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var h={},f=0,p=0;p<r;p++){var g=n[p];e.root=g;var v=this.degreeCentrality(e);f<v.degree&&(f=v.degree),h[g.id()]=v.degree}return{degree:function(e){return 0===f?0:(no(e)&&(e=t.filter(e)),h[e.id()]/f)}}},degreeCentrality:function(e){e=iO(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var l=i.connectedEdges(),c=l.filter(function(e){return e.target().same(i)&&n.has(e)}),u=l.filter(function(e){return e.source().same(i)&&n.has(e)}),d=c.length,h=u.length,f=0,p=0,g=0;g<c.length;g++)f+=a(c[g]);for(var v=0;v<u.length;v++)p+=a(u[v]);return{indegree:Math.pow(d,1-s)*Math.pow(f,s),outdegree:Math.pow(h,1-s)*Math.pow(p,s)}}for(var x=i.connectedEdges().intersection(n),y=x.length,b=0,w=0;w<x.length;w++)b+=a(x[w]);return{degree:Math.pow(y,1-s)*Math.pow(b,s)}}};iA.dc=iA.degreeCentrality,iA.dcn=iA.degreeCentralityNormalised=iA.degreeCentralityNormalized;var iD=rd({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),iP={closenessCentralityNormalized:function(e){for(var t=iD(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,l=this.nodes(),c=this.floydWarshall({weight:r,directed:i}),u=0;u<l.length;u++){for(var d=0,h=l[u],f=0;f<l.length;f++)if(u!==f){var p=c.distance(h,l[f]);n?d+=1/p:d+=p}n||(d=1/d),s<d&&(s=d),o[h.id()]=d}return{closeness:function(e){return 0==s?0:o[e=no(e)?a.filter(e)[0].id():e.id()]/s}}},closenessCentrality:function(e){var t=iD(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,l=this.nodes(),c=0;c<l.length;c++){var u=l[c];if(!u.same(n)){var d=o.distanceTo(u);a?s+=1/d:s+=d}}return a?s:1/s}};iP.cc=iP.closenessCentrality,iP.ccn=iP.closenessCentralityNormalised=iP.closenessCentralityNormalized;var iI=rd({weight:null,directed:!1}),iL={betweennessCentrality:function(e){for(var t=iI(e),n=t.directed,r=t.weight,i=null!=r,a=this.cy(),o=this.nodes(),s={},l={},c=0,u=function(e,t){l[e]=t,t>c&&(c=t)},d=function(e){return l[e]},h=0;h<o.length;h++){var f=o[h],p=f.id();n?s[p]=f.outgoers().nodes():s[p]=f.openNeighborhood().nodes(),u(p,0)}for(var g=0;g<o.length;g++)!function(){for(var e=o[g].id(),t=[],n={},l={},c={},h=new rC(function(e,t){return c[e]-c[t]}),f=0;f<o.length;f++){var p=o[f].id();n[p]=[],l[p]=0,c[p]=1/0}for(l[e]=1,c[e]=0,h.push(e);!h.empty();){var v=h.pop();if(t.push(v),i)for(var x=0;x<s[v].length;x++){var y=s[v][x],b=a.getElementById(v),w=r(b.edgesTo(y).length>0?b.edgesTo(y)[0]:y.edgesTo(b)[0]);c[y=y.id()]>c[v]+w&&(c[y]=c[v]+w,0>h.nodes.indexOf(y)?h.push(y):h.updateItem(y),l[y]=0,n[y]=[]),c[y]==c[v]+w&&(l[y]=l[y]+l[v],n[y].push(v))}else for(var N=0;N<s[v].length;N++){var j=s[v][N].id();c[j]==1/0&&(h.push(j),c[j]=c[v]+1),c[j]==c[v]+1&&(l[j]=l[j]+l[v],n[j].push(v))}}for(var k={},S=0;S<o.length;S++)k[o[S].id()]=0;for(;t.length>0;){for(var C=t.pop(),_=0;_<n[C].length;_++){var E=n[C][_];k[E]=k[E]+l[E]/l[C]*(1+k[C])}C!=o[g].id()&&u(C,d(C)+k[C])}}();var v={betweenness:function(e){return d(a.collection(e).id())},betweennessNormalized:function(e){return 0==c?0:d(a.collection(e).id())/c}};return v.betweennessNormalised=v.betweennessNormalized,v}};iL.bc=iL.betweennessCentrality;var iR=rd({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),iB=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},iF=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},iz=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},iV=function(e,t,n){for(var r=Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},iH=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=iV(e,r,t);return e},iU=function(e,t,n){for(var r=Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return iz(r,t),r},iW=function(e,t,n,r){for(var i=0;i<n;i++)if(Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r)!=Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r))return!1;return!0},iY=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i},iG=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},iX=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&iG(e[t],e[n])&&e.splice(n,1);return e},i$=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=iR(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,c=l*l,u=Array(c),d=0;d<c;d++)u[d]=0;for(var h=0;h<n.length;h++){var f=n[h],p=a[f.source().id()],g=a[f.target().id()],v=iB(f,i.attributes);u[p*l+g]+=v,u[g*l+p]+=v}iF(u,l,i.multFactor),iz(u,l);for(var x=!0,y=0;x&&y<i.maxIterations;)x=!1,iW(u=iU(s=iH(u,l,i.expandFactor),l,i.inflateFactor),s,c,4)||(x=!0),y++;var b=iY(u,l,t,r);return iX(b)},iq=function(e){return e},iK=function(e,t){return Math.abs(t-e)},iZ=function(e,t,n){return e+iK(t,n)},iQ=function(e,t,n){return e+Math.pow(n-t,2)},iJ=function(e){return Math.sqrt(e)},i0=function(e,t,n){return Math.max(e,iK(t,n))},i1=function(e,t,n,r,i){for(var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:iq,o=r,s=0;s<e;s++)o=i(o,t(s),n(s));return a(o)},i2={euclidean:function(e,t,n){return e>=2?i1(e,t,n,0,iQ,iJ):i1(e,t,n,0,iZ)},squaredEuclidean:function(e,t,n){return i1(e,t,n,0,iQ)},manhattan:function(e,t,n){return i1(e,t,n,0,iZ)},max:function(e,t,n){return i1(e,t,n,-1/0,i0)}};function i5(e,t,n,r,i,a){var o;return(o=ns(e)?e:i2[e]||i2.euclidean,0===t&&ns(e))?o(i,a):o(t,n,r,i,a)}i2["squared-euclidean"]=i2.squaredEuclidean,i2.squaredeuclidean=i2.squaredEuclidean;var i3=rd({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),i4=function(e){return i3(e)},i6=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)};return i5(e,r.length,a,function(e){return r[e](t)},n,t)},i7=function(e,t,n){for(var r=n.length,i=Array(r),a=Array(r),o=Array(t),s=null,l=0;l<r;l++)i[l]=e.min(n[l]).value,a[l]=e.max(n[l]).value;for(var c=0;c<t;c++){s=[];for(var u=0;u<r;u++)s[u]=Math.random()*(a[u]-i[u])+i[u];o[c]=s}return o},i9=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=i6(n,e,t[s],r,i);l<a&&(a=l,o=s)}return o},i8=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)n[(i=t[a]).id()]===e&&r.push(i);return r},ae=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)if(Math.abs(e[r][i]-t[r][i])>n)return!1;return!0},at=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},an=function(e,t){var n=Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];at(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},ar=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=i6("manhattan",t[i],e,n,"kMedoids");return r},ai=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],i.m);for(var c=0;c<e.length;c++)for(var u=0;u<i.attributes.length;u++){a=0,o=0;for(var d=0;d<t.length;d++)a+=r[d][c]*i.attributes[u](t[d]),o+=r[d][c];e[c][u]=a/o}},aa=function(e,t,n,r,i){for(var a,o=0;o<e.length;o++)t[o]=e[o].slice();for(var s=2/(i.m-1),l=0;l<n.length;l++)for(var c=0;c<r.length;c++){a=0;for(var u=0;u<n.length;u++)a+=Math.pow(i6(i.distance,r[c],n[l],i.attributes,"cmeans")/i6(i.distance,r[c],n[u],i.attributes,"cmeans"),s);e[c][l]=1/a}},ao=function(e,t,n,r){for(var i,a,o=Array(n.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){i=-1/0,a=-1;for(var c=0;c<t[0].length;c++)t[l][c]>i&&(i=t[l][c],a=c);o[a].push(e[l])}for(var u=0;u<o.length;u++)o[u]=r.collection(o[u]);return o},as=function(e){var t,n,r,i,a=this.cy(),o=this.nodes(),s=i4(e);r=Array(o.length);for(var l=0;l<o.length;l++)r[l]=Array(s.k);n=Array(o.length);for(var c=0;c<o.length;c++)n[c]=Array(s.k);for(var u=0;u<o.length;u++){for(var d=0,h=0;h<s.k;h++)n[u][h]=Math.random(),d+=n[u][h];for(var f=0;f<s.k;f++)n[u][f]=n[u][f]/d}t=Array(s.k);for(var p=0;p<s.k;p++)t[p]=Array(s.attributes.length);i=Array(o.length);for(var g=0;g<o.length;g++)i[g]=Array(s.k);for(var v=!0,x=0;v&&x<s.maxIterations;)v=!1,ai(t,o,n,i,s),aa(n,r,t,o,s),ae(n,r,s.sensitivityThreshold)||(v=!0),x++;return{clusters:ao(o,n,s,a),degreeOfMembership:n}},al=rd({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),ac={single:"min",complete:"max"},au=function(e){var t=al(e),n=ac[t.linkage];return null!=n&&(t.linkage=n),t},ad=function(e,t,n,r,i){for(var a,o,s=0,l=1/0,c=i.attributes,u=function(e,t){return i5(i.distance,c.length,function(t){return c[t](e)},function(e){return c[e](t)},e,t)},d=0;d<e.length;d++){var h=e[d].key,f=n[h][r[h]];f<l&&(s=h,l=f)}if("threshold"===i.mode&&l>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p=t[s],g=t[r[s]];o="dendrogram"===i.mode?{left:p,right:g,key:p.key}:{value:p.value.concat(g.value),key:p.key},e[p.index]=o,e.splice(g.index,1),t[p.key]=o;for(var v=0;v<e.length;v++){var x=e[v];p.key===x.key?a=1/0:"min"===i.linkage?(a=n[p.key][x.key],n[p.key][x.key]>n[g.key][x.key]&&(a=n[g.key][x.key])):"max"===i.linkage?(a=n[p.key][x.key],n[p.key][x.key]<n[g.key][x.key]&&(a=n[g.key][x.key])):a="mean"===i.linkage?(n[p.key][x.key]*p.size+n[g.key][x.key]*g.size)/(p.size+g.size):"dendrogram"===i.mode?u(x.value,p.value):u(x.value[0],p.value[0]),n[p.key][x.key]=n[x.key][p.key]=a}for(var y=0;y<e.length;y++){var b=e[y].key;if(r[b]===p.key||r[b]===g.key){for(var w=b,N=0;N<e.length;N++){var j=e[N].key;n[b][j]<n[b][w]&&(w=j)}r[b]=w}e[y].index=y}return p.key=g.key=p.index=g.index=null,!0},ah=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&ah(e.left,t),e.right&&ah(e.right,t)))},af=function(e,t){if(!e)return"";if(e.left&&e.right){var n=af(e.left,t),r=af(e.right,t),i=t.add({group:"nodes",data:{id:n+","+r}});return t.add({group:"edges",data:{source:n,target:i.id()}}),t.add({group:"edges",data:{source:r,target:i.id()}}),i.id()}if(e.value)return e.value.id()},ap=function(e,t,n){if(!e)return[];var r=[],i=[],a=[];if(0===t)return e.left&&ah(e.left,r),e.right&&ah(e.right,i),a=r.concat(i),[n.collection(a)];if(1===t)if(e.value)return[n.collection(e.value)];else return e.left&&ah(e.left,r),e.right&&ah(e.right,i),[n.collection(r),n.collection(i)];return e.value?[n.collection(e.value)]:(e.left&&(r=ap(e.left,t-1,n)),e.right&&(i=ap(e.right,t-1,n)),r.concat(i))},am=function(e){for(var t,n=this.cy(),r=this.nodes(),i=au(e),a=i.attributes,o=function(e,t){return i5(i.distance,a.length,function(t){return a[t](e)},function(e){return a[e](t)},e,t)},s=[],l=[],c=[],u=[],d=0;d<r.length;d++){var h={value:"dendrogram"===i.mode?r[d]:[r[d]],key:d,index:d};s[d]=h,u[d]=h,l[d]=[],c[d]=0}for(var f=0;f<s.length;f++)for(var p=0;p<=f;p++){var g=void 0;g="dendrogram"===i.mode?f===p?1/0:o(s[f].value,s[p].value):f===p?1/0:o(s[f].value[0],s[p].value[0]),l[f][p]=g,l[p][f]=g,g<l[f][c[f]]&&(c[f]=p)}for(var v=ad(s,u,l,c,i);v;)v=ad(s,u,l,c,i);return"dendrogram"===i.mode?(t=ap(s[0],i.dendrogramDepth,n),i.addDendrogram&&af(s[0],n)):(t=Array(s.length),s.forEach(function(e,r){e.key=e.index=null,t[r]=n.collection(e.value)})),t},ag=rd({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),av=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||ri("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some(function(e){return e===n})||nu(n)||ri("Preference must be one of [".concat(r.map(function(e){return"'".concat(e,"'")}).join(", "),"] or a number. Got: ").concat(n)),ag(e)},ax=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-i5(e,r.length,function(e){return i(t,e)},function(e){return i(n,e)},t,n)},ay=function(e,t){return"median"===t?rz(e):"mean"===t?rF(e):"min"===t?rR(e):"max"===t?rB(e):t},ab=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},aw=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[i*e+l]>o&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var c=0;c<n.length;c++)r[n[c]]=n[c];return r},aN=function(e,t,n){for(var r=aw(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,l=-1/0,c=0;c<a.length;c++){for(var u=0,d=0;d<a.length;d++)u+=t[a[d]*e+a[c]];u>l&&(s=c,l=u)}n[i]=a[s]}return aw(e,t,n)},aj=function(e){for(var t,n,r,i,a,o,s,l=this.cy(),c=this.nodes(),u=av(e),d={},h=0;h<c.length;h++)d[c[h].id()]=h;r=Array(n=(t=c.length)*t);for(var f=0;f<n;f++)r[f]=-1/0;for(var p=0;p<t;p++)for(var g=0;g<t;g++)p!==g&&(r[p*t+g]=ax(u.distance,c[p],c[g],u.attributes));i=ay(r,u.preference);for(var v=0;v<t;v++)r[v*t+v]=i;a=Array(n);for(var x=0;x<n;x++)a[x]=0;o=Array(n);for(var y=0;y<n;y++)o[y]=0;for(var b=Array(t),w=Array(t),N=Array(t),j=0;j<t;j++)b[j]=0,w[j]=0,N[j]=0;for(var k=Array(t*u.minIterations),S=0;S<k.length;S++)k[S]=0;for(s=0;s<u.maxIterations;s++){for(var C=0;C<t;C++){for(var _=-1/0,E=-1/0,T=-1,M=0,O=0;O<t;O++)b[O]=a[C*t+O],(M=o[C*t+O]+r[C*t+O])>=_?(E=_,_=M,T=O):M>E&&(E=M);for(var A=0;A<t;A++)a[C*t+A]=(1-u.damping)*(r[C*t+A]-_)+u.damping*b[A];a[C*t+T]=(1-u.damping)*(r[C*t+T]-E)+u.damping*b[T]}for(var D=0;D<t;D++){for(var P=0,I=0;I<t;I++)b[I]=o[I*t+D],w[I]=Math.max(0,a[I*t+D]),P+=w[I];P-=w[D],w[D]=a[D*t+D],P+=w[D];for(var L=0;L<t;L++)o[L*t+D]=(1-u.damping)*Math.min(0,P-w[L])+u.damping*b[L];o[D*t+D]=(1-u.damping)*(P-w[D])+u.damping*b[D]}for(var R=0,B=0;B<t;B++){var F=+(o[B*t+B]+a[B*t+B]>0);k[s%u.minIterations*t+B]=F,R+=F}if(R>0&&(s>=u.minIterations-1||s==u.maxIterations-1)){for(var z=0,V=0;V<t;V++){N[V]=0;for(var H=0;H<u.minIterations;H++)N[V]+=k[H*t+V];(0===N[V]||N[V]===u.minIterations)&&z++}if(z===t)break}}for(var U=ab(t,a,o),W=aN(t,r,U),Y={},G=0;G<U.length;G++)Y[U[G]]=[];for(var X=0;X<c.length;X++){var $=W[d[c[X].id()]];null!=$&&Y[$].push(c[X])}for(var q=Array(U.length),K=0;K<U.length;K++)q[K]=l.collection(Y[U[K]]);return q},ak=rd({root:void 0,directed:!1}),aS=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){for(var o=a.length-1,s=[],l=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach(function(n){var r=n.id(),i=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(i.filter(function(e){return e.isLoop()})):l.merge(i)})}),i.push(l)},l=function(c,u,d){c===d&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var h,f,p,g,v=e.getElementById(u).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(u))):v.forEach(function(e){h=e.source().id(),f=e.target().id(),(p=h===u?f:h)!==d&&(o[g=e.id()]||(o[g]=!0,a.push({x:u,y:p,edge:e})),p in t?t[u].low=Math.min(t[u].low,t[p].id):(l(c,p,u),t[u].low=Math.min(t[u].low,t[p].low),t[u].id<=t[p].low&&(t[u].cutVertex=!0,s(u,p))))})};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,l(n,n),t[n].cutVertex=r>1)}});var c=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(c),components:i}},aC=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var c=i.pop();if(l.merge(e.getElementById(c)),t[c].low=t[s].index,t[c].explored=!0,c===s)break}var u=l.edgesWith(l),d=l.merge(u);r.push(d),a=a.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},a_={};[rj,{dijkstra:function(e){if(!nc(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=r_(e),r=n.root,i=n.weight,a=n.directed,o=this,s=no(r)?this.filter(r)[0]:r[0],l={},c={},u={},d=this.byGroup(),h=d.nodes,f=d.edges;f.unmergeBy(function(e){return e.isLoop()});for(var p=function(e){return l[e.id()]},g=new rC(function(e,t){return p(e)-p(t)}),v=0;v<h.length;v++){var x=h[v];l[x.id()]=x.same(s)?0:1/0,g.push(x)}for(;g.size()>0;){var y=g.pop(),b=p(y);if(u[y.id()]=b,b!==1/0)for(var w=y.neighborhood().intersect(h),N=0;N<w.length;N++){var j=w[N],k=j.id(),S=function(e,t){for(var n,r=(a?e.edgesTo(t):e.edgesWith(t)).intersect(f),o=1/0,s=0;s<r.length;s++){var l=r[s],c=i(l);(c<o||!n)&&(o=c,n=l)}return{edge:n,dist:o}}(y,j),C=b+S.dist;C<p(j)&&(l[j.id()]=C,g.updateItem(j),c[k]={node:y,edge:S.edge})}}return{distanceTo:function(e){return u[(no(e)?h.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=no(e)?h.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},{kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=Array(i),o=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},s=0;s<i;s++)a[s]=this.spawn(n[s]);for(var l=r.sort(function(t,n){return e(t)-e(n)}),c=0;c<l.length;c++){var u=l[c],d=u.source()[0],h=u.target()[0],f=o(d),p=o(h),g=a[f],v=a[p];f!==p&&(n.merge(u),g.merge(v),a.splice(p,1))}return n}},{aStar:function(e){var t,n,r=this.cy(),i=rE(e),a=i.root,o=i.goal,s=i.heuristic,l=i.directed,c=i.weight;a=r.collection(a)[0],o=r.collection(o)[0];var u=a.id(),d=o.id(),h={},f={},p={},g=new rC(function(e,t){return f[e.id()]-f[t.id()]}),v=new rb,x={},y={},b=function(e,t){g.push(e),v.add(t)};b(a,u),h[u]=0,f[u]=s(a);for(var w=0;g.size()>0;){if(n=(t=g.pop()).id(),v.delete(n),w++,n===d){for(var N=[],j=o,k=d,S=y[k];N.unshift(j),null!=S&&N.unshift(S),null!=(j=x[k]);)S=y[k=j.id()];return{found:!0,distance:h[n],path:this.spawn(N),steps:w}}p[n]=!0;for(var C=t._private.edges,_=0;_<C.length;_++){var E=C[_];if(this.hasElementWithId(E.id())&&(!l||E.data("source")===n)){var T=E.source(),M=E.target(),O=T.id()!==n?T:M,A=O.id();if(this.hasElementWithId(A)&&!p[A]){var D=h[n]+c(E);if(!v.has(A)){h[A]=D,f[A]=D+s(O),b(O,A),x[A]=t,y[A]=E;continue}D<h[A]&&(h[A]=D,f[A]=D+s(O),x[A]=t,y[A]=E)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},{floydWarshall:function(e){for(var t=this.cy(),n=rT(e),r=n.weight,i=n.directed,a=this.byGroup(),o=a.nodes,s=a.edges,l=o.length,c=l*l,u=function(e){return o.indexOf(e)},d=function(e){return o[e]},h=Array(c),f=0;f<c;f++){var p=f%l;(f-p)/l===p?h[f]=0:h[f]=1/0}for(var g=Array(c),v=Array(c),x=0;x<s.length;x++){var y=s[x],b=y.source()[0],w=y.target()[0];if(b!==w){var N=u(b),j=u(w),k=N*l+j,S=r(y);if(h[k]>S&&(h[k]=S,g[k]=j,v[k]=y),!i){var C=j*l+N;!i&&h[C]>S&&(h[C]=S,g[C]=N,v[C]=y)}}}for(var _=0;_<l;_++)for(var E=0;E<l;E++)for(var T=E*l+_,M=0;M<l;M++){var O=E*l+M,A=_*l+M;h[T]+h[A]<h[O]&&(h[O]=h[T]+h[A],g[O]=g[T])}var D=function(e){return u((no(e)?t.filter(e):e)[0])};return{distance:function(e,t){return h[D(e)*l+D(t)]},path:function(e,n){var r,i=D(e),a=D(n),o=d(i);if(i===a)return o.collection();if(null==g[i*l+a])return t.collection();var s=t.collection(),c=i;for(s.merge(o);i!==a;)c=i,i=g[i*l+a],r=v[c*l+i],s.merge(r),s.merge(d(i));return s}}}},{bellmanFord:function(e){var t=this,n=rM(e),r=n.weight,i=n.directed,a=n.root,o=this,s=this.cy(),l=this.byGroup(),c=l.edges,u=l.nodes,d=u.length,h=new rx,f=!1,p=[];a=s.collection(a)[0],c.unmergeBy(function(e){return e.isLoop()});for(var g=c.length,v=function(e){var t=h.get(e.id());return t||(t={},h.set(e.id(),t)),t},x=function(e){return(no(e)?s.$(e):e)[0]},y=0;y<d;y++){var b=u[y],w=v(b);b.same(a)?w.dist=0:w.dist=1/0,w.pred=null,w.edge=null}for(var N=!1,j=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,N=!0)},k=1;k<d;k++){N=!1;for(var S=0;S<g;S++){var C=c[S],_=C.source(),E=C.target(),T=r(C),M=v(_),O=v(E);j(_,E,C,M,O,T),i||j(E,_,C,O,M,T)}if(!N)break}if(N)for(var A=[],D=0;D<g;D++){var P=c[D],I=P.source(),L=P.target(),R=r(P),B=v(I).dist,F=v(L).dist;if(B+R<F||!i&&F+R<B)if(f||(ro("Graph contains a negative weight cycle for Bellman-Ford"),f=!0),!1!==e.findNegativeWeightCycles){var z=[];B+R<F&&z.push(I),!i&&F+R<B&&z.push(L);for(var V=z.length,H=0;H<V;H++){var U=z[H],W=[U];W.push(v(U).edge);for(var Y=v(U).pred;-1===W.indexOf(Y);)W.push(Y),W.push(v(Y).edge),Y=v(Y).pred;for(var G=(W=W.slice(W.indexOf(Y)))[0].id(),X=0,$=2;$<W.length;$+=2)W[$].id()<G&&(G=W[$].id(),X=$);(W=W.slice(X).concat(W.slice(0,X))).push(W[0]);var q=W.map(function(e){return e.id()}).join(",");-1===A.indexOf(q)&&(p.push(o.spawn(W)),A.push(q))}}else break}return{distanceTo:function(e){return v(x(e)).dist},pathTo:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,r=x(e),i=[],s=r;;){if(null==s)return t.spawn();var l=v(s),c=l.edge,u=l.pred;if(i.unshift(s[0]),s.same(n)&&i.length>0)break;null!=c&&i.unshift(c),s=u}return o.spawn(i)},hasNegativeWeightCycle:f,negativeWeightCycles:p}}},{kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/rO);if(i<2)return void ri("At least 2 nodes are required for Karger-Stein algorithm");for(var l=[],c=0;c<a;c++){var u=r[c];l.push([c,n.indexOf(u.source()),n.indexOf(u.target())])}for(var d=1/0,h=[],f=Array(i),p=Array(i),g=Array(i),v=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},x=0;x<=o;x++){for(var y=0;y<i;y++)p[y]=y;var b=rD(p,l.slice(),i,s),w=b.slice();v(p,g);var N=rD(p,b,s,2),j=rD(g,w,s,2);N.length<=j.length&&N.length<d?(d=N.length,h=N,v(p,f)):j.length<=N.length&&j.length<d&&(d=j.length,h=j,v(g,f))}for(var k=this.spawn(h.map(function(e){return r[e[0]]})),S=this.spawn(),C=this.spawn(),_=f[0],E=0;E<f.length;E++){var T=f[E],M=n[E];T===_?S.merge(M):C.merge(M)}var O=function(t){var n=e.spawn();return t.forEach(function(t){n.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!k.contains(t)&&n.merge(t)})}),n};return{cut:k,components:[O(S),O(C)],partition1:S,partition2:C}}},{pageRank:function(e){for(var t,n=iM(e),r=n.dampingFactor,i=n.precision,a=n.iterations,o=n.weight,s=this._private.cy,l=this.byGroup(),c=l.nodes,u=l.edges,d=c.length,h=d*d,f=u.length,p=Array(h),g=Array(d),v=(1-r)/d,x=0;x<d;x++){for(var y=0;y<d;y++)p[x*d+y]=0;g[x]=0}for(var b=0;b<f;b++){var w=u[b],N=w.data("source"),j=w.data("target");if(N!==j){var k=c.indexOfId(N),S=c.indexOfId(j),C=o(w),_=S*d+k;p[_]+=C,g[k]+=C}}for(var E=1/d+v,T=0;T<d;T++)if(0===g[T])for(var M=0;M<d;M++)p[M*d+T]=E;else for(var O=0;O<d;O++){var A=O*d+T;p[A]=p[A]/g[T]+v}for(var D=Array(d),P=Array(d),I=0;I<d;I++)D[I]=1;for(var L=0;L<a;L++){for(var R=0;R<d;R++)P[R]=0;for(var B=0;B<d;B++)for(var F=0;F<d;F++){var z=B*d+F;P[B]+=p[z]*D[F]}rG(P),t=D,D=P,P=t;for(var V=0,H=0;H<d;H++){var U=t[H]-D[H];V+=U*U}if(V<i)break}return{rank:function(e){return e=s.collection(e)[0],D[c.indexOf(e)]}}}},iA,iP,iL,{markovClustering:i$,mcl:i$},{kMeans:function(e){var t,n=this.cy(),r=this.nodes(),i=null,a=i4(e),o=Array(a.k),s={};a.testMode?"number"==typeof a.testCentroids?(a.testCentroids,t=i7(r,a.k,a.attributes)):t="object"===t7(a.testCentroids)?a.testCentroids:i7(r,a.k,a.attributes):t=i7(r,a.k,a.attributes);for(var l=!0,c=0;l&&c<a.maxIterations;){for(var u=0;u<r.length;u++)s[(i=r[u]).id()]=i9(i,t,a.distance,a.attributes,"kMeans");l=!1;for(var d=0;d<a.k;d++){var h=i8(d,r,s);if(0!==h.length){for(var f=a.attributes.length,p=t[d],g=Array(f),v=Array(f),x=0;x<f;x++){v[x]=0;for(var y,b=0;b<h.length;b++)i=h[b],v[x]+=a.attributes[x](i);g[x]=v[x]/h.length,y=g[x],Math.abs(p[x]-y)<=a.sensitivityThreshold||(l=!0)}t[d]=g,o[d]=n.collection(h)}}c++}return o},kMedoids:function(e){var t,n,r=this.cy(),i=this.nodes(),a=null,o=i4(e),s=Array(o.k),l={},c=Array(o.k);o.testMode?"number"==typeof o.testCentroids||(t="object"===t7(o.testCentroids)?o.testCentroids:an(i,o.k)):t=an(i,o.k);for(var u=!0,d=0;u&&d<o.maxIterations;){for(var h=0;h<i.length;h++)l[(a=i[h]).id()]=i9(a,t,o.distance,o.attributes,"kMedoids");u=!1;for(var f=0;f<t.length;f++){var p=i8(f,i,l);if(0!==p.length){c[f]=ar(t[f],p,o.attributes);for(var g=0;g<p.length;g++)(n=ar(p[g],p,o.attributes))<c[f]&&(c[f]=n,t[f]=p[g],u=!0);s[f]=r.collection(p)}}d++}return s},fuzzyCMeans:as,fcm:as},{hierarchicalClustering:am,hca:am},{affinityPropagation:aj,ap:aj},{hierholzer:function(e){if(!nc(e)){var t,n,r,i=arguments;e={root:i[0],directed:i[1]}}var a=ak(e),o=a.root,s=a.directed,l=!1;o&&(r=no(o)?this.filter(o)[0].id():o[0].id());var c={},u={};s?this.forEach(function(e){var r=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?t?l=!0:t=r:1==s?n?l=!0:n=r:(s>1||o>1)&&(l=!0),c[r]=[],e.outgoers().forEach(function(e){e.isEdge()&&c[r].push(e.id())})}else u[r]=[void 0,e.target().id()]}):this.forEach(function(e){var r=e.id();e.isNode()?(e.degree(!0)%2&&(t?n?l=!0:n=r:t=r),c[r]=[],e.connectedEdges().forEach(function(e){return c[r].push(e.id())})):u[r]=[e.source().id(),e.target().id()]});var d={found:!1,trail:void 0};if(l)return d;if(n&&t)if(s){if(r&&n!=r)return d;r=n}else{if(r&&n!=r&&t!=r)return d;r||(r=n)}else r||(r=this[0].id());var h=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)n=u[t=c[i].shift()][0],i!=(r=u[t][1])?(c[r]=c[r].filter(function(e){return e!=t}),i=r):s||i==n||(c[n]=c[n].filter(function(e){return e!=t}),i=n),a.unshift(t),a.unshift(i);return a},f=[],p=[];for(p=h(r);1!=p.length;)0==c[p[0]].length?(f.unshift(this.getElementById(p.shift())),f.unshift(this.getElementById(p.shift()))):p=h(p.shift()).concat(p);for(var g in f.unshift(this.getElementById(p.shift())),c)if(c[g].length)return d;return d.found=!0,d.trail=this.spawn(f,!0),d}},{hopcroftTarjanBiconnected:aS,htbc:aS,htb:aS,hopcroftTarjanBiconnectedComponents:aS},{tarjanStronglyConnected:aC,tsc:aC,tscc:aC,tarjanStronglyConnectedComponents:aC}].forEach(function(e){nO(a_,e)});var aE=function(e){if(!(this instanceof aE))return new aE(e);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};aE.prototype={fulfill:function(e){return aT(this,1,"fulfillValue",e)},reject:function(e){return aT(this,2,"rejectReason",e)},then:function(e,t){var n=new aE;return this.onFulfilled.push(aA(e,n,"fulfill")),this.onRejected.push(aA(t,n,"reject")),aM(this),n.proxy}};var aT=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,aM(e)),e},aM=function(e){1===e.state?aO(e,"onFulfilled",e.fulfillValue):2===e.state&&aO(e,"onRejected",e.rejectReason)},aO=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},aA=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){t.reject(e);return}aD(t,i)}}},aD=function(e,t){if(e===t||e.proxy===t)return void e.reject(TypeError("cannot resolve promise with itself"));if("object"===t7(t)&&null!==t||"function"==typeof t)try{n=t.then}catch(t){e.reject(t);return}if("function"==typeof n){var n,r=!1;try{n.call(t,function(n){r||(r=!0,n===t?e.reject(TypeError("circular thenable chain")):aD(e,n))},function(t){r||(r=!0,e.reject(t))})}catch(t){r||e.reject(t)}return}e.fulfill(t)};aE.all=function(e){return new aE(function(t,n){for(var r=Array(e.length),i=0,a=function(n,a){r[n]=a,++i===e.length&&t(r)},o=0;o<e.length;o++)!function(t){var r=e[t];null!=r&&null!=r.then?r.then(function(e){a(t,e)},function(e){n(e)}):a(t,r)}(o)})},aE.resolve=function(e){return new aE(function(t,n){t(e)})},aE.reject=function(e){return new aE(function(t,n){n(e)})};var aP="u">typeof Promise?Promise:aE,aI=function(e,t,n){var r=nm(e),i=this._private=nO({duration:1e3},t,n);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&ns(i.complete)&&i.completes.push(i.complete),!r){var a=e.position();i.startPosition=i.startPosition||{x:a.x,y:a.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(r){var o=e.pan();i.startPan={x:o.x,y:o.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},aL=aI.prototype;function aR(){return ce?l8:(ce=1,l8=Array.isArray)}function aB(){if(cg)return cm;cg=1;var e=function(){if(ch)return cd;ch=1;var e=function(){if(ci)return cr;ci=1;var e=nW(),t=nV();return cr=function(n){if(!t(n))return!1;var r=e(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}(),t=function(){if(cl)return cs;cl=1;var e,t=co?ca:(co=1,ca=nH()["__core-js_shared__"]),n=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return cs=function(e){return!!n&&n in e}}(),n=nV(),r=function(){if(cu)return cc;cu=1;var e=Function.prototype.toString;return cc=function(t){if(null!=t){try{return e.call(t)}catch(e){}try{return t+""}catch(e){}}return""}}(),i=/^\[object .+?Constructor\]$/,a=Object.prototype,o=Function.prototype.toString,s=a.hasOwnProperty,l=RegExp("^"+o.call(s).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return cd=function(a){return!(!n(a)||t(a))&&(e(a)?l:i).test(r(a))}}(),t=cp?cf:(cp=1,cf=function(e,t){return null==e?void 0:e[t]});return cm=function(n,r){var i=t(n,r);return e(i)?i:void 0}}function aF(){return cx?cv:(cx=1,cv=aB()(Object,"create"))}function az(){return cP?cD:(cP=1,cD=function(e,t){return e===t||e!=e&&t!=t})}function aV(){if(cL)return cI;cL=1;var e=az();return cI=function(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return -1}}function aH(){if(c0)return cJ;c0=1;var e=cQ?cZ:(cQ=1,cZ=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e});return cJ=function(t,n){var r=t.__data__;return e(n)?r["string"==typeof n?"string":"hash"]:r.map}}function aU(){if(uo)return ua;uo=1;var e=function(){if(ui)return ur;ui=1;var e=function(){if(un)return ut;un=1;var e=function(){if(ue)return c8;ue=1;var e=function(){if(cK)return cq;cK=1;var e=function(){if(cM)return cT;cM=1;var e=function(){if(cb)return cy;cb=1;var e=aF();return cy=function(){this.__data__=e?e(null):{},this.size=0}}(),t=cN?cw:(cN=1,cw=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t}),n=function(){if(ck)return cj;ck=1;var e=aF(),t=Object.prototype.hasOwnProperty;return cj=function(n){var r=this.__data__;if(e){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return t.call(r,n)?r[n]:void 0}}(),r=function(){if(cC)return cS;cC=1;var e=aF(),t=Object.prototype.hasOwnProperty;return cS=function(n){var r=this.__data__;return e?void 0!==r[n]:t.call(r,n)}}(),i=function(){if(cE)return c_;cE=1;var e=aF();return c_=function(t,n){var r=this.__data__;return this.size+=+!this.has(t),r[t]=e&&void 0===n?"__lodash_hash_undefined__":n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,cT=a}(),t=function(){if(cG)return cY;cG=1;var e=cA?cO:(cA=1,cO=function(){this.__data__=[],this.size=0}),t=function(){if(cB)return cR;cB=1;var e=aV(),t=Array.prototype.splice;return cR=function(n){var r=this.__data__,i=e(r,n);return!(i<0)&&(i==r.length-1?r.pop():t.call(r,i,1),--this.size,!0)}}(),n=function(){if(cz)return cF;cz=1;var e=aV();return cF=function(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}}(),r=function(){if(cH)return cV;cH=1;var e=aV();return cV=function(t){return e(this.__data__,t)>-1}}(),i=function(){if(cW)return cU;cW=1;var e=aV();return cU=function(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,cY=a}(),n=c$?cX:(c$=1,cX=aB()(nH(),"Map"));return cq=function(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}}(),t=function(){if(c2)return c1;c2=1;var e=aH();return c1=function(t){var n=e(this,t).delete(t);return this.size-=!!n,n}}(),n=function(){if(c3)return c5;c3=1;var e=aH();return c5=function(t){return e(this,t).get(t)}}(),r=function(){if(c6)return c4;c6=1;var e=aH();return c4=function(t){return e(this,t).has(t)}}(),i=function(){if(c9)return c7;c9=1;var e=aH();return c7=function(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=+(r.size!=i),this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,c8=a}();function t(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw TypeError("Expected a function");var i=function(){var e=arguments,t=r?r.apply(this,e):e[0],a=i.cache;if(a.has(t))return a.get(t);var o=n.apply(this,e);return i.cache=a.set(t,o)||a,o};return i.cache=new(t.Cache||e),i}return t.Cache=e,ut=t}();return ur=function(t){var n=e(t,function(e){return 500===r.size&&r.clear(),e}),r=n.cache;return n}}(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g;return ua=e(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,"$1"):t||e)}),r})}function aW(){return ul?us:(ul=1,us=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i})}function aY(){if(uh)return ud;uh=1;var e=function(){if(uu)return uc;uu=1;var e=nU(),t=aW(),n=aR(),r=nY(),i=e?e.prototype:void 0,a=i?i.toString:void 0;return uc=function e(i){if("string"==typeof i)return i;if(n(i))return t(i,e)+"";if(r(i))return a?a.call(i):"";var o=i+"";return"0"==o&&1/i==-1/0?"-0":o}}();return ud=function(t){return null==t?"":e(t)}}function aG(){if(up)return uf;up=1;var e=aR(),t=function(){if(cn)return ct;cn=1;var e=aR(),t=nY(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return ct=function(i,a){if(e(i))return!1;var o=typeof i;return!!("number"==o||"symbol"==o||"boolean"==o||null==i||t(i))||r.test(i)||!n.test(i)||null!=a&&i in Object(a)}}(),n=aU(),r=aY();return uf=function(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}}function aX(){if(ug)return um;ug=1;var e=nY();return um=function(t){if("string"==typeof t||e(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}}nO(aL,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),nh(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;return t="frame"===e?n.frames:n.completes,new aP(function(e,n){t.push(function(){e()})})}}),aL.complete=aL.completed,aL.run=aL.play,aL.running=aL.playing;var a$=nz(function(){if(ub)return uy;ub=1;var e=function(){if(ux)return uv;ux=1;var e=aG(),t=aX();return uv=function(n,r){r=e(r,n);for(var i=0,a=r.length;null!=n&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}}();return uy=function(t,n,r){var i=null==t?void 0:e(t,n);return void 0===i?r:i}}()),aq=nz(function(){if(uA)return uO;uA=1;var e=function(){if(uM)return uT;uM=1;var e=function(){if(uC)return uS;uC=1;var e=function(){if(uk)return uj;uk=1;var e=function(){if(uN)return uw;uN=1;var e=aB();return uw=function(){try{var t=e(Object,"defineProperty");return t({},"",{}),t}catch(e){}}()}();return uj=function(t,n,r){"__proto__"==n&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}}(),t=az(),n=Object.prototype.hasOwnProperty;return uS=function(r,i,a){var o=r[i];n.call(r,i)&&t(o,a)&&(void 0!==a||i in r)||e(r,i,a)}}(),t=aG(),n=function(){if(uE)return u_;uE=1;var e=/^(?:0|[1-9]\d*)$/;return u_=function(t,n){var r=typeof t;return!!(n=null==n?0x1fffffffffffff:n)&&("number"==r||"symbol"!=r&&e.test(t))&&t>-1&&t%1==0&&t<n}}(),r=nV(),i=aX();return uT=function(a,o,s,l){if(!r(a))return a;o=t(o,a);for(var c=-1,u=o.length,d=u-1,h=a;null!=h&&++c<u;){var f=i(o[c]),p=s;if("__proto__"===f||"constructor"===f||"prototype"===f)break;if(c!=d){var g=h[f];void 0===(p=l?l(g,f,h):void 0)&&(p=r(g)?g:n(o[c+1])?[]:{})}e(h,f,p),h=h[f]}return a}}();return uO=function(t,n,r){return null==t?t:e(t,n,r)}}()),aK=nz(function(){if(uL)return uI;uL=1;var e=aW(),t=uP?uD:(uP=1,uD=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}),n=aR(),r=nY(),i=aU(),a=aX(),o=aY();return uI=function(s){return n(s)?e(s,a):r(s)?[s]:t(i(o(s)))}}()),aZ={};[{animated:function(){return function(){var e=void 0!==this.length;if(!(this._private.cy||this).styleEnabled())return!1;var t=(e?this:[this])[0];if(t)return t._private.animation.current.length>0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t<e.length;t++)e[t]._private.animation.queue=[];return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=void 0!==this.length,r=n?this:[this],i=this._private.cy||this,a=!n,o=!a;if(!i.styleEnabled())return this;var s=i.style();if(0===Object.keys(e=nO({},e,t)).length)return new aI(r[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(o&&(e.style=s.getPropsList(e.style||e.css),e.css=void 0),o&&null!=e.renderedPosition){var l=e.renderedPosition,c=i.pan(),u=i.zoom();e.position=rI(l,u,c)}if(a&&null!=e.panBy){var d=e.panBy,h=i.pan();e.pan={x:h.x+d.x,y:h.y+d.y}}var f=e.center||e.centre;if(a&&null!=f){var p=i.getCenterPan(f.eles,e.zoom);null!=p&&(e.pan=p)}if(a&&null!=e.fit){var g=e.fit,v=i.getFitViewport(g.eles||g.boundingBox,g.padding);null!=v&&(e.pan=v.pan,e.zoom=v.zoom)}if(a&&nc(e.zoom)){var x=i.getZoomedViewport(e.zoom);null!=x?(x.zoomed&&(e.zoom=x.zoom),x.panned&&(e.pan=x.pan)):e.zoom=null}return new aI(r[0],e)}},animate:function(){return function(e,t){var n=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=nO({},e,t));for(var r=0;r<n.length;r++){var i=n[r],a=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,a?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=void 0!==this.length?this:[this],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var i=0;i<n.length;i++){for(var a=n[i]._private,o=a.animation.current,s=0;s<o.length;s++){var l=o[s]._private;t&&(l.duration=0)}e&&(a.animation.queue=[]),t||(a.animation.current=[])}return r.notify("draw"),this}}},{data:function(e){return e=nO({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r,i=e,a=void 0!==this.length,o=a?this:[this],s=a?this[0]:this;if(no(t)){var l,c=-1!==t.indexOf(".")&&aK(t);if(i.allowGetting&&void 0===n)return s&&(i.beforeGet(s),l=c&&void 0===s._private[i.field][t]?a$(s._private[i.field],c):s._private[i.field][t]),l;if(i.allowSetting&&void 0!==n&&!i.immutableKeys[t]){var u=t5({},t,n);i.beforeSet(this,u);for(var d=0,h=o.length;d<h;d++){var f=o[d];i.canSet(f)&&(c&&void 0===s._private[i.field][t]?aq(f._private[i.field],c,n):f._private[i.field][t]=n)}i.updateStyle&&this.updateStyle(),i.onSet(this),i.settingTriggersEvent&&this[i.triggerFnName](i.settingEvent)}}else if(i.allowSetting&&nc(t)){var p,g,v=Object.keys(t);i.beforeSet(this,t);for(var x=0;x<v.length;x++)if(g=t[p=v[x]],!i.immutableKeys[p])for(var y=0;y<o.length;y++){var b=o[y];i.canSet(b)&&(b._private[i.field][p]=g)}i.updateStyle&&this.updateStyle(),i.onSet(this),i.settingTriggersEvent&&this[i.triggerFnName](i.settingEvent)}else if(i.allowBinding&&ns(t))this.on(i.bindingEvent,t);else if(i.allowGetting&&void 0===t)return s&&(i.beforeGet(s),r=s._private[i.field]),r;return this}},removeData:function(e){return e=nO({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=void 0!==this.length?this:[this];if(no(t)){for(var i=t.split(/\s+/),a=i.length,o=0;o<a;o++){var s=i[o];if(!nv(s)&&!n.immutableKeys[s])for(var l=0,c=r.length;l<c;l++)r[l]._private[n.field][s]=void 0}n.triggerEvent&&this[n.triggerFnName](n.event)}else if(void 0===t){for(var u=0,d=r.length;u<d;u++)for(var h=r[u]._private[n.field],f=Object.keys(h),p=0;p<f.length;p++){var g=f[p];n.immutableKeys[g]||(h[g]=void 0)}n.triggerEvent&&this[n.triggerFnName](n.event)}return this}}},{eventAliasesOn:function(e){e.addListener=e.listen=e.bind=e.on,e.unlisten=e.unbind=e.off=e.removeListener,e.trigger=e.emit,e.pon=e.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new aP(function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)})}}}].forEach(function(e){nO(aZ,e)});var aQ={animate:aZ.animate(),animation:aZ.animation(),animated:aZ.animated(),clearQueue:aZ.clearQueue(),delay:aZ.delay(),delayAnimation:aZ.delayAnimation(),stop:aZ.stop()},aJ={classes:function(e){if(void 0===e){var t=[];return this[0]._private.classes.forEach(function(e){return t.push(e)}),t}nl(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],r=new rb(e),i=0;i<this.length;i++){for(var a=this[i],o=a._private,s=o.classes,l=!1,c=0;c<e.length;c++){var u=e[c];if(!s.has(u)){l=!0;break}}l||(l=s.size!==e.length),l&&(o.classes=r,n.push(a))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){nl(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i<a;i++)for(var o=this[i],s=o._private.classes,l=!1,c=0;c<e.length;c++){var u=e[c],d=s.has(u),h=!1;t||n&&!d?(s.add(u),h=!0):(!t||n&&d)&&(s.delete(u),h=!0),!l&&h&&(r.push(o),l=!0)}return r.length>0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};aJ.className=aJ.classNames=aJ.classes;var a0={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:nS,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};for(lM=0,a0.variable="(?:[\\w-.]|(?:\\\\"+a0.metaChar+"))+",a0.className="(?:[\\w-]|(?:\\\\"+a0.metaChar+"))+",a0.value=a0.string+"|"+a0.number,a0.id=a0.variable,lE=a0.comparatorOp.split("|");lM<lE.length;lM++)lT=lE[lM],a0.comparatorOp+="|@"+lT;for(lM=0,lE=a0.comparatorOp.split("|");lM<lE.length;lM++)(lT=lE[lM]).indexOf("!")>=0||"="!==lT&&(a0.comparatorOp+="|\\!"+lT);var a1=function(){return{checks:[]}},a2=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return -1*nM(e.selector,t.selector)}),a5=function(){for(var e,t={},n=0;n<a2.length;n++)t[(e=a2[n]).selector]=e.matches;return t}(),a3="("+a2.map(function(e){return e.selector}).join("|")+")",a4=function(e){return e.replace(RegExp("\\\\("+a0.metaChar+")","g"),function(e,t){return t})},a6=function(e,t,n){e[e.length-1]=n},a7=[{name:"group",query:!0,regex:"("+a0.group+")",populate:function(e,t,n){var r=t3(n,1)[0];t.checks.push({type:0,value:"*"===r?r:r+"s"})}},{name:"state",query:!0,regex:a3,populate:function(e,t,n){var r=t3(n,1)[0];t.checks.push({type:7,value:r})}},{name:"id",query:!0,regex:"\\#("+a0.id+")",populate:function(e,t,n){var r=t3(n,1)[0];t.checks.push({type:8,value:a4(r)})}},{name:"className",query:!0,regex:"\\.("+a0.className+")",populate:function(e,t,n){var r=t3(n,1)[0];t.checks.push({type:9,value:a4(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+a0.variable+")\\s*\\]",populate:function(e,t,n){var r=t3(n,1)[0];t.checks.push({type:4,field:a4(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+a0.variable+")\\s*("+a0.comparatorOp+")\\s*("+a0.value+")\\s*\\]",populate:function(e,t,n){var r=t3(n,3),i=r[0],a=r[1],o=r[2];o=null!=RegExp("^"+a0.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:3,field:a4(i),operator:a,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+a0.boolOp+")\\s*("+a0.variable+")\\s*\\]",populate:function(e,t,n){var r=t3(n,2),i=r[0],a=r[1];t.checks.push({type:5,field:a4(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+a0.meta+")\\s*("+a0.comparatorOp+")\\s*("+a0.number+")\\s*\\]\\]",populate:function(e,t,n){var r=t3(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:6,field:a4(i),operator:a,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:a0.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=n&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=a1()}},{name:"directedEdge",separator:!0,regex:a0.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n=a1(),r=a1();return n.checks.push({type:11,source:t,target:r}),a6(e,t,n),e.edgeCount++,r}var i=a1(),a=a1();return i.checks.push({type:12,source:t,target:a}),a6(e,t,i),e.edgeCount++,a}},{name:"undirectedEdge",separator:!0,regex:a0.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n=a1(),r=a1();return n.checks.push({type:10,nodes:[t,r]}),a6(e,t,n),e.edgeCount++,r}var i=a1(),a=a1();return i.checks.push({type:14,node:t,neighbor:a}),a6(e,t,i),a}},{name:"child",separator:!0,regex:a0.child,populate:function(e,t){if(null==e.currentSubject){var n=a1(),r=a1(),i=e[e.length-1];return n.checks.push({type:15,parent:i,child:r}),a6(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=a1(),o=e[e.length-1],s=a1(),l=a1(),c=a1(),u=a1();return a.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:20}],u.checks.push({type:20}),s.checks.push({type:17,parent:u,child:c}),a6(e,o,a),e.currentSubject=l,e.compoundCount++,c}var d=a1(),h=a1(),f=[{type:17,parent:d,child:h}];return d.checks=t.checks,t.checks=f,e.compoundCount++,h}},{name:"descendant",separator:!0,regex:a0.descendant,populate:function(e,t){if(null==e.currentSubject){var n=a1(),r=a1(),i=e[e.length-1];return n.checks.push({type:16,ancestor:i,descendant:r}),a6(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=a1(),o=e[e.length-1],s=a1(),l=a1(),c=a1(),u=a1();return a.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:20}],u.checks.push({type:20}),s.checks.push({type:18,ancestor:u,descendant:c}),a6(e,o,a),e.currentSubject=l,e.compoundCount++,c}var d=a1(),h=a1(),f=[{type:18,ancestor:d,descendant:h}];return d.checks=t.checks,t.checks=f,e.compoundCount++,h}},{name:"subject",modifier:!0,regex:a0.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return ro("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=null==n?null:n.type;11===r?n.type=13:10===r&&(n.type=14,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];a7.forEach(function(e){return e.regexObj=RegExp("^"+e.regex)});var a9=function(e){for(var t,n,r,i=0;i<a7.length;i++){var a=a7[i],o=a.name,s=e.match(a.regexObj);if(null!=s){n=s,t=a,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},a8=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},oe=function(e,t,n){var r,i,a,o=no(e),s=nu(e),l=no(n),c=!1,u=!1,d=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),u=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),c=!0),(o||l||c)&&(i=o||s?""+e:"",a=""+n),c&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e<n;break;case"<=":d=!0,r=e<=n;break;default:r=!1}return u&&(null!=e||!d)&&(r=!r),r},ot=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}},on=function(e,t){return e.data(t)},or=[],oi=function(e,t){return e.checks.every(function(e){return or[e.type](e,t)})};or[0]=function(e,t){var n=e.value;return"*"===n||n===t.group()},or[7]=function(e,t){var n;return n=e.value,a5[n](t)},or[8]=function(e,t){var n=e.value;return t.id()===n},or[9]=function(e,t){var n=e.value;return t.hasClass(n)},or[6]=function(e,t){var n=e.field,r=e.operator,i=e.value;return oe(t[n](),r,i)},or[3]=function(e,t){var n=e.field,r=e.operator,i=e.value;return oe(on(t,n),r,i)},or[5]=function(e,t){var n=e.field,r=e.operator;return ot(on(t,n),r)},or[4]=function(e,t){var n=e.field;return e.operator,void 0!==on(t,n)},or[10]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return oi(n,i)&&oi(r,a)||oi(r,i)&&oi(n,a)},or[14]=function(e,t){return oi(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&oi(e.neighbor,t)})},or[11]=function(e,t){return oi(e.source,t.source())&&oi(e.target,t.target())},or[12]=function(e,t){return oi(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&oi(e.target,t)})},or[13]=function(e,t){return oi(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&oi(e.source,t)})},or[15]=function(e,t){return oi(e.child,t)&&oi(e.parent,t.parent())},or[17]=function(e,t){return oi(e.parent,t)&&t.children().some(function(t){return oi(e.child,t)})},or[16]=function(e,t){return oi(e.descendant,t)&&t.ancestors().some(function(t){return oi(e.ancestor,t)})},or[18]=function(e,t){return oi(e.ancestor,t)&&t.descendants().some(function(t){return oi(e.descendant,t)})},or[19]=function(e,t){return oi(e.subject,t)&&oi(e.left,t)&&oi(e.right,t)},or[20]=function(){return!0},or[1]=function(e,t){return e.value.has(t)},or[2]=function(e,t){return(0,e.value)(t)};var oa=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||no(e)&&e.match(/^\s*$/)||(nh(e)?this.addQuery({checks:[{type:1,value:e.collection()}]}):ns(e)?this.addQuery({checks:[{type:2,value:e}]}):no(e)?this.parse(e)||(this.invalid=!0):ri("A selector must be created from a string; found "))},oo=oa.prototype;[{parse:function(e){var t=this.inputText=e,n=this[0]=a1();for(this.length=1,t=a8(t);;){var r=a9(t);if(null==r.expr)return ro("The selector `"+e+"`is invalid"),!1;var i=r.match.slice(1),a=r.expr.populate(this,n,i);if(!1===a)return!1;if(null!=a&&(n=a),(t=r.remaining).match(/^\s*$/))break}var o=this[this.length-1];null!=this.currentSubject&&(o.subject=this.currentSubject),o.edgeCount=this.edgeCount,o.compoundCount=this.compoundCount;for(var s=0;s<this.length;s++){var l=this[s];if(l.compoundCount>0&&l.edgeCount>0)return ro("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return ro("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&ro("The selector `"+e+"` 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},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return no(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case 0:var l=e(s);return l.substring(0,l.length-1);case 3:return"["+r.field+n(e(r.operator))+t(s)+"]";case 5:var c=r.operator,u=r.field;return"["+e(c)+u+"]";case 4:return"["+r.field+"]";case 6:var d=r.operator;return"[["+r.field+n(e(d))+t(s)+"]]";case 7:return s;case 8:return"#"+s;case 9:return"."+s;case 17:case 15:return i(r.parent,a)+n(">")+i(r.child,a);case 18:case 16:return i(r.ancestor,a)+" "+i(r.descendant,a);case 19:var h=i(r.left,a),f=i(r.subject,a),p=i(r.right,a);return h+(h.length>0?" ":"")+f+p;case 20:return""}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)},"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},{matches:function(e){for(var t=0;t<this.length;t++)if(oi(this[t],e))return!0;return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&8===t[0].checks[0].type)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++)if(oi(t[n],e))return!0;return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}}].forEach(function(e){return nO(oo,e)}),oo.text=function(){return this.inputText},oo.size=function(){return this.length},oo.eq=function(e){return this[e]},oo.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},oo.addQuery=function(e){this[this.length++]=e},oo.selector=oo.toString;var os={allAre:function(e){var t=new oa(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new oa(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}))},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};os.allAreNeighbours=os.allAreNeighbors,os.has=os.contains,os.equal=os.equals=os.same;var ol=function(e,t){return function(n,r,i,a){if(null==n?o="":nh(n)&&1===n.length&&(o=n.id()),1!==this.length||!o)return e.call(this,n,r,i,a);var o,s=this[0]._private,l=s.traversalCache=s.traversalCache||{},c=l[t]=l[t]||[],u=n5(o),d=c[u];return d||(c[u]=e.call(this,n,r,i,a))}},oc={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t=(t=t||r).intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:ol(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return!function e(n){for(var r=0;r<n.length;r++){var i=n[r];t.push(i),i.children().nonempty()&&e(i.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function ou(e,t,n,r){for(var i=[],a=new rb,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?i.push(l):o&&r(i,a,l)}for(;i.length>0;){var c=i.shift();t(c),a.add(c.id()),o&&r(i,a,c)}return e}function od(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}function oh(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function of(e,t,n){oh(e,t,n),od(e,t,n)}oc.forEachDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return ou(this,e,t,od)},oc.forEachUp=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return ou(this,e,t,oh)},oc.forEachUpAndDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return ou(this,e,t,of)},oc.ancestors=oc.parents,(uR=uB={data:aZ.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:aZ.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:aZ.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:aZ.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:aZ.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:aZ.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=uR.data,uR.removeAttr=uR.removeData;var op={};function om(e){return function(t){if(void 0===t&&(t=!0),0!==this.length)if(!this.isNode()||this.removed())return;else{for(var n=0,r=this[0],i=r._private.edges,a=0;a<i.length;a++){var o=i[a];!t&&o.isLoop()||(n+=e(r,o))}return n}}}function og(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);void 0!==o&&(void 0===r||t(o,r))&&(r=o)}return r}}nO(op,{degree:om(function(e,t){return t.source().same(t.target())?2:1}),indegree:om(function(e,t){return+!!t.target().same(e)}),outdegree:om(function(e,t){return+!!t.source().same(e)})}),nO(op,{minDegree:og("degree",function(e,t){return e<t}),maxDegree:og("degree",function(e,t){return e>t}),minIndegree:og("indegree",function(e,t){return e<t}),maxIndegree:og("indegree",function(e,t){return e>t}),minOutdegree:og("outdegree",function(e,t){return e<t}),maxOutdegree:og("outdegree",function(e,t){return e>t})}),nO(op,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var ov=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};i.isParent()&&(0!==o.x||0!==o.y)&&i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},ox={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){ov(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(uF=uz={position:aZ.data(ox),silentPosition:aZ.data(nO({},ox,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){ov(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(nc(e))t?this.silentPosition(e):this.position(e);else if(ns(e)){var n=this.cy();n.startBatch();for(var r=0;r<this.length;r++){var i=this[r],a=void 0;(a=e(i,r))&&(t?i.silentPosition(a):i.position(a))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(nc(e)?(r={x:nu(e.x)?e.x:0,y:nu(e.y)?e.y:0},n=t):no(e)&&nu(t)&&((r={x:0,y:0})[e]=t),null!=r){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),l={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(l):o.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return nc(e)?this.shift(e,!0):no(e)&&nu(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=nc(e)?e:void 0,s=void 0!==o||void 0!==t&&no(e);if(n&&n.isNode())if(!s)return(o=rP(n.position(),i,a),void 0===e)?o:o[e];else for(var l=0;l<this.length;l++){var c=this[l];void 0!==t?c.position(e,(t-a[e])/i):void 0!==o&&c.position(rI(o,i,a))}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=nc(e)?e:void 0,a=void 0!==i||void 0!==t&&no(e),o=r.hasCompoundNodes();if(n&&n.isNode())if(a)for(var s=0;s<this.length;s++){var l=this[s],c=o?l.parent():null,u=c&&c.length>0;u&&(c=c[0]);var d=u?c.position():{x:0,y:0};void 0!==t?l.position(e,t+d[e]):void 0!==i&&l.position({x:i.x+d.x,y:i.y+d.y})}else{var h=n.position(),f=o?n.parent():null,p=f&&f.length>0;p&&(f=f[0]);var g=p?f.position():{x:0,y:0};return(i={x:h.x-g.x,y:h.y-g.y},void 0===e)?i:i[e]}else if(!a)return;return this}}).modelPosition=uF.point=uF.position,uF.modelPositions=uF.points=uF.positions,uF.renderedPoint=uF.renderedPosition,uF.relativePoint=uF.relativePosition,uV=uH={},uH.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},uH.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()&&this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}}),this},uH.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;for(var n=0;n<this.length;n++){var r=this[n],i=r._private;(!i.compoundBoundsClean||e)&&(!function(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;(0===a.w||0===a.h)&&((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var c=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(c=100*c/i.height.val);var u=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(u=100*u/i.height.val);var d=x(i.width.val-a.w,s,l),h=d.biasDiff,f=d.biasComplementDiff,p=x(i.height.val-a.h,c,u),g=p.biasDiff,v=p.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"===n.units)switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}return"px"===n.units?n.pfValue:0}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-h+a.x1+a.x2+f)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function x(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}(r),t.batching()||(i.compoundBoundsClean=!0))}return this};var oy=function(e){return e===1/0||e===-1/0?0:e},ob=function(e,t,n,r,i){r-t==0||i-n==0||null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},ow=function(e,t){return null==t?e:ob(e,t.x1,t.y1,t.x2,t.y2)},oN=function(e,t,n){return rm(e,t,n)},oj=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},c=l[n]=l[n]||{};c.x1=r-s,c.y1=i-s,c.x2=r+s,c.y2=i+s,c.w=c.x2-c.x1,c.h=c.y2-c.y1,r1(c,1),ob(e,c.x1,c.y1,c.x2,c.y2)}}},ok=function(e,t,n){if(!t.cy().headless()){a=n?n+"-":"";var r=t._private,i=r.rstyle;if(t.pstyle(a+"label").strValue){var a,o,s,l,c,u=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=oN(i,"labelWidth",n),f=oN(i,"labelHeight",n),p=oN(i,"labelX",n),g=oN(i,"labelY",n),v=t.pstyle(a+"text-margin-x").pfValue,x=t.pstyle(a+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle(a+"text-rotation"),w=t.pstyle("text-outline-width").pfValue,N=t.pstyle("text-border-width").pfValue/2,j=t.pstyle("text-background-padding").pfValue,k=h/2,S=f/2;if(y)o=p-k,s=p+k,l=g-S,c=g+S;else{switch(u.value){case"left":o=p-h,s=p;break;case"center":o=p-k,s=p+k;break;case"right":o=p,s=p+h}switch(d.value){case"top":l=g-f,c=g;break;case"center":l=g-S,c=g+S;break;case"bottom":l=g,c=g+f}}var C=v-Math.max(w,N)-j-2,_=v+Math.max(w,N)+j+2,E=x-Math.max(w,N)-j-2,T=x+Math.max(w,N)+j+2;o+=C,s+=_,l+=E,c+=T;var M=n||"main",O=r.labelBounds,A=O[M]=O[M]||{};A.x1=o,A.y1=l,A.x2=s,A.y2=c,A.w=s-o,A.h=c-l,A.leftPad=C,A.rightPad=_,A.topPad=E,A.botPad=T;var D=y&&"autorotate"===b.strValue,P=null!=b.pfValue&&0!==b.pfValue;if(D||P){var I=D?oN(r.rstyle,"labelAngle",n):b.pfValue,L=Math.cos(I),R=Math.sin(I),B=(o+s)/2,F=(l+c)/2;if(!y){switch(u.value){case"left":B=s;break;case"right":B=o}switch(d.value){case"top":F=c;break;case"bottom":F=l}}var z=function(e,t){return{x:(e-=B)*L-(t-=F)*R+B,y:e*R+t*L+F}},V=z(o,l),H=z(o,c),U=z(s,l),W=z(s,c);o=Math.min(V.x,H.x,U.x,W.x),s=Math.max(V.x,H.x,U.x,W.x),l=Math.min(V.y,H.y,U.y,W.y),c=Math.max(V.y,H.y,U.y,W.y)}var Y=M+"Rot",G=O[Y]=O[Y]||{};G.x1=o,G.y1=l,G.x2=s,G.y2=c,G.w=s-o,G.h=c-l,ob(e,o,l,s,c),ob(r.labelBounds.all,o,l,s,c)}return e}},oS=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value+t.pstyle("outline-offset").value;oC(e,t,n,r,"outside",r/2)}},oC=function(e,t,n,r,i,a){if(0!==n&&!(r<=0)&&"inside"!==i){var o=t.cy(),s=t.pstyle("shape").value,l=o.renderer().nodeShapes[s],c=t.position(),u=c.x,d=c.y,h=t.width(),f=t.height();l.hasMiterBounds?("center"===i&&(r/=2),ow(e,l.miterBounds(u,d,h,f,r))):null!=a&&a>0&&r2(e,[a,a,a,a])}},o_=function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,r=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;oC(e,t,n,r,i)}},oE=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=rZ(),o=e._private,s=e.isNode(),l=e.isEdge(),c=o.rstyle,u=s&&r?e.pstyle("bounds-expansion").pfValue:[0],d=function(e){return"none"!==e.pstyle("display").value},h=!r||d(e)&&(!l||d(e.source())&&d(e.target()));if(h){var f=0;r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(f=e.pstyle("overlay-padding").value);var p=0;r&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(p=e.pstyle("underlay-padding").value);var g=Math.max(f,p),v=0;if(r&&(v=e.pstyle("width").pfValue/2),s&&t.includeNodes){var x=e.position();S=x.x,C=x.y;var y=e.outerWidth()/2,b=e.outerHeight()/2;w=S-y,N=S+y,ob(a,w,j=C-b,N,k=C+b),r&&oS(a,e),r&&t.includeOutlines&&!i&&oS(a,e),r&&o_(a,e)}else if(l&&t.includeEdges)if(r&&!i){var w,N,j,k,S,C,_,E=e.pstyle("curve-style").strValue;if(w=Math.min(c.srcX,c.midX,c.tgtX),N=Math.max(c.srcX,c.midX,c.tgtX),j=Math.min(c.srcY,c.midY,c.tgtY),k=Math.max(c.srcY,c.midY,c.tgtY),w-=v,N+=v,ob(a,w,j-=v,N,k+=v),"haystack"===E){var T=c.haystackPts;if(T&&2===T.length){if(w=T[0].x,j=T[0].y,N=T[1].x,k=T[1].y,w>N){var M=w;w=N,N=M}if(j>k){var O=j;j=k,k=O}ob(a,w-v,j-v,N+v,k+v)}}else if("bezier"===E||"unbundled-bezier"===E||nk(E,"segments")||nk(E,"taxi")){switch(E){case"bezier":case"unbundled-bezier":_=c.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":_=c.linePts}if(null!=_)for(var A=0;A<_.length;A++){var D=_[A];w=D.x-v,N=D.x+v,ob(a,w,j=D.y-v,N,k=D.y+v)}}}else{var P=e.source().position(),I=e.target().position();if(w=P.x,N=I.x,j=P.y,k=I.y,w>N){var L=w;w=N,N=L}if(j>k){var R=j;j=k,k=R}w-=v,N+=v,ob(a,w,j-=v,N,k+=v)}if(r&&t.includeEdges&&l&&(oj(a,e,"mid-source"),oj(a,e,"mid-target"),oj(a,e,"source"),oj(a,e,"target")),r&&"yes"===e.pstyle("ghost").value){var B=e.pstyle("ghost-offset-x").pfValue,F=e.pstyle("ghost-offset-y").pfValue;ob(a,a.x1+B,a.y1+F,a.x2+B,a.y2+F)}var z=o.bodyBounds=o.bodyBounds||{};r5(z,a),r2(z,u),r1(z,1),r&&(w=a.x1,N=a.x2,j=a.y1,k=a.y2,ob(a,w-g,j-g,N+g,k+g));var V=o.overlayBounds=o.overlayBounds||{};r5(V,a),r2(V,u),r1(V,1);var H=o.labelBounds=o.labelBounds||{};null!=H.all?rQ(H.all):H.all=rZ(),r&&t.includeLabels&&(t.includeMainLabels&&ok(a,e,null),l&&(t.includeSourceLabels&&ok(a,e,"source"),t.includeTargetLabels&&ok(a,e,"target")))}return a.x1=oy(a.x1),a.y1=oy(a.y1),a.x2=oy(a.x2),a.y2=oy(a.y2),a.w=oy(a.x2-a.x1),a.h=oy(a.y2-a.y1),a.w>0&&a.h>0&&h&&(r2(a,u),r1(a,1)),a},oT=function(e){var t=0,n=function(e){return!!e<<t++};return 0+n(e.incudeNodes)+n(e.includeEdges)+n(e.includeLabels)+n(e.includeMainLabels)+n(e.includeSourceLabels)+n(e.includeTargetLabels)+n(e.includeOverlays)+n(e.includeOutlines)},oM=function(e){var t=function(e){return Math.round(e)};if(e.isEdge()){var n=e.source().position(),r=e.target().position();return n2([t(n.x),t(n.y),t(r.x),t(r.y)])}var i=e.position();return n2([t(i.x),t(i.y)])},oO=function(e,t){var n,r=e._private,i=e.isEdge(),a=null==t?oD:oT(t);if(null==r.bbCache?(r.bbCache=n=oE(e,oA),r.bbCachePosKey=oM(e)):n=r.bbCache,a!==oD){var o=e.isNode();n=rZ(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?ow(n,r.overlayBounds):ow(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?ow(n,r.labelBounds.all):(t.includeMainLabels&&ow(n,r.labelBounds.mainRot),t.includeSourceLabels&&ow(n,r.labelBounds.sourceRot),t.includeTargetLabels&&ow(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},oA={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},oD=oT(oA),oP=rd(oA);uH.boundingBox=function(e){var t,n=void 0===e||void 0===e.useCache||!0===e.useCache,r=ny(function(e){var t=e._private;return null==t.bbCache||t.styleDirty||t.bbCachePosKey!==oM(e)},function(e){return e.id()});if(n&&1===this.length&&!r(this[0]))e=void 0===e?oA:oP(e),t=oO(this[0],e);else{t=rZ();var i=oP(e=e||oA),a=this.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),a&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var o=0;o<this.length;o++){var s=this[o];r(s)&&s.dirtyBoundingBoxCache(),ow(t,oO(s,i))}}return t.x1=oy(t.x1),t.y1=oy(t.y1),t.x2=oy(t.x2),t.y2=oy(t.y2),t.w=oy(t.x2-t.x1),t.h=oy(t.y2-t.y1),t},uH.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},uH.boundingBoxAt=function(e){var t,n=this.nodes(),r=this.cy(),i=r.hasCompoundNodes(),a=r.collection();if(i&&(a=n.filter(function(e){return e.isParent()}),n=n.not(a)),nc(e)){var o=e;e=function(){return o}}r.startBatch(),n.forEach(function(t,n){return t._private.bbAtOldPos=e(t,n)}).silentPositions(e),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var s={x1:(t=this.boundingBox({useCache:!1})).x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h};return n.silentPositions(function(e){return e._private.bbAtOldPos}),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),r.endBatch(),s},uV.boundingbox=uV.bb=uV.boundingBox,uV.renderedBoundingbox=uV.renderedBoundingBox,uU=uW={};var oI=function(e){e.uppercaseName=nj(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=nj(e.outerName),uU[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t)if(!r)return 1;else{if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);return"label"===i.strValue?(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):i.pfValue}},uU["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)if(!n)return 1;else{var r=t[e.name](),i=t.pstyle("border-position").value;return r+("center"===i?t.pstyle("border-width").pfValue:"outside"===i?2*t.pstyle("border-width").pfValue:0)+2*t.padding()}},uU["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},uU["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};oI({name:"width"}),oI({name:"height"}),uW.padding=function(){var e=this[0],t=e._private;return e.isParent()&&(e.updateCompoundBounds(),void 0!==t.autoPadding)?t.autoPadding:e.pstyle("padding").pfValue},uW.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},uW.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var oL=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},oR=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return rP(t(e),n.zoom(),n.pan())}},oB=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(e){return rP(e,i,r)})}},oF={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},oz=nO({},uz,uH,uW,Object.keys(oF).reduce(function(e,t){var n=oF[t],r="rendered"+t[0].toUpperCase()+t.substr(1);return e[t]=function(){return oL(this,n.get)},n.mult?e[r]=function(){return oB(this,n.get)}:e[r]=function(){return oR(this,n.get)},e},{})),oV=function(e,t){this.recycle(e,t)};function oH(){return!1}function oU(){return!0}oV.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=oH,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?oU:oH):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=oU;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=oU;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=oU,this.stopPropagation()},isDefaultPrevented:oH,isPropagationStopped:oH,isImmediatePropagationStopped:oH};var oW=/^([^.]+)(\.(?:[^.]+))?$/,oY={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},oG=Object.keys(oY),oX={};function o$(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:oX,t=arguments.length>1?arguments[1]:void 0,n=0;n<oG.length;n++){var r=oG[n];this[r]=e[r]||oY[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var oq=o$.prototype,oK=function(e,t,n,r,i,a,o){ns(r)&&(i=r,r=null),o&&(a=null==a?o:nO({},a,o));for(var s=nl(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var c=s[l];if(!nv(c)){var u=c.match(oW);if(u&&!1===t(e,c,u[1],u[2]?u[2]:null,r,i,a))break}}},oZ=function(e,t){return e.addEventFields(e.context,t),new oV(t.type,t)},oQ=function(e,t,n){if("event"===na(n))return void t(e,n);if(nc(n))return void t(e,oZ(e,n));for(var r=nl(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!nv(a)){var o=a.match(oW);if(o){var s=oZ(e,{type:o[1],namespace:o[2]?o[2]:null,target:e.context});t(e,s)}}}};oq.on=oq.addListener=function(e,t,n,r,i){return oK(this,function(e,t,n,r,i,a,o){ns(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})},e,t,n,r,i),this},oq.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},oq.removeListener=oq.off=function(e,t,n,r){var i=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var a=this.listeners,o=function(o){var s=a[o];oK(i,function(t,n,r,i,l,c){if((s.type===r||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!c||s.callback===c))return a.splice(o,1),!1},e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},oq.removeAllListeners=function(){return this.removeListener("*")},oq.emit=oq.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,nl(t)||(t=[t]),oQ(this,function(e,a){null!=n&&(i=(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}]).length);for(var o=0;o<i;o++)!function(){var n=r[o];if(n.type===a.type&&(!n.namespace||n.namespace===a.namespace||".*"===n.namespace)&&e.eventMatches(e.context,n,a)){var i=[a];null!=t&&rp(i,t),e.beforeEmit(e.context,n,a),n.conf&&n.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==n}));var s=e.callbackContext(e.context,n,a),l=n.callback.apply(s,i);e.afterEmit(e.context,n,a),!1===l&&(a.stopPropagation(),a.preventDefault())}}();e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var oJ={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&nf(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},o0=function(e){return no(e)?new oa(e):e},o1={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new o$(oJ,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=o0(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=o0(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=o0(t),i=0;i<this.length;i++)this[i].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=o0(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};aZ.eventAliasesOn(o1);var o2={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(no(e)||nh(e))return new oa(e).filter(this);if(ns(e)){for(var n=this.spawn(),r=0;r<this.length;r++){var i=this[r];(t?e.apply(t,[i,r,this]):e(i,r,this))&&n.push(i)}return n}return this.spawn()},not:function(e){if(!e)return this;no(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(no(e))return this.filter(e);for(var t=this.spawn(),n=this.length<e.length,r=n?this:e,i=n?e:this,a=0;a<r.length;a++){var o=r[a];i.has(o)&&t.push(o)}return t},xor:function(e){var t=this._private.cy;no(e)&&(e=t.$(e));var n=this.spawn(),r=e,i=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return i(this,r),i(r,this),n},diff:function(e){var t=this._private.cy;no(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=e,o=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}};return o(this,a,n),o(a,this,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(no(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];this.has(a)||r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&no(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var l=this.length++;this[l]=o,i.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&no(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=0;r<this.length;r++){var i=this[r],a=t?e.apply(t,[i,r,this]):e(i,r,this);n.push(a)}return n},reduce:function(e,t){for(var n=t,r=0;r<this.length;r++)n=e(n,this[r],r,this);return n},max:function(e,t){for(var n,r=-1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o>r&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o<r&&(r=o,n=a)}return{value:r,ele:n}}};o2.u=o2["|"]=o2["+"]=o2.union=o2.or=o2.add,o2["\\"]=o2["!"]=o2["-"]=o2.difference=o2.relativeComplement=o2.subtract=o2.not,o2.n=o2["&"]=o2["."]=o2.and=o2.intersection=o2.intersect,o2["^"]=o2["(+)"]=o2["(-)"]=o2.symmetricDifference=o2.symdiff=o2.xor,o2.fnFilter=o2.filterFn=o2.stdFilter=o2.filter,o2.complement=o2.abscomp=o2.absoluteComplement;var o5=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?n8:0}var i=r(e)-r(t);if(0!==i)return i;function a(e){return"auto"===e.pstyle("z-index-compare").value?+!!e.isNode():0}var o=a(e)-a(t);if(0!==o)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==s?s:e.poolIndex()-t.poolIndex()},o3={forEach:function(e,t){if(ns(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if(!1===(t?e.apply(t,[i,r,this]):e(i,r,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;null==t&&(t=r),null==e&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!ns(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(o5)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:n8-1}var r=t.source,i=t.target;return Math.max(r.zDepth(),i.zDepth(),0)}}};o3.each=o3.forEach,("u"<typeof Symbol?"undefined":t7(Symbol))!="undefined"&&"undefined"!=t7(Symbol.iterator)&&(o3[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return t5({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})});var o4=rd({nodeDimensionsIncludeLabels:!1}),o6={layoutDimensions:function(e){if(e=o4(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var t,n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return(0===t.w||0===t.h)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(e){return!e.isParent()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=ny(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+i.x,y:r.y+i.y}},c=t.spacingFactor&&1!==t.spacingFactor,u=function(){if(!c)return null;for(var e=rZ(),t=0;t<r.length;t++){var n=s(r[t],t);r0(e,n.x,n.y)}return e}(),d=ny(function(e,n){var r=s(e,n);return c&&(r=l(Math.abs(t.spacingFactor),u,r)),null!=t.transform&&(r=t.transform(e,r)),r},o);if(t.animate){for(var h=0;h<r.length;h++){var f=r[h],p=d(f,h);if(null==t.animateFilter||t.animateFilter(f,h)){var g=f.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else f.position(p)}if(t.fit){var v=i.animation({fit:{boundingBox:a.boundingBoxAt(d),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}else if(void 0!==t.zoom&&void 0!==t.pan){var x=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(x)}e.animations.forEach(function(e){return e.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),aP.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else r.positions(d),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(nO({},e,{eles:this}))}};function o7(e,t,n){var r,i=n._private,a=i.styleCache=i.styleCache||[];return null!=(r=a[e])?r:r=a[e]=t(n)}function o9(e,t){return e=n5(e),function(n){return o7(e,t,n)}}function o8(e,t){e=n5(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return o7(e,n,t)}}o6.createLayout=o6.makeLayout=o6.layout;var se={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(e){return e._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(n)):this.forEach(function(e){n(e),e.connectedEdges().forEach(n)}),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=this;e=!!e||void 0===e,n&&(r=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=r;return e?i.emitAndNotify("style"):i.emit("style"),r.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(nc(e))r.applyBypass(this,e,!1),this.emitAndNotify("style");else if(no(e))if(void 0===t){var i=this[0];return i?r.getStylePropertyValue(i,e):void 0}else r.applyBypass(this,e,t,!1),this.emitAndNotify("style");else if(void 0===e){var a=this[0];return a?r.getRawStyle(a):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r<this.length;r++){var i=this[r];n.removeAllBypasses(i,!1)}else{e=e.split(/\s+/);for(var a=0;a<this.length;a++){var o=this[a];n.removeBypasses(o,e,!1)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle("opacity").value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++)i*=a[o].pstyle("opacity").value;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)if(!t)return 0===e.pstyle("opacity").value;else return 0===e.effectiveOpacity()},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function st(e,t){var n=e._private.data.parent?e.parents():null;if(n){for(var r=0;r<n.length;r++)if(!t(n[r]))return!1}return!0}function sn(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||st(i,r);var s=o.source,l=o.target;return n(s)&&(!a||st(s,n))&&(s===l||n(l)&&(!a||st(l,n)))}}}var sr=o9("eleTakesUpSpace",function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())});se.takesUpSpace=o8("takesUpSpace",sn({ok:sr})),se.interactive=o8("interactive",sn({ok:o9("eleInteractive",function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&sr(e)}),parentOk:o9("parentInteractive",function(e){return"visible"===e.pstyle("visibility").value&&sr(e)}),edgeOkViaNode:sr})),se.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},se.visible=o8("visible",sn({ok:o9("eleVisible",function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&sr(e)}),edgeOkViaNode:sr})),se.hidden=function(){var e=this[0];if(e)return!e.visible()},se.isBundledBezier=o8("isBundledBezier",function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()}),se.bypass=se.css=se.style,se.renderedCss=se.renderedStyle,se.removeBypass=se.removeCss=se.removeStyle,se.pstyle=se.parsedStyle;var si={};function sa(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(1===t.length&&ns(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&nl(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],c=!e.ableField||l._private[e.ableField],u=l._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(l);if(void 0!==d&&(c=d,!d))return this}c&&(l._private[e.field]=e.value,u&&n.push(l))}var h=this.spawn(n);h.updateStyle(),h.emit(e.event),o&&h.emit(o)}return this}}function so(e){si[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},si[e.on]=sa({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),si[e.off]=sa({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}so({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),so({field:"grabbable",overrideField:function(e){return!(e.cy().autoungrabify()||e.pannable())&&void 0},on:"grabify",off:"ungrabify"}),so({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),so({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),si.deselect=si.unselect,si.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},so({field:"active",on:"activate",off:"unactivate"}),so({field:"pannable",on:"panify",off:"unpanify"}),si.inactive=function(){var e=this[0];if(e)return!e._private.active};var ss={},sl=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode()){for(var a=!1,o=i.connectedEdges(),s=0;s<o.length;s++){var l=o[s],c=l.source(),u=l.target();if(e.noIncomingEdges&&u===i&&c!==i||e.noOutgoingEdges&&c===i&&u!==i){a=!0;break}}a||n.push(i)}}return this.spawn(n,!0).filter(t)}},sc=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode())for(var a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),c=s.target();e.outgoing&&l===i?(n.push(s),n.push(c)):e.incoming&&c===i&&(n.push(s),n.push(l))}}return this.spawn(n,!0).filter(t)}},su=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],c=l.id();i[c]||(i[c]=!0,r.push(l),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};function sd(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}function sh(e){return function(t){var n=[],r=this._private.cy,i=e||{};no(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var l=o[s],c=l._private.data,u=this.hasElementWithId(c.source)&&t.hasElementWithId(c.target),d=t.hasElementWithId(c.source)&&this.hasElementWithId(c.target);if(u||d){if((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!u||i.thisIsTgt&&!d))continue;n.push(l)}}return this.spawn(n,!0)}}function sf(e){return e=nO({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,l=s._private.data.id,c=o.data.target,u=s._private.edges,d=0;d<u.length;d++){var h=u[d],f=h._private.data,p=f.target,g=f.source,v=p===c&&g===l,x=l===p&&c===g;(i.codirected&&v||!i.codirected&&(v||x))&&n.push(h)}return this.spawn(n,!0).filter(t)}}ss.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},nO(ss,{roots:sl({noIncomingEdges:!0}),leaves:sl({noOutgoingEdges:!0}),outgoers:ol(sc({outgoing:!0}),"outgoers"),successors:su({outgoing:!0}),incomers:ol(sc({incoming:!0}),"incomers"),predecessors:su({})}),nO(ss,{neighborhood:ol(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),c=s.target(),u=i===l?c:l;u.length>0&&t.push(u[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),ss.neighbourhood=ss.neighborhood,ss.closedNeighbourhood=ss.closedNeighborhood,ss.openNeighbourhood=ss.openNeighborhood,nO(ss,{source:ol(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:ol(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:sd({attr:"source"}),targets:sd({attr:"target"})}),nO(ss,{edgesWith:ol(sh(),"edgesWith"),edgesTo:ol(sh({thisIsSrc:!0}),"edgesTo")}),nO(ss,{connectedEdges:ol(function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];if(r.isNode())for(var i=r._private.edges,a=0;a<i.length;a++){var o=i[a];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:ol(function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];r.isEdge()&&(t.push(r.source()[0]),t.push(r.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:ol(sf(),"parallelEdges"),codirectedEdges:ol(sf({codirected:!0}),"codirectedEdges")}),nO(ss,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();do!function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach(function(n){n.connectedEdges().forEach(function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)})})}();while(i.length>0)return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),ss.componentsOf=ss.components;var sp=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0===e)return void ri("A collection must have a reference to the core");var i=new rx,a=!1;if(t){if(t.length>0&&nc(t[0])&&!nf(t[0])){a=!0;for(var o=[],s=new rb,l=0,c=t.length;l<c;l++){var u=t[l];null==u.data&&(u.data={});var d=u.data;if(null==d.id)d.id=rl();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var h=new rw(e,u,!1);o.push(h),s.add(d.id)}t=o}}else t=[];this.length=0;for(var f=0,p=t.length;f<p;f++){var g=t[f][0];if(null!=g){var v=g._private.data.id;(!n||!i.has(v))&&(n&&i.set(v,{index:this.length,ele:g}),this[this.length]=g,this.length++)}}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var e=this.lazyMap=new rx,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()},sm=rw.prototype=sp.prototype=Object.create(Array.prototype);sm.instanceString=function(){return"collection"},sm.spawn=function(e,t){return new sp(this.cy(),e,t)},sm.spawnSelf=function(){return this.spawn(this)},sm.cy=function(){return this._private.cy},sm.renderer=function(){return this._private.cy.renderer()},sm.element=function(){return this[0]},sm.collection=function(){return np(this)?this:new sp(this._private.cy,[this])},sm.unique=function(){return new sp(this._private.cy,this,!0)},sm.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},sm.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new sp(t)},sm.$id=sm.getElementById,sm.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},sm.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},sm.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},sm.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(nc(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=l&&l!=i.target&&(o.target=""+l,a=!0),a&&(t=t.move(o))}else{var c="parent"in e.data,u=e.data.parent;c&&(null!=u||null!=i.parent)&&u!=i.parent&&(void 0===u&&(u=null),null!=u&&(u=""+u),t=t.move({parent:u}))}}e.position&&t.position(e.position);var d=function(n,i,a){var o=e[n];null!=o&&o!==r[n]&&(o?t[i]():t[a]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var h={data:rs(r.data),position:rs(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};h.classes="";var f=0;return r.classes.forEach(function(e){return h.classes+=0==f++?e:" "+e}),h}}},sm.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},sm.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=new rw(e,this[n].json(),!1);t.push(r)}return new sp(e,t)},sm.copy=sm.clone,sm.restore=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.cy(),r=n._private,i=[],a=[],o=0,s=this.length;o<s;o++){var l=this[o];(!t||l.removed())&&(l.isNode()?i.push(l):a.push(l))}O=i.concat(a);var c=function(){O.splice(A,1),A--};for(A=0;A<O.length;A++){var u=O[A],d=u._private,h=d.data;if(u.clearTraversalCache(),t||d.removed){if(void 0===h.id)h.id=rl();else if(nu(h.id))h.id=""+h.id;else if(nv(h.id)||!no(h.id)){ri("Can not create element with invalid string ID `"+h.id+"`"),c();continue}else if(n.hasElementWithId(h.id)){ri("Can not create second element with ID `"+h.id+"`"),c();continue}}var f=h.id;if(u.isNode()){var p=d.position;null==p.x&&(p.x=0),null==p.y&&(p.y=0)}if(u.isEdge()){for(var g=["source","target"],v=g.length,x=!1,y=0;y<v;y++){var b=g[y],w=h[b];nu(w)&&(w=h[b]=""+h[b]),null==w||""===w?(ri("Can not create edge `"+f+"` with unspecified "+b),x=!0):n.hasElementWithId(w)||(ri("Can not create edge `"+f+"` with nonexistant "+b+" `"+w+"`"),x=!0)}if(x){c();continue}var N=n.getElementById(h.source),j=n.getElementById(h.target);N.same(j)?N._private.edges.push(u):(N._private.edges.push(u),j._private.edges.push(u)),u._private.source=N,u._private.target=j}d.map=new rx,d.map.set(f,{ele:u,index:0}),d.removed=!1,t&&n.addToPool(u)}for(var k=0;k<i.length;k++){var S=i[k],C=S._private.data;nu(C.parent)&&(C.parent=""+C.parent);var _=C.parent;if(null!=_||S._private.parent){var E=S._private.parent?n.collection().merge(S._private.parent):n.getElementById(_);if(E.empty())C.parent=void 0;else if(E[0].removed())ro("Node added with missing parent, reference to parent removed"),C.parent=void 0,S._private.parent=null;else{for(var T=!1,M=E;!M.empty();){if(S.same(M)){T=!0,C.parent=void 0;break}M=M.parent()}T||(E[0]._private.children.push(S),S._private.parent=E[0],r.hasCompoundNodes=!0)}}}if(O.length>0){for(var O,A,D,P=O.length===this.length?this:new sp(n,O),I=0;I<P.length;I++){var L=P[I];L.isNode()||(L.parallelEdges().clearTraversalCache(),L.source().clearTraversalCache(),L.target().clearTraversalCache())}(r.hasCompoundNodes?n.collection().merge(P).merge(P.connectedNodes()).merge(P.parent()):P).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?P.emitAndNotify("add"):t&&P.emit("add")}return this},sm.removed=function(){var e=this[0];return e&&e._private.removed},sm.inside=function(){var e=this[0];return e&&!e._private.removed},sm.remove=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=[],r={},i=this._private.cy,a=0,o=this.length;a<o;a++)!function e(i){var a=r[i.id()];if(!(t&&i.removed())&&!a)if(r[i.id()]=!0,i.isNode()){n.push(i);for(var o=i._private.edges,s=0;s<o.length;s++)e(o[s]);for(var l=i._private.children,c=0;c<l.length;c++)e(l[c])}else n.unshift(i)}(this[a]);function s(e,t){rh(e._private.edges,t),e.clearTraversalCache()}var l=[];l.ids={},this.dirtyCompoundBoundsCache(),t&&i.removeFromPool(n);for(var c=0;c<n.length;c++){var u=n[c];if(u.isEdge()){var d=u.source()[0],h=u.target()[0];s(d,u),s(h,u);for(var f=u.parallelEdges(),p=0;p<f.length;p++){var g=f[p];g.clearTraversalCache(),g.isBundledBezier()&&g.dirtyBoundingBoxCache()}}else{var v=u.parent();0!==v.length&&function(e,t){t=t[0];var n=(e=e[0])._private.children,r=e.id();rh(n,t),t._private.parent=null,l.ids[r]||(l.ids[r]=!0,l.push(e))}(v,u)}t&&(u._private.removed=!0)}var x=i._private.elements;i._private.hasCompoundNodes=!1;for(var y=0;y<x.length;y++)if(x[y].isParent()){i._private.hasCompoundNodes=!0;break}var b=new sp(this.cy(),n);b.size()>0&&(e?b.emitAndNotify("remove"):t&&b.emit("remove"));for(var w=0;w<l.length;w++){var N=l[w];t&&N.removed()||N.updateStyle()}return b},sm.move=function(e){var t=this._private.cy,n=this,r=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var i=r(e.source),a=r(e.target),o=null!=i&&t.hasElementWithId(i),s=null!=a&&t.hasElementWithId(a);(o||s)&&(t.batch(function(){n.remove(!1,!1),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],r=t._private.data;t.isEdge()&&(o&&(r.source=i),s&&(r.target=a))}n.restore(!1,!1)}),n.emitAndNotify("move"))}else if(void 0!==e.parent){var l=r(e.parent);if(null===l||t.hasElementWithId(l)){var c=null===l?void 0:l;t.batch(function(){var e=n.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var r=n[t],i=r._private.data;r.isNode()&&(i.parent=c)}e.restore(!1,!1)}),n.emitAndNotify("move")}}return this},[a_,aQ,aJ,os,oc,uB,op,oz,o1,o2,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},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 e=this[0];if(e)return e._private.group}},o3,o6,se,si,ss].forEach(function(e){nO(sm,e)});var sg=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}return function n(r,i,a){var o,s,l,c,u,d,h,f,p,g,v,x={x:-1,v:0,tension:null,friction:null},y=[0],b=0;for(r=parseFloat(r)||500,i=parseFloat(i)||20,a=a||null,x.tension=r,x.friction=i,g=(p=null!==a)?(b=n(r,i))/a*.016:.016;o=v||x,s=g,l={dx:o.v,dv:e(o)},c=t(o,.5*s,l),u=t(o,.5*s,c),d=t(o,s,u),h=1/6*(l.dx+2*(c.dx+u.dx)+d.dx),f=1/6*(l.dv+2*(c.dv+u.dv)+d.dv),o.x=o.x+h*s,o.v=o.v+f*s,v=o,y.push(1+v.x),b+=16,Math.abs(v.x)>1e-4&&Math.abs(v.v)>1e-4;);return p?function(e){return y[e*(y.length-1)|0]}:b}}(),sv=function(e,t,n,r){var i=function(e,t,n,r){var i="u">typeof Float32Array;if(4!=arguments.length)return!1;for(var a=0;a<4;++a)if("number"!=typeof arguments[a]||isNaN(arguments[a])||!isFinite(arguments[a]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var o=i?new Float32Array(11):Array(11);function s(e,t,n){return(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e}function l(e,t,n){return 3*(1-3*n+3*t)*e*e+2*(3*n-6*t)*e+3*t}var c=!1,u=function(i){return(c||(c=!0,(e!==t||n!==r)&&function(){for(var t=0;t<11;++t)o[t]=s(.1*t,e,n)}()),e===t&&n===r)?i:0===i?0:1===i?1:s(function(t){for(var r=0,i=1;10!==i&&o[i]<=t;++i)r+=.1;var a=r+(t-o[--i])/(o[i+1]-o[i])*.1,c=l(a,e,n);if(c>=.001){for(var u=a,d=0;d<4;++d){var h=l(u,e,n);if(0===h)break;var f=s(u,e,n)-t;u-=f/h}return u}return 0===c?a:function(t,r,i){var a,o,l=0;do(a=s(o=r+(i-r)/2,e,n)-t)>0?i=o:r=o;while(Math.abs(a)>1e-7&&++l<10)return o}(t,r,r+.1)}(i),t,r)};u.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var d="generateBezier("+[e,t,n,r]+")";return u.toString=function(){return d},u}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},sx={linear:function(e,t,n){return e+(t-e)*n},ease:sv(.25,.1,.25,1),"ease-in":sv(.42,0,1,1),"ease-out":sv(0,0,.58,1),"ease-in-out":sv(.42,0,.58,1),"ease-in-sine":sv(.47,0,.745,.715),"ease-out-sine":sv(.39,.575,.565,1),"ease-in-out-sine":sv(.445,.05,.55,.95),"ease-in-quad":sv(.55,.085,.68,.53),"ease-out-quad":sv(.25,.46,.45,.94),"ease-in-out-quad":sv(.455,.03,.515,.955),"ease-in-cubic":sv(.55,.055,.675,.19),"ease-out-cubic":sv(.215,.61,.355,1),"ease-in-out-cubic":sv(.645,.045,.355,1),"ease-in-quart":sv(.895,.03,.685,.22),"ease-out-quart":sv(.165,.84,.44,1),"ease-in-out-quart":sv(.77,0,.175,1),"ease-in-quint":sv(.755,.05,.855,.06),"ease-out-quint":sv(.23,1,.32,1),"ease-in-out-quint":sv(.86,0,.07,1),"ease-in-expo":sv(.95,.05,.795,.035),"ease-out-expo":sv(.19,1,.22,1),"ease-in-out-expo":sv(1,0,0,1),"ease-in-circ":sv(.6,.04,.98,.335),"ease-out-circ":sv(.075,.82,.165,1),"ease-in-out-circ":sv(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return sx.linear;var r=sg(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":sv};function sy(e,t,n,r,i){if(1===r||t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function sb(e,t){return null==e.pfValue&&null==e.value?e:null!=e.pfValue&&(null==t||"%"!==t.type.units)?e.pfValue:e.value}function sw(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=sb(e,i),s=sb(t,i);if(nu(o)&&nu(s))return sy(a,o,s,n,r);if(nl(o)&&nl(s)){for(var l=[],c=0;c<s.length;c++){var u=o[c],d=s[c];if(null!=u&&null!=d){var h=sy(a,u,d,n,r);l.push(h)}else l.push(d)}return l}}function sN(e,t){return null!=e&&null!=t&&(!!(nu(e)&&nu(t))||!!e&&!!t)}function sj(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var l=o.shift();l&&a.push(l)}for(var c=function(e){for(var t=e.length-1;t>=0;t--)(0,e[t])();e.splice(0,e.length)},u=a.length-1;u>=0;u--){var d=a[u],h=d._private;if(h.stopped){a.splice(u,1),h.hooked=!1,h.playing=!1,h.started=!1,c(h.frames);continue}(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||function(e,t){var n=e._private;n.started=!0,n.startTime=t-n.progress*n.duration}(d,e),function(e,t,n,r){var i,a,o,s,l=!r,c=e._private,u=t._private,d=u.easing,h=u.startTime,f=(r?e:e.cy()).style();u.easingImpl||(null==d?u.easingImpl=sx.linear:(i=no(d)?f.parse("transition-timing-function",d).value:d,no(i)?(a=i,o=[]):(a=i[1],o=i.slice(2).map(function(e){return+e})),o.length>0?("spring"===a&&o.push(u.duration),u.easingImpl=sx[a].apply(null,o)):u.easingImpl=sx[a]));var p=u.easingImpl;if(s=0===u.duration?1:(n-h)/u.duration,u.applying&&(s=u.progress),s<0?s=0:s>1&&(s=1),null==u.delay){var g=u.startPosition,v=u.position;if(v&&l&&!e.locked()){var x={};sN(g.x,v.x)&&(x.x=sw(g.x,v.x,s,p)),sN(g.y,v.y)&&(x.y=sw(g.y,v.y,s,p)),e.position(x)}var y=u.startPan,b=u.pan,w=c.pan,N=null!=b&&r;N&&(sN(y.x,b.x)&&(w.x=sw(y.x,b.x,s,p)),sN(y.y,b.y)&&(w.y=sw(y.y,b.y,s,p)),e.emit("pan"));var j=u.startZoom,k=u.zoom,S=null!=k&&r;S&&(sN(j,k)&&(c.zoom=rK(c.minZoom,sw(j,k,s,p),c.maxZoom)),e.emit("zoom")),(N||S)&&e.emit("viewport");var C=u.style;if(C&&C.length>0&&l){for(var _=0;_<C.length;_++){var E=C[_],T=E.name,M=u.startStyle[T],O=f.properties[M.name],A=sw(M,E,s,p,O);f.overrideBypass(e,T,A)}e.emit("style")}}u.progress=s}(t,d,e,n),h.applying&&(h.applying=!1),c(h.frames),null!=h.step&&h.step(e),d.completed()&&(a.splice(u,1),h.hooked=!1,h.playing=!1,h.started=!1,c(h.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=i(n[o]);a=a||s}var l=i(t,!0);(a||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var sk={animate:aZ.animate(),animation:aZ.animation(),animated:aZ.animated(),clearQueue:aZ.clearQueue(),delay:aZ.delay(),delayAnimation:aZ.delayAnimation(),stop:aZ.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,n){sj(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&nK(function(n){sj(n,e),t()})}()}}},sS={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&nf(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},sC=function(e){return no(e)?new oa(e):e},s_={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new o$(sS,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,sC(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,sC(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,sC(t),n),this},once:function(e,t,n){return this.emitter().one(e,sC(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};aZ.eventAliasesOn(s_);var sE={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};sE.jpeg=sE.jpg;var sT={layout:function(e){if(null==e)return void ri("Layout options must be specified to make a layout");if(null==e.name)return void ri("A `name` must be specified to make a layout");var t,n=e.name,r=this.extension("layout",n);return null==r?void ri("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?"):(t=no(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new r(nO({},e,{cy:this,eles:t})))}};sT.createLayout=sT.makeLayout=sT.layout;var sM=rd({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]}),sO={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),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(e){var t=this.extension("renderer",e.name);if(null==t)return void ri("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));void 0!==e.wheelSensitivity&&ro("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 n=sM(e);n.cy=this,this._private.renderer=new t(n),this.notify("init")},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};sO.invalidateDimensions=sO.resize;var sA={collection:function(e,t){return no(e)?this.$(e):nh(e)?e.collection():nl(e)?(t||(t={}),new sp(this,e,t.unique,t.removed)):new sp(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};sA.elements=sA.filter=sA.$;var sD={};sD.apply=function(e){for(var t=this._private.cy.collection(),n=0;n<e.length;n++){var r=e[n],i=this.getContextMeta(r);if(!i.empty){var a=this.getContextStyle(i),o=this.applyContextStyle(i,a,r);r._private.appliedInitStyle?this.updateTransitions(r,o.diffProps):r._private.appliedInitStyle=!0,this.updateStyleHints(r)&&t.push(r)}}return t},sD.getPropertiesDiff=function(e,t){var n=this._private.propDiffs=this._private.propDiffs||{},r=e+"-"+t,i=n[r];if(i)return i;for(var a=[],o={},s=0;s<this.length;s++){var l=this[s],c="t"===e[s],u="t"===t[s],d=c!==u,h=l.mappedProperties.length>0;if(d||u&&h){var f=void 0;d&&h||d?f=l.properties:h&&(f=l.mappedProperties);for(var p=0;p<f.length;p++){for(var g=f[p],v=g.name,x=!1,y=s+1;y<this.length;y++){var b=this[y];if("t"===t[y]&&(x=null!=b.properties[g.name]))break}o[v]||x||(o[v]=!0,a.push(v))}}}return n[r]=a,a},sD.getContextMeta=function(e){for(var t,n="",r=e._private.styleCxtKey||"",i=0;i<this.length;i++){var a=this[i];a.selector&&a.selector.matches(e)?n+="t":n+="f"}return t=this.getPropertiesDiff(r,n),e._private.styleCxtKey=n,{key:n,diffPropNames:t,empty:0===t.length}},sD.getContextStyle=function(e){var t=e.key,n=this._private.contextStyles=this._private.contextStyles||{};if(n[t])return n[t];for(var r={_private:{key:t}},i=0;i<this.length;i++){var a=this[i];if("t"===t[i])for(var o=0;o<a.properties.length;o++){var s=a.properties[o];r[s.name]=s}}return n[t]=r,r},sD.applyContextStyle=function(e,t,n){for(var r=e.diffPropNames,i={},a=this.types,o=0;o<r.length;o++){var s=r[o],l=t[s],c=n.pstyle(s);if(!l)if(!c)continue;else l=c.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0};if(c!==l){if(l.mapped===a.fn&&null!=c&&null!=c.mapping&&c.mapping.value===l.value){var u=c.mapping;if((u.fnValue=l.value(n))===u.prevFnValue)continue}var d=i[s]={prev:c};this.applyParsedProperty(n,l),d.next=n.pstyle(s),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:i}},sD.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;r=Object.keys(l);for(var c=0;c<i.length;c++){var u=i[c];t.styleKeys[u]=[9261,5381]}for(var d=function(e,n){return t.styleKeys[n][0]=nQ(e,t.styleKeys[n][0])},h=function(e,n){return t.styleKeys[n][1]=nJ(e,t.styleKeys[n][1])},f=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);d(r,t),h(r,t)}},p=0;p<r.length;p++){var g=r[p],v=l[g];if(null!=v){var x,y,b=this.properties[g],w=b.type,N=b.groupKey,j=void 0;null!=b.hashOverride?j=b.hashOverride(e,v):null!=v.pfValue&&(j=v.pfValue);var k=null==b.enums?v.value:null,S=null!=j,C=null!=k,_=S||C,E=v.units;w.number&&_&&!w.multiple?(d(y=-128<(x=S?j:k)&&x<128&&Math.floor(x)!==x?2e9-(1024*x|0):x,N),h(y,N),S||null==E||f(E,N)):f(v.strValue,N)}}for(var T=[9261,5381],M=0;M<i.length;M++){var O=i[M],A=t.styleKeys[O];T[0]=nQ(A[0],T[0]),T[1]=nJ(A[1],T[1])}t.styleKey=2097152*T[0]+T[1];var D=t.styleKeys;t.labelDimsKey=n0(D.labelDimensions);var P=a(e,["label"],D.labelDimensions);if(t.labelKey=n0(P),t.labelStyleKey=n0(n1(D.commonLabel,P)),!s){var I=a(e,["source-label"],D.labelDimensions);t.sourceLabelKey=n0(I),t.sourceLabelStyleKey=n0(n1(D.commonLabel,I));var L=a(e,["target-label"],D.labelDimensions);t.targetLabelKey=n0(L),t.targetLabelStyleKey=n0(n1(D.commonLabel,L))}if(s){var R=t.styleKeys,B=R.nodeBody,F=R.nodeBorder,z=R.nodeOutline,V=R.backgroundImage,H=R.compound,U=R.pie,W=R.stripe;t.nodeKey=n0([B,F,z,V,H,U,W].filter(function(e){return null!=e}).reduce(n1,[9261,5381])),t.hasPie=null!=U&&9261!==U[0]&&5381!==U[1],t.hasStripe=null!=W&&9261!==W[0]&&5381!==W[1]}return o!==t.styleKey},sD.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},sD.applyParsedProperty=function(e,t){var n=this,r=t,i=e._private.style,a=n.types,o=n.properties[r.name].type,s=r.bypass,l=i[r.name],c=l&&l.bypass,u=e._private,d="mapping",h=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},f=function(){var t=h(l),i=h(r);n.checkTriggers(e,r.name,t,i)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,"bezier",s)),r.delete)return i[r.name]=void 0,f(),!0;if(r.deleteBypassed)if(!l)return f(),!0;else if(l.bypass)return l.bypassed=void 0,f(),!0;else return!1;if(r.deleteBypass)if(!l)return f(),!0;else if(l.bypass)return i[r.name]=l.bypassed,f(),!0;else return!1;var p=function(){ro("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 a.mapData:for(var g,v,x=r.field.split("."),y=u.data,b=0;b<x.length&&y;b++)y=y[x[b]];if(null==y)return p(),!1;if(!nu(y))return ro("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+y+"` for `"+e.id()+"` is non-numeric)"),!1;var w=r.fieldMax-r.fieldMin;if((v=0===w?0:(y-r.fieldMin)/w)<0?v=0:v>1&&(v=1),o.color){var N=r.valueMin[0],j=r.valueMax[0],k=r.valueMin[1],S=r.valueMax[1],C=r.valueMin[2],_=r.valueMax[2],E=null==r.valueMin[3]?1:r.valueMin[3],T=[Math.round(N+(j-N)*v),Math.round(k+(S-k)*v),Math.round(C+(_-C)*v),Math.round(E+((null==r.valueMax[3]?1:r.valueMax[3])-E)*v)];g={bypass:r.bypass,name:r.name,value:T,strValue:"rgb("+T[0]+", "+T[1]+", "+T[2]+")"}}else{if(!o.number)return!1;var M=r.valueMin+(r.valueMax-r.valueMin)*v;g=this.parse(r.name,M,r.bypass,d)}if(!g)return p(),!1;g.mapping=r,r=g;break;case a.data:for(var O=r.field.split("."),A=u.data,D=0;D<O.length&&A;D++)A=A[O[D]];if(null!=A&&(g=this.parse(r.name,A,r.bypass,d)),!g)return p(),!1;g.mapping=r,r=g;break;case a.fn:var P=r.value,I=null!=r.fnValue?r.fnValue:P(e);if(r.prevFnValue=I,null==I)return ro("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(g=this.parse(r.name,I,r.bypass,d)))return ro("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;g.mapping=rs(r),r=g;break;case void 0:break;default:return!1}return s?(c?r.bypassed=l.bypassed:r.bypassed=l,i[r.name]=r):c?l.bypassed=r:i[r.name]=r,f(),!0},sD.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)for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else r._private.style={}}},sD.update=function(){this._private.cy.mutableElements().updateStyle()},sD.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},l=!1,c=0;c<i.length;c++){var u=i[c],d=e.pstyle(u),h=t[u];if(h){var f=h.prev,p=null!=h.next?h.next:d,g=!1,v=void 0;f&&(nu(f.pfValue)&&nu(p.pfValue)?(g=p.pfValue-f.pfValue,v=f.pfValue+1e-6*g):nu(f.value)&&nu(p.value)?(g=p.value-f.value,v=f.value+1e-6*g):nl(f.value)&&nl(p.value)&&(g=f.value[0]!==p.value[0]||f.value[1]!==p.value[1]||f.value[2]!==p.value[2],v=f.strValue),g&&(s[u]=p.strValue,this.applyBypass(e,u,v),l=!0))}}if(!l)return;r.transitioning=!0,new aP(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},sD.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);!e.removed()&&null!=s&&s(n,r,e)&&a(o)},sD.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},sD.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},sD.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},sD.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},sD.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 sP={};sP.applyBypass=function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;a<this.properties.length;a++){var o=this.properties[a].name,s=this.parse(o,n,!0);s&&i.push(s)}}else if(no(t)){var l=this.parse(t,n,!0);l&&i.push(l)}else{if(!nc(t))return!1;r=n;for(var c=Object.keys(t),u=0;u<c.length;u++){var d=c[u],h=t[d];if(void 0===h&&(h=t[nw(d)]),void 0!==h){var f=this.parse(d,h,!0);f&&i.push(f)}}}if(0===i.length)return!1;for(var p=!1,g=0;g<e.length;g++){for(var v=e[g],x={},y=void 0,b=0;b<i.length;b++){var w=i[b];if(r){var N=v.pstyle(w.name);y=x[w.name]={prev:N}}p=this.applyParsedProperty(v,rs(w))||p,r&&(y.next=v.pstyle(w.name))}p&&this.updateStyleHints(v),r&&this.updateTransitions(v,x,!0)}return p},sP.overrideBypass=function(e,t,n){t=nb(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,c=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=n,null!=a.pfValue&&(a.pfValue=n),s?a.strValue="rgb("+n.join(",")+")":l?a.strValue=n.join(" "):a.strValue=""+n,this.updateStyleHints(i)):this.applyBypass(i,t,n),this.checkTriggers(i,t,c,n)}},sP.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},sP.removeBypasses=function(e,t,n){for(var r=0;r<e.length;r++){for(var i=e[r],a={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],c=i.pstyle(l.name);if(c&&c.bypass){var u=this.parse(s,"",!0),d=a[l.name]={prev:c};this.applyParsedProperty(i,u),d.next=i.pstyle(l.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,a,!0)}};var sI={};sI.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},sI.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 sL={};sL.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},sL.getRawStyle=function(e,t){if(e=e[0]){for(var n={},r=0;r<this.properties.length;r++){var i=this.properties[r],a=this.getStylePropertyValue(e,i.name,t);null!=a&&(n[i.name]=a,n[nw(i.name)]=a)}return n}},sL.getIndexedStyle=function(e,t,n,r){var i=e.pstyle(t)[n][r];return null!=i?i:e.cy().style().getDefaultProperty(t)[n][0]},sL.getStylePropertyValue=function(e,t,n){if(e=e[0]){var r=this.properties[t];r.alias&&(r=r.pointsTo);var i=r.type,a=e.pstyle(r.name);if(a){var o=a.value,s=a.units,l=a.strValue;if(n&&i.number&&null!=o&&nu(o)){var c=e.cy().zoom(),u=function(e){return e*c},d=function(e,t){return u(e)+t},h=nl(o);if(h?s.every(function(e){return null!=e}):null!=s)if(h)return o.map(function(e,t){return d(e,s[t])}).join(" ");else return d(o,s);return h?o.map(function(e){return no(e)?e:""+u(e)}).join(" "):""+u(o)}if(null!=l)return l}return null}},sL.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);void 0!==a&&(a=nc(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},sL.getPropsList=function(e){var t=[],n=this.properties;if(e)for(var r=Object.keys(e),i=0;i<r.length;i++){var a=r[i],o=e[a],s=n[a]||n[nb(a)],l=this.parse(s.name,o);l&&t.push(l)}return t},sL.getNonDefaultPropertiesHash=function(e,t,n){var r,i,a,o,s,l,c=n.slice();for(s=0;s<t.length;s++)if(r=t[s],null!=(i=e.pstyle(r,!1)))if(null!=i.pfValue)c[0]=nQ(o,c[0]),c[1]=nJ(o,c[1]);else for(l=0,a=i.strValue;l<a.length;l++)o=a.charCodeAt(l),c[0]=nQ(o,c[0]),c[1]=nJ(o,c[1]);return c},sL.getPropertiesHash=sL.getNonDefaultPropertiesHash;var sR={};sR.appendFromJson=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n.selector,i=n.style||n.css,a=Object.keys(i);this.selector(r);for(var o=0;o<a.length;o++){var s=a[o],l=i[s];this.css(s,l)}}return this},sR.fromJson=function(e){return this.resetToDefault(),this.appendFromJson(e),this},sR.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:a})}return e};var sB={};sB.appendFromString=function(e){var t,n,r,i=""+e;function a(){i=i.length>t.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){ro("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l&&new oa(l).invalid){ro("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var c=s[2],u=!1;n=c;for(var d=[];!n.match(/^\s*$/);){var h=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){ro("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),u=!0;break}r=h[0];var f=h[1],p=h[2];if(!this.properties[f]){ro("Skipping property: Invalid property name in: "+r),o();continue}if(!this.parse(f,p)){ro("Skipping property: Invalid property definition in: "+r),o();continue}d.push({name:f,val:p}),o()}if(u){a();break}this.selector(l);for(var g=0;g<d.length;g++){var v=d[g];this.css(v.name,v.val)}a()}return this},sB.fromString=function(e){return this.resetToDefault(),this.appendFromString(e),this};var sF={};!function(){var e=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},t=function(e){var t=nS+"|\\w+|"+n_+"|"+nT+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+e+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+nS+")\\s*\\,\\s*("+nS+")\\s*,\\s*("+t+")\\s*\\,\\s*("+t+")\\)$"},n=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];sF.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:e("data")},layoutData:{mapping:!0,regex:e("layoutData")},scratch:{mapping:!0,regex:e("scratch")},mapData:{mapping:!0,regex:t("mapData")},mapLayoutData:{mapping:!0,regex:t("mapLayoutData")},mapScratch:{mapping:!0,regex:t("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:n,singleRegexMatchValue:!0},urls:{regexes:n,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(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return no(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+nS+")\\s*,\\s*("+nS+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+nS+")\\s*,\\s*("+nS+")\\s*,\\s*("+nS+")\\s*,\\s*("+nS+")\\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(e){var t=e.length;return 1===t||2===t||4===t}}};var r=function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},i=function(e,t){return e!=t},a=sF.types,o=[{name:"label",type:a.text,triggersBounds:i,triggersZOrder:function(e,t){var n=nv(e),r=nv(t);return n&&!r||!n&&r}},{name:"text-rotation",type:a.textRotation,triggersBounds:i},{name:"text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"text-margin-y",type:a.bidirectionalSize,triggersBounds:i}],s=[{name:"source-label",type:a.text,triggersBounds:i},{name:"source-text-rotation",type:a.textRotation,triggersBounds:i},{name:"source-text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"source-text-margin-y",type:a.bidirectionalSize,triggersBounds:i},{name:"source-text-offset",type:a.size,triggersBounds:i}],l=[{name:"target-label",type:a.text,triggersBounds:i},{name:"target-text-rotation",type:a.textRotation,triggersBounds:i},{name:"target-text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"target-text-margin-y",type:a.bidirectionalSize,triggersBounds:i},{name:"target-text-offset",type:a.size,triggersBounds:i}],c=[{name:"font-family",type:a.fontFamily,triggersBounds:i},{name:"font-style",type:a.fontStyle,triggersBounds:i},{name:"font-weight",type:a.fontWeight,triggersBounds:i},{name:"font-size",type:a.size,triggersBounds:i},{name:"text-transform",type:a.textTransform,triggersBounds:i},{name:"text-wrap",type:a.textWrap,triggersBounds:i},{name:"text-overflow-wrap",type:a.textOverflowWrap,triggersBounds:i},{name:"text-max-width",type:a.size,triggersBounds:i},{name:"text-outline-width",type:a.size,triggersBounds:i},{name:"line-height",type:a.positiveNumber,triggersBounds:i}],u=[{name:"text-valign",type:a.valign,triggersBounds:i},{name:"text-halign",type:a.halign,triggersBounds:i},{name:"color",type:a.color},{name:"text-outline-color",type:a.color},{name:"text-outline-opacity",type:a.zeroOneNumber},{name:"text-background-color",type:a.color},{name:"text-background-opacity",type:a.zeroOneNumber},{name:"text-background-padding",type:a.size,triggersBounds:i},{name:"text-border-opacity",type:a.zeroOneNumber},{name:"text-border-color",type:a.color},{name:"text-border-width",type:a.size,triggersBounds:i},{name:"text-border-style",type:a.borderStyle,triggersBounds:i},{name:"text-background-shape",type:a.textBackgroundShape,triggersBounds:i},{name:"text-justification",type:a.justification},{name:"box-select-labels",type:a.bool,triggersBounds:i}],d=[{name:"events",type:a.bool,triggersZOrder:i},{name:"text-events",type:a.bool,triggersZOrder:i},{name:"box-selection",type:a.boxSelection,triggersZOrder:i}],h=[{name:"display",type:a.display,triggersZOrder:i,triggersBounds:i,triggersBoundsOfConnectedEdges:i,triggersBoundsOfParallelEdges:function(e,t,n){return e!==t&&"bezier"===n.pstyle("curve-style").value}},{name:"visibility",type:a.visibility,triggersZOrder:i},{name:"opacity",type:a.zeroOneNumber,triggersZOrder:r},{name:"text-opacity",type:a.zeroOneNumber},{name:"min-zoomed-font-size",type:a.size},{name:"z-compound-depth",type:a.zCompoundDepth,triggersZOrder:i},{name:"z-index-compare",type:a.zIndexCompare,triggersZOrder:i},{name:"z-index",type:a.number,triggersZOrder:i}],f=[{name:"overlay-padding",type:a.size,triggersBounds:i},{name:"overlay-color",type:a.color},{name:"overlay-opacity",type:a.zeroOneNumber,triggersBounds:r},{name:"overlay-shape",type:a.overlayShape,triggersBounds:i},{name:"overlay-corner-radius",type:a.cornerRadius}],p=[{name:"underlay-padding",type:a.size,triggersBounds:i},{name:"underlay-color",type:a.color},{name:"underlay-opacity",type:a.zeroOneNumber,triggersBounds:r},{name:"underlay-shape",type:a.overlayShape,triggersBounds:i},{name:"underlay-corner-radius",type:a.cornerRadius}],g=[{name:"transition-property",type:a.propList},{name:"transition-duration",type:a.time},{name:"transition-delay",type:a.time},{name:"transition-timing-function",type:a.easing}],v=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},x=[{name:"height",type:a.nodeSize,triggersBounds:i,hashOverride:v},{name:"width",type:a.nodeSize,triggersBounds:i,hashOverride:v},{name:"shape",type:a.nodeShape,triggersBounds:i},{name:"shape-polygon-points",type:a.polygonPointList,triggersBounds:i},{name:"corner-radius",type:a.cornerRadius},{name:"background-color",type:a.color},{name:"background-fill",type:a.fill},{name:"background-opacity",type:a.zeroOneNumber},{name:"background-blacken",type:a.nOneOneNumber},{name:"background-gradient-stop-colors",type:a.colors},{name:"background-gradient-stop-positions",type:a.percentages},{name:"background-gradient-direction",type:a.gradientDirection},{name:"padding",type:a.sizeMaybePercent,triggersBounds:i},{name:"padding-relative-to",type:a.paddingRelativeTo,triggersBounds:i},{name:"bounds-expansion",type:a.boundsExpansion,triggersBounds:i}],y=[{name:"border-color",type:a.color},{name:"border-opacity",type:a.zeroOneNumber},{name:"border-width",type:a.size,triggersBounds:i},{name:"border-style",type:a.borderStyle},{name:"border-cap",type:a.lineCap},{name:"border-join",type:a.lineJoin},{name:"border-dash-pattern",type:a.numbers},{name:"border-dash-offset",type:a.number},{name:"border-position",type:a.linePosition}],b=[{name:"outline-color",type:a.color},{name:"outline-opacity",type:a.zeroOneNumber},{name:"outline-width",type:a.size,triggersBounds:i},{name:"outline-style",type:a.borderStyle},{name:"outline-offset",type:a.size,triggersBounds:i}],w=[{name:"background-image",type:a.urls},{name:"background-image-crossorigin",type:a.bgCrossOrigin},{name:"background-image-opacity",type:a.zeroOneNumbers},{name:"background-image-containment",type:a.bgContainment},{name:"background-image-smoothing",type:a.bools},{name:"background-position-x",type:a.bgPos},{name:"background-position-y",type:a.bgPos},{name:"background-width-relative-to",type:a.bgRelativeTo},{name:"background-height-relative-to",type:a.bgRelativeTo},{name:"background-repeat",type:a.bgRepeat},{name:"background-fit",type:a.bgFit},{name:"background-clip",type:a.bgClip},{name:"background-width",type:a.bgWH},{name:"background-height",type:a.bgWH},{name:"background-offset-x",type:a.bgPos},{name:"background-offset-y",type:a.bgPos}],N=[{name:"position",type:a.position,triggersBounds:i},{name:"compound-sizing-wrt-labels",type:a.compoundIncludeLabels,triggersBounds:i},{name:"min-width",type:a.size,triggersBounds:i},{name:"min-width-bias-left",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-width-bias-right",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-height",type:a.size,triggersBounds:i},{name:"min-height-bias-top",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-height-bias-bottom",type:a.sizeMaybePercent,triggersBounds:i}],j=[{name:"line-style",type:a.lineStyle},{name:"line-color",type:a.color},{name:"line-fill",type:a.fill},{name:"line-cap",type:a.lineCap},{name:"line-opacity",type:a.zeroOneNumber},{name:"line-dash-pattern",type:a.numbers},{name:"line-dash-offset",type:a.number},{name:"line-outline-width",type:a.size},{name:"line-outline-color",type:a.color},{name:"line-gradient-stop-colors",type:a.colors},{name:"line-gradient-stop-positions",type:a.percentages},{name:"curve-style",type:a.curveStyle,triggersBounds:i,triggersBoundsOfParallelEdges:function(e,t){return e!==t&&("bezier"===e||"bezier"===t)}},{name:"haystack-radius",type:a.zeroOneNumber,triggersBounds:i},{name:"source-endpoint",type:a.edgeEndpoint,triggersBounds:i},{name:"target-endpoint",type:a.edgeEndpoint,triggersBounds:i},{name:"control-point-step-size",type:a.size,triggersBounds:i},{name:"control-point-distances",type:a.bidirectionalSizes,triggersBounds:i},{name:"control-point-weights",type:a.numbers,triggersBounds:i},{name:"segment-distances",type:a.bidirectionalSizes,triggersBounds:i},{name:"segment-weights",type:a.numbers,triggersBounds:i},{name:"segment-radii",type:a.numbers,triggersBounds:i},{name:"radius-type",type:a.radiusType,triggersBounds:i},{name:"taxi-turn",type:a.bidirectionalSizeMaybePercent,triggersBounds:i},{name:"taxi-turn-min-distance",type:a.size,triggersBounds:i},{name:"taxi-direction",type:a.axisDirection,triggersBounds:i},{name:"taxi-radius",type:a.number,triggersBounds:i},{name:"edge-distances",type:a.edgeDistances,triggersBounds:i},{name:"arrow-scale",type:a.positiveNumber,triggersBounds:i},{name:"loop-direction",type:a.angle,triggersBounds:i},{name:"loop-sweep",type:a.angle,triggersBounds:i},{name:"source-distance-from-node",type:a.size,triggersBounds:i},{name:"target-distance-from-node",type:a.size,triggersBounds:i}],k=[{name:"ghost",type:a.bool,triggersBounds:i},{name:"ghost-offset-x",type:a.bidirectionalSize,triggersBounds:i},{name:"ghost-offset-y",type:a.bidirectionalSize,triggersBounds:i},{name:"ghost-opacity",type:a.zeroOneNumber}],S=[{name:"selection-box-color",type:a.color},{name:"selection-box-opacity",type:a.zeroOneNumber},{name:"selection-box-border-color",type:a.color},{name:"selection-box-border-width",type:a.size},{name:"active-bg-color",type:a.color},{name:"active-bg-opacity",type:a.zeroOneNumber},{name:"active-bg-size",type:a.size},{name:"outside-texture-bg-color",type:a.color},{name:"outside-texture-bg-opacity",type:a.zeroOneNumber}],C=[];sF.pieBackgroundN=16,C.push({name:"pie-size",type:a.sizeMaybePercent}),C.push({name:"pie-hole",type:a.sizeMaybePercent}),C.push({name:"pie-start-angle",type:a.angle});for(var _=1;_<=sF.pieBackgroundN;_++)C.push({name:"pie-"+_+"-background-color",type:a.color}),C.push({name:"pie-"+_+"-background-size",type:a.percent}),C.push({name:"pie-"+_+"-background-opacity",type:a.zeroOneNumber});var E=[];sF.stripeBackgroundN=16,E.push({name:"stripe-size",type:a.sizeMaybePercent}),E.push({name:"stripe-direction",type:a.axisDirectionPrimary});for(var T=1;T<=sF.stripeBackgroundN;T++)E.push({name:"stripe-"+T+"-background-color",type:a.color}),E.push({name:"stripe-"+T+"-background-size",type:a.percent}),E.push({name:"stripe-"+T+"-background-opacity",type:a.zeroOneNumber});var M=[],O=sF.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:a.arrowShape,triggersBounds:i},{name:"arrow-color",type:a.color},{name:"arrow-fill",type:a.arrowFill},{name:"arrow-width",type:a.arrowWidth}].forEach(function(e){O.forEach(function(t){var n=t+"-"+e.name,r=e.type,i=e.triggersBounds;M.push({name:n,type:r,triggersBounds:i})})},{});var A=sF.properties=[].concat(d,g,h,f,p,k,u,c,o,s,l,x,y,b,w,C,E,N,j,M,S),D=sF.propertyGroups={behavior:d,transition:g,visibility:h,overlay:f,underlay:p,ghost:k,commonLabel:u,labelDimensions:c,mainLabel:o,sourceLabel:s,targetLabel:l,nodeBody:x,nodeBorder:y,nodeOutline:b,backgroundImage:w,pie:C,stripe:E,compound:N,edgeLine:j,edgeArrow:M,core:S},P=sF.propertyGroupNames={};(sF.propertyGroupKeys=Object.keys(D)).forEach(function(e){P[e]=D[e].map(function(e){return e.name}),D[e].forEach(function(t){return t.groupKey=e})});var I=sF.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"}];sF.propertyNames=A.map(function(e){return e.name});for(var L=0;L<A.length;L++){var R=A[L];A[R.name]=R}for(var B=0;B<I.length;B++){var F=I[B],z=A[F.pointsTo],V={name:F.name,alias:!0,pointsTo:z};A.push(V),A[F.name]=V}}(),sF.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},sF.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=nO({"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(e,t){for(var n=1;n<=sF.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e},{}),{"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(e,t){for(var n=1;n<=sF.stripeBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e},{}),{"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(e,t){return sF.arrowPrefixes.forEach(function(n){var r=n+"-"+t.name,i=t.value;e[r]=i}),e},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);n[a]=s}}return e.defaultProperties=n,e.defaultProperties},sF.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 sz={};sz.parse=function(e,t,n,r){if(ns(t))return this.parseImplWarn(e,t,n,r);var i,a=n3(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),o=this.propCache=this.propCache||[];return(i=o[a])||(i=o[a]=this.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(i=rs(i))&&(i.value=rs(i.value)),i},sz.parseImplWarn=function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return i||null==t||ro("The style property `".concat(e,": ").concat(t,"` is invalid")),i&&("width"===i.name||"height"===i.name)&&"label"===t&&ro("The style value of `label` is deprecated for `"+i.name+"`"),i},sz.parseImpl=function(e,t,n,r){e=nb(e);var i=this.properties[e],a=t,o=this.types;if(!i||void 0===t)return null;i.alias&&(e=(i=i.pointsTo).name);var s=no(t);s&&(t=t.trim());var l=i.type;if(!l)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(ns(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:n};if(!s||r||t.length<7||"a"!==t[1]);else if(t.length>=7&&"d"===t[0]&&(g=new RegExp(o.data.regex).exec(t))){if(n)return!1;var c=o.data;return{name:e,value:g,strValue:""+t,mapped:c,field:g[1],bypass:n}}else if(t.length>=10&&"m"===t[0]&&(v=new RegExp(o.mapData.regex).exec(t))){if(n||l.multiple)return!1;var u=o.mapData;if(!(l.color||l.number))return!1;var d=this.parse(e,v[4]);if(!d||d.mapped)return!1;var h=this.parse(e,v[5]);if(!h||h.mapped)return!1;if(d.pfValue===h.pfValue||d.strValue===h.strValue)return ro("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+d.strValue+"`"),this.parse(e,d.strValue);if(l.color){var f=d.value,p=h.value;if(f[0]===p[0]&&f[1]===p[1]&&f[2]===p[2]&&(f[3]===p[3]||(null==f[3]||1===f[3])&&(null==p[3]||1===p[3])))return!1}return{name:e,value:v,strValue:""+t,mapped:u,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:d.value,valueMax:h.value,bypass:n}}if(l.multiple&&"multiple"!==r){if(x=s?t.split(/\s+/):nl(t)?t:[t],l.evenMultiple&&x.length%2!=0)return null;for(var g,v,x,y=[],b=[],w=[],N="",j=!1,k=0;k<x.length;k++){var S=this.parse(e,x[k],n,"multiple");j=j||no(S.value),y.push(S.value),w.push(null!=S.pfValue?S.pfValue:S.value),b.push(S.units),N+=(k>0?" ":"")+S.strValue}if(l.validate&&!l.validate(y,b))return null;if(l.singleEnum&&j)if(1===y.length&&no(y[0]))return{name:e,value:y[0],strValue:y[0],bypass:n};else return null;return{name:e,value:y,pfValue:w,strValue:N,bypass:n,units:b}}var C=function(){for(var r=0;r<l.enums.length;r++)if(l.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n};return null};if(l.number){var _,E,T="px";if(l.units&&(E=l.units),l.implicitUnits&&(T=l.implicitUnits),!l.unitless)if(s){var M="px|em"+(l.allowPercent?"|\\%":"");E&&(M=E);var O=t.match("^("+nS+")("+M+")?$");O&&(t=O[1],E=O[2]||T)}else(!E||l.implicitUnits)&&(E=T);if(isNaN(t=parseFloat(t))&&void 0===l.enums)return null;if(isNaN(t)&&void 0!==l.enums)return t=a,C();if(l.integer&&!(nu(_=t)&&Math.floor(_)===_)||void 0!==l.min&&(t<l.min||l.strictMin&&t===l.min)||void 0!==l.max&&(t>l.max||l.strictMax&&t===l.max))return null;var A={name:e,value:t,strValue:""+t+(E||""),units:E,bypass:n};return l.unitless||"px"!==E&&"em"!==E?A.pfValue=t:A.pfValue="px"!==E&&E?this.getEmSizeInPixels()*t:t,("ms"===E||"s"===E)&&(A.pfValue="ms"===E?t:1e3*t),("deg"===E||"rad"===E)&&(A.pfValue="rad"===E?t:Math.PI*t/180),"%"===E&&(A.pfValue=t/100),A}if(l.propList){var D=[],P=""+t;if("none"===P);else{for(var I=P.split(/\s*,\s*|\s+/),L=0;L<I.length;L++){var R=I[L].trim();this.properties[R]?D.push(R):ro("`"+R+"` is not a valid property name")}if(0===D.length)return null}return{name:e,value:D,strValue:0===D.length?"none":D.join(" "),bypass:n}}if(l.color){var B=nI(t);return B?{name:e,value:B,pfValue:B,strValue:"rgb("+B[0]+","+B[1]+","+B[2]+")",bypass:n}:null}if(l.regex||l.regexes){if(l.enums){var F=C();if(F)return F}for(var z=l.regexes?l.regexes:[l.regex],V=0;V<z.length;V++){var H=new RegExp(z[V]).exec(t);if(H)return{name:e,value:l.singleRegexMatchValue?H[1]:H,strValue:""+t,bypass:n}}return null}if(l.string)return{name:e,value:""+t,strValue:""+t,bypass:n};else if(l.enums)return C();else return null};var sV=function(e){return this instanceof sV?nm(e)?void(this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()):void ri("A style must have a core reference"):new sV(e)},sH=sV.prototype;sH.instanceString=function(){return"style"},sH.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},sH.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},sH.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},sH.selector=function(e){var t="core"===e?null:new oa(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},sH.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],n=0;n<this.properties.length;n++){var r=this.properties[n],i=t[r.name];void 0===i&&(i=t[nw(r.name)]),void 0!==i&&this.cssRule(r.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},sH.style=sH.css,sH.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),this[r].selector||(this._private.coreStyle[n.name]=n)}return this},sH.append=function(e){return ng(e)?e.appendToStyle(this):nl(e)?this.appendFromJson(e):no(e)&&this.appendFromString(e),this},sV.fromJson=function(e,t){var n=new sV(e);return n.fromJson(t),n},sV.fromString=function(e,t){return new sV(e).fromString(t)},[sD,sP,sI,sL,sR,sB,sF,sz].forEach(function(e){nO(sH,e)}),sV.types=sH.types,sV.properties=sH.properties,sV.propertyGroups=sH.propertyGroups,sV.propertyGroupNames=sH.propertyGroupNames,sV.propertyGroupKeys=sH.propertyGroupKeys;var sU={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return(null==t.selectionType&&(t.selectionType="single"),void 0===e)?t.selectionType:(("additive"===e||"single"===e)&&(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(no(a[0]))return o[e=a[0]];if(nc(a[0])){if(!this._private.panningEnabled)return this;r=(n=a[0]).x,i=n.y,nu(r)&&(o.x=r),nu(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],("x"===e||"y"===e)&&nu(t)&&(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i,a=arguments,o=this._private.pan;if(!this._private.panningEnabled)return this;switch(a.length){case 1:nc(e)&&(r=(n=a[0]).x,i=n.y,nu(r)&&(o.x+=r),nu(i)&&(o.y+=i),this.emit("pan viewport"));break;case 2:("x"===e||"y"===e)&&nu(t)&&(o[e]+=t),this.emit("pan viewport")}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(nu(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){if(no(e)){var n,r,i,a=e;e=this.$(a)}else if(nc(n=e)&&nu(n.x1)&&nu(n.x2)&&nu(n.y1)&&nu(n.y2)){var o=e;(r={x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2}).w=r.x2-r.x1,r.h=r.y2-r.y1}else nh(e)||(e=this.mutableElements());if(!(nh(e)&&e.empty())){r=r||e.boundingBox();var s=this.width(),l=this.height();if(t=nu(t)?t:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){i=(i=(i=Math.min((s-2*t)/r.w,(l-2*t)/r.h))>this._private.maxZoom?this._private.maxZoom:i)<this._private.minZoom?this._private.minZoom:i;var c={x:(s-i*(r.x1+r.x2))/2,y:(l-i*(r.y1+r.y2))/2};return{zoom:i,pan:c}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var r=e;e=r.min,t=r.max}return nu(e)&&nu(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):nu(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:nu(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),nu(e)?n=e:nc(e)&&(n=e.level,null!=e.position?t=rP(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,o||!nu(n)||n===a||null!=t&&(!nu(t.x)||!nu(t.y)))return null;if(null==t)return{zoomed:!0,panned:!1,zoom:n,pan:i};var s=n,l={x:-s/a*(t.x-i.x)+t.x,y:-s/a*(t.y-i.y)+t.y};return{zoomed:!0,panned:!0,zoom:s,pan:l}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed&&(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport")),this},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1;if(!e||(nu(e.zoom)||(n=!1),nc(e.pan)||(r=!1),!n&&!r))return this;if(n){var o=e.zoom;o<t.minZoom||o>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=o,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var s=e.pan;nu(s.x)&&(t.pan.x=s.x),nu(s.y)&&(t.pan.y=s.y),i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(no(e)){var n=e;e=this.mutableElements().filter(n)}else nh(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled&&this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=this.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};sU.centre=sU.center,sU.autolockNodes=sU.autolock,sU.autoungrabifyNodes=sU.autoungrabify;var sW={data:aZ.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:aZ.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:aZ.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:aZ.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};sW.attr=sW.data,sW.removeAttr=sW.removeData;var sY=function(e){var t=this,n=(e=nO({},e)).container;n&&!nd(n)&&nd(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{}).cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==t8&&void 0!==n&&!e.headless,o=e;o.layout=nO({name:a?"grid":"null"},o.layout),o.renderer=nO({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new sp(this),listeners:[],aniEles:new sp(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:nu(o.zoom)?o.zoom:1,pan:{x:nc(o.pan)&&nu(o.pan.x)?o.pan.x:0,y:nc(o.pan)&&nu(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),l.styleEnabled&&t.setStyle([]);var c=nO({},o,o.renderer);t.initRenderer(c);var u=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(nc(e)||nl(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var a=nO({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};!function(e,t){if(e.some(nx))return aP.all(e).then(t);t(e)}([o.style,o.elements],function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),u(a,function(){t.startAnimationLoop(),l.ready=!0,ns(o.ready)&&t.on("ready",o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")},o.done)})},sG=sY.prototype;nO(sG,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){if(!this.destroyed())return this.stopAnimationLoop(),this.destroyRenderer(),this.emit("destroy"),this._private.destroyed=!0,this},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(null==this._private.container)return t8;var e=this._private.container.ownerDocument;return void 0===e||null==e?t8:e.defaultView||t8},mount:function(e){if(null!=e){var t=this._private,n=t.options;return!nd(e)&&nd(e[0])&&(e=e[0]),this.stopAnimationLoop(),this.destroyRenderer(),t.container=e,t.styleEnabled=!0,this.invalidateSize(),this.initRenderer(nO({},n,n.renderer,{name:"null"===n.renderer.name?"canvas":n.renderer.name})),this.startAnimationLoop(),this.style(n.style),this.emit("mount"),this}},unmount:function(){return this.stopAnimationLoop(),this.destroyRenderer(),this.initRenderer({name:"null"}),this.emit("unmount"),this},options:function(){return rs(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements();if(nc(e)){if(t.startBatch(),e.elements){var i={},a=function(e,n){for(var r=[],a=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){ro("cy.json() cannot handle elements without an ID attribute");continue}var l=""+s.data.id,c=t.getElementById(l);i[l]=!0,0!==c.length?a.push({ele:c,json:s}):(n&&(s.group=n),r.push(s))}t.add(r);for(var u=0;u<a.length;u++){var d=a[u],h=d.ele,f=d.json;h.json(f)}};if(nl(e.elements))a(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],c=e.elements[l];nl(c)&&a(c,l)}var u=t.collection();r.filter(function(e){return!i[e.id()]}).forEach(function(e){e.isParent()?u.merge(e):e.remove()}),u.forEach(function(e){return e.children().move({parent:null})}),u.forEach(function(e){return t.getElementById(e.id()).remove()})}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<d.length;h++){var f=d[h];null!=e[f]&&t[f](e[f])}return t.endBatch(),this}var p={};e?p.elements=this.elements().map(function(e){return e.json()}):(p.elements={},r.forEach(function(e){var t=e.group();p.elements[t]||(p.elements[t]=[]),p.elements[t].push(e.json())})),this._private.styleEnabled&&(p.style=t.style().json()),p.data=rs(t.data());var g=n.options;return p.zoomingEnabled=n.zoomingEnabled,p.userZoomingEnabled=n.userZoomingEnabled,p.zoom=n.zoom,p.minZoom=n.minZoom,p.maxZoom=n.maxZoom,p.panningEnabled=n.panningEnabled,p.userPanningEnabled=n.userPanningEnabled,p.pan=rs(n.pan),p.boxSelectionEnabled=n.boxSelectionEnabled,p.renderer=rs(g.renderer),p.hideEdgesOnViewport=g.hideEdgesOnViewport,p.textureOnViewport=g.textureOnViewport,p.wheelSensitivity=g.wheelSensitivity,p.motionBlur=g.motionBlur,p.multiClickDebounceTime=g.multiClickDebounceTime,p}}),sG.$id=sG.getElementById,[{add:function(e){var t;if(nh(e))if(e._private.cy===this)t=e.restore();else{for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(i.json())}t=new sp(this,n)}else if(nl(e))t=new sp(this,e);else if(nc(e)&&(nl(e.nodes)||nl(e.edges))){for(var a=[],o=["nodes","edges"],s=0,l=o.length;s<l;s++){var c=o[s],u=e[c];if(nl(u))for(var d=0,h=u.length;d<h;d++){var f=nO({group:c},u[d]);a.push(f)}}t=new sp(this,a)}else t=new rw(this,e).collection();return t},remove:function(e){if(nh(e));else if(no(e)){var t=e;e=this.$(t)}return e.remove()}},sk,s_,sE,sT,{notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}})}},sO,sA,{style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return ng(e)?t.style=e.generateStyle(this):nl(e)?t.style=sV.fromJson(this,e):no(e)?t.style=sV.fromString(this,e):t.style=sV(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},sU,sW].forEach(function(e){nO(sG,e)});var sX={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(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},s$={maximal:!1,acyclic:!1},sq=function(e){return e.scratch("breadthfirst")},sK=function(e,t){return e.scratch("breadthfirst",t)};function sZ(e){this.options=nO({},sX,s$,e)}sZ.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=r.nodes().filter(function(e){return e.isChildless()}),a=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=!!t.boundingBox,l=rZ(s?t.boundingBox:structuredClone(n.extent()));if(nh(t.roots))e=t.roots;else if(nl(t.roots)){for(var c=[],u=0;u<t.roots.length;u++){var d=t.roots[u],h=n.getElementById(d);c.push(h)}e=n.collection(c)}else if(no(t.roots))e=n.$(t.roots);else if(a)e=i.roots();else{var f=r.components();e=n.collection();for(var p=0;p<f.length;p++)!function(){var t=f[p],n=t.maxDegree(!1),r=t.filter(function(e){return e.degree(!1)===n});e=e.add(r)}()}var g=[],v={},x=function(e,t){null==g[t]&&(g[t]=[]);var n=g[t].length;g[t].push(e),sK(e,{index:n,depth:t})},y=function(e,t){var n=sq(e),r=n.depth,i=n.index;g[r][i]=null,e.isChildless()&&x(e,t)};r.bfs({roots:e,directed:t.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();a.isChildless()&&x(a,i),v[o]=!0}});for(var b=[],w=0;w<i.length;w++){var N=i[w];v[N.id()]||b.push(N)}var j=function(e){for(var t=g[e],n=0;n<t.length;n++){var r=t[n];if(null==r){t.splice(n,1),n--;continue}sK(r,{depth:e,index:n})}};if(a&&o){var k=[],S={},C=function(e){return k.push(e)};for(i.forEach(function(e){return k.push(e)});k.length>0;){var _=k.shift(),E=function(e,n){for(var i=sq(e),a=e.incomers().filter(function(e){return e.isNode()&&r.has(e)}),o=-1,s=e.id(),l=0;l<a.length;l++)o=Math.max(o,sq(a[l]).depth);if(i.depth<=o){if(!t.acyclic&&n[s])return null;var c=o+1;return y(e,c),n[s]=c,!0}return!1}(_,S);if(E)_.outgoers().filter(function(e){return e.isNode()&&r.has(e)}).forEach(C);else if(null===E){ro("Detected double maximal shift for node `"+_.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var T=0;if(t.avoidOverlap)for(var M=0;M<i.length;M++){var O=i[M].layoutDimensions(t),A=O.w,D=O.h;T=Math.max(T,A,D)}var P={},I=function(e){if(P[e.id()])return P[e.id()];for(var t=sq(e).depth,n=e.neighborhood(),r=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!(s.isEdge()||s.isParent())&&i.has(s)){var l=sq(s);if(null!=l){var c=l.index,u=l.depth;if(null!=c&&null!=u){var d=g[u].length;u<t&&(r+=c/d,a++)}}}}return r/=a=Math.max(1,a),0===a&&(r=0),P[e.id()]=r,r},L=function(e,t){var n=I(e)-I(t);return 0===n?nM(e.id(),t.id()):n};void 0!==t.depthSort&&(L=t.depthSort);for(var R=g.length,B=0;B<R;B++)g[B].sort(L),j(B);for(var F=[],z=0;z<b.length;z++)F.push(b[z]);if(F.length){g.unshift(F),R=g.length;for(var V=0;V<R;V++)j(V)}for(var H=0,U=0;U<R;U++)H=Math.max(g[U].length,H);var W={x:l.x1+l.w/2,y:l.y1+l.h/2},Y=i.reduce(function(e,n){var r;return r=n.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}),{w:-1===e.w?r.w:(e.w+r.w)/2,h:-1===e.h?r.h:(e.h+r.h)/2}},{w:-1,h:-1}),G=Math.max(1===R?0:s?(l.h-2*t.padding-Y.h)/(R-1):(l.h-2*t.padding-Y.h)/(R+1),T),X=g.reduce(function(e,t){return Math.max(e,t.length)},0),$=function(e){var n=sq(e),r=n.depth,i=n.index;if(t.circle){var a=Math.min(l.w/2/R,l.h/2/R),o=(a=Math.max(a,T))*r+a-(R>0&&g[0].length<=3?a/2:0),c=2*Math.PI/g[r].length*i;return 0===r&&1===g[0].length&&(o=1),{x:W.x+o*Math.cos(c),y:W.y+o*Math.sin(c)}}var u=g[r].length,d=Math.max(1===u?0:s?(l.w-2*t.padding-Y.w)/((t.grid?X:u)-1):(l.w-2*t.padding-Y.w)/((t.grid?X:u)+1),T);return{x:W.x+(i+1-(u+1)/2)*d,y:W.y+(r+1-(R+1)/2)*G}},q={downward:0,leftward:90,upward:180,rightward:-90};return -1===Object.keys(q).indexOf(t.direction)&&ri("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(q).join(", "))),r.nodes().layoutPositions(this,t,function(e){return function(e,t,n){if(0===n)return e;var r,i,a,o,s=(t.x1+t.x2)/2,l=(t.y1+t.y2)/2,c=t.w/t.h,u=(r=e.x,i=e.y,{x:Math.cos(a=n*Math.PI/180)*(r-s)-Math.sin(a)*(i-l)+s,y:Math.sin(a)*(r-s)+Math.cos(a)*(i-l)+l}),d=(o=u.x,{x:(o-s)*c+s,y:(u.y-l)*(1/c)+l});return{x:d.x,y:d.y}}($(e),l,q[t.direction])}),this};var sQ={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function sJ(e){this.options=nO({},sQ,e)}sJ.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o=rZ(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),c=0,u=0;u<a.length;u++){var d=a[u].layoutDimensions(t);c=Math.max(c,d.w,d.h)}if(e=nu(t.radius)?t.radius:a.length<=1?0:Math.min(o.h,o.w)/2-c,a.length>1&&t.avoidOverlap){var h=Math.cos(l)-1,f=Math.sin(l)-0;e=Math.max(Math.sqrt((c*=1.75)*c/(h*h+f*f)),e)}return r.nodes().layoutPositions(this,t,function(n,r){var a=t.startAngle+r*l*(i?1:-1),o=e*Math.cos(a),c=e*Math.sin(a);return{x:s.x+o,y:s.y+c}}),this};var s0={fit:!0,padding:30,startAngle:1.5*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(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function s1(e){this.options=nO({},s0,e)}s1.prototype.run=function(){for(var e=this.options,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,n=e.cy,r=e.eles,i=r.nodes().not(":parent"),a=rZ(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:a.x1+a.w/2,y:a.y1+a.h/2},s=[],l=0,c=0;c<i.length;c++){var u=i[c],d=void 0;d=e.concentric(u),s.push({value:d,node:u}),u._private.scratch.concentric=d}i.updateStyle();for(var h=0;h<i.length;h++){var f=i[h].layoutDimensions(e);l=Math.max(l,f.w,f.h)}s.sort(function(e,t){return t.value-e.value});for(var p=e.levelWidth(i),g=[[]],v=g[0],x=0;x<s.length;x++){var y=s[x];v.length>0&&Math.abs(v[0].value-y.value)>=p&&(v=[],g.push(v)),v.push(y)}var b=l+e.minNodeSpacing;if(!e.avoidOverlap){var w=g.length>0&&g[0].length>1,N=(Math.min(a.w,a.h)/2-b)/(g.length+w?1:0);b=Math.min(b,N)}for(var j=0,k=0;k<g.length;k++){var S=g[k],C=void 0===e.sweep?2*Math.PI-2*Math.PI/S.length:e.sweep,_=S.dTheta=C/Math.max(1,S.length-1);if(S.length>1&&e.avoidOverlap){var E=Math.cos(_)-1,T=Math.sin(_)-0;j=Math.max(Math.sqrt(b*b/(E*E+T*T)),j)}S.r=j,j+=b}if(e.equidistant){for(var M=0,O=0,A=0;A<g.length;A++)M=Math.max(M,g[A].r-O);O=0;for(var D=0;D<g.length;D++){var P=g[D];0===D&&(O=P.r),P.r=O,O+=M}}for(var I={},L=0;L<g.length;L++)for(var R=g[L],B=R.dTheta,F=R.r,z=0;z<R.length;z++){var V=R[z],H=e.startAngle+(t?1:-1)*B*z,U={x:o.x+F*Math.cos(H),y:o.y+F*Math.sin(H)};I[V.node.id()]=U}return r.nodes().layoutPositions(this,e,function(e){return I[e.id()]}),this};var s2={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function s5(e){this.options=nO({},s2,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(e){var n=e.source().data("id"),r=e.target().data("id"),i=t.some(function(e){return e.data("id")===n}),a=t.some(function(e){return e.data("id")===r});return!i||!a});this.options.eles=this.options.eles.not(n)}s5.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(!0===e.animate||!1===e.animate)&&n.emit({type:"layoutstart",layout:n}),uY=!0===e.debug;var r=s3(t,n,e);uY&&uG(r),e.randomize&&s7(r);var i=n$(),a=function(){s8(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!n.stopped&&!(t>=e.numIter)&&(le(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),i=s9(r,e,t);t.layoutPositions(n,e,i)}},l=0,c=!0;if(!0===e.animate){var u=function(){for(var t=0;c&&t<e.refresh;)c=o(l),l++,t++;c?(n$()-i>=e.animationThreshold&&a(),nK(u)):(lh(r,e),s())};u()}else{for(;c;)c=o(l),l++;lh(r,e),s()}return this},s5.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},s5.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var s3=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=rZ(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},c=0;c<s.length;c++)for(var u=s[c],d=0;d<u.length;d++){var h=u[d];l[h.id()]=c}for(var c=0;c<o.nodeSize;c++){var f=i[c],p=f.layoutDimensions(n),g={};g.isLocked=f.locked(),g.id=f.data("id"),g.parentId=f.data("parent"),g.cmptId=l[f.id()],g.children=[],g.positionX=f.position("x"),g.positionY=f.position("y"),g.offsetX=0,g.offsetY=0,g.height=p.w,g.width=p.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(f.style("padding")),g.padRight=parseFloat(f.style("padding")),g.padTop=parseFloat(f.style("padding")),g.padBottom=parseFloat(f.style("padding")),g.nodeRepulsion=ns(n.nodeRepulsion)?n.nodeRepulsion(f):n.nodeRepulsion,o.layoutNodes.push(g),o.idToIndex[g.id]=c}for(var v=[],x=0,y=-1,b=[],c=0;c<o.nodeSize;c++){var f=o.layoutNodes[c],w=f.parentId;null!=w?o.layoutNodes[o.idToIndex[w]].children.push(f.id):(v[++y]=f.id,b.push(f.id))}for(o.graphSet.push(b);x<=y;){var N=v[x++],j=o.idToIndex[N],h=o.layoutNodes[j],k=h.children;if(k.length>0){o.graphSet.push(k);for(var c=0;c<k.length;c++)v[++y]=k[c]}}for(var c=0;c<o.graphSet.length;c++)for(var S=o.graphSet[c],d=0;d<S.length;d++){var C=o.idToIndex[S[d]];o.indexToGraph[C]=c}for(var c=0;c<o.edgeSize;c++){var _=r[c],E={};E.id=_.data("id"),E.sourceId=_.data("source"),E.targetId=_.data("target");var T=ns(n.idealEdgeLength)?n.idealEdgeLength(_):n.idealEdgeLength,M=ns(n.edgeElasticity)?n.edgeElasticity(_):n.edgeElasticity,O=o.idToIndex[E.sourceId],A=o.idToIndex[E.targetId];if(o.indexToGraph[O]!=o.indexToGraph[A]){for(var D=s4(E.sourceId,E.targetId,o),P=o.graphSet[D],I=0,g=o.layoutNodes[O];-1===P.indexOf(g.id);)g=o.layoutNodes[o.idToIndex[g.parentId]],I++;for(g=o.layoutNodes[A];-1===P.indexOf(g.id);)g=o.layoutNodes[o.idToIndex[g.parentId]],I++;T*=I*n.nestingFactor}E.idealLength=T,E.elasticity=M,o.layoutEdges.push(E)}return o},s4=function(e,t,n){var r=s6(e,t,0,n);return 2>r.count?0:r.graph},s6=function(e,t,n,r){var i=r.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var a=0,o=0;o<i.length;o++){var s=i[o],l=r.idToIndex[s],c=r.layoutNodes[l].children;if(0!==c.length){var u=s6(e,t,r.indexToGraph[r.idToIndex[c[0]]],r);if(0===u.count)continue;if(1!==u.count)return u;if(2==++a)break}}return{count:a,graph:n}},s7=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},s9=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(!t.boundingBox)return{x:o.positionX,y:o.positionY};var s=0===i.w?.5:(o.positionX-i.x1)/i.w,l=0===i.h?.5:(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+l*r.h}}},s8=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=s9(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},le=function(e,t,n){lt(e,t),lo(e),ls(e,t),ll(e),lc(e)},lt=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++)lr(o,e.layoutNodes[e.idToIndex[r[s]]],e,t)},ln=function(e){return -1+2*e*Math.random()},lr=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var i=t.positionX-e.positionX,a=t.positionY-e.positionY;0===i&&0===a&&(i=ln(1),a=ln(1));var o=li(e,t,i,a);if(o>0)var s=r.nodeOverlap*o,l=Math.sqrt(i*i+a*a),c=s*i/l,u=s*a/l;else var d=la(e,i,a),h=la(t,-1*i,-1*a),f=h.x-d.x,p=h.y-d.y,g=f*f+p*p,l=Math.sqrt(g),s=(e.nodeRepulsion+t.nodeRepulsion)/g,c=s*f/l,u=s*p/l;e.isLocked||(e.offsetX-=c,e.offsetY-=u),t.isLocked||(t.offsetX+=c,t.offsetY+=u)}},li=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},la=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,c={};return 0===t&&0<n||0===t&&0>n?(c.x=r,c.y=i+a/2):0<t&&-1*l<=s&&s<=l?(c.x=r+o/2,c.y=i+o*n/2/t):0>t&&-1*l<=s&&s<=l?(c.x=r-o/2,c.y=i-o*n/2/t):0<n&&(s<=-1*l||s>=l)?(c.x=r+a*t/2/n,c.y=i+a/2):0>n&&(s<=-1*l||s>=l)&&(c.x=r-a*t/2/n,c.y=i-a/2),c},lo=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-a.positionX,c=s.positionY-a.positionY;if(0!==l||0!==c){var u=la(a,l,c),d=la(s,-1*l,-1*c),h=d.x-u.x,f=d.y-u.y,p=Math.sqrt(h*h+f*f),g=Math.pow(r.idealLength-p,2)/r.elasticity;if(0!==p)var v=g*h/p,x=g*f/p;else var v=0,x=0;a.isLocked||(a.offsetX+=v,a.offsetY+=x),s.isLocked||(s.offsetX-=v,s.offsetY-=x)}}},ls=function(e,t){if(0!==t.gravity)for(var n=0;n<e.graphSet.length;n++){var r=e.graphSet[n],i=r.length;if(0===n)var a=e.clientHeight/2,o=e.clientWidth/2;else var s=e.layoutNodes[e.idToIndex[r[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]],a=l.positionX,o=l.positionY;for(var c=0;c<i;c++){var u=e.layoutNodes[e.idToIndex[r[c]]];if(!u.isLocked){var d=a-u.positionX,h=o-u.positionY,f=Math.sqrt(d*d+h*h);if(f>1){var p=t.gravity*d/f,g=t.gravity*h/f;u.offsetX+=p,u.offsetY+=g}}}}},ll=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var c=s.offsetX,u=s.offsetY,d=0;d<l.length;d++){var h=e.layoutNodes[e.idToIndex[l[d]]];h.offsetX+=c,h.offsetY+=u,n[++i]=l[d]}s.offsetX=0,s.offsetY=0}}},lc=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length)&&!r.isLocked){var i=lu(r.offsetX,r.offsetY,e.temperature);r.positionX+=i.x,r.positionY+=i.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,ld(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},lu=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},ld=function(e,t){var n=e.parentId;if(null!=n){var r=t.layoutNodes[t.idToIndex[n]],i=!1;if((null==r.maxX||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(null==r.minX||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,i=!0),(null==r.maxY||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(null==r.minY||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,i=!0),i)return ld(r,t)}},lh=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}for(var s=0,i=0;i<r.length;i++){var l=r[i];if(l){l.x1=1/0,l.x2=-1/0,l.y1=1/0,l.y2=-1/0;for(var c=0;c<l.length;c++){var u=l[c];l.x1=Math.min(l.x1,u.positionX-u.width/2),l.x2=Math.max(l.x2,u.positionX+u.width/2),l.y1=Math.min(l.y1,u.positionY-u.height/2),l.y2=Math.max(l.y2,u.positionY+u.height/2)}l.w=l.x2-l.x1,l.h=l.y2-l.y1,s+=l.w*l.h}}r.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var d=0,h=0,f=0,p=0,g=Math.sqrt(s)*e.clientWidth/e.clientHeight,i=0;i<r.length;i++){var l=r[i];if(l){for(var c=0;c<l.length;c++){var u=l[c];u.isLocked||(u.positionX+=d-l.x1,u.positionY+=h-l.y1)}d+=l.w+t.componentSpacing,f+=l.w+t.componentSpacing,p=Math.max(p,l.h),f>g&&(h+=p+t.componentSpacing,d=0,f=0,p=0)}}},lf={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(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function lp(e){this.options=nO({},lf,e)}lp.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().not(":parent");e.sort&&(r=r.sort(e.sort));var i=rZ(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===i.h||0===i.w)n.nodes().layoutPositions(this,e,function(e){return{x:i.x1,y:i.y1}});else{var a=r.size(),o=Math.sqrt(a*i.h/i.w),s=Math.round(o),l=Math.round(i.w/i.h*o),c=function(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e},u=function(e){if(null==e)return Math.max(s,l);Math.max(s,l)==s?s=e:l=e},d=e.rows,h=null!=e.cols?e.cols:e.columns;if(null!=d&&null!=h)s=d,l=h;else if(null!=d&&null==h)l=Math.ceil(a/(s=d));else if(null==d&&null!=h)s=Math.ceil(a/(l=h));else if(l*s>a){var f=c(),p=u();(f-1)*p>=a?c(f-1):(p-1)*f>=a&&u(p-1)}else for(;l*s<a;){var g=c(),v=u();(v+1)*g>=a?u(v+1):c(g+1)}var x=i.w/l,y=i.h/s;if(e.condense&&(x=0,y=0),e.avoidOverlap)for(var b=0;b<r.length;b++){var w=r[b],N=w._private.position;(null==N.x||null==N.y)&&(N.x=0,N.y=0);var j=w.layoutDimensions(e),k=e.avoidOverlapPadding,S=j.w+k,C=j.h+k;x=Math.max(x,S),y=Math.max(y,C)}for(var _={},E=function(e,t){return!!_["c-"+e+"-"+t]},T=function(e,t){_["c-"+e+"-"+t]=!0},M=0,O=0,A=function(){++O>=l&&(O=0,M++)},D={},P=0;P<r.length;P++){var I=r[P],L=e.position(I);if(L&&(void 0!==L.row||void 0!==L.col)){var R={row:L.row,col:L.col};if(void 0===R.col)for(R.col=0;E(R.row,R.col);)R.col++;else if(void 0===R.row)for(R.row=0;E(R.row,R.col);)R.row++;D[I.id()]=R,T(R.row,R.col)}}r.layoutPositions(this,e,function(e,t){if(e.locked()||e.isParent())return!1;var n,r,a=D[e.id()];if(a)n=a.col*x+x/2+i.x1,r=a.row*y+y/2+i.y1;else{for(;E(M,O);)A();n=O*x+x/2+i.x1,r=M*y+y/2+i.y1,T(M,O),A()}return{x:n,y:r}})}return this};var lm={ready:function(){},stop:function(){}};function lg(e){this.options=nO({},lm,e)}lg.prototype.run=function(){var e=this.options,t=e.eles;return e.cy,this.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),this.one("layoutready",e.ready),this.emit("layoutready"),this.one("layoutstop",e.stop),this.emit("layoutstop"),this},lg.prototype.stop=function(){return this};var lv={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(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function lx(e){this.options=nO({},lv,e)}lx.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=ns(e.positions);return t.layoutPositions(this,e,function(t,r){var i=function(t){if(null==e.positions){var r;return{x:(r=t.position()).x,y:r.y}}if(n)return e.positions(t);var i=e.positions[t._private.data.id];return null==i?null:i}(t);return!t.locked()&&null!=i&&i}),this};var ly={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function lb(e){this.options=nO({},ly,e)}lb.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=rZ(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}}),this};var lw=[{name:"breadthfirst",impl:sZ},{name:"circle",impl:sJ},{name:"concentric",impl:s1},{name:"cose",impl:s5},{name:"grid",impl:lp},{name:"null",impl:lg},{name:"preset",impl:lx},{name:"random",impl:lb}];function lN(e){this.options=e,this.notifications=0}var lj=function(){},lk=function(){throw Error("A headless instance can not render images")};lN.prototype={recalculateRenderedStyle:lj,notify:function(){this.notifications++},init:lj,isHeadless:function(){return!0},png:lk,jpg:lk};var lS={};lS.arrowShapeWidth=.3,lS.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,l=i.x+n/2+o,c=i.y-n/2-o,u=i.y+n/2+o;return s<=e&&e<=l&&c<=t&&t<=u},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=e*Math.sin(r)+t*Math.cos(r);return{x:a*n+i.x,y:o*n+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(r(s,l,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(r,s){no(s)&&(s=e[s]),e[r]=nO({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){return is(e,t,a(i(this.points,n+2*s,r,o)))},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:rt,roughCollide:rt,draw:rr,spacing:rn,gap:rn}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var l=i(this.points,n,a,o),c=this.controlPoint,u=r(c[0],c[1],n,a,o);t.arrowShapeImpl(this.name)(e,l,u)},gap:function(e){return .8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,l){var c=a(i(this.points,n+2*l,r,o)),u=a(i(this.pointsTee,n+2*l,r,o));return is(e,t,c)||is(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,l){var c=Math.pow(o.x-e,2)+Math.pow(o.y-t,2)<=Math.pow((n+2*l)*this.radius,2);return is(e,t,a(i(this.points,n+2*l,r,o)))||c},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e;return n[3]=n[3]-r,n[5]=n[5]-r,n},collide:function(e,t,n,r,o,s,l){var c=a(i(this.points,n+2*l,r,o)),u=a(i(this.crossLinePts(n,s),n+2*l,r,o));return is(e,t,c)||is(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return .525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,n,r,i,a,o){return Math.pow(i.x-e,2)+Math.pow(i.y-t,2)<=Math.pow((n+2*o)*this.radius,2)},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})};var lC={};lC.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),l=n.zoom();return[((e-i)/o-s.x)/l,((t-a)/o-s.y)/l]},lC.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},a={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,l=i.left+i.right,c=i.top+i.bottom,u=a.left+a.right,d=t.width/(o+u),h=t.left+i.left+a.left,f=t.top+i.top+a.top;return this.containerBB=[h,f,o-l,s-c,d]},lC.invalidateContainerClientCoordsCache=function(){this.containerBB=null},lC.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},lC.findNearestElements=function(e,t,n,r){var i,a,o=this,s=this,l=s.getCachedZSortedEles(),c=[],u=s.cy.zoom(),d=s.cy.hasCompoundNodes(),h=(r?24:8)/u,f=(r?8:2)/u,p=(r?8:2)/u,g=1/0;function v(e,t){if(e.isNode())if(a)return;else a=e,c.push(e);if(e.isEdge()&&(null==t||t<g))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value){for(var n=0;n<c.length;n++)if(c[n].isEdge()){c[n]=e,i=e,g=null!=t?t:g;break}}}else c.push(e),i=e,g=null!=t?t:g}function x(n){var r=n.outerWidth()+2*f,i=n.outerHeight()+2*f,a=r/2,l=i/2,c=n.position(),u="auto"===n.pstyle("corner-radius").value?"auto":n.pstyle("corner-radius").pfValue,d=n._private.rscratch;if(c.x-a<=e&&e<=c.x+a&&c.y-l<=t&&t<=c.y+l&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,i,c.x,c.y,u,d))return v(n,0),!0}n&&(l=l.interactive);function y(n,r){var i,a=n._private;i=r?r+"-":"",n.boundingBox();var o=a.labelBounds[r||"main"],s=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&s){var l=rm(a.rscratch,"labelX",r),c=rm(a.rscratch,"labelY",r),u=rm(a.rscratch,"labelAngle",r),d=n.pstyle(i+"text-margin-x").pfValue,h=n.pstyle(i+"text-margin-y").pfValue,f=o.x1-p-d,g=o.x2+p-d,x=o.y1-p-h,y=o.y2+p-h;if(u){var b=Math.cos(u),w=Math.sin(u),N=function(e,t){return{x:(e-=l)*b-(t-=c)*w+l,y:e*w+t*b+c}},j=N(f,x),k=N(f,y),S=N(g,x),C=N(g,y);if(is(e,t,[j.x+d,j.y+h,S.x+d,S.y+h,C.x+d,C.y+h,k.x+d,k.y+h]))return v(n),!0}else if(r4(o,e,t))return v(n),!0}}for(var b=l.length-1;b>=0;b--){var w=l[b];w.isNode()?x(w)||y(w):function(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,u=n.pstyle("arrow-scale").value,f=l/2+h,p=f*f,g=2*f,y=i.source,b=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var w=a.allpts,N=0;N+3<w.length;N+=2)if(ie(e,t,w[N],w[N+1],w[N+2],w[N+3],g)&&p>(r=io(e,t,w[N],w[N+1],w[N+2],w[N+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType){for(var w=a.allpts,N=0;N+5<a.allpts.length;N+=4)if(it(e,t,w[N],w[N+1],w[N+2],w[N+3],w[N+4],w[N+5],g)&&p>(r=ia(e,t,w[N],w[N+1],w[N+2],w[N+3],w[N+4],w[N+5])))return v(n,r),!0}for(var y=y||i.source,b=b||i.target,j=o.getArrowWidth(l,u),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}],N=0;N<k.length;N++){var S=k[N],C=s.arrowShapes[n.pstyle(S.name+"-arrow-shape").value],_=n.pstyle("width").pfValue;if(C.roughCollide(e,t,j,S.angle,{x:S.x,y:S.y},_,h)&&C.collide(e,t,j,S.angle,{x:S.x,y:S.y},_,h))return v(n),!0}d&&c.length>0&&(x(y),x(b))}(w)||y(w)||y(w,"source")||y(w,"target")}return c},lC.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=2/this.cy.zoom(),o=[],s=Math.min(e,n),l=Math.max(e,n),c=Math.min(t,r),u=Math.max(t,r);e=s,n=l;var d=rZ({x1:e,y1:t=c,x2:n,y2:r=u}),h=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],f=[[h[0],h[1]],[h[1],h[2]],[h[2],h[3]],[h[3],h[0]]];function p(e,t){var n=e._private;e.boundingBox();var r=n.labelBounds.main;if(!r)return null;var i=rm(n.rscratch,"labelX",t),o=rm(n.rscratch,"labelY",t),s=rm(n.rscratch,"labelAngle",t),l=e.pstyle("text-margin-x").pfValue,c=e.pstyle("text-margin-y").pfValue,u=r.x1-a-l,d=r.x2+a-l,h=r.y1-a-c,f=r.y2+a-c;if(!s)return[{x:u,y:h},{x:d,y:h},{x:d,y:f},{x:u,y:f}];var p=Math.cos(s),g=Math.sin(s),v=function(e,t){return{x:(e-=i)*p-(t-=o)*g+i,y:e*g+t*p+o}};return[v(u,h),v(d,h),v(d,f),v(u,f)]}for(var g=0;g<i.length;g++){var v=i[g];if(v.isNode()){var x="yes"===v.pstyle("text-events").strValue,y=v.pstyle("box-selection").strValue,b="yes"===v.pstyle("box-select-labels").strValue;if("none"===y)continue;var w=("overlap"===y||b)&&x,N=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:w});if("contain"===y){var j=!1;if(b&&x){var k=p(v);k&&iT(k,h)&&(o.push(v),j=!0)}!j&&r7(d,N)&&o.push(v)}else if("overlap"===y&&r3(d,N)){var S=v.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if(iT([{x:S.x1,y:S.y1},{x:S.x2,y:S.y1},{x:S.x2,y:S.y2},{x:S.x1,y:S.y2}],h))o.push(v);else{var C=p(v);C&&iT(C,h)&&o.push(v)}}}else{var _=v._private,E=_.rscratch,T=v.pstyle("box-selection").strValue;if("none"===T)continue;if("contain"===T){if(null!=E.startX&&null!=E.startY&&!r4(d,E.startX,E.startY)||null!=E.endX&&null!=E.endY&&!r4(d,E.endX,E.endY))continue;if("bezier"===E.edgeType||"multibezier"===E.edgeType||"self"===E.edgeType||"compound"===E.edgeType||"segments"===E.edgeType||"haystack"===E.edgeType){for(var M=_.rstyle.bezierPts||_.rstyle.linePts||_.rstyle.haystackPts,O=!0,A=0;A<M.length;A++)if(!r6(d,M[A])){O=!1;break}O&&o.push(v)}else"straight"===E.edgeType&&o.push(v)}else if("overlap"===T){var D=!1;if(null!=E.startX&&null!=E.startY&&null!=E.endX&&null!=E.endY&&(r4(d,E.startX,E.startY)||r4(d,E.endX,E.endY)))o.push(v),D=!0;else if(!D&&"haystack"===E.edgeType){for(var P=_.rstyle.haystackPts,I=0;I<P.length;I++)if(r6(d,P[I])){o.push(v),D=!0;break}}if(!D){var L=_.rstyle.bezierPts||_.rstyle.linePts||_.rstyle.haystackPts;if((!L||L.length<2)&&"straight"===E.edgeType&&null!=E.startX&&null!=E.startY&&null!=E.endX&&null!=E.endY&&(L=[{x:E.startX,y:E.startY},{x:E.endX,y:E.endY}]),!L||L.length<2)continue;for(var R=0;R<L.length-1;R++){for(var B=L[R],F=L[R+1],z=0;z<f.length;z++){var V=t3(f[z],2);if(function(e,t,n,r){function i(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return i(e,n,r)!==i(t,n,r)&&i(e,t,n)!==i(e,t,r)}(B,F,V[0],V[1])){o.push(v),D=!0;break}}if(D)break}}}}}return o};var l_={};l_.calculateArrowAngles=function(e){var t=e._private.rscratch,n="haystack"===t.edgeType,r="bezier"===t.edgeType,i="multibezier"===t.edgeType,a="segments"===t.edgeType,o="compound"===t.edgeType,s="self"===t.edgeType;if(n?(x=t.haystackPts[0],y=t.haystackPts[1],b=t.haystackPts[2],w=t.haystackPts[3]):(x=t.arrowStartX,y=t.arrowStartY,b=t.arrowEndX,w=t.arrowEndY),d=t.midX,h=t.midY,a)g=x-t.segpts[0],v=y-t.segpts[1];else if(i||o||s||r){var l=t.allpts,c=rX(l[0],l[2],l[4],.1),u=rX(l[1],l[3],l[5],.1);g=x-c,v=y-u}else g=x-d,v=y-h;t.srcArrowAngle=rV(g,v);var d=t.midX,h=t.midY;if(n&&(d=(x+b)/2,h=(y+w)/2),g=b-x,v=w-y,a){var l=t.allpts;if(l.length/2%2==0){var f=l.length/2,p=f-2;g=l[f]-l[p],v=l[f+1]-l[p+1]}else if(t.isRound)g=t.midVector[1],v=-t.midVector[0];else{var f=l.length/2-1,p=f-2;g=l[f]-l[p],v=l[f+1]-l[p+1]}}else if(i||o||s){var g,v,x,y,b,w,d,h,N,j,k,S,l=t.allpts;if(t.ctrlpts.length/2%2==0){var C=l.length/2-1,_=C+2,E=_+2;N=rX(l[C],l[_],l[E],0),j=rX(l[C+1],l[_+1],l[E+1],0),k=rX(l[C],l[_],l[E],1e-4),S=rX(l[C+1],l[_+1],l[E+1],1e-4)}else{var _=l.length/2-1,C=_-2,E=_+2;N=rX(l[C],l[_],l[E],.4999),j=rX(l[C+1],l[_+1],l[E+1],.4999),k=rX(l[C],l[_],l[E],.5),S=rX(l[C+1],l[_+1],l[E+1],.5)}g=k-N,v=S-j}if(t.midtgtArrowAngle=rV(g,v),t.midDispX=g,t.midDispY=v,g*=-1,v*=-1,a){var l=t.allpts;if(l.length/2%2==0);else if(!t.isRound){var f=l.length/2-1,T=f+2;g=-(l[T]-l[f]),v=-(l[T+1]-l[f+1])}}if(t.midsrcArrowAngle=rV(g,v),a)g=b-t.segpts[t.segpts.length-2],v=w-t.segpts[t.segpts.length-1];else if(i||o||s||r){var l=t.allpts,M=l.length,c=rX(l[M-6],l[M-4],l[M-2],.9),u=rX(l[M-5],l[M-3],l[M-1],.9);g=b-c,v=w-u}else g=b-d,v=w-h;t.tgtArrowAngle=rV(g,v)},l_.getArrowWidth=l_.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r),r};var lE,lT,lM,lO,lA,lD,lP,lI,lL,lR,lB,lF,lz,lV,lH,lU,lW,lY,lG,lX,l$,lq,lK,lZ,lQ,lJ,l0,l1,l2,l5,l3,l4,l6,l7,l9,l8,ce,ct,cn,cr,ci,ca,co,cs,cl,cc,cu,cd,ch,cf,cp,cm,cg,cv,cx,cy,cb,cw,cN,cj,ck,cS,cC,c_,cE,cT,cM,cO,cA,cD,cP,cI,cL,cR,cB,cF,cz,cV,cH,cU,cW,cY,cG,cX,c$,cq,cK,cZ,cQ,cJ,c0,c1,c2,c5,c3,c4,c6,c7,c9,c8,ue,ut,un,ur,ui,ua,uo,us,ul,uc,uu,ud,uh,uf,up,um,ug,uv,ux,uy,ub,uw,uN,uj,uk,uS,uC,u_,uE,uT,uM,uO,uA,uD,uP,uI,uL,uR,uB,uF,uz,uV,uH,uU,uW,uY,uG,uX,u$,uq,uK,uZ,uQ,uJ,u0,u1,u2,u5,u3,u4={},u6={},u7=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},u9=function(e,t){t.x=-1*e.x,t.y=-1*e.y,t.nx=-1*e.nx,t.ny=-1*e.ny,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},u8=function(e,t,n,r,i){if(e!==p?u7(t,e,u4):u9(u6,u4),u7(t,n,u6),uq=u4.nx*u6.ny-u4.ny*u6.nx,uK=u4.nx*u6.nx- -(u4.ny*u6.ny),1e-6>Math.abs(uJ=Math.asin(Math.max(-1,Math.min(1,uq))))){uX=t.x,u$=t.y,u1=u5=0;return}uZ=1,uQ=!1,uK<0?uJ<0?uJ=Math.PI+uJ:(uJ=Math.PI-uJ,uZ=-1,uQ=!0):uJ>0&&(uZ=-1,uQ=!0),u5=void 0!==t.radius?t.radius:r,u0=uJ/2,u3=Math.min(u4.len/2,u6.len/2),u1=i?(u2=Math.abs(Math.cos(u0)*u5/Math.sin(u0)))>u3?Math.abs((u2=u3)*Math.sin(u0)/Math.cos(u0)):u5:Math.abs((u2=Math.min(u3,u5))*Math.sin(u0)/Math.cos(u0)),h=t.x+u6.nx*u2,f=t.y+u6.ny*u2,uX=h-u6.ny*u1*uZ,u$=f+u6.nx*u1*uZ,u=t.x+u4.nx*u2,d=t.y+u4.ny*u2,p=t};function de(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function dt(e,t,n,r){var i=!(arguments.length>4)||void 0===arguments[4]||arguments[4];return 0===r||0===t.radius?{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}:(u8(e,t,n,r,i),{cx:uX,cy:u$,radius:u1,startX:u,startY:d,stopX:h,stopY:f,startAngle:u4.ang+Math.PI/2*uZ,endAngle:u6.ang-Math.PI/2*uZ,counterClockwise:uQ})}var dn=Math.sqrt(.02),dr={};function di(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}dr.findMidptPtsEtc=function(e,t){var n,r=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,o=e.pstyle("source-endpoint"),s=e.pstyle("target-endpoint"),l=null!=o.units&&null!=s.units;switch(e.pstyle("edge-distances").value){case"node-position":n=r;break;case"intersection":n=i;break;case"endpoints":if(l){var c,u,d,h=t3(this.manualEndptToPx(e.source()[0],o),2),f=h[0],p=h[1],g=t3(this.manualEndptToPx(e.target()[0],s),2),v=g[0],x=g[1];c=x-p,d=Math.sqrt((u=v-f)*u+c*c),a={x:-c/d,y:u/d},n={x1:f,y1:p,x2:v,y2:x}}else ro("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).")),n=i}return{midptPts:n,vectorNormInverse:a}},dr.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},i.target={x:Math.cos(a=2*Math.random()*Math.PI),y:Math.sin(a)}}var o=r.source,s=r.target,l=o.position(),c=s.position(),u=o.width(),d=s.width(),h=o.height(),f=s.height(),p=n.pstyle("haystack-radius").value/2;i.haystackPts=i.allpts=[i.source.x*u*p+l.x,i.source.y*h*p+l.y,i.target.x*d*p+c.x,i.target.y*f*p+c.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},dr.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),a=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),s=Math.min(r.pfValue.length,i.pfValue.length),l=a.pfValue[a.pfValue.length-1],c=o.pfValue[o.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var u=0;u<s;u++){var d=r.pfValue[u],h=i.pfValue[u],f=1-d,p=this.findMidptPtsEtc(e,t),g=p.midptPts,v=p.vectorNormInverse,x={x:g.x1*f+g.x2*d,y:g.y1*f+g.y2*d};n.segpts.push(x.x+v.x*h,x.y+v.y*h),n.radii.push(void 0!==a.pfValue[u]?a.pfValue[u]:l),n.isArcRadius.push((void 0!==o.pfValue[u]?o.pfValue[u]:c)==="arc-radius")}},dr.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,c=e.pstyle("loop-direction").pfValue,u=e.pstyle("loop-sweep").pfValue,d=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var h=n,f=d;r&&(h=0,f=l);var p=c-Math.PI/2,g=p-u/2,v=p+u/2,x=String(c+"_"+u);h=void 0===a[x]?a[x]=0:++a[x],i.ctrlpts=[o.x+1.4*Math.cos(g)*f*(h/3+1),o.y+1.4*Math.sin(g)*f*(h/3+1),o.x+1.4*Math.cos(v)*f*(h/3+1),o.y+1.4*Math.sin(v)*f*(h/3+1)]},dr.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,c=t.tgtW,u=t.tgtH,d=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),f=h?h.pfValue[0]:void 0,p=n,g=d;r&&(p=0,g=f);var v={x:a.x-s/2,y:a.y-l/2},x={x:o.x-c/2,y:o.y-u/2},y={x:Math.min(v.x,x.x),y:Math.min(v.y,x.y)},b=Math.max(.5,Math.log(.01*s)),w=Math.max(.5,Math.log(.01*c));i.ctrlpts=[y.x,y.y-1.7995514309304248*g*(p/3+1)*b,y.x-1.7995514309304248*g*(p/3+1)*w,y.y]},dr.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},dr.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),c=s&&l?Math.min(s.value.length,l.value.length):1,u=s?s.pfValue[0]:void 0,d=l.value[0];a.edgeType=r?"multibezier":"bezier",a.ctrlpts=[];for(var h=0;h<c;h++){var f=(.5-t.eles.length/2+n)*o*(i?-1:1),p=void 0,g=rU(f);r&&(u=s?s.pfValue[h]:o,d=l.value[h]);var v=void 0!==(p=r?u:void 0!==u?g*u:void 0)?p:f,x=1-d,y=d,b=this.findMidptPtsEtc(e,t),w=b.midptPts,N=b.vectorNormInverse,j={x:w.x1*x+w.x2*y,y:w.y1*x+w.y2*y};a.ctrlpts.push(j.x+N.x*v,j.y+N.y*v)}},dr.findTaxiPoints=function(e,t){var n,r=e._private.rscratch;r.edgeType="segments";var i="vertical",a="horizontal",o="leftward",s="rightward",l="downward",c="upward",u=t.posPts,d=t.srcW,h=t.srcH,f=t.tgtW,p=t.tgtH,g="node-position"!==e.pstyle("edge-distances").value,v=e.pstyle("taxi-direction").value,x=v,y=e.pstyle("taxi-turn"),b="%"===y.units,w=y.pfValue,N=e.pstyle("taxi-turn-min-distance").pfValue,j=u.x2-u.x1,k=u.y2-u.y1,S=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},C=S(j,g?(d+f)/2:0),_=S(k,g?(h+p)/2:0),E=!1;"auto"===x?v=Math.abs(C)>Math.abs(_)?a:i:x===c||x===l?(v=i,E=!0):(x===o||x===s)&&(v=a,E=!0);var T=v===i,M=T?_:C,O=T?k:j,A=rU(O),D=!1;!(E&&(b||w<0))&&(x===l&&O<0||x===c&&O>0||x===o&&O>0||x===s&&O<0)&&(A*=-1,M=A*Math.abs(M),D=!0);var P=function(e){return Math.abs(e)<N||Math.abs(e)>=Math.abs(M)},I=P(n=b?(w<0?1+w:w)*M:(w<0?M:0)+w*A),L=P(Math.abs(M)-Math.abs(n));if((I||L)&&!D)if(T){var R=Math.abs(j)<=f/2;if(Math.abs(O)<=h/2){var B=(u.x1+u.x2)/2;r.segpts=[B,u.y1,B,u.y2]}else if(R){var F=(u.y1+u.y2)/2;r.segpts=[u.x1,F,u.x2,F]}else r.segpts=[u.x1,u.y2]}else{var z=Math.abs(k)<=p/2;if(Math.abs(O)<=d/2){var V=(u.y1+u.y2)/2;r.segpts=[u.x1,V,u.x2,V]}else if(z){var H=(u.x1+u.x2)/2;r.segpts=[H,u.y1,H,u.y2]}else r.segpts=[u.x2,u.y1]}else if(T){var U=u.y1+n+(g?h/2*A:0);r.segpts=[u.x1,U,u.x2,U]}else{var W=u.x1+n+(g?d/2*A:0);r.segpts=[W,u.y1,W,u.y2]}if(r.isRound){var Y=e.pstyle("taxi-radius").value,G="arc-radius"===e.pstyle("radius-type").value[0];r.radii=Array(r.segpts.length/2).fill(Y),r.isArcRadius=Array(r.segpts.length/2).fill(G)}},dr.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,c=t.srcShape,u=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,f=t.srcRs,p=t.tgtRs,g=!nu(n.startX)||!nu(n.startY),v=!nu(n.arrowStartX)||!nu(n.arrowStartY),x=!nu(n.endX)||!nu(n.endY),y=!nu(n.arrowEndX)||!nu(n.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=rW({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),N=w<b,j=rW({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),k=j<b,S=!1;if(g||v||N){S=!0;var C={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},_=Math.sqrt(C.x*C.x+C.y*C.y),E={x:C.x/_,y:C.y/_},T=Math.max(a,o),M={x:n.ctrlpts[0]+2*E.x*T,y:n.ctrlpts[1]+2*E.y*T},O=c.intersectLine(r.x,r.y,a,o,M.x,M.y,0,d,f);N?(n.ctrlpts[0]=n.ctrlpts[0]+E.x*(b-w),n.ctrlpts[1]=n.ctrlpts[1]+E.y*(b-w)):(n.ctrlpts[0]=O[0]+E.x*b,n.ctrlpts[1]=O[1]+E.y*b)}if(x||y||k){S=!0;var A={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},D=Math.sqrt(A.x*A.x+A.y*A.y),P={x:A.x/D,y:A.y/D},I=Math.max(a,o),L={x:n.ctrlpts[0]+2*P.x*I,y:n.ctrlpts[1]+2*P.y*I},R=u.intersectLine(i.x,i.y,s,l,L.x,L.y,0,h,p);k?(n.ctrlpts[0]=n.ctrlpts[0]+P.x*(b-j),n.ctrlpts[1]=n.ctrlpts[1]+P.y*(b-j)):(n.ctrlpts[0]=R[0]+P.x*b,n.ctrlpts[1]=R[1]+P.y*b)}S&&this.findEndpoints(e)}},dr.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n,r=0;r+1<t.ctrlpts.length;r+=2)t.allpts.push(t.ctrlpts[r],t.ctrlpts[r+1]),r+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[r]+t.ctrlpts[r+2])/2,(t.ctrlpts[r+1]+t.ctrlpts[r+3])/2);(t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0)?(n=t.allpts.length/2-1,t.midX=t.allpts[n],t.midY=t.allpts[n+1]):(n=t.allpts.length/2-3,t.midX=rX(t.allpts[n],t.allpts[n+2],t.allpts[n+4],.5),t.midY=rX(t.allpts[n+1],t.allpts[n+3],t.allpts[n+5],.5))}else if("straight"===t.edgeType)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("segments"===t.edgeType){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 a=t.radii[i/2-1],o=t.isArcRadius[i/2-1];t.roundCorners.push(dt({x:t.allpts[i-2],y:t.allpts[i-1]},{x:t.allpts[i],y:t.allpts[i+1],radius:a},{x:t.allpts[i+2],y:t.allpts[i+3]},a,o))}}if(t.segpts.length%4==0){var s=t.segpts.length/2,l=s-2;t.midX=(t.segpts[l]+t.segpts[s])/2,t.midY=(t.segpts[l+1]+t.segpts[s+1])/2}else{var c=t.segpts.length/2-1;if(t.isRound){var u={x:t.segpts[c],y:t.segpts[c+1]},d=t.roundCorners[c/2];if(0===d.radius){var h={x:t.segpts[c+2],y:t.segpts[c+3]};t.midX=u.x,t.midY=u.y,t.midVector=[u.y-h.y,h.x-u.x]}else{var f=[u.x-d.cx,u.y-d.cy],p=d.radius/Math.sqrt(Math.pow(f[0],2)+Math.pow(f[1],2));f=f.map(function(e){return e*p}),t.midX=d.cx+f[0],t.midY=d.cy+f[1],t.midVector=f}}else t.midX=t.segpts[c],t.midY=t.segpts[c+1]}}},dr.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||nu(t.startX)&&nu(t.startY)&&nu(t.endX)&&nu(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,ro("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."))},dr.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),i=new rx,a=function(e,t){return[].concat(t4(e),[+!!t]).join("-")},o=[],s=[],l=0;l<e.length;l++){var c=e[l],u=c._private,d=c.pstyle("curve-style").value;if(!c.removed()&&c.takesUpSpace()){if("haystack"===d){s.push(c);continue}var h="unbundled-bezier"===d||nk(d,"segments")||"straight"===d||"straight-triangle"===d||nk(d,"taxi"),f="unbundled-bezier"===d||"bezier"===d,p=u.source,g=u.target,v=[p.poolIndex(),g.poolIndex()].sort(),x=a(v,h),y=i.get(x);null==y&&(y={eles:[]},o.push({pairId:v,edgeIsUnbundled:h}),i.set(x,y)),y.eles.push(c),h&&(y.hasUnbundled=!0),f&&(y.hasBezier=!0)}}for(var b=0;b<o.length;b++)!function(){var e,s=o[b],l=a(s.pairId,s.edgeIsUnbundled),c=i.get(l);if(!c.hasUnbundled){var u=c.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});rf(c.eles),u.forEach(function(e){return c.eles.push(e)}),c.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var d=c.eles[0],h=d.source(),f=d.target();if(h.poolIndex()>f.poolIndex()){var p=h;h=f,f=p}var g=c.srcPos=h.position(),v=c.tgtPos=f.position(),x=c.srcW=h.outerWidth(),y=c.srcH=h.outerHeight(),w=c.tgtW=f.outerWidth(),N=c.tgtH=f.outerHeight(),j=c.srcShape=n.nodeShapes[t.getNodeShape(h)],k=c.tgtShape=n.nodeShapes[t.getNodeShape(f)],S=c.srcCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,C=c.tgtCornerRadius="auto"===f.pstyle("corner-radius").value?"auto":f.pstyle("corner-radius").pfValue,_=c.tgtRs=f._private.rscratch,E=c.srcRs=h._private.rscratch;c.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var T=0;T<c.eles.length;T++){var M=c.eles[T],O=M[0]._private.rscratch,A=M.pstyle("curve-style").value,D="unbundled-bezier"===A||nk(A,"segments")||nk(A,"taxi"),P=!h.same(M.source());if(!c.calculatedIntersection&&h!==f&&(c.hasBezier||c.hasUnbundled)){c.calculatedIntersection=!0;var I=j.intersectLine(g.x,g.y,x,y,v.x,v.y,0,S,E),L=c.srcIntn=I,R=k.intersectLine(v.x,v.y,w,N,g.x,g.y,0,C,_),B=c.tgtIntn=R,F=c.intersectionPts={x1:I[0],x2:R[0],y1:I[1],y2:R[1]},z=c.posPts={x1:g.x,x2:v.x,y1:g.y,y2:v.y},V=R[1]-I[1],H=R[0]-I[0],U=Math.sqrt(H*H+V*V);nu(U)&&U>=dn||(U=Math.sqrt(Math.max(H*H,.01)+Math.max(V*V,.01)));var W=c.vector={x:H,y:V},Y=c.vectorNorm={x:W.x/U,y:W.y/U},G={x:-Y.y,y:Y.x};c.nodesOverlap=!nu(U)||k.checkPoint(I[0],I[1],0,w,N,v.x,v.y,C,_)||j.checkPoint(R[0],R[1],0,x,y,g.x,g.y,S,E),c.vectorNormInverse=G,e={nodesOverlap:c.nodesOverlap,dirCounts:c.dirCounts,calculatedIntersection:!0,hasBezier:c.hasBezier,hasUnbundled:c.hasUnbundled,eles:c.eles,srcPos:v,srcRs:_,tgtPos:g,tgtRs:E,srcW:w,srcH:N,tgtW:x,tgtH:y,srcIntn:B,tgtIntn:L,srcShape:k,tgtShape:j,posPts:{x1:z.x2,y1:z.y2,x2:z.x1,y2:z.y1},intersectionPts:{x1:F.x2,y1:F.y2,x2:F.x1,y2:F.y1},vector:{x:-W.x,y:-W.y},vectorNorm:{x:-Y.x,y:-Y.y},vectorNormInverse:{x:-G.x,y:-G.y}}}var X=P?e:c;O.nodesOverlap=X.nodesOverlap,O.srcIntn=X.srcIntn,O.tgtIntn=X.tgtIntn,O.isRound=A.startsWith("round"),r&&(h.isParent()||h.isChild()||f.isParent()||f.isChild())&&(h.parents().anySame(f)||f.parents().anySame(h)||h.same(f)&&h.isParent())?t.findCompoundLoopPoints(M,X,T,D):h===f?t.findLoopPoints(M,X,T,D):A.endsWith("segments")?t.findSegmentsPoints(M,X):A.endsWith("taxi")?t.findTaxiPoints(M,X):"straight"!==A&&(D||c.eles.length%2!=1||T!==Math.floor(c.eles.length/2))?t.findBezierPoints(M,X,T,D,P):t.findStraightEdgePoints(M),t.findEndpoints(M),t.tryToCorrectInvalidPoints(M,X),t.checkForInvalidEdgeWarning(M),t.storeAllpts(M),t.storeEdgeProjections(M),t.calculateArrowAngles(M),t.recalculateEdgeLabelProjections(M),t.calculateLabelAngles(M)}}();this.findHaystackPoints(s)}},dr.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),"segments"===t.edgeType)return di(t.segpts)},dr.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return di(t.ctrlpts)},dr.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var da={};da.manualEndptToPx=function(e,t){var n=e.position(),r=e.outerWidth(),i=e.outerHeight(),a=e._private.rscratch;if(2===t.value.length){var o=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(o[0]=o[0]*r),"%"===t.units[1]&&(o[1]=o[1]*i),o[0]+=n.x,o[1]+=n.y,o}var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(r,i),c=[n.x+Math.cos(s)*l,n.y+Math.sin(s)*l];return this.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,r,i,c[0],c[1],0,"auto"===e.pstyle("corner-radius").value?"auto":e.pstyle("corner-radius").pfValue,a)},da.findEndpoints=function(e){var t,n,r,i,a,o,s,l,c,u=e.source()[0],d=e.target()[0],h=u.position(),f=d.position(),p=e.pstyle("target-arrow-shape").value,g=e.pstyle("source-arrow-shape").value,v=e.pstyle("target-distance-from-node").pfValue,x=e.pstyle("source-distance-from-node").pfValue,y=u._private.rscratch,b=d._private.rscratch,w=e.pstyle("curve-style").value,N=e._private.rscratch,j=N.edgeType,k=nk(w,"taxi"),S="self"===j||"compound"===j,C="bezier"===j||"multibezier"===j||S,_="bezier"!==j,E="straight"===j||"segments"===j,T="segments"===j,M=S||k,O=e.pstyle("source-endpoint"),A=M?"outside-to-node":O.value,D="auto"===u.pstyle("corner-radius").value?"auto":u.pstyle("corner-radius").pfValue,P=e.pstyle("target-endpoint"),I=M?"outside-to-node":P.value,L="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue;N.srcManEndpt=O,N.tgtManEndpt=P;var R=null!=(t=(null==P||null==(n=P.pfValue)?void 0:n.length)===2?P.pfValue:null)?t:[0,0],B=null!=(r=(null==O||null==(i=O.pfValue)?void 0:i.length)===2?O.pfValue:null)?r:[0,0];if(C){var F=[N.ctrlpts[0],N.ctrlpts[1]];o=_?[N.ctrlpts[N.ctrlpts.length-2],N.ctrlpts[N.ctrlpts.length-1]]:F,s=F}else if(E){var z=T?N.segpts.slice(0,2):[f.x+R[0],f.y+R[1]];o=T?N.segpts.slice(N.segpts.length-2):[h.x+B[0],h.y+B[1]],s=z}if("inside-to-node"===I)a=[f.x,f.y];else if(P.units)a=this.manualEndptToPx(d,P);else if("outside-to-line"===I)a=N.tgtIntn;else if("outside-to-node"===I||"outside-to-node-or-label"===I?l=o:("outside-to-line"===I||"outside-to-line-or-label"===I)&&(l=[h.x,h.y]),a=this.nodeShapes[this.getNodeShape(d)].intersectLine(f.x,f.y,d.outerWidth(),d.outerHeight(),l[0],l[1],0,L,b),"outside-to-node-or-label"===I||"outside-to-line-or-label"===I){var V=d._private.rscratch,H=V.labelWidth,U=V.labelHeight,W=V.labelX,Y=V.labelY,G=H/2,X=U/2,$=d.pstyle("text-valign").value;"top"===$?Y-=X:"bottom"===$&&(Y+=X);var q=d.pstyle("text-halign").value;"left"===q?W-=G:"right"===q&&(W+=G);var K=iy(l[0],l[1],[W-G,Y-X,W+G,Y-X,W+G,Y+X,W-G,Y+X],f.x,f.y);if(K.length>0){var Z=rY(h,rL(a)),Q=rY(h,rL(K)),J=Z;Q<Z&&(a=K,J=Q),K.length>2&&rY(h,{x:K[2],y:K[3]})<J&&(a=[K[2],K[3]])}}var ee=iw(a,o,this.arrowShapes[p].spacing(e)+v),et=iw(a,o,this.arrowShapes[p].gap(e)+v);if(N.endX=et[0],N.endY=et[1],N.arrowEndX=ee[0],N.arrowEndY=ee[1],"inside-to-node"===A)a=[h.x,h.y];else if(O.units)a=this.manualEndptToPx(u,O);else if("outside-to-line"===A)a=N.srcIntn;else if("outside-to-node"===A||"outside-to-node-or-label"===A?c=s:("outside-to-line"===A||"outside-to-line-or-label"===A)&&(c=[f.x,f.y]),a=this.nodeShapes[this.getNodeShape(u)].intersectLine(h.x,h.y,u.outerWidth(),u.outerHeight(),c[0],c[1],0,D,y),"outside-to-node-or-label"===A||"outside-to-line-or-label"===A){var en=u._private.rscratch,er=en.labelWidth,ei=en.labelHeight,ea=en.labelX,eo=en.labelY,es=er/2,el=ei/2,ec=u.pstyle("text-valign").value;"top"===ec?eo-=el:"bottom"===ec&&(eo+=el);var eu=u.pstyle("text-halign").value;"left"===eu?ea-=es:"right"===eu&&(ea+=es);var ed=iy(c[0],c[1],[ea-es,eo-el,ea+es,eo-el,ea+es,eo+el,ea-es,eo+el],h.x,h.y);if(ed.length>0){var eh=rY(f,rL(a)),ef=rY(f,rL(ed)),ep=eh;ef<eh&&(a=[ed[0],ed[1]],ep=ef),ed.length>2&&rY(f,{x:ed[2],y:ed[3]})<ep&&(a=[ed[2],ed[3]])}}var em=iw(a,s,this.arrowShapes[g].spacing(e)+x),eg=iw(a,s,this.arrowShapes[g].gap(e)+x);N.startX=eg[0],N.startY=eg[1],N.arrowStartX=em[0],N.arrowStartY=em[1],(C||_||E)&&(nu(N.startX)&&nu(N.startY)&&nu(N.endX)&&nu(N.endY)?N.badLine=!1:N.badLine=!0)},da.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[0],y:t.haystackPts[1]}:{x:t.arrowStartX,y:t.arrowStartY}},da.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[2],y:t.haystackPts[3]}:{x:t.arrowEndX,y:t.arrowEndY}};var ds={};ds.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,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)!function(e,t,n){for(var r=function(e,t,n,r){return rX(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}(this,e,n.allpts.slice(i,i+6))}else if("segments"===r)for(var a=t.rstyle.linePts=[],i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]});else if("haystack"===r){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},ds.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var dl={};dl.recalculateNodeLabelProjection=function(e){var t,n;if(!nv(e.pstyle("label").strValue)){var r=e._private,i=e.width(),a=e.height(),o=e.padding(),s=e.position(),l=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,u=r.rscratch,d=r.rstyle;switch(l){case"left":t=s.x-i/2-o;break;case"right":t=s.x+i/2+o;break;default:t=s.x}switch(c){case"top":n=s.y-a/2-o;break;case"bottom":n=s.y+a/2+o;break;default:n=s.y}u.labelX=t,u.labelY=n,d.labelX=t,d.labelY=n,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var dc=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},du=function(e,t){return dc(t.x-e.x,t.y-e.y)},dd=function(e,t,n,r){var i=rK(0,r-.001,1),a=rK(0,r+.001,1);return du(r$(e,t,n,i),r$(e,t,n,a))};dl.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){rg(n.rscratch,e,t,r),rg(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y),o("labelAutoAngle",null,dc(r.midDispX,r.midDispY));var s=function(){if(s.cache)return s.cache;for(var e=[],t=0;t+5<r.allpts.length;t+=4){var a={x:r.allpts[t],y:r.allpts[t+1]},o={x:r.allpts[t+2],y:r.allpts[t+3]},l={x:r.allpts[t+4],y:r.allpts[t+5]};e.push({p0:a,p1:o,p2:l,startDist:0,length:0,segments:[]})}var c=n.rstyle.bezierPts,u=i.bezierProjPcts.length;function d(e,t,n,r,i){var a=rW(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var h=0;h<e.length;h++){var f=e[h],p=e[h-1];p&&(f.startDist=p.startDist+p.length),d(f,f.p0,c[h*u],0,i.bezierProjPcts[0]);for(var g=0;g<u-1;g++)d(f,c[h*u+g],c[h*u+g+1],i.bezierProjPcts[g],i.bezierProjPcts[g+1]);d(f,c[h*u+u-1],f.p2,i.bezierProjPcts[u-1],1)}return s.cache=e},l=function(n){var i="source"===n;if(a[n]){var l=e.pstyle(n+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var c,u,d=s(),h=0,f=0,p=0;p<d.length;p++){for(var g=d[i?p:d.length-1-p],v=0;v<g.segments.length;v++){var x=g.segments[i?v:g.segments.length-1-v],y=p===d.length-1&&v===g.segments.length-1;if(h=f,(f+=x.length)>=l||y){u={cp:g,segment:x};break}}if(u)break}var b=u.cp,w=u.segment,N=(l-h)/w.length,j=w.t1-w.t0,k=i?w.t0+j*N:w.t1-j*N;k=rK(0,k,1),t=r$(b.p0,b.p1,b.p2,k),c=dd(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var S,C,_,E,T=0,M=r.allpts.length,O=0;O+3<M&&(i?(S={x:r.allpts[O],y:r.allpts[O+1]},C={x:r.allpts[O+2],y:r.allpts[O+3]}):(S={x:r.allpts[M-2-O],y:r.allpts[M-1-O]},C={x:r.allpts[M-4-O],y:r.allpts[M-3-O]}),_=rW(S,C),E=T,!((T+=_)>=l));O+=2);var A=(l-E)/_;t=rq(S,C,A=rK(0,A,1)),c=du(S,C)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,c)}};l("source"),l("target"),this.applyLabelDimensions(e)}},dl.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},dl.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=n5(r,e._private.labelDimsKey);if(rm(n.rscratch,"prefixedLabelDimsKey",t)!==i){rg(n.rscratch,"prefixedLabelDimsKey",t,i);var a=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,s=e.pstyle("text-wrap").strValue,l=rm(n.rscratch,"labelWrapCachedLines",t)||[],c="wrap"!==s?1:Math.max(l.length,1),u=a.height/c,d=a.width,h=a.height+(c-1)*(o-1)*u;rg(n.rstyle,"labelWidth",t,d),rg(n.rscratch,"labelWidth",t,d),rg(n.rstyle,"labelHeight",t,h),rg(n.rscratch,"labelHeight",t,h),rg(n.rscratch,"labelLineHeight",t,u*o)}},dl.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(rg(n.rscratch,e,t,r),r):rm(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var c=i.split("\n"),u=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,h=[],f=/[\s\u200b]+|$/g,p=0;p<c.length;p++){var g=c[p],v=this.calculateLabelDimensions(e,g).width;if(d&&(g=g.split("").join("")),v>u){var x,y=g.matchAll(f),b="",w=0,N=t2(y);try{for(N.s();!(x=N.n()).done;){var j=x.value,k=j[0],S=g.substring(w,j.index);w=j.index+k.length;var C=0===b.length?S:b+S+k;this.calculateLabelDimensions(e,C).width<=u?b+=S+k:(b&&h.push(b),b=S+k)}}catch(e){N.e(e)}finally{N.f()}b.match(/^[\s\u200b]+$/)||h.push(b)}else h.push(g)}o("labelWrapCachedLines",h),i=o("labelWrapCachedText",h.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var _=e.pstyle("text-max-width").pfValue,E="",T=!1;if(this.calculateLabelDimensions(e,i).width<_)return i;for(var M=0;M<i.length&&!(this.calculateLabelDimensions(e,E+i[M]+"…").width>_);M++)E+=i[M],M===i.length-1&&(T=!0);return T||(E+="…"),E}return i},dl.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},dl.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue,a=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=this.labelCalcCanvas,l=this.labelCalcCanvasContext;if(!s){s=this.labelCalcCanvas=n.createElement("canvas"),l=this.labelCalcCanvasContext=s.getContext("2d");var c=s.style;c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none"}l.font="".concat(r," ").concat(o," ").concat(i,"px ").concat(a);for(var u=0,d=0,h=t.split("\n"),f=0;f<h.length;f++){var p=h[f];u=Math.max(Math.ceil(l.measureText(p).width),u),d+=i}return{width:u+=0,height:d+=0}},dl.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=e.pstyle((t?t+"-":"")+"text-rotation"),a=i.strValue;return"none"===a?0:r&&"autorotate"===a?n.labelAutoAngle:"autorotate"===a?0:i.pfValue},dl.calculateLabelAngles=function(e){var t=e.isEdge(),n=e._private.rscratch;n.labelAngle=this.calculateLabelAngle(e),t&&(n.sourceLabelAngle=this.calculateLabelAngle(e,"source"),n.targetLabelAngle=this.calculateLabelAngle(e,"target"))};var dh={},df=!1;dh.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(28>e.width()||28>e.height()))return df||(ro("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),df=!0),"rectangle";if(e.isParent())if("rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t)return t;else return"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var dp={};dp.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(e){r(e.target)}).on("style.* background.*",function(e){r(e.target,!1)});var i=function(i){if(i){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(r(s.connectedEdges()),l.cleanConnected=!0)}if(a)for(var c=0;c<a.length;c++)(0,a[c])(i,t);n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},dp.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},dp.recalculateRenderedStyle=function(e,t){var n=function(e){return e._private.rstyle.cleanConnected};if(0!==e.length){var r=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||n(o.source())&&n(o.target())||(l.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(e){return!e._private.rstyle.clean&&e.isBundledBezier()})&&(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?i.push(o):r.push(o),l.clean=!0)}for(var c=0;c<i.length;c++){var u=i[c],d=u._private.rstyle,h=u.position();this.recalculateNodeLabelProjection(u),d.nodeX=h.x,d.nodeY=h.y,d.nodeW=u.pstyle("width").pfValue,d.nodeH=u.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var f=0;f<r.length;f++){var p=r[f]._private,g=p.rstyle,v=p.rscratch;g.srcX=v.arrowStartX,g.srcY=v.arrowStartY,g.tgtX=v.arrowEndX,g.tgtY=v.arrowEndY,g.midX=v.midX,g.midY=v.midY,g.labelAngle=v.labelAngle,g.sourceLabelAngle=v.sourceLabelAngle,g.targetLabelAngle=v.targetLabelAngle}}}};var dm={};dm.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],i=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):i.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)}}},dm.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},dm.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(o5),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var dg={};[lC,l_,dr,da,ds,dl,dh,dp,dm].forEach(function(e){nO(dg,e)});var dv={};dv.getCachedImage=function(e,t,n){var r=this.imageCache=this.imageCache||{},i=r[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;var a=(i=r[e]=r[e]||{}).image=new Image;a.addEventListener("load",n),a.addEventListener("error",function(){a.error=!0});var o="data:";return e.substring(0,o.length).toLowerCase()!==o&&(a.crossOrigin=t="null"===t?null:t),a.src=e,a};var dx={};dx.registerBinding=function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s=e[o];if(void 0!==s){var l=this.binder(s);a.push(l.on.apply(l,i))}}return a}var l=this.binder(e);return l.on.apply(l,i)},dx.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||!("u"<typeof HTMLElement)&&e instanceof HTMLElement;if(null==t.supportsPassiveEvents){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});n.addEventListener("test",null,a)}catch(e){}t.supportsPassiveEvents=i}var o=function(n,i,a){var o=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},dx.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},dx.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},dx.load=function(){var e,t,n,r,i,a,o,s,l,c,u,d,h,f,p,g,v,x,y,b,w,N,j,k,S,C=this,_=C.cy.window(),E=function(e){return e.selected()},T=function(e,t,n,r){null==e&&(e=C.cy);for(var i=0;i<t.length;i++){var a=t[i];e.emit({originalEvent:n,type:a,position:r})}},M=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},O=function(e,t){var n=!0;if(C.cy.hasCompoundNodes()&&e&&e.pannable())for(var r=0;t&&r<t.length;r++){var e=t[r];if(e.isNode()&&e.isParent()&&!e.pannable()){n=!1;break}}else n=!0;return n},A=function(e){e[0]._private.grabbed=!0},D=function(e){e[0]._private.grabbed=!1},P=function(e){e[0]._private.rscratch.inDragLayer=!0},I=function(e){e[0]._private.rscratch.inDragLayer=!1},L=function(e){e[0]._private.rscratch.isGrabTarget=!0},R=function(e){e[0]._private.rscratch.isGrabTarget=!1},B=function(e,t){var n=t.addToList;!n.has(e)&&e.grabbable()&&!e.locked()&&(n.merge(e),A(e))},F=function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(P),n.connectedEdges().forEach(P)),t.addToList&&B(n,t)}},z=function(e,t){t=t||{};var n=e.cy().hasCompoundNodes();t.inDragLayer&&(e.forEach(P),e.neighborhood().stdFilter(function(e){return!n||e.isEdge()}).forEach(P)),t.addToList&&e.forEach(function(e){B(e,t)}),F(e,t),H(e,{inDragLayer:t.inDragLayer}),C.updateCachedGrabbedEles()},V=function(e){e&&(C.getCachedZSortedEles().forEach(function(e){D(e),I(e),R(e)}),C.updateCachedGrabbedEles())},H=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(P),r.forEach(P)),t.addToList&&r.forEach(function(e){B(e,t)})}}},U=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},W="u">typeof MutationObserver,Y="u">typeof ResizeObserver;W?(C.removeObserver=new MutationObserver(function(e){for(var t=0;t<e.length;t++){var n=e[t].removedNodes;if(n){for(var r=0;r<n.length;r++)if(n[r]===C.container){C.destroy();break}}}}),C.container.parentNode&&C.removeObserver.observe(C.container.parentNode,{childList:!0})):C.registerBinding(C.container,"DOMNodeRemoved",function(e){C.destroy()});var G=nG(function(){C.cy.resize()},100);W&&(C.styleObserver=new MutationObserver(G),C.styleObserver.observe(C.container,{attributes:!0})),C.registerBinding(_,"resize",G),Y&&(C.resizeObserver=new ResizeObserver(G),C.resizeObserver.observe(C.container));for(var X=function(){C.invalidateContainerClientCoordsCache()},$=C.container;null!=$;){e=$,C.registerBinding(e,"transitionend",X),C.registerBinding(e,"animationend",X),C.registerBinding(e,"scroll",X),$=$.parentNode}C.registerBinding(C.container,"contextmenu",function(e){e.preventDefault()});var q=function(e){for(var t=C.findContainerClientCoords(),n=t[0],r=t[1],i=t[2],a=t[3],o=e.touches?e.touches:[e],s=!1,l=0;l<o.length;l++){var c=o[l];if(n<=c.clientX&&c.clientX<=n+i&&r<=c.clientY&&c.clientY<=r+a){s=!0;break}}if(!s)return!1;for(var u=C.container,d=e.target.parentNode,h=!1;d;){if(d===u){h=!0;break}d=d.parentNode}return!!h};C.registerBinding(C.container,"mousedown",function(e){if(q(e)&&(1!==C.hoverData.which||1===e.which)){e.preventDefault(),U(),C.hoverData.capture=!0,C.hoverData.which=e.which;var t=C.cy,n=[e.clientX,e.clientY],r=C.projectIntoViewport(n[0],n[1]),i=C.selection,a=C.findNearestElements(r[0],r[1],!0,!1),o=a[0],s=C.dragData.possibleDragElements;C.hoverData.mdownPos=r,C.hoverData.mdownGPos=n;var l=function(t){return{originalEvent:e,type:t,position:{x:r[0],y:r[1]}}};if(3==e.which){C.hoverData.cxtStarted=!0;var c={originalEvent:e,type:"cxttapstart",position:{x:r[0],y:r[1]}};o?(o.activate(),o.emit(c),C.hoverData.down=o):t.emit(c),C.hoverData.downTime=new Date().getTime(),C.hoverData.cxtDragged=!1}else if(1==e.which){if(o&&o.activate(),null!=o&&C.nodeIsGrabbable(o)){if(L(o),o.selected()){s=C.dragData.possibleDragElements=t.collection();var u=t.$(function(e){return e.isNode()&&e.selected()&&C.nodeIsGrabbable(e)});z(u,{addToList:s}),o.emit(l("grabon")),u.forEach(function(e){e.emit(l("grab"))})}else z(o,{addToList:s=C.dragData.possibleDragElements=t.collection()}),o.emit(l("grabon")).emit(l("grab"));C.redrawHint("eles",!0),C.redrawHint("drag",!0)}C.hoverData.down=o,C.hoverData.downs=a,C.hoverData.downTime=new Date().getTime(),T(o,["mousedown","tapstart","vmousedown"],e,{x:r[0],y:r[1]}),null==o?(i[4]=1,C.data.bgActivePosistion={x:r[0],y:r[1]},C.redrawHint("select",!0),C.redraw()):o.pannable()&&(i[4]=1),C.hoverData.tapholdCancelled=!1,clearTimeout(C.hoverData.tapholdTimeout),C.hoverData.tapholdTimeout=setTimeout(function(){if(!C.hoverData.tapholdCancelled){var e=C.hoverData.down;e?e.emit(l("taphold")):t.emit(l("taphold"))}},C.tapholdDuration)}i[0]=i[2]=r[0],i[1]=i[3]=r[1]}},!1);var K=function(e){var t=e.getRootNode();if(t&&11===t.nodeType&&void 0!==t.host)return t}(C.container);C.registerBinding([_,K],"mousemove",function(e){var t,n;if(C.hoverData.capture||q(e)){var r=!1,i=C.cy,a=i.zoom(),o=[e.clientX,e.clientY],s=C.projectIntoViewport(o[0],o[1]),l=C.hoverData.mdownPos,c=C.hoverData.mdownGPos,u=C.selection,d=null;C.hoverData.draggingEles||C.hoverData.dragging||C.hoverData.selecting||(d=C.findNearestElement(s[0],s[1],!0,!1));var h=C.hoverData.last,f=C.hoverData.down,p=[s[0]-u[2],s[1]-u[3]],g=C.dragData.possibleDragElements;if(c){var v=o[0]-c[0],x=o[1]-c[1];C.hoverData.isOverThresholdDrag=t=v*v+x*x>=C.desktopTapThreshold2}var y=M(e);t&&(C.hoverData.tapholdCancelled=!0),r=!0,T(d,["mousemove","vmousemove","tapdrag"],e,{x:s[0],y:s[1]});var b=function(t){return{originalEvent:e,type:t,position:{x:s[0],y:s[1]}}},w=function(){C.data.bgActivePosistion=void 0,C.hoverData.selecting||i.emit(b("boxstart")),u[4]=1,C.hoverData.selecting=!0,C.redrawHint("select",!0),C.redraw()};if(3===C.hoverData.which){if(t){var N=b("cxtdrag");f?f.emit(N):i.emit(N),C.hoverData.cxtDragged=!0,(!C.hoverData.cxtOver||d!==C.hoverData.cxtOver)&&(C.hoverData.cxtOver&&C.hoverData.cxtOver.emit(b("cxtdragout")),C.hoverData.cxtOver=d,d&&d.emit(b("cxtdragover")))}}else if(C.hoverData.dragging){if(r=!0,i.panningEnabled()&&i.userPanningEnabled()){if(C.hoverData.justStartedPan){var j=C.hoverData.mdownPos;n={x:(s[0]-j[0])*a,y:(s[1]-j[1])*a},C.hoverData.justStartedPan=!1}else n={x:p[0]*a,y:p[1]*a};i.panBy(n),i.emit(b("dragpan")),C.hoverData.dragged=!0}s=C.projectIntoViewport(e.clientX,e.clientY)}else if(1==u[4]&&(null==f||f.pannable()))t&&(!C.hoverData.dragging&&i.boxSelectionEnabled()&&(y||!i.panningEnabled()||!i.userPanningEnabled())?w():!C.hoverData.selecting&&i.panningEnabled()&&i.userPanningEnabled()&&O(f,C.hoverData.downs)&&(C.hoverData.dragging=!0,C.hoverData.justStartedPan=!0,u[4]=0,C.data.bgActivePosistion=rL(l),C.redrawHint("select",!0),C.redraw()),f&&f.pannable()&&f.active()&&f.unactivate());else{if(f&&f.pannable()&&f.active()&&f.unactivate(),f&&f.grabbed()||d==h||(h&&T(h,["mouseout","tapdragout"],e,{x:s[0],y:s[1]}),d&&T(d,["mouseover","tapdragover"],e,{x:s[0],y:s[1]}),C.hoverData.last=d),f)if(t){if(i.boxSelectionEnabled()&&y)f&&f.grabbed()&&(V(g),f.emit(b("freeon")),g.emit(b("free")),C.dragData.didDrag&&(f.emit(b("dragfreeon")),g.emit(b("dragfree")))),w();else if(f&&f.grabbed()&&C.nodeIsDraggable(f)){var k,S=!C.dragData.didDrag;S&&C.redrawHint("eles",!0),C.dragData.didDrag=!0,C.hoverData.draggingEles||z(g,{inDragLayer:!0});var _={x:0,y:0};if(nu(p[0])&&nu(p[1])&&(_.x+=p[0],_.y+=p[1],S)){var E=C.hoverData.dragDelta;E&&nu(E[0])&&nu(E[1])&&(_.x+=E[0],_.y+=E[1])}C.hoverData.draggingEles=!0,g.silentShift(_).emit(b("position")).emit(b("drag")),C.redrawHint("drag",!0),C.redraw()}}else 0===(k=C.hoverData.dragDelta=C.hoverData.dragDelta||[]).length?(k.push(p[0]),k.push(p[1])):(k[0]+=p[0],k[1]+=p[1]);r=!0}if(u[2]=s[0],u[3]=s[1],r)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1),C.registerBinding(_,"mouseup",function(e){if((1!==C.hoverData.which||1===e.which||!C.hoverData.capture)&&C.hoverData.capture){C.hoverData.capture=!1;var i=C.cy,a=C.projectIntoViewport(e.clientX,e.clientY),o=C.selection,s=C.findNearestElement(a[0],a[1],!0,!1),l=C.dragData.possibleDragElements,c=C.hoverData.down,u=M(e);C.data.bgActivePosistion&&(C.redrawHint("select",!0),C.redraw()),C.hoverData.tapholdCancelled=!0,C.data.bgActivePosistion=void 0,c&&c.unactivate();var d=function(t){return{originalEvent:e,type:t,position:{x:a[0],y:a[1]}}};if(3===C.hoverData.which){var h=d("cxttapend");if(c?c.emit(h):i.emit(h),!C.hoverData.cxtDragged){var f=d("cxttap");c?c.emit(f):i.emit(f)}C.hoverData.cxtDragged=!1,C.hoverData.which=null}else if(1===C.hoverData.which){if(T(s,["mouseup","tapend","vmouseup"],e,{x:a[0],y:a[1]}),C.dragData.didDrag||C.hoverData.dragged||C.hoverData.selecting||C.hoverData.isOverThresholdDrag||(T(c,["click","tap","vclick"],e,{x:a[0],y:a[1]}),n=!1,e.timeStamp-r<=i.multiClickDebounceTime()?(t&&clearTimeout(t),n=!0,r=null,T(c,["dblclick","dbltap","vdblclick"],e,{x:a[0],y:a[1]})):(t=setTimeout(function(){n||T(c,["oneclick","onetap","voneclick"],e,{x:a[0],y:a[1]})},i.multiClickDebounceTime()),r=e.timeStamp)),null!=c||C.dragData.didDrag||C.hoverData.selecting||C.hoverData.dragged||M(e)||(i.$(E).unselect(["tapunselect"]),l.length>0&&C.redrawHint("eles",!0),C.dragData.possibleDragElements=l=i.collection()),s!=c||C.dragData.didDrag||C.hoverData.selecting||null==s||!s._private.selectable||(C.hoverData.dragging||("additive"===i.selectionType()||u?s.selected()?s.unselect(["tapunselect"]):s.select(["tapselect"]):u||(i.$(E).unmerge(s).unselect(["tapunselect"]),s.select(["tapselect"]))),C.redrawHint("eles",!0)),C.hoverData.selecting){var p=i.collection(C.getAllInBox(o[0],o[1],o[2],o[3]));C.redrawHint("select",!0),p.length>0&&C.redrawHint("eles",!0),i.emit(d("boxend"));"additive"===i.selectionType()||u||i.$(E).unmerge(p).unselect(),p.emit(d("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(d("boxselect")),C.redraw()}if(C.hoverData.dragging&&(C.hoverData.dragging=!1,C.redrawHint("select",!0),C.redrawHint("eles",!0),C.redraw()),!o[4]){C.redrawHint("drag",!0),C.redrawHint("eles",!0);var g=c&&c.grabbed();V(l),g&&(c.emit(d("freeon")),l.emit(d("free")),C.dragData.didDrag&&(c.emit(d("dragfreeon")),l.emit(d("dragfree"))))}}o[4]=0,C.hoverData.down=null,C.hoverData.cxtStarted=!1,C.hoverData.draggingEles=!1,C.hoverData.selecting=!1,C.hoverData.isOverThresholdDrag=!1,C.dragData.didDrag=!1,C.hoverData.dragged=!1,C.hoverData.dragDelta=[],C.hoverData.mdownPos=null,C.hoverData.mdownGPos=null,C.hoverData.which=null}},!1);var Z=[],Q=1e5,J=function(e,t){for(var n=0;n<e.length;n++)if(e[n]%t!=0)return!1;return!0},ee=function(e){for(var t=Math.abs(e[0]),n=1;n<e.length;n++)if(Math.abs(e[n])!==t)return!1;return!0},et=function(e){var t=!1,n=e.deltaY;if(null==n&&(null!=e.wheelDeltaY?n=e.wheelDeltaY/4:null!=e.wheelDelta&&(n=e.wheelDelta/4)),0!==n){if(null==i)if(Z.length>=4){if(!(i=J(Z,5))){var r=Math.abs(Z[0]);i=ee(Z)&&r>5}if(i)for(var a=0;a<Z.length;a++)Q=Math.min(Math.abs(Z[a]),Q)}else Z.push(n),t=!0;else i&&(Q=Math.min(Math.abs(n),Q));if(!C.scrollingPage){var o=C.cy,s=o.zoom(),l=o.pan(),c=C.projectIntoViewport(e.clientX,e.clientY),u=[c[0]*s+l.x,c[1]*s+l.y];if(C.hoverData.draggingEles||C.hoverData.dragging||C.hoverData.cxtStarted||0!==C.selection[4])return void e.preventDefault();if(o.panningEnabled()&&o.userPanningEnabled()&&o.zoomingEnabled()&&o.userZoomingEnabled()){e.preventDefault(),C.data.wheelZooming=!0,clearTimeout(C.data.wheelTimeout),C.data.wheelTimeout=setTimeout(function(){C.data.wheelZooming=!1,C.redrawHint("eles",!0),C.redraw()},150),t&&Math.abs(n)>5&&(n=5*rU(n)),d=-(n/250),i&&(d/=Q,d*=3),d*=C.wheelSensitivity,1===e.deltaMode&&(d*=33);var d,h=o.zoom()*Math.pow(10,d);"gesturechange"===e.type&&(h=C.gestureStartZoom*e.scale),o.zoom({level:h,renderedPosition:{x:u[0],y:u[1]}}),o.emit({type:"gesturechange"===e.type?"pinchzoom":"scrollzoom",originalEvent:e,position:{x:c[0],y:c[1]}})}}}};C.registerBinding(C.container,"wheel",et,!0),C.registerBinding(_,"scroll",function(e){C.scrollingPage=!0,clearTimeout(C.scrollingPageTimeout),C.scrollingPageTimeout=setTimeout(function(){C.scrollingPage=!1},250)},!0),C.registerBinding(C.container,"gesturestart",function(e){C.gestureStartZoom=C.cy.zoom(),C.hasTouchStarted||e.preventDefault()},!0),C.registerBinding(C.container,"gesturechange",function(e){C.hasTouchStarted||et(e)},!0),C.registerBinding(C.container,"mouseout",function(e){var t=C.projectIntoViewport(e.clientX,e.clientY);C.cy.emit({originalEvent:e,type:"mouseout",position:{x:t[0],y:t[1]}})},!1),C.registerBinding(C.container,"mouseover",function(e){var t=C.projectIntoViewport(e.clientX,e.clientY);C.cy.emit({originalEvent:e,type:"mouseover",position:{x:t[0],y:t[1]}})},!1);var en=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},er=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(C.registerBinding(C.container,"touchstart",y=function(e){if(C.hasTouchStarted=!0,q(e)){U(),C.touchData.capture=!0,C.data.bgActivePosistion=void 0;var t=C.cy,n=C.touchData.now,r=C.touchData.earlier;if(e.touches[0]){var i=C.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);n[0]=i[0],n[1]=i[1]}if(e.touches[1]){var i=C.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);n[2]=i[0],n[3]=i[1]}if(e.touches[2]){var i=C.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);n[4]=i[0],n[5]=i[1]}var y=function(t){return{originalEvent:e,type:t,position:{x:n[0],y:n[1]}}};if(e.touches[1]){C.touchData.singleTouchMoved=!0,V(C.dragData.touchDragEles);var b=C.findContainerClientCoords();f=b[0],p=b[1],g=b[2],v=b[3],a=e.touches[0].clientX-f,o=e.touches[0].clientY-p,s=e.touches[1].clientX-f,l=e.touches[1].clientY-p,x=0<=a&&a<=g&&0<=s&&s<=g&&0<=o&&o<=v&&0<=l&&l<=v;var w=t.pan(),N=t.zoom();if(c=en(a,o,s,l),u=er(a,o,s,l),h=[((d=[(a+s)/2,(o+l)/2])[0]-w.x)/N,(d[1]-w.y)/N],u<4e4&&!e.touches[2]){var j=C.findNearestElement(n[0],n[1],!0,!0),k=C.findNearestElement(n[2],n[3],!0,!0);j&&j.isNode()?(j.activate().emit(y("cxttapstart")),C.touchData.start=j):k&&k.isNode()?(k.activate().emit(y("cxttapstart")),C.touchData.start=k):t.emit(y("cxttapstart")),C.touchData.start&&(C.touchData.start._private.grabbed=!1),C.touchData.cxt=!0,C.touchData.cxtDragged=!1,C.data.bgActivePosistion=void 0,C.redraw();return}}if(e.touches[2])t.boxSelectionEnabled()&&e.preventDefault();else if(e.touches[1]);else if(e.touches[0]){var S=C.findNearestElements(n[0],n[1],!0,!0),_=S[0];if(null!=_&&(_.activate(),C.touchData.start=_,C.touchData.starts=S,C.nodeIsGrabbable(_))){var E=C.dragData.touchDragEles=t.collection(),M=null;C.redrawHint("eles",!0),C.redrawHint("drag",!0),_.selected()?z(M=t.$(function(e){return e.selected()&&C.nodeIsGrabbable(e)}),{addToList:E}):z(_,{addToList:E}),L(_),_.emit(y("grabon")),M?M.forEach(function(e){e.emit(y("grab"))}):_.emit(y("grab"))}T(_,["touchstart","tapstart","vmousedown"],e,{x:n[0],y:n[1]}),null==_&&(C.data.bgActivePosistion={x:i[0],y:i[1]},C.redrawHint("select",!0),C.redraw()),C.touchData.singleTouchMoved=!1,C.touchData.singleTouchStartTime=+new Date,clearTimeout(C.touchData.tapholdTimeout),C.touchData.tapholdTimeout=setTimeout(function(){!1!==C.touchData.singleTouchMoved||C.pinching||C.touchData.selecting||T(C.touchData.start,["taphold"],e,{x:n[0],y:n[1]})},C.tapholdDuration)}if(e.touches.length>=1){for(var O=C.touchData.startPosition=[null,null,null,null,null,null],A=0;A<n.length;A++)O[A]=r[A]=n[A];var D=e.touches[0];C.touchData.startGPosition=[D.clientX,D.clientY]}}},!1),C.registerBinding(_,"touchmove",b=function(e){var t=C.touchData.capture;if(t||q(e)){var n=C.selection,r=C.cy,i=C.touchData.now,d=C.touchData.earlier,g=r.zoom();if(e.touches[0]){var v=C.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);i[0]=v[0],i[1]=v[1]}if(e.touches[1]){var v=C.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);i[2]=v[0],i[3]=v[1]}if(e.touches[2]){var v=C.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);i[4]=v[0],i[5]=v[1]}var y=function(t){return{originalEvent:e,type:t,position:{x:i[0],y:i[1]}}},b=C.touchData.startGPosition;if(t&&e.touches[0]&&b){for(var w=[],N=0;N<i.length;N++)w[N]=i[N]-d[N];var j=e.touches[0].clientX-b[0],k=j*j,S=e.touches[0].clientY-b[1];et=k+S*S>=C.touchTapThreshold2}if(t&&C.touchData.cxt){e.preventDefault();var _=e.touches[0].clientX-f,E=e.touches[0].clientY-p,M=e.touches[1].clientX-f,A=e.touches[1].clientY-p,D=er(_,E,M,A);if(D/u>=2.25||D>=22500){C.touchData.cxt=!1,C.data.bgActivePosistion=void 0,C.redrawHint("select",!0);var P=y("cxttapend");C.touchData.start?(C.touchData.start.unactivate().emit(P),C.touchData.start=null):r.emit(P)}}if(t&&C.touchData.cxt){var P=y("cxtdrag");C.data.bgActivePosistion=void 0,C.redrawHint("select",!0),C.touchData.start?C.touchData.start.emit(P):r.emit(P),C.touchData.start&&(C.touchData.start._private.grabbed=!1),C.touchData.cxtDragged=!0;var I=C.findNearestElement(i[0],i[1],!0,!0);(!C.touchData.cxtOver||I!==C.touchData.cxtOver)&&(C.touchData.cxtOver&&C.touchData.cxtOver.emit(y("cxtdragout")),C.touchData.cxtOver=I,I&&I.emit(y("cxtdragover")))}else if(t&&e.touches[2]&&r.boxSelectionEnabled())e.preventDefault(),C.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,C.touchData.selecting||r.emit(y("boxstart")),C.touchData.selecting=!0,C.touchData.didSelect=!0,n[4]=1,n&&0!==n.length&&void 0!==n[0]?(n[2]=(i[0]+i[2]+i[4])/3,n[3]=(i[1]+i[3]+i[5])/3):(n[0]=(i[0]+i[2]+i[4])/3,n[1]=(i[1]+i[3]+i[5])/3,n[2]=(i[0]+i[2]+i[4])/3+1,n[3]=(i[1]+i[3]+i[5])/3+1),C.redrawHint("select",!0),C.redraw();else if(t&&e.touches[1]&&!C.touchData.didSelect&&r.zoomingEnabled()&&r.panningEnabled()&&r.userZoomingEnabled()&&r.userPanningEnabled()){e.preventDefault(),C.data.bgActivePosistion=void 0,C.redrawHint("select",!0);var L=C.dragData.touchDragEles;if(L){C.redrawHint("drag",!0);for(var R=0;R<L.length;R++){var B=L[R]._private;B.grabbed=!1,B.rscratch.inDragLayer=!1}}var F=C.touchData.start,_=e.touches[0].clientX-f,E=e.touches[0].clientY-p,M=e.touches[1].clientX-f,A=e.touches[1].clientY-p,H=en(_,E,M,A),U=H/c;if(x){var W=_-a,Y=E-o,G=M-s,X=A-l,$=r.zoom(),K=$*U,Z=r.pan(),Q=h[0]*$+Z.x,J=h[1]*$+Z.y,ee={x:-K/$*(Q-Z.x-(W+G)/2)+Q,y:-K/$*(J-Z.y-(Y+X)/2)+J};if(F&&F.active()){var L=C.dragData.touchDragEles;V(L),C.redrawHint("drag",!0),C.redrawHint("eles",!0),F.unactivate().emit(y("freeon")),L.emit(y("free")),C.dragData.didDrag&&(F.emit(y("dragfreeon")),L.emit(y("dragfree")))}r.viewport({zoom:K,pan:ee,cancelOnFailedZoom:!0}),r.emit(y("pinchzoom")),c=H,a=_,o=E,s=M,l=A,C.pinching=!0}if(e.touches[0]){var v=C.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);i[0]=v[0],i[1]=v[1]}if(e.touches[1]){var v=C.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);i[2]=v[0],i[3]=v[1]}if(e.touches[2]){var v=C.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);i[4]=v[0],i[5]=v[1]}}else if(e.touches[0]&&!C.touchData.didSelect){var et,I,ei=C.touchData.start,ea=C.touchData.last;if(C.hoverData.draggingEles||C.swipePanning||(I=C.findNearestElement(i[0],i[1],!0,!0)),t&&null!=ei&&e.preventDefault(),t&&null!=ei&&C.nodeIsDraggable(ei))if(et){var L=C.dragData.touchDragEles,eo=!C.dragData.didDrag;eo&&z(L,{inDragLayer:!0}),C.dragData.didDrag=!0;var es={x:0,y:0};if(nu(w[0])&&nu(w[1])&&(es.x+=w[0],es.y+=w[1],eo)){C.redrawHint("eles",!0);var el=C.touchData.dragDelta;el&&nu(el[0])&&nu(el[1])&&(es.x+=el[0],es.y+=el[1])}C.hoverData.draggingEles=!0,L.silentShift(es).emit(y("position")).emit(y("drag")),C.redrawHint("drag",!0),C.touchData.startPosition[0]==d[0]&&C.touchData.startPosition[1]==d[1]&&C.redrawHint("eles",!0),C.redraw()}else{var el=C.touchData.dragDelta=C.touchData.dragDelta||[];0===el.length?(el.push(w[0]),el.push(w[1])):(el[0]+=w[0],el[1]+=w[1])}if(T(ei||I,["touchmove","tapdrag","vmousemove"],e,{x:i[0],y:i[1]}),ei&&ei.grabbed()||I==ea||(ea&&ea.emit(y("tapdragout")),I&&I.emit(y("tapdragover"))),C.touchData.last=I,t)for(var R=0;R<i.length;R++)i[R]&&C.touchData.startPosition[R]&&et&&(C.touchData.singleTouchMoved=!0);if(t&&(null==ei||ei.pannable())&&r.panningEnabled()&&r.userPanningEnabled()){O(ei,C.touchData.starts)&&(e.preventDefault(),C.data.bgActivePosistion||(C.data.bgActivePosistion=rL(C.touchData.startPosition)),C.swipePanning?(r.panBy({x:w[0]*g,y:w[1]*g}),r.emit(y("dragpan"))):et&&(C.swipePanning=!0,r.panBy({x:j*g,y:S*g}),r.emit(y("dragpan")),ei&&(ei.unactivate(),C.redrawHint("select",!0),C.touchData.start=null)));var v=C.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);i[0]=v[0],i[1]=v[1]}}for(var N=0;N<i.length;N++)d[N]=i[N];t&&e.touches.length>0&&!C.hoverData.draggingEles&&!C.swipePanning&&null!=C.data.bgActivePosistion&&(C.data.bgActivePosistion=void 0,C.redrawHint("select",!0),C.redraw())}},!1),C.registerBinding(_,"touchcancel",w=function(e){var t=C.touchData.start;C.touchData.capture=!1,t&&t.unactivate()}),C.registerBinding(_,"touchend",N=function(e){var t,n=C.touchData.start;if(C.touchData.capture){0===e.touches.length&&(C.touchData.capture=!1),e.preventDefault();var r=C.selection;C.swipePanning=!1,C.hoverData.draggingEles=!1;var i=C.cy,a=i.zoom(),o=C.touchData.now,s=C.touchData.earlier;if(e.touches[0]){var l=C.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);o[0]=l[0],o[1]=l[1]}if(e.touches[1]){var l=C.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);o[2]=l[0],o[3]=l[1]}if(e.touches[2]){var l=C.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);o[4]=l[0],o[5]=l[1]}var c=function(t){return{originalEvent:e,type:t,position:{x:o[0],y:o[1]}}};if(n&&n.unactivate(),C.touchData.cxt){if(t=c("cxttapend"),n?n.emit(t):i.emit(t),!C.touchData.cxtDragged){var u=c("cxttap");n?n.emit(u):i.emit(u)}C.touchData.start&&(C.touchData.start._private.grabbed=!1),C.touchData.cxt=!1,C.touchData.start=null,C.redraw();return}if(!e.touches[2]&&i.boxSelectionEnabled()&&C.touchData.selecting){C.touchData.selecting=!1;var d=i.collection(C.getAllInBox(r[0],r[1],r[2],r[3]));r[0]=void 0,r[1]=void 0,r[2]=void 0,r[3]=void 0,r[4]=0,C.redrawHint("select",!0),i.emit(c("boxend")),d.emit(c("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(c("boxselect")),d.nonempty()&&C.redrawHint("eles",!0),C.redraw()}if(null!=n&&n.unactivate(),e.touches[2])C.data.bgActivePosistion=void 0,C.redrawHint("select",!0);else if(e.touches[1]);else if(e.touches[0]);else if(!e.touches[0]){C.data.bgActivePosistion=void 0,C.redrawHint("select",!0);var h=C.dragData.touchDragEles;if(null!=n){var f=n._private.grabbed;V(h),C.redrawHint("drag",!0),C.redrawHint("eles",!0),f&&(n.emit(c("freeon")),h.emit(c("free")),C.dragData.didDrag&&(n.emit(c("dragfreeon")),h.emit(c("dragfree")))),T(n,["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]}),n.unactivate(),C.touchData.start=null}else T(C.findNearestElement(o[0],o[1],!0,!0),["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]});var p=C.touchData.startPosition[0]-o[0],g=C.touchData.startPosition[1]-o[1];C.touchData.singleTouchMoved||(n||i.$(":selected").unselect(["tapunselect"]),T(n,["tap","vclick"],e,{x:o[0],y:o[1]}),j=!1,e.timeStamp-S<=i.multiClickDebounceTime()?(k&&clearTimeout(k),j=!0,S=null,T(n,["dbltap","vdblclick"],e,{x:o[0],y:o[1]})):(k=setTimeout(function(){j||T(n,["onetap","voneclick"],e,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),S=e.timeStamp)),null!=n&&!C.dragData.didDrag&&n._private.selectable&&(p*p+g*g)*a*a<C.touchTapThreshold2&&!C.pinching&&("single"===i.selectionType()?(i.$(E).unmerge(n).unselect(["tapunselect"]),n.select(["tapselect"])):n.selected()?n.unselect(["tapunselect"]):n.select(["tapselect"]),C.redrawHint("eles",!0)),C.touchData.singleTouchMoved=!0}for(var v=0;v<o.length;v++)s[v]=o[v];C.dragData.didDrag=!1,0===e.touches.length&&(C.touchData.dragDelta=[],C.touchData.startPosition=[null,null,null,null,null,null],C.touchData.startGPosition=null,C.touchData.didSelect=!1),e.touches.length<2&&(1===e.touches.length&&(C.touchData.startGPosition=[e.touches[0].clientX,e.touches[0].clientY]),C.pinching=!1,C.redrawHint("eles",!0),C.redraw())}},!1),"u"<typeof TouchEvent){var ei=[],ea=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},eo=function(e){ei.push({event:e,touch:ea(e)})},es=function(e){for(var t=0;t<ei.length;t++)if(ei[t].event.pointerId===e.pointerId)return void ei.splice(t,1)},el=function(e){var t=ei.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=ea(e)},ec=function(e){e.touches=ei.map(function(e){return e.touch})},eu=function(e){return"mouse"===e.pointerType||4===e.pointerType};C.registerBinding(C.container,"pointerdown",function(e){eu(e)||(e.preventDefault(),eo(e),ec(e),y(e))}),C.registerBinding(C.container,"pointerup",function(e){eu(e)||(es(e),ec(e),N(e))}),C.registerBinding(C.container,"pointercancel",function(e){eu(e)||(es(e),ec(e),w(e))}),C.registerBinding(C.container,"pointermove",function(e){eu(e)||(e.preventDefault(),el(e),ec(e),b(e))})}};var dy={};dy.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl("polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o,s){return iy(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o,s){return il(e,t,this.points,a,o,r,i,[0,-1],n)},hasMiterBounds:"rectangle"!==e,miterBounds:function(e,t,n,r,i,a){var o,s,l;return o=this.points,s=function(e,t){if(e.length<3)throw Error("Need at least 3 vertices");var n=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},r=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},i=function(e,t){return{x:e.x*t,y:e.y*t}},a=function(e,t){return e.x*t.y-e.y*t.x},o=e.map(function(e){return{x:e.x,y:e.y}});0>function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2}(o)&&o.reverse();for(var s=o.length,l=[],c=0;c<s;c++){var u=o[c],d=r(o[(c+1)%s],u),h=function(e){var t=r9(e.x,e.y);return 0===t?{x:0,y:0}:{x:e.x/t,y:e.y/t}}({x:d.y,y:-d.x});l.push(h)}for(var f=l.map(function(e,r){return{p1:n(o[r],i(e,t)),p2:n(o[(r+1)%s],i(e,t))}}),p=[],g=0;g<s;g++){var v=f[(g-1+s)%s],x=f[g],y=function(e,t,o,s){var l=r(t,e),c=r(s,o),u=a(l,c);if(1e-9>Math.abs(u))return n(e,i(l,.5));var d=a(r(o,e),c)/u;return n(e,i(l,d))}(v.p1,v.p2,x.p1,x.p2);p.push(y)}return p}(ix(o,e,t,n,r),i),l=rZ(),s.forEach(function(e){return r0(l,e.x,e.y)}),l}}},dy.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return ih(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return ip(e,t,r,i,a,o,n)}}},dy.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,o,s){if(void 0!==o[s]&&o[s+"-cx"]===e&&o[s+"-cy"]===n)return o[s];o[s]=Array(t.length/2),o[s+"-cx"]=e,o[s+"-cy"]=n;var l=r/2,c=i/2;a="auto"===a?iC(r,i):a;for(var u=Array(t.length/2),d=0;d<t.length/2;d++)u[d]={x:e+l*t[2*d],y:n+c*t[2*d+1]};var h,f,p,g,v=u.length;for(h=0,f=u[v-1];h<v;h++)p=u[h%v],g=u[(h+1)%v],o[s][h]=dt(f,p,g,a),f=p,p=g;return o[s]},draw:function(e,t,n,r,i,a,o){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,i,this.points,this.getOrCreateCorners(t,n,r,i,a,o,"drawCorners"))},intersectLine:function(e,t,n,r,i,a,o,s,l){return ib(i,a,this.points,e,t,n,r,o,this.getOrCreateCorners(e,t,n,r,s,l,"corners"))},checkPoint:function(e,t,n,r,i,a,o,s,l){return ic(e,t,this.points,a,o,r,i,this.getOrCreateCorners(a,o,r,i,s,l,"corners"))}}},dy.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:iN(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){return r8(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=r/2,c=i/2,u=2*(s=Math.min(l,c,s="auto"===s?iS(r,i):s));return!!(il(e,t,this.points,a,o,r,i-u,[0,-1],n)||il(e,t,this.points,a,o,r-u,i,[0,-1],n)||ip(e,t,u,u,a-l+s,o-c+s,n)||ip(e,t,u,u,a+l-s,o-c+s,n)||ip(e,t,u,u,a+l-s,o+c-s,n)||ip(e,t,u,u,a-l+s,o+c-s,n))}}},dy.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:i_(),points:iN(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,null,a)},generateCutTrianglePts:function(e,t,n,r,i){var a="auto"===i?this.cornerLength:i,o=t/2,s=e/2,l=n-s,c=n+s,u=r-o,d=r+o;return{topLeft:[l,u+a,l+a,u,l+a,u+a],topRight:[c-a,u,c,u+a,c-a,u+a],bottomRight:[c,d-a,c-a,d,c-a,d-a],bottomLeft:[l+a,d,l,d-a,l+a,d-a]}},intersectLine:function(e,t,n,r,i,a,o,s){var l=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s);return iy(i,a,[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]),e,t)},checkPoint:function(e,t,n,r,i,a,o,s){var l="auto"===s?this.cornerLength:s;if(il(e,t,this.points,a,o,r,i-2*l,[0,-1],n)||il(e,t,this.points,a,o,r-2*l,i,[0,-1],n))return!0;var c=this.generateCutTrianglePts(r,i,a,o);return is(e,t,c.topLeft)||is(e,t,c.topRight)||is(e,t,c.bottomRight)||is(e,t,c.bottomLeft)}}},dy.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:iN(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){var l=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),c=function(e){var t=r$({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),n=r$({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),r=r$({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]};return iy(i,a,[].concat(c(l.topLeft),c(l.topRight),c(l.bottomRight),c(l.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,l=r-i,c=r+i,u=iE(e,t),d=u.heightOffset,h=u.widthOffset,f=u.ctrlPtOffsetPct*e,p={topLeft:[o,l+d,o+f,l,o+h,l],topRight:[s-h,l,s-f,l,s,l+d],bottomRight:[s,c-d,s-f,c,s-h,c],bottomLeft:[o+h,c,o+f,c,o,c-d]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,n,r,i,a,o,s){var l=iE(r,i),c=l.heightOffset,u=l.widthOffset;if(il(e,t,this.points,a,o,r,i-2*c,[0,-1],n)||il(e,t,this.points,a,o,r-2*u,i,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(r,i,a,o),h=Object.keys(d),f=0;f<h.length;f++){var p=d[h[f]],g=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=n[1],l=Math.min(r,a),c=Math.max(r,a),u=Math.min(o,s),d=Math.max(o,s);if(l<=e&&e<=c&&u<=t&&t<=d){var h=[r-2*i+a,2*(i-r),r],f=ir(h[0],h[1],h[2],e).filter(function(e){return 0<=e&&e<=1});if(f.length>0)return f[0]}return null}(e,t,p);if(null!=g){var v=rX(p[5],p[3],p[1],g);if(p.isTop&&v<=t||p.isBottom&&t<=v)return!0}}return!1}}},dy.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:iN(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var l=e-(n/2+o),c=t-(r/2+o),u=e+(n/2+o),d=iv(i,a,e,t,l,c,u,c,!1);return d.length>0?d:r8(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?iS(r,i):s);if(il(e,t,this.points,a,o,r,i-l,[0,-1],n)||il(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var c=r/2+2*n,u=i/2+2*n;return!!(is(e,t,[a-c,o-u,a-c,o,a+c,o,a+c,o-u])||ip(e,t,l,l,a+r/2-s,o+i/2-s,n)||ip(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},dy.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",iN(3,0)),this.generateRoundPolygon("round-triangle",iN(3,0)),this.generatePolygon("rectangle",iN(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",iN(5,0)),this.generateRoundPolygon("round-pentagon",iN(5,0)),this.generatePolygon("hexagon",iN(6,0)),this.generateRoundPolygon("round-hexagon",iN(6,0)),this.generatePolygon("heptagon",iN(7,0)),this.generateRoundPolygon("round-heptagon",iN(7,0)),this.generatePolygon("octagon",iN(8,0)),this.generateRoundPolygon("round-octagon",iN(8,0));var r=Array(20),i=ik(5,0),a=ik(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(var s=0;s<5;s++)r[4*s]=i[2*s],r[4*s+1]=i[2*s+1],r[4*s+2]=a[2*s],r[4*s+3]=a[2*s+1];r=ij(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 l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),e.makePolygon=function(e){var n,r="polygon-"+e.join("$");return(n=this[r])?n:t.generatePolygon(r,e)}};var db={};db.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},db.redraw=function(e){e=e||ru(),void 0===this.averageRedrawTime&&(this.averageRedrawTime=0),void 0===this.lastRedrawTime&&(this.lastRedrawTime=0),void 0===this.lastDrawTime&&(this.lastDrawTime=0),this.requestedFrame=!0,this.renderOptions=e},db.beforeRender=function(e,t){if(!this.destroyed){null==t&&ri("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(e,t){return t.priority-e.priority})}};var dw=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};db.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){dw(e,!0,r);var i=n$();e.render(e.renderOptions);var a=e.lastDrawTime=n$();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else dw(e,!1,r);e.skipFrame=!1,nK(n)}};nK(n)}};var dN=function(e){this.init(e)},dj=dN.prototype;dj.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],dj.init=function(e){this.options=e,this.cy=e.cy;var t=this.container=e.cy.container(),n=this.cy.window();if(n){var r=n.document,i=r.head,a="__________cytoscape_stylesheet",o="__________cytoscape_container",s=null!=r.getElementById(a);if(0>t.className.indexOf(o)&&(t.className=(t.className||"")+" "+o),!s){var l=r.createElement("style");l.id=a,l.textContent="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}"static"===n.getComputedStyle(t).getPropertyValue("position")&&ro("A Cytoscape container has style position:static and so can not use UI extensions properly")}this.selection=[void 0,void 0,void 0,void 0,0],this.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],this.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},this.dragData={possibleDragElements:[]},this.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]},this.redraws=0,this.showFps=e.showFps,this.debug=e.debug,this.webgl=e.webgl,this.hideEdgesOnViewport=e.hideEdgesOnViewport,this.textureOnViewport=e.textureOnViewport,this.wheelSensitivity=e.wheelSensitivity,this.motionBlurEnabled=e.motionBlur,this.forcedPixelRatio=nu(e.pixelRatio)?e.pixelRatio:null,this.motionBlur=e.motionBlur,this.motionBlurOpacity=e.motionBlurOpacity,this.motionBlurTransparency=1-this.motionBlurOpacity,this.motionBlurPxRatio=1,this.mbPxRBlurry=1,this.minMbLowQualFrames=4,this.fullQualityMb=!1,this.clearedForMotionBlur=[],this.desktopTapThreshold=e.desktopTapThreshold,this.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,this.touchTapThreshold=e.touchTapThreshold,this.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,this.tapholdDuration=500,this.bindings=[],this.beforeRenderCallbacks=[],this.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},this.registerNodeShapes(),this.registerArrowShapes(),this.registerCalculationListeners()},dj.notify=function(e,t){var n=this.cy;if(!this.destroyed){if("init"===e)return void this.load();if("destroy"===e)return void this.destroy();("add"===e||"remove"===e||"move"===e&&n.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&this.invalidateCachedZSortedEles(),"viewport"===e&&this.redrawHint("select",!0),"gc"===e&&this.redrawHint("gc",!0),("load"===e||"resize"===e||"mount"===e)&&(this.invalidateContainerClientCoordsCache(),this.matchCanvasSize(this.container)),this.redrawHint("eles",!0),this.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},dj.destroy=function(){this.destroyed=!0,this.cy.stopAnimationLoop();for(var e=0;e<this.bindings.length;e++){var t=this.bindings[e],n=t.target;(n.off||n.removeEventListener).apply(n,t.args)}if(this.bindings=[],this.beforeRenderCallbacks=[],this.onUpdateEleCalcsFns=[],this.removeObserver&&this.removeObserver.disconnect(),this.styleObserver&&this.styleObserver.disconnect(),this.resizeObserver&&this.resizeObserver.disconnect(),this.labelCalcDiv)try{document.body.removeChild(this.labelCalcDiv)}catch(e){}},dj.isHeadless=function(){return!1},[lS,dg,dv,dx,dy,db].forEach(function(e){nO(dj,e)});var dk=1e3/60,dS=function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=nG(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),i=e.priority||rr;n.beforeRender(function(i,a){var o=n$(),s=n.averageRedrawTime,l=n.lastRedrawTime,c=[],u=n.cy.extent(),d=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var h=n$(),f=h-o,p=h-a;if(l<dk){var g=dk-(i?s:0);if(p>=e.deqFastCost*g)break}else if(i){if(f>=e.deqCost*l||f>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*dk)break;var v=e.deq(t,d,u);if(v.length>0)for(var x=0;x<v.length;x++)c.push(v[x]);else break}c.length>0&&(e.onDeqd(t,c),!i&&e.shouldRedraw(t,c,d,u)&&r())},i(t))}}},dC=t1(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rt;t0(this,e),this.idsByKey=new rx,this.keyForId=new rx,this.cachesByLvl=new rx,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n},[{key:"getIdsFor",value:function(e){null==e&&ri("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new rb,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new rx,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),d_={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},dE=rd({getKey:null,doesEleInvalidateKey:rt,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:re,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),dT=function(e,t){this.renderer=e,this.onDequeues=[];var n=dE(t);nO(this,n),this.lookup=new dC(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},dM=dT.prototype;dM.reasons=d_,dM.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},dM.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},dM.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new rC(function(e,t){return t.reqs-e.reqs})},dM.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},dM.getElement=function(e,t,n,r,i){var a,o,s,l=this,c=this.renderer,u=c.cy.zoom(),d=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!l.allowEdgeTxrCaching&&e.isEdge()||!l.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(rH(u*n))),r<-4)r=-4;else if(u>=7.99||r>3)return null;var h=Math.pow(2,r),f=t.h*h,p=t.w*h,g=c.eleTextBiggerThanMin(e,h);if(!this.isVisible(e,g))return null;var v=d.get(e,r);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;if(a=f<=25?25:f<=50?50:50*Math.ceil(f/50),f>1024||p>1024)return null;var x=l.getTextureQueue(a),y=x[x.length-2],b=function(){return l.recycleTexture(a,p)||l.addTexture(a,p)};y||(y=x[x.length-1]),y||(y=b()),y.width-y.usedWidth<p&&(y=b());for(var w=function(e){return e&&e.scaledLabelShown===g},N=i&&i===d_.dequeue,j=i&&i===d_.highQuality,k=i&&i===d_.downscale,S=r+1;S<=3;S++){var C=d.get(e,S);if(C){o=C;break}}var _=o&&o.level===r+1?o:null,E=function(){y.context.drawImage(_.texture.canvas,_.x,0,_.width,_.height,y.usedWidth,0,p,f)};if(y.context.setTransform(1,0,0,1,0,0),y.context.clearRect(y.usedWidth,0,p,a),w(_))E();else if(w(o))if(!j)return l.queueElement(e,o.level-1),o;else{for(var T=o.level;T>r;T--)_=l.getElement(e,t,n,T,d_.downscale);E()}else{if(!N&&!j&&!k)for(var M=r-1;M>=-4;M--){var O=d.get(e,M);if(O){s=O;break}}if(w(s))return l.queueElement(e,r),s;y.context.translate(y.usedWidth,0),y.context.scale(h,h),this.drawElement(y.context,e,t,g,!1),y.context.scale(1/h,1/h),y.context.translate(-y.usedWidth,0)}return v={x:y.usedWidth,texture:y,level:r,scale:h,width:p,height:f,scaledLabelShown:g},y.usedWidth+=Math.ceil(p+8),y.eleCaches.push(v),d.set(e,r,v),l.checkTextureFullness(y),v},dM.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},dM.invalidateElement=function(e){var t=this.lookup,n=[];if(t.isInvalid(e)){for(var r=-4;r<=3;r++){var i=t.getForCachedKey(e,r);i&&n.push(i)}if(t.invalidate(e))for(var a=0;a<n.length;a++){var o=n[a],s=o.texture;s.invalidatedWidth+=o.width,o.invalidated=!0,this.checkTextureUtility(s)}this.removeFromQueue(e)}},dM.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},dM.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?rh(t,e):e.fullnessChecks++},dM.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;rh(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a<i.length;a++){var o=i[a];r.deleteCache(o.key,o.level)}rf(i),this.getRetiredTextureQueue(t).push(e)},dM.addTexture=function(e,t){var n=this.getTextureQueue(e),r={};return n.push(r),r.eleCaches=[],r.height=e,r.width=Math.max(1024,t),r.usedWidth=0,r.invalidatedWidth=0,r.fullnessChecks=0,r.canvas=this.renderer.makeOffscreenCanvas(r.width,r.height),r.context=r.canvas.getContext("2d"),r},dM.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),r=this.getRetiredTextureQueue(e),i=0;i<r.length;i++){var a=r[i];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,rf(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),rh(r,a),n.push(a),a}},dM.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},dM.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1;a++)if(t.size()>0){var o=t.pop(),s=o.key,l=o.eles[0],c=i.hasCache(l,o.level);if(n[s]=null,c)continue;r.push(o);var u=this.getBoundingBox(l);this.getElement(l,u,e,o.level,d_.dequeue)}else break;return r},dM.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=n8,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},dM.onDequeue=function(e){this.onDequeues.push(e)},dM.offDequeue=function(e){rh(this.onDequeues,e)},dM.setupDequeueing=dS({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++)(0,e.onDequeues[n])(t)},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++)if(r3(a[o].boundingBox(),r))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var dO=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=n$()-500,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=nG(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),n.beforeRender(function(e,n){n-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new rC(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},dA=dO.prototype,dD=0;dA.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:dD=++dD%0x1fffffffffffff,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,c=-o.bb.y1;return s.scale(n,n),s.translate(l,c),o},dA.getLayers=function(e,t,n){var r,i,a=this,o=a.renderer.cy.zoom(),s=a.firstGet;if(a.firstGet=!1,null==n){if((n=Math.ceil(rH(o*t)))<-4)n=-4;else if(o>=3.99||n>2)return null}a.validateLayersElesOrdering(n,e);var l=a.layersByLevel,c=Math.pow(2,n),u=l[n]=l[n]||[];if(a.levelIsComplete(n,e))return u;var d=function(t){if(a.validateLayersElesOrdering(t,e),a.levelIsComplete(t,e))return i=l[t],!0},h=function(e){if(!i)for(var t=n+e;-4<=t&&t<=2&&!d(t);t+=e);};h(1),h(-1);for(var f=u.length-1;f>=0;f--){var p=u[f];p.invalid&&rh(u,p)}var g=function(){if(!r){r=rZ();for(var t=0;t<e.length;t++)rJ(r,e[t].boundingBox())}return r};if(a.skipping&&!s)return null;for(var v=null,x=e.length/1,y=!s,b=0;b<e.length;b++){var w=e[b],N=w._private.rscratch,j=N.imgLayerCaches=N.imgLayerCaches||{},k=j[n];if(k){v=k;continue}if((!v||v.eles.length>=x||!r7(v.bb,w.boundingBox()))&&!(v=function(e){var t=(e=e||{}).after;g();var i=Math.ceil(r.w*c),o=Math.ceil(r.h*c);if(i>32767||o>32767||i*o>16e6)return null;var s=a.makeLayer(r,n);if(null!=t){var l=u.indexOf(t)+1;u.splice(l,0,s)}else(void 0===e.insert||e.insert)&&u.unshift(s);return s}({insert:!0,after:v})))return null;i||y?a.queueLayer(v,w):a.drawEleInLayer(v,w,n,t),v.eles.push(w),j[n]=v}return i||(y?null:u)},dA.getEleLevelForLayerLevel=function(e,t){return e},dA.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},dA.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0||a.invalid)return!1;r+=a.eles.length}return r===t.length},dA.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0){this.invalidateLayer(i);continue}for(var s=a,o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}},dA.updateElementsInLayers=function(e,t){for(var n=nf(e[0]),r=0;r<e.length;r++)for(var i=n?null:e[r],a=n?e[r]:e[r].ele,o=a._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var c=s[l];c&&(i&&this.getEleLevelForLayerLevel(c.level)!==i.level||t(c,a,i))}},dA.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e},dA.invalidateElements=function(e){var t=this;0===e.length||(t.lastInvalidationTime=n$(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},dA.invalidateLayer=function(e){if(this.lastInvalidationTime=n$(),!e.invalid){var t=e.level,n=e.eles;rh(this.layersByLevel[t],e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var r=0;r<n.length;r++){var i=n[r]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}},dA.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,n,r){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},dA.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},dA.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},dA.dequeue=function(e){for(var t=this.layersQueue,n=[],r=0;r<1&&0!==t.size();){var i=t.peek();if(i.replacement||i.replaces&&i!==i.replaces.replacement||i.invalid){t.pop();continue}var a=i.elesQueue.shift();a&&(this.drawEleInLayer(i,a,i.level,e),r++),0===n.length&&n.push(!0),0===i.elesQueue.length&&(t.pop(),i.reqs=0,i.replaces&&this.applyLayerReplacement(i),this.requestRedraw())}return n},dA.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],n=e.replaces,r=t.indexOf(n);if(!(r<0)&&!n.invalid){t[r]=e;for(var i=0;i<e.eles.length;i++){var a=e.eles[i]._private,o=a.imgLayerCaches=a.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},dA.requestRedraw=nG(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),dA.setupDequeueing=dS({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:rr,shouldRedraw:re,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var dP={};function dI(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function dL(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];0===i&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function dR(e,t,n){e.beginPath&&e.beginPath();for(var r=0;r<t.length;r++){var i=t[r];e.lineTo(i.x,i.y)}var a=n[0];e.moveTo(a.x,a.y);for(var r=1;r<n.length;r++){var i=n[r];e.lineTo(i.x,i.y)}e.closePath&&e.closePath()}function dB(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,2*Math.PI,!1);var a=t[0];e.moveTo(a.x,a.y);for(var o=0;o<t.length;o++){var s=t[o];e.lineTo(s.x,s.y)}e.closePath&&e.closePath()}function dF(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}dP.arrowShapeImpl=function(e){return(g||(g={polygon:dI,"triangle-backcurve":dL,"triangle-tee":dR,"circle-triangle":dB,"triangle-cross":dR,circle:dF}))[e]};var dz={};dz.drawElement=function(e,t,n,r,i,a){t.isNode()?this.drawNode(e,t,n,r,i,a):this.drawEdge(e,t,n,r,i,a)},dz.drawElementOverlay=function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},dz.drawElementUnderlay=function(e,t){t.isNode()?this.drawNodeUnderlay(e,t):this.drawEdgeUnderlay(e,t)},dz.drawCachedElementPortion=function(e,t,n,r,i,a,o,s){var l=n.getBoundingBox(t);if(0!==l.w&&0!==l.h){var c=n.getElement(t,l,r,i,a);if(null!=c){var u,d,h,f,p,g,v=s(this,t);if(0===v)return;var x=o(this,t),y=l.x1,b=l.y1,w=l.w,N=l.h;if(0!==x){var j=n.getRotationPoint(t);h=j.x,f=j.y,e.translate(h,f),e.rotate(x),(p=this.getImgSmoothing(e))||this.setImgSmoothing(e,!0);var k=n.getRotationOffset(t);u=k.x,d=k.y}else u=y,d=b;1!==v&&(g=e.globalAlpha,e.globalAlpha=g*v),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,u,d,w,N),1!==v&&(e.globalAlpha=g),0!==x&&(e.rotate(-x),e.translate(-h,-f),p||this.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var dV=function(){return 0},dH=function(e,t){return e.getTextAngle(t,null)},dU=function(e,t){return e.getTextAngle(t,"source")},dW=function(e,t){return e.getTextAngle(t,"target")},dY=function(e,t){return t.effectiveOpacity()},dG=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};dz.drawCachedElement=function(e,t,n,r,i,a){var o=this.data,s=o.eleTxrCache,l=o.lblTxrCache,c=o.slbTxrCache,u=o.tlbTxrCache,d=t.boundingBox(),h=!0===a?s.reasons.highQuality:null;if(0!==d.w&&0!==d.h&&t.visible()&&(!r||r3(d,r))){var f=t.isEdge(),p=t.element()._private.rscratch.badLine;this.drawElementUnderlay(e,t),this.drawCachedElementPortion(e,t,s,n,i,h,dV,dY),f&&p||this.drawCachedElementPortion(e,t,l,n,i,h,dH,dG),f&&!p&&(this.drawCachedElementPortion(e,t,c,n,i,h,dU,dG),this.drawCachedElementPortion(e,t,u,n,i,h,dW,dG)),this.drawElementOverlay(e,t)}},dz.drawElements=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];this.drawElement(e,r)}},dz.drawCachedElements=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];this.drawCachedElement(e,a,n,r)}},dz.drawCachedNodes=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];a.isNode()&&this.drawCachedElement(e,a,n,r)}},dz.drawLayeredElements=function(e,t,n,r){var i=this.data.lyrTxrCache.getLayers(t,n);if(i)for(var a=0;a<i.length;a++){var o=i[a],s=o.bb;0!==s.w&&0!==s.h&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,n,r)};var dX={};dX.drawEdge=function(e,t,n){var r,i=!(arguments.length>3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],o=!(arguments.length>5)||void 0===arguments[5]||arguments[5],s=this,l=t._private.rscratch;if((!o||t.visible())&&!(l.badLine||null==l.allpts||isNaN(l.allpts[0]))){n&&(r=n,e.translate(-r.x1,-r.y1));var c=o?t.pstyle("opacity").value:1,u=o?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,f=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,x=c*u,y=c*u,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;"straight-triangle"===d?(s.eleStrokeStyle(e,t,n),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=f,e.lineCap=p,s.eleStrokeStyle(e,t,n),s.drawEdgePath(t,e,l.allpts,h),e.lineCap="butt")},w=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;s.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var N=t.pstyle("ghost-offset-x").pfValue,j=t.pstyle("ghost-offset-y").pfValue,k=x*t.pstyle("ghost-opacity").value;e.translate(N,j),b(k),w(k),e.translate(-N,-j)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;if(e.lineWidth=f+g,e.lineCap=p,g>0)s.colorStrokeStyle(e,v[0],v[1],v[2],n);else{e.lineCap="butt";return}"straight-triangle"===d?s.drawEdgeTrianglePath(t,e,l.allpts):(s.drawEdgePath(t,e,l.allpts,h),e.lineCap="butt")}();a&&s.drawEdgeUnderlay(e,t),b(),w(),a&&s.drawEdgeOverlay(e,t),s.drawElementText(e,t,null,i),n&&e.translate(r.x1,r.y1)}};var d$=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this.usePaths(),a=n._private.rscratch,o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-color")).value;t.lineWidth=2*o,"self"!==a.edgeType||i?t.lineCap="round":t.lineCap="butt",this.colorStrokeStyle(t,s[0],s[1],s[2],r),this.drawEdgePath(n,t,a.allpts,"solid")}}}};dX.drawEdgeOverlay=d$("overlay"),dX.drawEdgeUnderlay=d$("underlay"),dX.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o=!1,s=this.usePaths(),l=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(s){var u=n.join("$");i.pathCacheKey&&i.pathCacheKey===u?(f=t=i.pathCache,o=!0):(f=t=new Path2D,i.pathCacheKey=u,i.pathCache=f)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(l),a.lineDashOffset=c;break;case"solid":a.setLineDash([])}if(!o&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<n.length;d+=4)t.quadraticCurveTo(n[d],n[d+1],n[d+2],n[d+3]);break;case"straight":case"haystack":for(var h=2;h+1<n.length;h+=2)t.lineTo(n[h],n[h+1]);break;case"segments":if(i.isRound){var f,p,g=t2(i.roundCorners);try{for(g.s();!(p=g.n()).done;){var v=p.value;de(t,v)}}catch(e){g.e(e)}finally{g.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var x=2;x+1<n.length;x+=2)t.lineTo(n[x],n[x+1])}t=a,s?t.stroke(f):t.stroke(),t.setLineDash&&t.setLineDash([])},dX.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],l=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-l[0],n[i+1]-l[1]),t.lineTo(n[i]+l[0],n[i+1]+l[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},dX.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i="haystack"===r.edgeType;i||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),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},dX.drawArrowhead=function(e,t,n,r,i,a,o){if(!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a))&&null!=a){var s=t.pstyle(n+"-arrow-shape").value;if("none"!==s){var l="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,u=t.pstyle("width").pfValue,d=t.pstyle(n+"-arrow-width"),h="match-line"===d.value?u:d.pfValue;"%"===d.units&&(h*=u);var f=t.pstyle("opacity").value;void 0===o&&(o=f);var p=e.globalCompositeOperation;(1!==o||"hollow"===c)&&(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,l,u,s,h,r,i,a),e.globalCompositeOperation=p);var g=t.pstyle(n+"-arrow-color").value;this.colorFillStyle(e,g[0],g[1],g[2],o),this.colorStrokeStyle(e,g[0],g[1],g[2],o),this.drawArrowShape(t,e,c,u,s,h,r,i,a)}}},dX.drawArrowShape=function(e,t,n,r,i,a,o,s,l){var c,u=this.usePaths()&&"triangle-cross"!==i,d=!1,h=t,f=e.pstyle("arrow-scale").value,p=this.getArrowWidth(r,f),g=this.arrowShapes[i];if(u){var v=this.arrowPathCache=this.arrowPathCache||[],x=n5(i),y=v[x];null!=y?(c=t=y,d=!0):(c=t=new Path2D,v[x]=c)}!d&&(t.beginPath&&t.beginPath(),u?g.draw(t,1,0,{x:0,y:0},1):g.draw(t,p,l,{x:o,y:s},r),t.closePath&&t.closePath()),t=h,u&&(t.translate(o,s),t.rotate(l),t.scale(p,p)),("filled"===n||"both"===n)&&(u?t.fill(c):t.fill()),("hollow"===n||"both"===n)&&(t.lineWidth=a/(u?p:1),t.lineJoin="miter",u?t.stroke(c):t.stroke()),u&&(t.scale(1/p,1/p),t.rotate(-l),t.translate(-o,-s))};var dq={};dq.safeDrawImage=function(e,t,n,r,i,a,o,s,l,c){if(!(i<=0)&&!(a<=0)&&!(l<=0)&&!(c<=0))try{e.drawImage(t,n,r,i,a,o,s,l,c)}catch(e){ro(e)}},dq.drawInscribedImage=function(e,t,n,r,i){var a=n.position(),o=a.x,s=a.y,l=n.cy().style(),c=l.getIndexedStyle.bind(l),u=c(n,"background-fit","value",r),d=c(n,"background-repeat","value",r),h=n.width(),f=n.height(),p=2*n.padding(),g=h+("inner"===c(n,"background-width-relative-to","value",r)?0:p),v=f+("inner"===c(n,"background-height-relative-to","value",r)?0:p),x=n._private.rscratch,y="node"===c(n,"background-clip","value",r),b=c(n,"background-image-opacity","value",r)*i,w=c(n,"background-image-smoothing","value",r),N=n.pstyle("corner-radius").value;"auto"!==N&&(N=n.pstyle("corner-radius").pfValue);var j=t.width||t.cachedW,k=t.height||t.cachedH;(null==j||null==k)&&(document.body.appendChild(t),j=t.cachedW=t.width||t.offsetWidth,k=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var S=j,C=k;if("auto"!==c(n,"background-width","value",r)&&(S="%"===c(n,"background-width","units",r)?c(n,"background-width","pfValue",r)*g:c(n,"background-width","pfValue",r)),"auto"!==c(n,"background-height","value",r)&&(C="%"===c(n,"background-height","units",r)?c(n,"background-height","pfValue",r)*v:c(n,"background-height","pfValue",r)),0!==S&&0!==C){if("contain"===u){var _=Math.min(g/S,v/C);S*=_,C*=_}else if("cover"===u){var _=Math.max(g/S,v/C);S*=_,C*=_}var E=o-g/2,T=c(n,"background-position-x","units",r),M=c(n,"background-position-x","pfValue",r);"%"===T?E+=(g-S)*M:E+=M;var O=c(n,"background-offset-x","units",r),A=c(n,"background-offset-x","pfValue",r);"%"===O?E+=(g-S)*A:E+=A;var D=s-v/2,P=c(n,"background-position-y","units",r),I=c(n,"background-position-y","pfValue",r);"%"===P?D+=(v-C)*I:D+=I;var L=c(n,"background-offset-y","units",r),R=c(n,"background-offset-y","pfValue",r);"%"===L?D+=(v-C)*R:D+=R,x.pathCache&&(E-=o,D-=s,o=0,s=0);var B=e.globalAlpha;e.globalAlpha=b;var F=this.getImgSmoothing(e),z=!1;if("no"===w&&F?(this.setImgSmoothing(e,!1),z=!0):"yes"!==w||F||(this.setImgSmoothing(e,!0),z=!0),"no-repeat"===d)y&&(e.save(),x.pathCache?e.clip(x.pathCache):(this.nodeShapes[this.getNodeShape(n)].draw(e,o,s,g,v,N,x),e.clip())),this.safeDrawImage(e,t,0,0,j,k,E,D,S,C),y&&e.restore();else{var V=e.createPattern(t,d);e.fillStyle=V,this.nodeShapes[this.getNodeShape(n)].draw(e,o,s,g,v,N,x),e.translate(E,D),e.fill(),e.translate(-E,-D)}e.globalAlpha=B,z&&this.setImgSmoothing(e,F)}};var dK={};function dZ(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5,o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}dK.eleTextBiggerThanMin=function(e,t){return t||(t=Math.pow(2,Math.ceil(rH(e.cy().zoom()*this.getPixelRatio())))),!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},dK.drawElementText=function(e,t,n,r,i){var a,o=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if(null==r){if(o&&!this.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;e.textAlign=this.getLabelJustification(t),e.textBaseline="bottom"}else{var l=t.element()._private.rscratch.badLine,c=t.pstyle("label"),u=t.pstyle("source-label"),d=t.pstyle("target-label");if(l||(!c||!c.value)&&(!u||!u.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var h=!n;n&&(a=n,e.translate(-a.x1,-a.y1)),null==i?(this.drawText(e,t,null,h,o),t.isEdge()&&(this.drawText(e,t,"source",h,o),this.drawText(e,t,"target",h,o))):this.drawText(e,t,i,h,o),n&&e.translate(a.x1,a.y1)},dK.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},dK.setupTextStyle=function(e,t){var n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,c=t.pstyle("color").value,u=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,c[0],c[1],c[2],s),this.colorStrokeStyle(e,u[0],u[1],u[2],l)},dK.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+"-":"",a=e.pstyle(i+"text-rotation");if("autorotate"===a.strValue){var o=rm(r,"labelAngle",t);n=e.isEdge()?o:0}else n="none"===a.strValue?0:a.pfValue;return n},dK.drawText=function(e,t,n){var r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s=rm(a,"labelX",n),l=rm(a,"labelY",n),c=this.getLabelText(t,n);if(null!=c&&""!==c&&!isNaN(s)&&!isNaN(l)){this.setupTextStyle(e,t,i);var u,d,h,f=n?n+"-":"",p=rm(a,"labelWidth",n),g=rm(a,"labelHeight",n),v=t.pstyle(f+"text-margin-x").pfValue,x=t.pstyle(f+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(y&&(b="center",w="center"),s+=v,l+=x,0!==(h=r?this.getTextAngle(t,n):0)&&(u=s,d=l,e.translate(u,d),e.rotate(h),s=0,l=0),w){case"top":break;case"center":l+=g/2;break;case"bottom":l+=g}var N=t.pstyle("text-background-opacity").value,j=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,S=t.pstyle("text-background-padding").pfValue,C=t.pstyle("text-background-shape").strValue,_="round-rectangle"===C||"roundrectangle"===C;if(N>0||k>0&&j>0){var E,T,M=e.fillStyle,O=e.strokeStyle,A=e.lineWidth,D=t.pstyle("text-background-color").value,P=t.pstyle("text-border-color").value,I=t.pstyle("text-border-style").value,L=N>0,R=k>0&&j>0,B=s-S;switch(b){case"left":B-=p;break;case"center":B-=p/2}var F=l-g-S,z=p+2*S,V=g+2*S;if(L&&(e.fillStyle="rgba(".concat(D[0],",").concat(D[1],",").concat(D[2],",").concat(N*o,")")),R&&(e.strokeStyle="rgba(".concat(P[0],",").concat(P[1],",").concat(P[2],",").concat(j*o,")"),e.lineWidth=k,e.setLineDash))switch(I){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;default:e.setLineDash([])}if(_?(e.beginPath(),dZ(e,B,F,z,V,2)):"circle"===C?(e.beginPath(),E=B,T=Math.min(z,V),e.beginPath(),e.arc(E+z/2,F+V/2,T/2,0,2*Math.PI),e.closePath()):(e.beginPath(),e.rect(B,F,z,V)),L&&e.fill(),R&&e.stroke(),R&&"double"===I){var H=k/2;e.beginPath(),_?dZ(e,B+H,F+H,z-2*H,V-2*H,2):e.rect(B+H,F+H,z-2*H,V-2*H),e.stroke()}e.fillStyle=M,e.strokeStyle=O,e.lineWidth=A,e.setLineDash&&e.setLineDash([])}var U=2*t.pstyle("text-outline-width").pfValue;if(U>0&&(e.lineWidth=U),"wrap"===t.pstyle("text-wrap").value){var W=rm(a,"labelWrapCachedLines",n),Y=rm(a,"labelLineHeight",n),G=p/2,X=this.getLabelJustification(t);switch("auto"===X||("left"===b?"left"===X?s+=-p:"center"===X&&(s+=-G):"center"===b?"left"===X?s+=-G:"right"===X&&(s+=G):"right"===b&&("center"===X?s+=G:"right"===X&&(s+=p))),w){case"top":case"center":case"bottom":l-=(W.length-1)*Y}for(var $=0;$<W.length;$++)U>0&&e.strokeText(W[$],s,l),e.fillText(W[$],s,l),l+=Y}else U>0&&e.strokeText(c,s,l),e.fillText(c,s,l);0!==h&&(e.rotate(-h),e.translate(-u,-d))}}};var dQ={};dQ.drawNode=function(e,t,n){var r,i,a,o,s=!(arguments.length>3)||void 0===arguments[3]||arguments[3],l=!(arguments.length>4)||void 0===arguments[4]||arguments[4],c=!(arguments.length>5)||void 0===arguments[5]||arguments[5],u=this,d=t._private,h=d.rscratch,f=t.position();if(nu(f.x)&&nu(f.y)&&(!c||t.visible())){var p=c?t.effectiveOpacity():1,g=u.usePaths(),v=!1,x=t.padding();r=t.width()+2*x,i=t.height()+2*x,n&&(o=n,e.translate(-o.x1,-o.y1));for(var y=t.pstyle("background-image").value,b=Array(y.length),w=Array(y.length),N=0,j=0;j<y.length;j++){var k=y[j];if(b[j]=null!=k&&"none"!==k){var S=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",j);N++,w[j]=u.getCachedImage(k,S,function(){d.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var C=t.pstyle("background-blacken").value,_=t.pstyle("border-width").pfValue,E=t.pstyle("background-opacity").value*p,T=t.pstyle("border-color").value,M=t.pstyle("border-style").value,O=t.pstyle("border-join").value,A=t.pstyle("border-cap").value,D=t.pstyle("border-position").value,P=t.pstyle("border-dash-pattern").pfValue,I=t.pstyle("border-dash-offset").pfValue,L=t.pstyle("border-opacity").value*p,R=t.pstyle("outline-width").pfValue,B=t.pstyle("outline-color").value,F=t.pstyle("outline-style").value,z=t.pstyle("outline-opacity").value*p,V=t.pstyle("outline-offset").value,H=t.pstyle("corner-radius").value;"auto"!==H&&(H=t.pstyle("corner-radius").pfValue);var U=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E;u.eleFillStyle(e,t,n)},W=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L;u.colorStrokeStyle(e,T[0],T[1],T[2],t)},Y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z;u.colorStrokeStyle(e,B[0],B[1],B[2],t)},G=function(e,t,n,r){var i,a=u.nodePathCache=u.nodePathCache||[],o=n3("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+H),s=a[o],l=!1;return null!=s?(l=!0,h.pathCache=i=s):(i=new Path2D,a[o]=h.pathCache=i),{path:i,cacheHit:l}},X=t.pstyle("shape").strValue,$=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(f.x,f.y);var q=G(r,i,X,$);a=q.path,v=q.cacheHit}var K=function(){if(!v){var n=f;g&&(n={x:0,y:0}),u.nodeShapes[u.getNodeShape(t)].draw(a||e,n.x,n.y,r,i,H,h)}g?e.fill(a):e.fill()},Z=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=d.backgrounding,a=0,o=0;o<w.length;o++){var s=t.cy().style().getIndexedStyle(t,"background-image-containment","value",o);if(r&&"over"===s||!r&&"inside"===s){a++;continue}b[o]&&w[o].complete&&!w[o].error&&(a++,u.drawInscribedImage(e,w[o],t,o,n))}d.backgrounding=a!==N,i!==d.backgrounding&&t.updateStyle(!1)},Q=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;u.hasPie(t)&&(u.drawPie(e,t,a),n&&!g&&u.nodeShapes[u.getNodeShape(t)].draw(e,f.x,f.y,r,i,H,h))},J=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;u.hasStripe(t)&&(e.save(),g?e.clip(h.pathCache):(u.nodeShapes[u.getNodeShape(t)].draw(e,f.x,f.y,r,i,H,h),e.clip()),u.drawStripe(e,t,a),e.restore(),n&&!g&&u.nodeShapes[u.getNodeShape(t)].draw(e,f.x,f.y,r,i,H,h))},ee=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,n=C>0?0:255;0!==C&&(u.colorFillStyle(e,n,n,n,(C>0?C:-C)*t),g?e.fill(a):e.fill())},et=function(){if(_>0){if(e.lineWidth=_,e.lineCap=A,e.lineJoin=O,e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(P),e.lineDashOffset=I;break;case"solid":case"double":e.setLineDash([])}if("center"!==D){if(e.save(),e.lineWidth*=2,"inside"===D)g?e.clip(a):e.clip();else{var t=new Path2D;t.rect(-r/2-_,-i/2-_,r+2*_,i+2*_),t.addPath(a),e.clip(t,"evenodd")}g?e.stroke(a):e.stroke(),e.restore()}else g?e.stroke(a):e.stroke();if("double"===M){e.lineWidth=_/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(a):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},en=function(){if(R>0){if(e.lineWidth=R,e.lineCap="butt",e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=f;g&&(n={x:0,y:0});var a=u.getNodeShape(t),o=_;"inside"===D&&(o=0),"outside"===D&&(o*=2);var s=(r+o+(R+V))/r,l=(i+o+(R+V))/i,c=r*s,d=i*l,h=u.nodeShapes[a].points;if(g&&(S=G(c,d,a,h).path),"ellipse"===a)u.drawEllipsePath(S||e,n.x,n.y,c,d);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var p=0,v=0,x=0;"round-diamond"===a?p=(o+V+R)*1.4:"round-heptagon"===a?(p=(o+V+R)*1.075,x=-(o/2+V+R)/35):"round-hexagon"===a?p=(o+V+R)*1.12:"round-pentagon"===a?(p=(o+V+R)*1.13,x=-(o/2+V+R)/15):"round-tag"===a?(p=(o+V+R)*1.12,v=(o/2+R+V)*.07):"round-triangle"===a&&(p=Math.PI/2*(o+V+R),x=-(o+V/2+R)/Math.PI),0!==p&&(s=(r+p)/r,c=r*s,["round-hexagon","round-tag"].includes(a)||(l=(i+p)/i,d=i*l)),H="auto"===H?iC(c,d):H;for(var y=c/2,b=d/2,w=H+(o+R+V)/2,N=Array(h.length/2),j=Array(h.length/2),k=0;k<h.length/2;k++)N[k]={x:n.x+v+y*h[2*k],y:n.y+x+b*h[2*k+1]};var S,C,E,T,M,O=N.length;for(C=0,E=N[O-1];C<O;C++)T=N[C%O],M=N[(C+1)%O],j[C]=dt(E,T,M,w),E=T,T=M;u.drawRoundPolygonPath(S||e,n.x+v,n.y+x,r*s,i*l,h,j)}else["roundrectangle","round-rectangle"].includes(a)?(H="auto"===H?iS(c,d):H,u.drawRoundRectanglePath(S||e,n.x,n.y,c,d,H+(o+R+V)/2)):["cutrectangle","cut-rectangle"].includes(a)?(H="auto"===H?i_():H,u.drawCutRectanglePath(S||e,n.x,n.y,c,d,null,H+(o+R+V)/4)):["bottomroundrectangle","bottom-round-rectangle"].includes(a)?(H="auto"===H?iS(c,d):H,u.drawBottomRoundRectanglePath(S||e,n.x,n.y,c,d,H+(o+R+V)/2)):"barrel"===a?u.drawBarrelPath(S||e,n.x,n.y,c,d):(h=a.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(a)?iu(id(h,(o+R+V)/r)):iu(id(h,-((o+R+V)/r))),u.drawPolygonPath(S||e,n.x,n.y,r,i,h));if(g?e.stroke(S):e.stroke(),"double"===F){e.lineWidth=o/3;var A=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(S):e.stroke(),e.globalCompositeOperation=A}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var er=t.pstyle("ghost-offset-x").pfValue,ei=t.pstyle("ghost-offset-y").pfValue,ea=t.pstyle("ghost-opacity").value,eo=ea*p;e.translate(er,ei),Y(),en(),U(ea*E),K(),Z(eo,!0),W(ea*L),et(),Q(0!==C||0!==_),J(0!==C||0!==_),Z(eo,!1),ee(eo),e.translate(-er,-ei)}g&&e.translate(-f.x,-f.y),l&&u.drawNodeUnderlay(e,t,f,r,i),g&&e.translate(f.x,f.y),Y(),en(),U(),K(),Z(p,!0),W(),et(),Q(0!==C||0!==_),J(0!==C||0!==_),Z(p,!1),ee(),g&&e.translate(-f.x,-f.y),u.drawElementText(e,t,null,s),l&&u.drawNodeOverlay(e,t,f,r,i),n&&e.translate(o.x1,o.y1)}};var dJ=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,n,r,i,a){if(n.visible()){var o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-opacity")).value,l=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value,u=n.pstyle("".concat(e,"-corner-radius")).value;if(s>0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[c].draw(t,r.x,r.y,i+2*o,a+2*o,u),t.fill()}}}};dQ.drawNodeOverlay=dJ("overlay"),dQ.drawNodeUnderlay=dJ("underlay"),dQ.hasPie=function(e){return(e=e[0])._private.hasPie},dQ.hasStripe=function(e){return(e=e[0])._private.hasStripe},dQ.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i,a=t.cy().style(),o=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),l=t.pstyle("pie-start-angle").pfValue,c=r.x,u=r.y,d=Math.min(t.width(),t.height())/2,h=0;if(this.usePaths()&&(c=0,u=0),"%"===o.units?d*=o.pfValue:void 0!==o.pfValue&&(d=o.pfValue/2),"%"===s.units?i=d*s.pfValue:void 0!==s.pfValue&&(i=s.pfValue/2),!(i>=d))for(var f=1;f<=a.pieBackgroundN;f++){var p=t.pstyle("pie-"+f+"-background-size").value,g=t.pstyle("pie-"+f+"-background-color").value,v=t.pstyle("pie-"+f+"-background-opacity").value*n,x=p/100;x+h>1&&(x=1-h);var y=1.5*Math.PI+2*Math.PI*h,b=2*Math.PI*x,w=(y+=l)+b;0===p||h>=1||h+x>1||(0===i?(e.beginPath(),e.moveTo(c,u),e.arc(c,u,d,y,w)):(e.beginPath(),e.arc(c,u,d,y,w),e.arc(c,u,i,w,y,!0)),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],v),e.fill(),h+=x)}},dQ.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=r.x,o=r.y,s=t.width(),l=t.height(),c=0,u=this.usePaths();e.save();var d=t.pstyle("stripe-direction").value,h=t.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":e.rotate(-Math.PI/2)}var f=s,p=l;"%"===h.units?(f*=h.pfValue,p*=h.pfValue):void 0!==h.pfValue&&(f=h.pfValue,p=h.pfValue),u&&(a=0,o=0),o-=f/2,a-=p/2;for(var g=1;g<=i.stripeBackgroundN;g++){var v=t.pstyle("stripe-"+g+"-background-size").value,x=t.pstyle("stripe-"+g+"-background-color").value,y=t.pstyle("stripe-"+g+"-background-opacity").value*n,b=v/100;b+c>1&&(b=1-c),0===v||c>=1||c+b>1||(e.beginPath(),e.rect(a,o+p*c,f,p*b),e.closePath(),this.colorFillStyle(e,x[0],x[1],x[2],y),e.fill(),c+=b)}e.restore()};var d0={};function d1(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw Error(e.getShaderInfoLog(r));return r}function d2(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function d5(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 d3(e){return"solid"===e.pstyle("background-fill").value&&"none"===e.pstyle("background-image").strValue&&(0===e.pstyle("border-width").value||0===e.pstyle("border-opacity").value||"solid"===e.pstyle("border-style").value)}function d4(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=n||[,,,,];return o[0]=r*t,o[1]=i*t,o[2]=a*t,o[3]=t,o}function d6(e,t){var n=t||[,,,,];return n[0]=(255&e)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function d7(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 d9(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function d8(e,t,n,r){var i=t3(d7(e,n),3),a=i[0],o=i[1],s=i[2],l=d9(e,o,t*a),c=a*s,u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,t*c,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,a,o,!1,c,0):o===e.INT&&e.vertexAttribIPointer(r,a,o,c,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=Array(t),h=0;h<t;h++)d[h]=function(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}(e,o,l,c,a,h);return u.dataArray=l,u.stride=c,u.size=a,u.getView=function(e){return d[e]},u.setPoint=function(e,t,n){var r=d[e];r[0]=t,r[1]=n},u.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,u),t?e.bufferSubData(e.ARRAY_BUFFER,0,l,0,t*a):e.bufferSubData(e.ARRAY_BUFFER,0,l)},u}d0.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)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},d0.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;i<n.length;i++)if((t=n[i]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},d0.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r)if(n.isEdge()){var c=n.sourceEndpoint(),u=n.targetEndpoint(),d=n.midpoint(),h=rW(c,d),f=rW(u,d);a=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(h,f))}else{var p=o?{x:0,y:0}:n.position(),g=n.paddedWidth(),v=n.paddedHeight();a=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(g,v))}else if(n.isEdge()){var x=n.sourceEndpoint(),y=n.targetEndpoint();a=e.createLinearGradient(x.x,x.y,y.x,y.y)}else{var b=o?{x:0,y:0}:n.position(),w=n.paddedWidth(),N=n.paddedHeight(),j=w/2,k=N/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":a=e.createLinearGradient(b.x,b.y-k,b.x,b.y+k);break;case"to-top":a=e.createLinearGradient(b.x,b.y+k,b.x,b.y-k);break;case"to-left":a=e.createLinearGradient(b.x+j,b.y,b.x-j,b.y);break;case"to-right":a=e.createLinearGradient(b.x-j,b.y,b.x+j,b.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(b.x-j,b.y-k,b.x+j,b.y+k);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(b.x-j,b.y+k,b.x+j,b.y-k);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(b.x+j,b.y-k,b.x-j,b.y+k);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(b.x+j,b.y+k,b.x-j,b.y-k)}}if(!a)return null;for(var S=l.length===s.length,C=s.length,_=0;_<C;_++)a.addColorStop(S?l[_]:_/(C-1),"rgba("+s[_][0]+","+s[_][1]+","+s[_][2]+","+i+")");return a},d0.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},d0.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},d0.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},d0.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},d0.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},d0.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},d0.matchCanvasSize=function(e){var t,n=this.data,r=this.findContainerClientCoords(),i=r[2],a=r[3],o=this.getPixelRatio(),s=this.motionBlurPxRatio;(e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_NODE]||e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var l=i*o,c=a*o;if(l!==this.canvasWidth||c!==this.canvasHeight){this.fontCaches=null;var u=n.canvasContainer;u.style.width=i+"px",u.style.height=a+"px";for(var d=0;d<this.CANVAS_LAYERS;d++)(t=n.canvases[d]).width=l,t.height=c,t.style.width=i+"px",t.style.height=a+"px";for(var d=0;d<this.BUFFER_COUNT;d++)(t=n.bufferCanvases[d]).width=l,t.height=c,t.style.width=i+"px",t.style.height=a+"px";this.textureMult=1,o<=1&&(t=n.bufferCanvases[this.TEXTURE_BUFFER],this.textureMult=2,t.width=l*this.textureMult,t.height=c*this.textureMult),this.canvasWidth=l,this.canvasHeight=c,this.pixelRatio=o}},d0.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},d0.clearCanvas=function(){var e=this,t=e.data;function n(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},d0.render=function(e){var t=this;e=e||ru();var n=t.cy,r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,l=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,c=t.data,u=c.canvasNeedsRedraw,d=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),h=void 0!==e.motionBlur?e.motionBlur:t.motionBlur,f=t.motionBlurPxRatio,p=n.hasCompoundNodes(),g=t.hoverData.draggingEles,v=!!t.hoverData.selecting||!!t.touchData.selecting,x=h=h&&!r&&t.motionBlurEnabled&&!v;r||(t.prevPxRatio!==l&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=l),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),h&&(null==t.mbFrames&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(x=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(u[t.NODE]=!0,u[t.SELECT_BOX]=!0);var y=n.style(),b=n.zoom(),w=void 0!==o?o:b,N=n.pan(),j={x:N.x,y:N.y},k={zoom:b,pan:{x:N.x,y:N.y}},S=t.prevViewport;void 0===S||k.zoom!==S.zoom||k.pan.x!==S.pan.x||k.pan.y!==S.pan.y||g&&!p||(t.motionBlurPxRatio=1),s&&(j=s),w*=l,j.x*=l,j.y*=l;var C=t.getCachedZSortedEles();function _(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function E(e,n){var a,l,u,d;t.clearingMotionBlur||e!==c.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==c.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(a=j,l=w,u=t.canvasWidth,d=t.canvasHeight):(a={x:N.x*f,y:N.y*f},l=b*f,u=t.canvasWidth*f,d=t.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?_(e,0,0,u,d):!r&&(void 0===n||n)&&e.clearRect(0,0,u,d),i||(e.translate(a.x,a.y),e.scale(l,l)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var T=t.data.bufferContexts[t.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult});var k=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};k.mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}u[t.DRAG]=!1,u[t.NODE]=!1;var M=c.contexts[t.NODE],O=t.textureCache.texture,k=t.textureCache.viewport;M.setTransform(1,0,0,1,0,0),h?_(M,0,0,k.width,k.height):M.clearRect(0,0,k.width,k.height);var A=y.core("outside-texture-bg-color").value,D=y.core("outside-texture-bg-opacity").value;t.colorFillStyle(M,A[0],A[1],A[2],D),M.fillRect(0,0,k.width,k.height);var b=n.zoom();E(M,!1),M.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l),M.drawImage(O,k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var P=n.extent(),I=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),L=t.hideEdgesOnViewport&&I,R=[];if(R[t.NODE]=!u[t.NODE]&&h&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,R[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),R[t.DRAG]=!u[t.DRAG]&&h&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,R[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),u[t.NODE]||i||a||R[t.NODE]){var B=h&&!R[t.NODE]&&1!==f,M=r||(B?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:c.contexts[t.NODE]);E(M,h&&!B?"motionBlur":void 0),L?t.drawCachedNodes(M,C.nondrag,l,P):t.drawLayeredElements(M,C.nondrag,l,P),t.debug&&t.drawDebugPoints(M,C.nondrag),i||h||(u[t.NODE]=!1)}if(!a&&(u[t.DRAG]||i||R[t.DRAG])){var B=h&&!R[t.DRAG]&&1!==f,M=r||(B?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:c.contexts[t.DRAG]);E(M,h&&!B?"motionBlur":void 0),L?t.drawCachedNodes(M,C.drag,l,P):t.drawCachedElements(M,C.drag,l,P),t.debug&&t.drawDebugPoints(M,C.drag),i||h||(u[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,E),h&&1!==f){var F=c.contexts[t.NODE],z=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],V=c.contexts[t.DRAG],H=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],U=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!x?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):_(e,0,0,t.canvasWidth,t.canvasHeight),e.drawImage(n,0,0,t.canvasWidth*f,t.canvasHeight*f,0,0,t.canvasWidth,t.canvasHeight)};(u[t.NODE]||R[t.NODE])&&(U(F,z,R[t.NODE]),u[t.NODE]=!1),(u[t.DRAG]||R[t.DRAG])&&(U(V,H,R[t.DRAG]),u[t.DRAG]=!1)}t.prevViewport=k,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),h&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,u[t.NODE]=!0,u[t.DRAG]=!0,t.redraw()},100)),r||n.emit("render")},d0.drawSelectionRectangle=function(e,t){var n=this.cy,r=this.data,i=n.style(),a=e.drawOnlyNodeLayer,o=e.drawAllLayers,s=r.canvasNeedsRedraw,l=e.forcedContext;if(this.showFps||!a&&s[this.SELECT_BOX]&&!o){var c=l||r.contexts[this.SELECT_BOX];if(t(c),1==this.selection[4]&&(this.hoverData.selecting||this.touchData.selecting)){var u=this.cy.zoom(),d=i.core("selection-box-border-width").value/u;c.lineWidth=d,c.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+")",c.fillRect(this.selection[0],this.selection[1],this.selection[2]-this.selection[0],this.selection[3]-this.selection[1]),d>0&&(c.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+")",c.strokeRect(this.selection[0],this.selection[1],this.selection[2]-this.selection[0],this.selection[3]-this.selection[1]))}if(r.bgActivePosistion&&!this.hoverData.selecting){var u=this.cy.zoom(),h=r.bgActivePosistion;c.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+")",c.beginPath(),c.arc(h.x,h.y,i.core("active-bg-size").pfValue/u,0,2*Math.PI),c.fill()}var f=this.lastRedrawTime;if(this.showFps&&f){var p=Math.round(1e3/(f=Math.round(f))),g="1 frame = "+f+" ms = "+p+" fps";c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",v||(v=c.measureText(g).actualBoundingBoxAscent),c.fillText(g,0,v),c.strokeRect(0,v+10,250,20),c.fillRect(0,v+10,250*Math.min(p/60,1),20)}o||(s[this.SELECT_BOX]=!1)}};var he="u">typeof Float32Array?Float32Array:Array;function ht(){var e=new he(9);return he!=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 hn(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 hr(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=n[0],f=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=h*r+f*o+c,e[7]=h*i+f*s+u,e[8]=h*a+f*l+d,e}function hi(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=Math.sin(n),f=Math.cos(n);return e[0]=f*r+h*o,e[1]=f*i+h*s,e[2]=f*a+h*l,e[3]=f*o-h*r,e[4]=f*s-h*i,e[5]=f*l-h*a,e[6]=c,e[7]=u,e[8]=d,e}function ha(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var ho=t1(function e(t,n,r,i){t0(this,e),this.debugID=Math.floor(1e4*Math.random()),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=i(t,n,n),this.scratch=i(t,n,this.texHeight,"scratch")},[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.texSize,a=r/n,o=t*a,s=n*a;return o>i&&(a=i/t,o=t*a,s=n*a),{scale:a,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r,i,a,o,s,l,c,u=this;if(this.locked)throw Error("can't draw, atlas is locked");var d=this.texSize,h=this.texRows,f=this.texHeight,p=this.getScale(t),g=p.scale,v=p.texW,x=p.texH,y=function(e,r){if(n&&r){var i=r.context,a=e.x,o=f*e.row;i.save(),i.translate(a,o),i.scale(g,g),n(i,t),i.restore()}},b=[null,null],w=function(){y(u.freePointer,u.canvas),b[0]={x:u.freePointer.x,y:u.freePointer.row*f,w:v,h:x},b[1]={x:u.freePointer.x+v,y:u.freePointer.row*f,w:0,h:x},u.freePointer.x+=v,u.freePointer.x==d&&(u.freePointer.x=0,u.freePointer.row++)},N=function(){u.freePointer.x=0,u.freePointer.row++};if(this.freePointer.x+v<=d)w();else{if(this.freePointer.row>=h-1)return!1;this.freePointer.x===d?(N(),w()):this.enableWrapping?(r=u.scratch,i=u.canvas,r.clear(),y({x:0,row:0},r),o=v-(a=d-u.freePointer.x),s=u.freePointer.x,l=u.freePointer.row*f,i.context.drawImage(r,0,0,a,f,s,l,a,f),b[0]={x:s,y:l,w:a,h:x},c=(u.freePointer.row+1)*f,i&&i.context.drawImage(r,a,0,o,f,0,c,o,f),b[1]={x:0,y:c,w:o,h:x},u.freePointer.x=o,u.freePointer.row++):(N(),w())}return this.keyToLocation.set(e,b),this.needsBuffer=!0,b}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return!(this.freePointer.x+r>t)||this.freePointer.row<n-1}},{key:"bufferIfNeeded",value:function(e){var t;this.texture||(this.texture=(this.debugID,(t=e.createTexture()).buffer=function(n){e.bindTexture(e.TEXTURE_2D,t),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,n),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},t.deleteTexture=function(){e.deleteTexture(t)},t)),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}}]),hs=t1(function e(t,n,r,i){t0(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set},[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){return new ho(this.r,this.texSize,this.texRows,this.createTextureCanvas)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas,i=Math.floor(t/n);this.scratch=r(e,t,i,"scratch")}return this.scratch}},{key:"draw",value:function(e,t,n){var r=this.styleKeyToAtlas.get(e);return r||((r=this.atlases[this.atlases.length-1])&&r.canFit(t)||(r&&r.lock(),r=this._createAtlas(),this.atlases.push(r)),r.draw(e,t,n),this.styleKeyToAtlas.set(e,r)),r}},{key:"getAtlas",value:function(e){return this.styleKeyToAtlas.get(e)}},{key:"hasAtlas",value:function(e){return this.styleKeyToAtlas.has(e)}},{key:"markKeyForGC",value:function(e){this.markedKeys.add(e)}},{key:"gc",value:function(){var e=this,t=this.markedKeys;if(0===t.size)return void console.log("nothing to garbage collect");var n,r=[],i=new Map,a=null,o=t2(this.atlases);try{for(o.s();!(n=o.n()).done;)if(function(){var o=n.value,s=o.getKeys(),l=function(e,t){return e.intersection?e.intersection(t):new Set(t4(e).filter(function(e){return t.has(e)}))}(t,s);if(0===l.size)return r.push(o),s.forEach(function(e){return i.set(e,o)}),1;a||(a=e._createAtlas(),r.push(a));var c,u=t2(s);try{for(u.s();!(c=u.n()).done;){var d=c.value;if(!l.has(d)){var h=o.getOffsets(d),f=t3(h,2),p=f[0],g=f[1];a.canFit({w:p.w+g.w,h:p.h})||(a.lock(),a=e._createAtlas(),r.push(a)),o.canvas&&(e._copyTextureToNewAtlas(d,o,a),i.set(d,a))}}}catch(e){u.e(e)}finally{u.f()}o.dispose()}())continue}catch(e){o.e(e)}finally{o.f()}this.atlases=r,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(e,t,n){var r=t3(t.getOffsets(e),2),i=r[0],a=r[1];if(0===a.w)n.draw(e,i,function(e){e.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h)});else{var o=this._getScratchCanvas();o.clear(),o.context.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h),o.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,i.w,0,a.w,a.h);var s=i.w+a.w,l=i.h;n.draw(e,{w:s,h:l},function(e){e.drawImage(o,0,0,s,l,0,0,s,l)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}]),hl=t1(function e(t,n){t0(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},[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(e,t){var n=this.globalOptions,r=n.webglTexSize,i=n.createTextureCanvas,a=t.texRows,o=this._cacheScratchCanvas(i),s=new hs(this.r,r,a,o);this.collections.set(e,s)}},{key:"addRenderType",value:function(e,t){var n=t.collection;if(!this.collections.has(n))throw Error("invalid atlas collection name '".concat(n,"'"));var r=nO({type:e,atlasCollection:this.collections.get(n)},t);this.renderTypes.set(e,r)}},{key:"getRenderTypeOpts",value:function(e){return this.renderTypes.get(e)}},{key:"getAtlasCollection",value:function(e){return this.collections.get(e)}},{key:"_cacheScratchCanvas",value:function(e){var t=-1,n=-1,r=null;return function(i,a,o,s){return s?(r&&a==t&&o==n||(t=a,n=o,r=e(i,a,o)),r):e(i,a,o)}}},{key:"_key",value:function(e,t){return"".concat(e,"-").concat(t)}},{key:"invalidate",value:function(e){var t,n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.forceRedraw,a=void 0!==i&&i,o=r.filterEle,s=void 0===o?function(){return!0}:o,l=r.filterType,c=void 0===l?function(){return!0}:l,u=!1,d=!1,h=t2(e);try{for(h.s();!(t=h.n()).done;){var f=t.value;if(s(f)){var p,g=t2(this.renderTypes.values());try{for(g.s();!(p=g.n()).done;)!function(){var e=p.value,t=e.type;if(c(t)){var r=n.collections.get(e.collection),i=e.getKey(f),o=Array.isArray(i)?i:[i];if(a)o.forEach(function(e){return r.markKeyForGC(e)}),d=!0;else{var s=e.getID?e.getID(f):f.id(),l=n._key(t,s),h=n.typeAndIdToKey.get(l);void 0!==h&&!function(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}(o,h)&&(u=!0,n.typeAndIdToKey.delete(l),h.forEach(function(e){return r.markKeyForGC(e)}))}}}()}catch(e){g.e(e)}finally{g.f()}}}}catch(e){h.e(e)}finally{h.f()}return d&&(this.gc(),u=!1),u}},{key:"gc",value:function(){var e,t=t2(this.collections.values());try{for(t.s();!(e=t.n()).done;)e.value.gc()}catch(e){t.e(e)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(e,t,n,r){var i=this.renderTypes.get(t),a=this.collections.get(i.collection),o=!1,s=a.draw(r,n,function(t){i.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),i.drawElement(t,e,n,!0,!0),t.restore()):i.drawElement(t,e,n,!0,!0),o=!0});if(o){var l=i.getID?i.getID(e):e.id(),c=this._key(t,l);this.typeAndIdToKey.has(c)?this.typeAndIdToKey.get(c).push(r):this.typeAndIdToKey.set(c,[r])}return s}},{key:"getAtlasInfo",value:function(e,t){var n=this,r=this.renderTypes.get(t),i=r.getKey(e);return(Array.isArray(i)?i:[i]).map(function(i){var a=r.getBoundingBox(e,i),o=n.getOrCreateAtlas(e,t,a,i),s=t3(o.getOffsets(i),2),l=s[0];return{atlas:o,tex:l,tex1:l,tex2:s[1],bb:a}})}},{key:"getDebugInfo",value:function(){var e,t=[],n=t2(this.collections);try{for(n.s();!(e=n.n()).done;){var r=t3(e.value,2),i=r[0],a=r[1].getCounts(),o=a.keyCount,s=a.atlasCount;t.push({type:i,keyCount:o,atlasCount:s})}}catch(e){n.e(e)}finally{n.f()}return t}}]),hc=t1(function e(t){t0(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]},[{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(e,t){return t})}},{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(e){return this.batchAtlases.length!==this.maxAtlasesPerBatch||this.batchAtlases.includes(e)}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw Error("cannot add more atlases to batch");this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}]),hu={name:"screen",screen:!0},hd={name:"picking",picking:!0},hh=t1(function e(t,n,r){t0(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=d2,this.atlasManager=new hl(t,r),this.batchManager=new hc(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(hu),this.pickingProgram=this._createShaderProgram(hd),this.vao=this._createVAO()},[{key:"addAtlasCollection",value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:"addTextureAtlasRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"addSimpleShapeRenderType",value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:"invalidate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.type,r=this.atlasManager;return n?r.invalidate(e,{filterType:function(e){return e===n},forceRedraw:!0}):r.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4," || aVertType == ").concat(7," \n || aVertType == ").concat(5," || aVertType == ").concat(6,") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(1,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(2,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(3," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "),r=this.batchManager.getIndexArray(),i=function(e,t,n){var r=d1(e,e.VERTEX_SHADER,t),i=d1(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw Error("Could not initialize shaders");return a}(t,n,"#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(r.map(function(e){return"uniform sampler2D uTexture".concat(e,";")}).join("\n "),"\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat("\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n","\n ").concat("\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n","\n ").concat("\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n","\n ").concat("\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x<q.y)? 1.570796327 : 0.0;\n for( int i=0; i<5; i++ ) {\n vec2 cs = vec2(cos(w),sin(w));\n vec2 u = ab*vec2( cs.x,cs.y);\n vec2 v = ab*vec2(-cs.y,cs.x);\n w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));\n }\n \n // compute final point and distance\n float d = length(p-ab*vec2(cos(w),sin(w)));\n \n // return signed distance\n return (dot(p/ab,p/ab)>1.0) ? d : -d;\n }\n","\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n // look up the texel from the texture unit\n ").concat(r.map(function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")}).join("\n else "),"\n } \n else if(vVertType == ").concat(3,") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(4," && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(4," || vVertType == ").concat(7," \n || vVertType == ").concat(5," || vVertType == ").concat(6,") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(4,") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(7," && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(7,") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "));i.aPosition=t.getAttribLocation(i,"aPosition"),i.aIndex=t.getAttribLocation(i,"aIndex"),i.aVertType=t.getAttribLocation(i,"aVertType"),i.aTransform=t.getAttribLocation(i,"aTransform"),i.aAtlasId=t.getAttribLocation(i,"aAtlasId"),i.aTex=t.getAttribLocation(i,"aTex"),i.aPointAPointB=t.getAttribLocation(i,"aPointAPointB"),i.aPointCPointD=t.getAttribLocation(i,"aPointCPointD"),i.aLineWidth=t.getAttribLocation(i,"aLineWidth"),i.aColor=t.getAttribLocation(i,"aColor"),i.aCornerRadius=t.getAttribLocation(i,"aCornerRadius"),i.aBorderColor=t.getAttribLocation(i,"aBorderColor"),i.uPanZoomMatrix=t.getUniformLocation(i,"uPanZoomMatrix"),i.uAtlasSize=t.getUniformLocation(i,"uAtlasSize"),i.uBGColor=t.getUniformLocation(i,"uBGColor"),i.uZoom=t.getUniformLocation(i,"uZoom"),i.uTextures=[];for(var a=0;a<this.batchManager.getMaxAtlasesPerBatch();a++)i.uTextures.push(t.getUniformLocation(i,"uTexture".concat(a)));return i}},{key:"_createVAO",value:function(){var e,t,n,r,i,a,o=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=o.length/2;var s=this.maxInstances,l=this.gl,c=this.program,u=l.createVertexArray();return l.bindVertexArray(u),e=c.aPosition,n=(t=t3(d7(l,"vec2"),2))[0],i=d9(l,r=t[1],o),a=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,a),l.bufferData(l.ARRAY_BUFFER,i,l.STATIC_DRAW),r===l.FLOAT?l.vertexAttribPointer(e,n,r,!1,0,0):r===l.INT&&l.vertexAttribIPointer(e,n,r,0,0),l.enableVertexAttribArray(e),l.bindBuffer(l.ARRAY_BUFFER,null),this.transformBuffer=function(e,t,n){for(var r=new Float32Array(9*t),i=Array(t),a=0;a<t;a++){var o=9*a*4;i[a]=new Float32Array(r.buffer,o,9)}var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,r.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var c=n+l;e.enableVertexAttribArray(c),e.vertexAttribPointer(c,3,e.FLOAT,!1,36,12*l),e.vertexAttribDivisor(c,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),s.getMatrixView=function(e){return i[e]},s.setData=function(e,t){i[t].set(e,0)},s.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferSubData(e.ARRAY_BUFFER,0,r)},s}(l,s,c.aTransform),this.indexBuffer=d8(l,s,"vec4",c.aIndex),this.vertTypeBuffer=d8(l,s,"int",c.aVertType),this.atlasIdBuffer=d8(l,s,"int",c.aAtlasId),this.texBuffer=d8(l,s,"vec4",c.aTex),this.pointAPointBBuffer=d8(l,s,"vec4",c.aPointAPointB),this.pointCPointDBuffer=d8(l,s,"vec4",c.aPointCPointD),this.lineWidthBuffer=d8(l,s,"vec2",c.aLineWidth),this.colorBuffer=d8(l,s,"vec4",c.aColor),this.cornerRadiusBuffer=d8(l,s,"vec4",c.aCornerRadius),this.borderColorBuffer=d8(l,s,"vec4",c.aBorderColor),l.bindVertexArray(null),u}},{key:"buffers",get:function(){var e=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(e){return nk(e,"Buffer")}).map(function(t){return e[t]})),this._buffers}},{key:"startFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hu;this.panZoomMatrix=e,this.renderTarget=t,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(e,t){return!!e.visible()&&(!t||!t.isVisible||t.isVisible(e))}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,a=r.getRenderTypeOpts(n);if(this._isVisible(e,a)&&(!e.isEdge()||this._isValidEdge(e))){if(this.renderTarget.picking&&a.getTexPickingMode){var o=a.getTexPickingMode(e);if(1===o)return;if(2==o)return void this.drawPickingRectangle(e,t,n)}var s,l=t2(r.getAtlasInfo(e,n));try{for(l.s();!(s=l.n()).done;){var c=s.value,u=c.atlas,d=c.tex1,h=c.tex2;i.canAddToCurrentBatch(u)||this.endBatch();for(var f=i.getAtlasIndexForBatch(u),p=0,g=[[d,!0],[h,!1]];p<g.length;p++){var v=t3(g[p],2),x=v[0],y=v[1];if(0!=x.w){var b=this.instanceCount;this.vertTypeBuffer.getView(b)[0]=0;var w=this.indexBuffer.getView(b);d6(t,w),this.atlasIdBuffer.getView(b)[0]=f;var N=this.texBuffer.getView(b);N[0]=x.x,N[1]=x.y,N[2]=x.w,N[3]=x.h;var j=this.transformBuffer.getMatrixView(b);this.setTransformMatrix(e,j,a,c,y),this.instanceCount++,!y&&this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(e){l.e(e)}finally{l.f()}}}},{key:"setTransformMatrix",value:function(e,t,n,r){var i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=0;if(n.shapeProps&&n.shapeProps.padding&&(a=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,l=r.tex2,c=s.w/(s.w+l.w);i||(c=1-c);var u=this._getAdjustedBB(o,a,i,c);this._applyTransformMatrix(t,u,n,e)}else{var d=n.getBoundingBox(e),h=this._getAdjustedBB(d,a,!0,1);this._applyTransformMatrix(t,h,n,e)}}},{key:"_applyTransformMatrix",value:function(e,t,n,r){hn(e);var i,a,o=n.getRotation?n.getRotation(r):0;if(0!==o){var s=n.getRotationPoint(r);hr(e,e,[s.x,s.y]),hi(e,e,o);var l=n.getRotationOffset(r);i=l.x+(t.xOffset||0),a=l.y+(t.yOffset||0)}else i=t.x1,a=t.y1;hr(e,e,[i,a]),ha(e,e,[t.w,t.h])}},{key:"_getAdjustedBB",value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h,l=e.yOffset;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var c=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(i+=c=o-u,o=u),{x1:i,y1:a,w:o,h:s,xOffset:c,yOffset:l}}},{key:"drawPickingRectangle",value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=4,d6(t,this.indexBuffer.getView(i)),d4([0,0,0],1,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(e,a,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var i=r.shapeProps,a=this._getVertTypeForShape(e,i.shape);if(void 0===a||r.isSimple&&!r.isSimple(e))return void this.drawTexture(e,t,n);var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=a,5===a||6===a){var s=r.getBoundingBox(e),l=this._getCornerRadius(e,i.radius,s),c=this.cornerRadiusBuffer.getView(o);c[0]=l,c[1]=l,c[2]=l,c[3]=l,6===a&&(c[0]=0,c[2]=0)}d6(t,this.indexBuffer.getView(o)),d4(e.pstyle(i.color).value,e.pstyle(i.opacity).value,this.colorBuffer.getView(o));var u=this.lineWidthBuffer.getView(o);if(u[0]=0,u[1]=0,i.border){var d=e.pstyle("border-width").value;if(d>0){d4(e.pstyle("border-color").value,e.pstyle("border-opacity").value,this.borderColorBuffer.getView(o));var h=e.pstyle("border-position").value;if("inside"===h)u[0]=0,u[1]=-d;else if("outside"===h)u[0]=d,u[1]=0;else{var f=d/2;u[0]=f,u[1]=-f}}}var p=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,p,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(e,t){switch(e.pstyle(t).value){case"rectangle":return 4;case"ellipse":return 7;case"roundrectangle":case"round-rectangle":return 5;case"bottom-round-rectangle":return 6;default:return}}},{key:"_getCornerRadius",value:function(e,t,n){var r=n.w,i=n.h;return"auto"===e.pstyle(t).value?iS(r,i):Math.min(e.pstyle(t).pfValue,i/2,r/2)}},{key:"drawEdgeArrow",value:function(e,t,n){if(e.visible()){var r,i,a,o=e._private.rscratch;if(("source"===n?(r=o.arrowStartX,i=o.arrowStartY,a=o.srcArrowAngle):(r=o.arrowEndX,i=o.arrowEndY,a=o.tgtArrowAngle),!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a))&&null!=a)&&"none"!==e.pstyle(n+"-arrow-shape").value){var s=e.pstyle(n+"-arrow-color").value,l=e.pstyle("opacity").value,c=e.pstyle("line-opacity").value,u=e.pstyle("width").pfValue,d=e.pstyle("arrow-scale").value,h=this.r.getArrowWidth(u,d),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);hn(p),hr(p,p,[r,i]),ha(p,p,[h,h]),hi(p,p,a),this.vertTypeBuffer.getView(f)[0]=3,d6(t,this.indexBuffer.getView(f)),d4(s,l*c,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle("opacity").value,i=e.pstyle("line-opacity").value,a=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=1,d6(t,this.indexBuffer.getView(l)),d4(o,s,this.colorBuffer.getView(l)),this.lineWidthBuffer.getView(l)[0]=a;var c=this.pointAPointBBuffer.getView(l);c[0]=n[0],c[1]=n[1],c[2]=n[2],c[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var u=0;u<n.length-2;u+=2){var d=this.instanceCount;this.vertTypeBuffer.getView(d)[0]=2,d6(t,this.indexBuffer.getView(d)),d4(o,s,this.colorBuffer.getView(d)),this.lineWidthBuffer.getView(d)[0]=a;var h=n[u-2],f=n[u-1],p=n[u],g=n[u+1],v=n[u+2],x=n[u+3],y=n[u+4],b=n[u+5];0==u&&(h=2*p-v+.001,f=2*g-x+.001),u==n.length-4&&(y=2*v-p+.001,b=2*x-g+.001);var w=this.pointAPointBBuffer.getView(d);w[0]=h,w[1]=f,w[2]=p,w[3]=g;var N=this.pointCPointDBuffer.getView(d);N[0]=v,N[1]=x,N[2]=y,N[3]=b,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(e){var t=e._private.rscratch;return!(t.badLine||null==t.allpts||isNaN(t.allpts[0]))}},{key:"_getEdgePoints",value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(4==n.length)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:"_getNumSegments",value:function(e){return Math.min(15,this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array((t+1)*2),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var i=r/t;this._setCurvePoint(e,i,n,2*r)}return n}},{key:"_setCurvePoint",value:function(e,t,n,r){if(e.length<=2)n[r]=e[0],n[r+1]=e[1];else{for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this._setCurvePoint(i,t,n,r)}}},{key:"endBatch",value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(0!==r){var i,a,o=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(o),e.bindVertexArray(t);var s,l=t2(this.buffers);try{for(l.s();!(s=l.n()).done;)s.value.bufferSubData(r)}catch(e){l.e(e)}finally{l.f()}for(var c=this.batchManager.getAtlases(),u=0;u<c.length;u++)c[u].bufferIfNeeded(e);for(var d=0;d<c.length;d++)e.activeTexture(e.TEXTURE0+d),e.bindTexture(e.TEXTURE_2D,c[d].texture),e.uniform1i(o.uTextures[d],d);e.uniform1f(o.uZoom,(a=(i=this.r).pixelRatio,i.cy.zoom()*a)),e.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var h=d4(this.bgColor,1);e.uniform4fv(o.uBGColor,h),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:c.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}]),hf={};function hp(e,t){return rm(e._private.rscratch,"labelWrapCachedLines",t)||[]}hf.initWebgl=function(e,t){var n,r,i,a,o,s,l,c,u=this,d=u.data.contexts[u.WEBGL];e.bgColor=nI((n=u.cy.container())&&n.style&&n.style.backgroundColor||"white"),e.webglTexSize=Math.min(e.webglTexSize,d.getParameter(d.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,d.getParameter(d.MAX_TEXTURE_IMAGE_UNITS)),u.webglDebug=e.webglDebug,u.webglDebugShowAtlases=e.webglDebugShowAtlases,l=d.createFramebuffer(),d.bindFramebuffer(d.FRAMEBUFFER,l),c=d.createTexture(),d.bindTexture(d.TEXTURE_2D,c),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,c,0),d.bindFramebuffer(d.FRAMEBUFFER,null),l.setFramebufferAttachmentSizes=function(e,t){d.bindTexture(d.TEXTURE_2D,c),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,e,t,0,d.RGBA,d.UNSIGNED_BYTE,null)},u.pickingFrameBuffer=l,u.pickingFrameBuffer.needsDraw=!0,u.drawing=new hh(u,d,e);var h=function(e){return function(t){return u.getTextAngle(t,e)}},f=function(e){return function(t){var n=t.pstyle(e);return n&&n.value}},p=function(e){return function(t){return t.pstyle("".concat(e,"-opacity")).value>0}},g=function(e){return"yes"===e.pstyle("text-events").strValue?2:1},v=function(e){var t=e.position(),n=t.x,r=t.y,i=e.outerWidth(),a=e.outerHeight();return{w:i,h:a,x1:n-i/2,y1:r-a/2}};u.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),u.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),u.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),u.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:v,isSimple:d3,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),u.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:v,isVisible:p("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),u.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:v,isVisible:p("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),u.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:g,getKey:hm(t.getLabelKey,null),getBoundingBox:hg(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:h(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:f("label")}),u.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:g,getKey:hm(t.getSourceLabelKey,"source"),getBoundingBox:hg(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:h("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:f("source-label")}),u.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:g,getKey:hm(t.getTargetLabelKey,"target"),getBoundingBox:hg(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:h("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:f("target-label")});var x=nG(function(){console.log("garbage collect flag set"),u.data.gc=!0},1e4);u.onUpdateEleCalcs(function(e,t){var n=!1;t&&t.length>0&&(n|=u.drawing.invalidate(t)),n&&x()}),i=(r=u).render,r.render=function(e){e=e||{};var t,n,a,o,s=r.cy;r.webgl&&(s.zoom()>7.99?((n=(t=r).data.contexts[t.WEBGL]).clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),i.call(r,e)):(a=r,(o=function(e){e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,a.canvasWidth,a.canvasHeight),e.restore()})(a.data.contexts[a.NODE]),o(a.data.contexts[a.DRAG]),hy(r,e,hu)))},a=r.matchCanvasSize,r.matchCanvasSize=function(e){a.call(r,e),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0},r.findNearestElements=function(e,t,n,i){return function(e,t,n){var r,i,a,o=function(e,t,n){var r=d5(e),i=r.pan,a=r.zoom,o=t3((f=t*a+i.x,p=n*a+i.y,[f,p=Math.round(e.canvasHeight-p)]),2),s=o[0],l=o[1],c=e.data.contexts[e.WEBGL];c.bindFramebuffer(c.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(c.viewport(0,0,c.canvas.width,c.canvas.height),hy(e,null,hd),e.pickingFrameBuffer.needsDraw=!1);var u=new Uint8Array(144);c.readPixels(s-3,l-3,6,6,c.RGBA,c.UNSIGNED_BYTE,u),c.bindFramebuffer(c.FRAMEBUFFER,null);for(var d=new Set,h=0;h<36;h++){var f,p,g,v=(g=u.slice(4*h,4*h+4))[0]+(g[1]<<8)+(g[2]<<16)+(g[3]<<24)-1;v>=0&&d.add(v)}return d}(e,t,n),s=e.getCachedZSortedEles(),l=t2(o);try{for(l.s();!(a=l.n()).done;){var c=s[a.value];if(!r&&c.isNode()&&(r=c),!i&&c.isEdge()&&(i=c),r&&i)break}}catch(e){l.e(e)}finally{l.f()}return[r,i].filter(Boolean)}(r,e,t)},o=r.invalidateCachedZSortedEles,r.invalidateCachedZSortedEles=function(){o.call(r),r.pickingFrameBuffer.needsDraw=!0},s=r.notify,r.notify=function(e,t){s.call(r,e,t),"viewport"===e||"bounds"===e?r.pickingFrameBuffer.needsDraw=!0:"background"===e&&r.drawing.invalidate(t,{type:"node-body"})}};var hm=function(e,t){return function(n){var r=e(n),i=hp(n,t);return i.length>1?i.map(function(e,t){return"".concat(r,"_").concat(t)}):r}},hg=function(e,t){return function(n,r){var i=e(n);if("string"==typeof r){var a=r.indexOf("_");if(a>0){var o=Number(r.substring(a+1)),s=hp(n,t),l=i.h/s.length,c=l*o,u=i.y1+c;return{x1:i.x1,w:i.w,y1:u,h:l,yOffset:c}}}return i}};function hv(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=d5(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function hx(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 hy(e,t,n){e.webglDebug&&(G=performance.now());var r=e.drawing,i=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&e.drawSelectionRectangle(t,function(t){return hv(e,t)}),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var a,o,s,l,c,u,d,h,f,p,g,v,x,y,b,w,N,j,k,S,C,_,E,T,M,O,A,D,P,I,L,R=e.data.contexts[e.WEBGL];n.screen?(R.clearColor(0,0,0,0),R.enable(R.BLEND),R.blendFunc(R.ONE,R.ONE_MINUS_SRC_ALPHA)):R.disable(R.BLEND),R.clear(R.COLOR_BUFFER_BIT|R.DEPTH_BUFFER_BIT),R.viewport(0,0,R.canvas.width,R.canvas.height);var B=(a=e.canvasWidth,o=e.canvasHeight,l=(s=d5(e)).pan,c=s.zoom,hr(u=ht(),u,[l.x,l.y]),ha(u,u,[c,c]),h=d=ht(),h[0]=2/a,h[1]=0,h[2]=0,h[3]=0,h[4]=-2/o,h[5]=0,h[6]=-1,h[7]=1,h[8]=1,p=f=ht(),g=d[0],v=d[1],x=d[2],y=d[3],b=d[4],w=d[5],N=d[6],j=d[7],k=d[8],S=u[0],C=u[1],_=u[2],E=u[3],T=u[4],M=u[5],O=u[6],A=u[7],D=u[8],p[0]=S*g+C*y+_*N,p[1]=S*v+C*b+_*j,p[2]=S*x+C*w+_*k,p[3]=E*g+T*y+M*N,p[4]=E*v+T*b+M*j,p[5]=E*x+T*w+M*k,p[6]=O*g+A*y+D*N,p[7]=O*v+A*b+D*j,p[8]=O*x+A*w+D*k,f),F=e.getCachedZSortedEles();if(i=F.length,r.startFrame(B,n),n.screen){for(var z=0;z<F.nondrag.length;z++)hx(e,z,F.nondrag[z]);for(var V=0;V<F.drag.length;V++)hx(e,V,F.drag[V])}else if(n.picking)for(var H=0;H<F.length;H++)hx(e,H,F[H]);r.endFrame(),n.screen&&e.webglDebugShowAtlases&&((P=e.data.contexts[e.NODE]).save(),hv(e,P),P.strokeStyle="rgba(0, 0, 0, 0.3)",P.beginPath(),P.moveTo(-1e3,0),P.lineTo(1e3,0),P.stroke(),P.beginPath(),P.moveTo(0,-1e3),P.lineTo(0,1e3),P.stroke(),P.restore(),L=0,(I=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=i.atlases,s=0;s<o.length;s++){var l=o[s].canvas;if(l){var c=l.width,u=l.height,d=c*s,h=l.height*r;a.save(),a.scale(.4,.4),a.drawImage(l,d,h),a.strokeStyle="black",a.rect(d,h,c,u),a.stroke(),a.restore()}}})(e.drawing,"node",L++),I(e.drawing,"label",L++)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var U=Math.ceil(performance.now()-G),W=r.getDebugInfo(),Y=["".concat(i," elements"),"".concat(W.totalInstances," instances"),"".concat(W.batchCount," batches"),"".concat(W.totalAtlases," atlases"),"".concat(W.wrappedCount," wrapped textures"),"".concat(W.simpleCount," simple shapes")].join(", ");console.log("WebGL (".concat(n.name,") - frame time ").concat(U,"ms")),console.log("Totals:"),console.log(" ".concat(Y)),console.log("Texture Atlases Used:");var G,X,$=t2(W.atlasInfo);try{for($.s();!(X=$.n()).done;){var q=X.value;console.log(" ".concat(q.type,": ").concat(q.keyCount," keys, ").concat(q.atlasCount," atlases"))}}catch(e){$.e(e)}finally{$.f()}console.log("")}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,r.gc())}var hb={};hb.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],n+s*a[2*l+1]);e.closePath()},hb.drawRoundPolygonPath=function(e,t,n,r,i,a,o){o.forEach(function(t){return de(e,t)}),e.closePath()},hb.drawRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,l="auto"===a?iS(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,l),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.arcTo(t-o,n-s,t,n-s,l),e.lineTo(t,n-s),e.closePath()},hb.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,l="auto"===a?iS(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},hb.drawCutRectanglePath=function(e,t,n,r,i,a,o){var s=r/2,l=i/2,c="auto"===o?i_():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+c,n-l),e.lineTo(t+s-c,n-l),e.lineTo(t+s,n-l+c),e.lineTo(t+s,n+l-c),e.lineTo(t+s-c,n+l),e.lineTo(t-s+c,n+l),e.lineTo(t-s,n+l-c),e.lineTo(t-s,n-l+c),e.closePath()},hb.drawBarrelPath=function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,l=t+a,c=n-o,u=n+o,d=iE(r,i),h=d.widthOffset,f=d.heightOffset,p=d.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(s,c+f),e.lineTo(s,u-f),e.quadraticCurveTo(s+p,u,s+h,u),e.lineTo(l-h,u),e.quadraticCurveTo(l-p,u,l,u-f),e.lineTo(l,c+f),e.quadraticCurveTo(l-p,c,l-h,c),e.lineTo(s+h,c),e.quadraticCurveTo(s+p,c,s,c+f),e.closePath()};for(var hw={},hN={},hj=Math.PI/40,hk=0*Math.PI;hk<2*Math.PI;hk+=hj)hw[hk]=Math.sin(hk),hN[hk]=Math.cos(hk);hb.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,l=i/2,c=0*Math.PI;c<2*Math.PI;c+=hj)a=t-s*hw[c]*0+s*hN[c]*1,o=n+l*hN[c]*0+l*hw[c]*1,0===c?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var hS={};function hC(e){var t=e.indexOf(",");return e.substr(t+1)}function h_(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new aP(function(r,i){try{t.toBlob(function(e){null!=e?r(e):i(Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(e){i(e)}});case"blob":return function(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}(hC(r()),n);case"base64":return hC(r());default:return r()}}hS.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},hS.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=nu(e.maxWidth)||nu(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)i*=e.scale,a*=e.scale,l=e.scale;else if(o){var c=1/0,u=1/0;nu(e.maxWidth)&&(c=l*e.maxWidth/i),nu(e.maxHeight)&&(u=l*e.maxHeight/a),i*=l=Math.min(c,u),a*=l}o||(i*=s,a*=s,l*=s);var d=document.createElement("canvas");d.width=i,d.height=a,d.style.width=i+"px",d.style.height=a+"px";var h=d.getContext("2d");if(i>0&&a>0){h.clearRect(0,0,i,a),h.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,f),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var p=t.pan(),g={x:p.x*l,y:p.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,f),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,i,a),h.fill())}return d},hS.png=function(e){return h_(e,this.bufferCanvasImage(e),"image/png")},hS.jpg=function(e){return h_(e,this.bufferCanvasImage(e),"image/jpeg")};var hE={};hE.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}};var hT=hM.prototype;function hM(e){var t=this,n=t.cy.window().document;e.webgl&&(hT.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:Array(hT.CANVAS_LAYERS),contexts:Array(hT.CANVAS_LAYERS),canvasNeedsRedraw:Array(hT.CANVAS_LAYERS),bufferCanvases:Array(hT.BUFFER_COUNT),bufferContexts:Array(hT.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position="relative",a.zIndex="0",a.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};ne&&ne.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l<hT.CANVAS_LAYERS;l++){var c=t.data.canvases[l]=n.createElement("canvas"),u=hT.CANVAS_TYPES[l];t.data.contexts[l]=c.getContext(u),t.data.contexts[l]||ri("Could not create canvas of type "+u),Object.keys(s).forEach(function(e){c.style[e]=s[e]}),c.style.position="absolute",c.setAttribute("data-id","layer"+l),c.style.zIndex=String(hT.CANVAS_LAYERS-l),t.data.canvasContainer.appendChild(c),t.data.canvasNeedsRedraw[l]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[hT.NODE].setAttribute("data-id","layer"+hT.NODE+"-node"),t.data.canvases[hT.SELECT_BOX].setAttribute("data-id","layer"+hT.SELECT_BOX+"-selectbox"),t.data.canvases[hT.DRAG].setAttribute("data-id","layer"+hT.DRAG+"-drag"),t.data.canvases[hT.WEBGL]&&t.data.canvases[hT.WEBGL].setAttribute("data-id","layer"+hT.WEBGL+"-webgl");for(var l=0;l<hT.BUFFER_COUNT;l++)t.data.bufferCanvases[l]=n.createElement("canvas"),t.data.bufferContexts[l]=t.data.bufferCanvases[l].getContext("2d"),t.data.bufferCanvases[l].style.position="absolute",t.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),t.data.bufferCanvases[l].style.zIndex=String(-l-1),t.data.bufferCanvases[l].style.visibility="hidden";t.pathsEnabled=!0;var d=rZ(),h=function(e){return{x:-e.w/2,y:-e.h/2}},f=function(e){return e[0]._private.nodeKey},p=function(e){return e[0]._private.labelStyleKey},g=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},x=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},y=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"main",a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"source",a)},w=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"target",a)},N=function(e){return e.boundingBox(),e[0]._private.bodyBounds},j=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||d},k=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||d},S=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||d},C=function(e,t){return t},_=function(e){var t;return{x:((t=N(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2}},E=function(e,t,n){var r=e?e+"-":"";return{x:t.x+n.pstyle(r+"text-margin-x").pfValue,y:t.y+n.pstyle(r+"text-margin-y").pfValue}},T=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},M=function(e){return E("",T(e,"labelX","labelY"),e)},O=function(e){return E("source",T(e,"sourceLabelX","sourceLabelY"),e)},A=function(e){return E("target",T(e,"targetLabelX","targetLabelY"),e)},D=function(e){return h(N(e))},P=function(e){return h(k(e))},I=function(e){return h(S(e))},L=function(e){var t=j(e),n=h(j(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w-(t.leftPad||0);break;case"right":n.x=-(t.rightPad||0)}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h-(t.topPad||0);break;case"bottom":n.y=-(t.botPad||0)}}return n},R=t.data.eleTxrCache=new dT(t,{getKey:f,doesEleInvalidateKey:function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},drawElement:x,getBoundingBox:N,getRotationPoint:_,getRotationOffset:D,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),B=t.data.lblTxrCache=new dT(t,{getKey:p,drawElement:y,getBoundingBox:j,getRotationPoint:M,getRotationOffset:L,isVisible:C}),F=t.data.slbTxrCache=new dT(t,{getKey:g,drawElement:b,getBoundingBox:k,getRotationPoint:O,getRotationOffset:P,isVisible:C}),z=t.data.tlbTxrCache=new dT(t,{getKey:v,drawElement:w,getBoundingBox:S,getRotationPoint:A,getRotationOffset:I,isVisible:C}),V=t.data.lyrTxrCache=new dO(t);t.onUpdateEleCalcs(function(e,t){R.invalidateElements(t),B.invalidateElements(t),F.invalidateElements(t),z.invalidateElements(t),V.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var H=function(e){for(var t=0;t<e.length;t++)V.enqueueElementRefinement(e[t].ele)};R.onDequeue(H),B.onDequeue(H),F.onDequeue(H),z.onDequeue(H),e.webgl&&t.initWebgl(e,{getStyleKey:f,getLabelKey:p,getSourceLabelKey:g,getTargetLabelKey:v,drawElement:x,drawLabel:y,drawSourceLabel:b,drawTargetLabel:w,getElementBox:N,getLabelBox:j,getSourceLabelBox:k,getTargetLabelBox:S,getElementRotationPoint:_,getElementRotationOffset:D,getLabelRotationPoint:M,getSourceLabelRotationPoint:O,getTargetLabelRotationPoint:A,getLabelRotationOffset:L,getSourceLabelRotationOffset:P,getTargetLabelRotationOffset:I})}hT.CANVAS_LAYERS=3,hT.SELECT_BOX=0,hT.DRAG=1,hT.NODE=2,hT.WEBGL=3,hT.CANVAS_TYPES=["2d","2d","2d","webgl2"],hT.BUFFER_COUNT=3,hT.TEXTURE_BUFFER=0,hT.MOTIONBLUR_BUFFER_NODE=1,hT.MOTIONBLUR_BUFFER_DRAG=2,hT.redrawHint=function(e,t){switch(e){case"eles":this.data.canvasNeedsRedraw[hT.NODE]=t;break;case"drag":this.data.canvasNeedsRedraw[hT.DRAG]=t;break;case"select":this.data.canvasNeedsRedraw[hT.SELECT_BOX]=t;break;case"gc":this.data.gc=!0}};var hO="u">typeof Path2D;hT.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},hT.usePaths=function(){return hO&&this.pathsEnabled},hT.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},hT.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},hT.makeOffscreenCanvas=function(e,t){var n;return("u"<typeof OffscreenCanvas?"undefined":t7(OffscreenCanvas))!=="undefined"?n=new OffscreenCanvas(e,t):((n=this.cy.window().document.createElement("canvas")).width=e,n.height=t),n},[dP,dz,dX,dq,dK,dQ,d0,hf,hb,hS,hE].forEach(function(e){nO(hT,e)});var hA=[{name:"null",impl:lN},{name:"base",impl:dN},{name:"canvas",impl:hM}],hD={},hP={};function hI(e,t,n){var r=n,i=function(n){ro("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e)if(sY.prototype[t])return i(t);else sY.prototype[t]=n;else if("collection"===e)if(sp.prototype[t])return i(t);else sp.prototype[t]=n;else if("layout"===e){for(var a=function(e){this.options=e,n.call(this,e),nc(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var c=s[l];o[c]=o[c]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var u=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return u?u.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var d=function(e){return e._private.cy},h={addEventFields:function(e,t){t.layout=e,t.cy=d(e),t.target=e},bubble:function(){return!0},parent:function(e){return d(e)}};nO(o,{createEmitter:function(){return this._private.emitter=new o$(h,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),aZ.eventAliasesOn(o),r=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var f=hL("renderer","base"),p=f.prototype,g=n.prototype,v=function(){f.apply(this,arguments),n.apply(this,arguments)},x=v.prototype;for(var y in p){var b=p[y];if(null!=g[y])return i(y);x[y]=b}for(var w in g)x[w]=g[w];p.clientFunctions.forEach(function(e){x[e]=x[e]||function(){ri("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=v}else if("__proto__"===e||"constructor"===e||"prototype"===e)return ri(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return nR({map:hD,keys:[e,t],value:r})}function hL(e,t){return nB({map:hD,keys:[e,t]})}function hR(e,t,n,r,i){return nR({map:hP,keys:[e,t,n,r],value:i})}function hB(e,t,n,r){return nB({map:hP,keys:[e,t,n,r]})}var hF=function(){return 2==arguments.length?hL.apply(null,arguments):3==arguments.length?hI.apply(null,arguments):4==arguments.length?hB.apply(null,arguments):5==arguments.length?hR.apply(null,arguments):void ri("Invalid extension access syntax")};sY.prototype.extension=hF,[{type:"layout",extensions:lw},{type:"renderer",extensions:hA}].forEach(function(e){e.extensions.forEach(function(t){hI(e.type,t.name,t.impl)})});var hz=function(){if(!(this instanceof hz))return new hz;this.length=0},hV=hz.prototype;hV.instanceString=function(){return"stylesheet"},hV.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},hV.css=function(e,t){var n=this.length-1;if(no(e))this[n].properties.push({name:e,value:t});else if(nc(e))for(var r=Object.keys(e),i=0;i<r.length;i++){var a=r[i],o=e[a];if(null!=o){var s=sV.properties[a]||sV.properties[nw(a)];if(null!=s){var l=s.name;this[n].properties.push({name:l,value:o})}}}return this},hV.style=hV.css,hV.generateStyle=function(e){var t=new sV(e);return this.appendToStyle(t)},hV.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var hH=function(e){return(void 0===e&&(e={}),nc(e))?new sY(e):no(e)?hF.apply(hF,arguments):void 0};hH.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(hH),e.apply(null,t),this},hH.warnings=function(e){return ra(e)},hH.version="3.33.1",hH.stylesheet=hH.Stylesheet=hz;var hU=e.i(45108);function hW({data:e,height:t=600,showLabels:n=!0,onNodeClick:r,onNodeHover:i,nodeColorFn:a,nodeSizeFn:o,linkColorFn:s,linkWidthFn:l,maxNodes:c}){let u,d=(0,ep.useTranslations)("graph2d"),[h,f]=(0,eh.useState)(null),p=(0,eh.useRef)(null),g=(0,eh.useRef)(!1),v=(0,eh.useRef)(""),[x,y]=(0,eh.useState)(null),[b,w]=(0,eh.useState)(null),[N,j]=(0,eh.useState)(null),[k,S]=(0,eh.useState)(!0),[C,_]=(0,eh.useState)(!1),[E,T]=(0,eh.useState)(!1),M=function(){let[e,t]=(0,eh.useState)(!1);return(0,eh.useEffect)(()=>{let e=()=>{t(document.documentElement.classList.contains("dark"))};e();let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>n.disconnect()},[]),e}(),O=(0,eh.useRef)(r),A=(0,eh.useRef)(i),D=(0,eh.useRef)(e),P=(0,eh.useRef)(a),I=(0,eh.useRef)(s),L=(0,eh.useRef)(E);O.current=r,A.current=i,D.current=e,P.current=a,I.current=s,L.current=E;let R=(0,eh.useMemo)(()=>{let t=[...e.nodes];c&&t.length>c&&(t=t.slice(0,c));let n=new Set(t.map(e=>e.id));return{nodes:t,links:e.links.filter(e=>n.has(e.source)&&n.has(e.target))}},[e,c]);(0,eh.useEffect)(()=>(_(!0),()=>_(!1)),[]);let B=(0,eh.useMemo)(()=>{let e=new Map;return R.links.forEach(t=>{e.set(t.source,(e.get(t.source)||0)+1),e.set(t.target,(e.get(t.target)||0)+1)}),[...R.nodes.map(t=>{let n=e.get(t.id)||0,r=o?o(t):Math.max(16,Math.min(40,16+4*n));return{data:{id:t.id,label:t.label||t.id.substring(0,8),color:a?a(t):t.color||"#0074d9",size:t.size||r,originalNode:t,connections:n}}}),...R.links.map((e,t)=>({data:{id:`edge-${t}`,source:e.source,target:e.target,color:s?s(e):e.color||"#0074d9",width:l?l(e):e.width||1,type:e.type,entity:e.entity,weight:e.weight,originalLink:e}}))]},[R,a,o,s,l]),F=(0,eh.useMemo)(()=>JSON.stringify({nodeCount:R.nodes.length,linkCount:R.links.length,nodeIds:R.nodes.map(e=>e.id).sort().join(","),showLabels:n,isDarkMode:M,maxNodes:c}),[R.nodes,R.links,n,M,c]);return(0,eh.useEffect)(()=>{let e=!1,t=setTimeout(()=>{if(e||!C||!h||g.current)return;if(v.current===F)return void console.log("Data signature unchanged, skipping graph initialization");let t=h.getBoundingClientRect();if(0===t.width||0===t.height){console.warn("Container has no dimensions, skipping cytoscape initialization"),S(!1);return}if(0===B.length)return void S(!1);if(p.current&&!p.current.destroyed()){let e=p.current.nodes().length,t=p.current.edges().length,n=B.filter(e=>!e.data.source).length,r=B.filter(e=>e.data.source).length;if(e===n&&t===r){console.log("Graph already initialized with same data, skipping reinitialization"),S(!1);return}console.log("Data changed, destroying existing graph"),p.current.destroy(),p.current=null}S(!0),g.current=!0;let r=M?"#ffffff":"#1f2937",i=M?"rgba(0,0,0,0.8)":"rgba(255,255,255,0.9)";try{console.log("Initializing cytoscape with container:",h),console.log("Elements count:",B.length),console.log("Sample elements:",B.slice(0,2));let e=hH({container:h,elements:[],selectionType:"single",userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,layout:{name:"preset"},style:[{selector:"node",style:{"background-color":"data(color)",width:"data(size)",height:"data(size)",label:n?"data(label)":"",color:r,"text-valign":"bottom","text-halign":"center","font-size":"8px","font-weight":500,"text-margin-y":3,"text-wrap":"wrap","text-max-width":"80px","text-background-color":i,"text-background-opacity":.9,"text-background-padding":"2px","text-background-shape":"roundrectangle","border-width":1,"border-color":M?"#ffffff20":"#00000020","border-opacity":.3}},{selector:"node:selected",style:{"border-width":3,"border-color":"#0074d9","border-opacity":1}},{selector:"edge",style:{width:"data(width)","line-color":"data(color)","target-arrow-color":"data(color)","target-arrow-shape":"triangle","target-arrow-size":6,"curve-style":"bezier",opacity:M?.6:.7}},{selector:".dimmed",style:{opacity:.2}},{selector:".focused",style:{"border-width":4,"border-color":"#ff6b35","border-opacity":1,"z-index":999}},{selector:".connected",style:{"border-width":2,"border-color":"#0074d9","border-opacity":.8,opacity:1}},{selector:"edge.connection",style:{width:2,opacity:1,"z-index":100}},{selector:"edge.connection:hover",style:{width:3,opacity:1,"z-index":200}},{selector:"edge:selected",style:{"overlay-opacity":0,"overlay-color":"transparent","overlay-padding":0}}]});p.current=e,console.log("Cytoscape initialized successfully"),B.length>0&&(console.log("Adding elements to cytoscape"),e.add(B),e.layout({name:"fcose",quality:"default",randomize:!1,animate:!0,animationDuration:1500,nodeSeparation:200,idealEdgeLength:()=>250,edgeElasticity:()=>.05,nestingFactor:.05,gravity:.05,numIter:2500,nodeOverlap:30,avoidOverlap:!0,nodeDimensionsIncludeLabels:!0,padding:20,boundingBox:void 0,tile:!0,tilingPaddingVertical:30,tilingPaddingHorizontal:30,uniformNodeDimensions:!1,packComponents:!1}).run(),e.fit()),e.on("tap","node",e=>{let t=e.target.data("originalNode");O.current&&t&&O.current(t)}),e.on("mouseover","node",e=>{let t=e.target.data("originalNode");y(t),A.current&&t&&A.current(t),h&&(h.style.cursor="pointer")}),e.on("mouseout","node",()=>{y(null),A.current&&A.current(null),h&&(h.style.cursor="default")}),e.on("mouseover","edge",e=>{let t=e.target;if(!L.current||!t.hasClass("connection"))return;let n=t.data("originalLink");if(n){w(n);let e=t.renderedMidpoint();j({x:e.x,y:e.y})}}),e.on("mouseout","edge",e=>{let t=e.target;L.current&&t.hasClass("connection")&&(w(null),j(null))}),e.on("select","edge",e=>{e.target.unselect()}),e.on("dblclick","node",t=>{let n=t.target,r=n.id();console.log("Double-clicked node:",r),T(!0),e.elements().removeClass("dimmed focused connected connection");let i=n.neighborhood(),a=i.nodes(),o=i.edges();e.elements().addClass("dimmed"),n.removeClass("dimmed").addClass("focused"),a.removeClass("dimmed").addClass("connected"),o.removeClass("dimmed").addClass("connection");let s=n.union(i);e.animate({fit:{eles:s,padding:100},center:{eles:n}},{duration:800,easing:"ease-out-cubic"})}),e.on("tap",t=>{t.target===e&&(console.log("Clicked background - resetting focus"),T(!1),e.elements().removeClass("dimmed focused connected connection"),e.animate({fit:{eles:e.elements(),padding:50}},{duration:600,easing:"ease-out"}))}),S(!1),g.current=!1,v.current=F}catch(e){console.error("Error initializing cytoscape:",e),S(!1),g.current=!1}},100);return()=>{e=!0,clearTimeout(t),g.current=!1,p.current&&(p.current.destroy(),p.current=null)}},[F,C,h]),(0,eh.useEffect)(()=>{let e=()=>{p.current&&(p.current.resize(),p.current.fit(void 0,80))};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,ed.jsxs)("div",{className:"relative w-full rounded-lg overflow-hidden border border-border",style:{height:t},children:[k&&(0,ed.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background z-10",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),(0,ed.jsx)("p",{className:"text-sm text-muted-foreground",children:d("loading")})]})}),C&&(0,ed.jsx)("div",{ref:f,className:"w-full h-full",style:{backgroundImage:M?"radial-gradient(circle at 1px 1px, rgba(255,255,255,0.08) 1px, transparent 0)":"radial-gradient(circle at 1px 1px, rgba(0,0,0,0.06) 1px, transparent 0)",backgroundSize:"20px 20px",backgroundColor:M?"#0f1419":"#f8fafc"}}),!k&&0===R.nodes.length&&(0,ed.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,ed.jsx)("div",{className:"text-center",children:(0,ed.jsx)("p",{className:"text-muted-foreground",children:d("emptyState")})})}),b&&N&&(0,ed.jsx)("div",{className:"absolute z-30 pointer-events-none",style:{left:N.x,top:N.y,transform:"translate(-50%, -100%) translateY(-8px)"},children:(0,ed.jsxs)("div",{className:`px-3 py-2 rounded-lg shadow-lg text-sm ${M?"bg-gray-800 text-white":"bg-white text-gray-900 border border-gray-200"}`,children:[(0,ed.jsx)("div",{className:"font-medium capitalize mb-1",children:["causes","caused_by","enables","prevents"].includes(u=b.type||"semantic")?d("linkTypeCausal",{type:u.replace("_"," ")}):d("linkTypeGeneric",{type:u})}),b.entity&&(0,ed.jsxs)("div",{className:"text-xs opacity-80",children:[d("linkTooltipEntity")," ",(0,ed.jsx)("span",{className:"font-medium",children:b.entity})]}),void 0!==b.weight&&(0,ed.jsxs)("div",{className:"text-xs opacity-80",children:[d("linkTooltipWeight")," ",(0,ed.jsx)("span",{className:"font-medium",children:b.weight.toFixed(3)})]})]})}),(0,ed.jsx)("div",{className:"absolute bottom-4 right-4 text-xs text-muted-foreground/60 z-20",children:d("controlsHint")})]})}function hY(e){return{nodes:(e.nodes||[]).map(t=>{let n=e.table_rows?.find(e=>e.id===t.data.id),r=t.data.label;return!r&&n?.text&&(r=n.text.length>40?n.text.substring(0,40)+"...":n.text),r||(r=t.data.id.substring(0,8)),{id:t.data.id,label:r,color:t.data.color,metadata:n}}),links:(e.edges||[]).map(e=>({source:e.data.source,target:e.data.target,color:e.data.color,type:e.data.linkType||("dashed"===e.data.lineStyle?"temporal":"semantic"),entity:e.data.entityName,weight:e.data.weight??e.data.similarity}))}}hH.use(hU.default);let hG=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],hX=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]],h$=/[ \t\n\r\f]+/g,hq=/[\t\n\r\f]| {2,}|^ | $/,hK=null,hZ=/\p{Script=Arabic}/u,hQ=/\p{M}/u,hJ=/\p{Nd}/u;function h0(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function h1(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){let r=e.charCodeAt(t+1);if(r>=56320&&r<=57343){if(h0((n-55296<<10)+(r-56320)+65536))return!0;t++;continue}}if(h0(n))return!0}}return!1}let h2=new Set([" "," ","","\uFEFF"]),h5=new Set(["-","‐","–","—"]);function h3(e,t){let n,r,i;return!(null!==(n=fi(e))&&h2.has(n))&&(!t||!(null!==(r=fi(e))&&(h4.has(r)||h9.has(r)))&&!(null!==(i=fi(e))&&h5.has(i)))}let h4=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),h6=new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),h7=new Set(["'","’"]),h9=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),h8=new Set([":",".","،","؛"]),fe=new Set(["၏"]),ft=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function fn(e){let t=!1;for(let n of e)if(!("\\"===n||hQ.test(n))){if(h6.has(n)||h9.has(n)||h7.has(n)){t=!0;continue}return!1}return t}function fr(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let a=e.charCodeAt(i);return a>=55296&&a<=56319?i:n}function fi(e){if(0===e.length)return null;let t=fr(e,e.length);return e.slice(t)}let fa=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function fo(e){let t=e.codePointAt(0);return void 0!==t&&function(e,t){for(let n=0;n<t.length;n+=2)if(e>=t[n]&&e<=t[n+1])return!0;return!1}(t,fa)}function fs(e,t,n,r){let i=t[r],a=e[r];if(null==i)return a;let o=n[r];if(a.length===o)return a;let s=i.repeat(o);return e[r]=s,s}function fl(e,t){return e&&null!==t&&h8.has(t)}function fc(e){let t=e.length;for(;t>0;){let n=fr(e,t),r=e.slice(n,t);if(ft.has(r))return!0;if(!h9.has(r))break;t=n}return!1}let fu=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function fd(e){return 1===e.length?e[0]:e.join("")}function fh(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}let ff=/^[A-Za-z][A-Za-z0-9+.-]*:$/,fp=new Set([":","-","/","×",",",".","+","–","—"]),fm=new Set([".",",",":",";"]);function fg(e){for(let t=e.length;t>0;){let n=fr(e,t),r=e.slice(n,t);if(hQ.test(r)){t=n;continue}return fm.has(r)||fo(r)}return!1}function fv(e){for(let t of e)if(hJ.test(t))return!0;return!1}function fx(e){if(0===e.length)return!1;for(let t of e)if(!(hJ.test(t)||fp.has(t)))return!1;return!0}let fy=null,fb=new Map,fw=null,fN=/\p{Emoji_Presentation}/u,fj=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u,fk=null,fS=new Map;function fC(){if(null!==fy)return fy;if("u">typeof OffscreenCanvas)return fy=new OffscreenCanvas(1,1).getContext("2d");if("u">typeof document)return fy=document.createElement("canvas").getContext("2d");throw Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function f_(e,t){let n=t.get(e);return void 0===n&&(n={width:fC().measureText(e).width,containsCJK:h1(e)},t.set(e,n)),n}function fE(){if(null!==fw)return fw;if("u"<typeof navigator)return fw={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1};let e=navigator.userAgent,t="Apple Computer, Inc."===navigator.vendor&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/");return fw={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/"),breakKeepAllAfterPunctuation:!t,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t}}function fT(){return null===fk&&(fk=new Intl.Segmenter(void 0,{granularity:"grapheme"})),fk}function fM(e,t,n){return 0===n?t.width:t.width-(void 0===t.emojiCount&&(t.emojiCount=function(e){let t=0;for(let r of fT().segment(e)){var n;n=r.segment,(fN.test(n)||n.includes("️"))&&t++}return t}(e)),t.emojiCount*n)}function fO(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function fA(e,t,n=e.widths.length){for(;t<n;){var r;if("space"!==(r=e.kinds[t])&&"zero-width-break"!==r&&"soft-hyphen"!==r)break;t++}return t}function fD(e,t){return 0===t?0:e+t}function fP(e,t,n,r){return fD(r,"tab"===t?0:e.lineEndFitAdvances[n])}function fI(e,t,n,r,i){return fD(r,"tab"===t?i:e.lineEndPaintAdvances[n])}let fL=null,fR=new WeakMap;function fB(e,t,n){let r=n.get(e);if(void 0!==r)return r;for(let n of(r=[],(null===fL&&(fL=new Intl.Segmenter(void 0,{granularity:"grapheme"})),fL).segment(t[e])))r.push(n.segment);return n.set(e,r),r}function fF(e,t,n,r){for(let i=n;i<r;i++)e+=t[i];return e}let fz=null;function fV(){return null===fz&&(fz=new Intl.Segmenter(void 0,{granularity:"grapheme"})),fz}function fH(e,t){if("zero-width-break"===t||"soft-hyphen"===t||"hard-break"===t)return 0;if("tab"===t)return 1;let n=0;for(let t of fV().segment(e))n++;return n}function fU(e,n,r,i){let a=i?.wordBreak??"normal",o=i?.letterSpacing??0;return function(e,t,n,r,i){var a;let o=fE(),{cache:s,emojiCorrection:l}=function(e,t){let n,r;fC().font=e;let i=((n=fb.get(e))||(n=new Map,fb.set(e,n)),n),a=(r=e.match(/(\d+(?:\.\d+)?)\s*px/))?parseFloat(r[1]):16,o=t?function(e,t){let n=fS.get(e);if(void 0!==n)return n;let r=fC();r.font=e;let i=r.measureText("😀").width;if(n=0,i>t+.5&&"u">typeof document&&null!==document.body){let t=document.createElement("span");t.style.font=e,t.style.display="inline-block",t.style.visibility="hidden",t.style.position="absolute",t.textContent="😀",document.body.appendChild(t);let r=t.getBoundingClientRect().width;document.body.removeChild(t),i-r>.5&&(n=i-r)}return fS.set(e,n),n}(e,a):0;return{cache:i,fontSize:a,emojiCorrection:o}}(t,(a=e.normalized,fj.test(a))),c=fM("-",f_("-",s),l)+(0===i?0:2*i),u=8*fM(" ",f_(" ",s),l),d=0!==i;if(0===e.len)return n?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};let h=[],f=[],p=[],g=[],v=e.chunks.length<=1&&!d,x=n?[]:null,y=[],b=[],w=n?[]:null,N=Array.from({length:e.len});function j(e,t,n,r,i,a,o,s){"text"!==i&&"space"!==i&&"zero-width-break"!==i&&(v=!1),h.push(t),f.push(n),p.push(r),g.push(i),x?.push(a),y.push(o),d&&b.push(s),null!==w&&w.push(e)}function k(e,t,n,r,a){var c;let u=f_(e,s),h=d?fH(e,t):0,f=(c=fM(e,u,l),h>1?c+(h-1)*i:c),p="space"===t||"preserved-space"===t||"zero-width-break"===t?0:f,g=0===p?0:p+(h>0?i:0),v="space"===t||"zero-width-break"===t?0:f;if(a&&r&&e.length>1){let r="sum-graphemes";0!==i?r="segment-prefixes":fx(e)?r="pair-context":o.preferPrefixWidthsForBreakableRuns&&(r="segment-prefixes");let a=function(e,t,n,r,i){if(void 0!==t.breakableFitAdvances&&t.breakableFitMode===i)return t.breakableFitAdvances;t.breakableFitMode=i;let a=fT(),o=[];for(let t of a.segment(e))o.push(t.segment);if(o.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if("sum-graphemes"===i){let e=[];for(let t of o){let i=f_(t,n);e.push(fM(t,i,r))}return t.breakableFitAdvances=e,t.breakableFitAdvances}if("pair-context"===i||o.length>96){let e=[],i=null,a=0;for(let t of o){let o=f_(t,n),s=fM(t,o,r);if(null===i)e.push(s);else{let o=i+t,s=f_(o,n);e.push(fM(o,s,r)-a)}i=t,a=s}return t.breakableFitAdvances=e,t.breakableFitAdvances}let s=[],l="",c=0;for(let e of o){let t=f_(l+=e,n),i=fM(l,t,r);s.push(i-c),c=i}return t.breakableFitAdvances=s,t.breakableFitAdvances}(e,u,s,l,r);j(e,f,g,v,t,n,a,h);return}j(e,f,g,v,t,n,null,h)}for(let t=0;t<e.len;t++){N[t]=h.length;let n=e.texts[t],i=e.isWordLike[t],a=e.kinds[t],l=e.starts[t];if("soft-hyphen"===a){j(n,0,c,c,a,l,null,0);continue}if("hard-break"===a){j(n,0,0,0,a,l,null,0);continue}if("tab"===a){j(n,0,0,0,a,l,null,d?fH(n,a):0);continue}let u=f_(n,s);if("text"===a&&u.containsCJK){let e=function(e,t){let n=[],r=[],i=0,a=!1,o=!1,s=!1;function l(){0!==r.length&&(n.push({text:1===r.length?r[0]:r.join(""),start:i}),r=[],a=!1,o=!1,s=!1)}function c(e,t,n){r=[e],i=t,a=n,o=fc(e),s=h6.has(e)}for(let n of fV().segment(e)){let e=n.segment,i=h1(e);if(0===r.length){c(e,n.index,i);continue}if(s||h4.has(e)||h9.has(e)||t.carryCJKAfterClosingQuote&&i&&o||!a&&!i){!function(e,t){r.push(e),a=a||t;let n=fc(e);o=1===e.length&&h9.has(e)&&o||n,s=!1}(e,i);continue}l(),c(e,n.index,i)}return l(),n}(n,o),t="keep-all"===r?function(e,t,n){if(t.length<=1)return t;let r=[],i=-1,a=!1;function o(n){if(!(i<0)){if(a)if(i+1===n)r.push(t[i]);else{let a,o;a=t[i].start,o=n<t.length?t[n].start:e.length,r.push({text:e.slice(a,o),start:a})}else for(let e=i;e<n;e++)r.push(t[e]);i=-1,a=!1}}for(let e=0;e<t.length;e++){let r=t[e];i>=0&&!h3(t[e-1].text,n)&&o(e),i<0&&(i=e),a=a||h1(r.text)}return o(t.length),r}(n,e,o.breakKeepAllAfterPunctuation):e;for(let e=0;e<t.length;e++){let n=t[e];k(n.text,"text",l+n.start,i,"keep-all"===r||!h1(n.text))}continue}k(n,a,l,i,!0)}let S=function(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a.startSegmentIndex<t.length?t[a.startSegmentIndex]:n,s=a.endSegmentIndex<t.length?t[a.endSegmentIndex]:n,l=a.consumedEndSegmentIndex<t.length?t[a.consumedEndSegmentIndex]:n;r.push({startSegmentIndex:o,endSegmentIndex:s,consumedEndSegmentIndex:l})}return r}(e.chunks,N,h.length),C=null===x?null:function(e,t){let n=function(e){let t=e.length;if(0===t)return null;let n=Array(t),r=!1;for(let i=0;i<t;){let a=e.charCodeAt(i),o=a,s=1;if(a>=55296&&a<=56319&&i+1<t){let t=e.charCodeAt(i+1);t>=56320&&t<=57343&&(o=(a-55296<<10)+(t-56320)+65536,s=2)}let l=function(e){if(e<=255)return hG[e];let t=0,n=hX.length-1;for(;t<=n;){let r=t+n>>1,i=hX[r];if(e<i[0]){n=r-1;continue}if(e>i[1]){t=r+1;continue}return i[2]}return"L"}(o);("R"===l||"AL"===l||"AN"===l)&&(r=!0);for(let e=0;e<s;e++)n[i+e]=l;i+=s}if(!r)return null;let i=0;for(let e=0;e<t;e++){let t=n[e];if("L"===t){i=0;break}if("R"===t||"AL"===t){i=1;break}}let a=new Int8Array(t);for(let e=0;e<t;e++)a[e]=i;let o=1&i?"R":"L",s=o;for(let e=0;e<t;e++)"NSM"===n[e]?n[e]=s:s=n[e];s=o;for(let e=0;e<t;e++){let t=n[e];"EN"===t?n[e]="AL"===s?"AN":"EN":("R"===t||"L"===t||"AL"===t)&&(s=t)}for(let e=0;e<t;e++)"AL"===n[e]&&(n[e]="R");for(let e=1;e<t-1;e++)"ES"===n[e]&&"EN"===n[e-1]&&"EN"===n[e+1]&&(n[e]="EN"),"CS"===n[e]&&("EN"===n[e-1]||"AN"===n[e-1])&&n[e+1]===n[e-1]&&(n[e]=n[e-1]);for(let e=0;e<t;e++){let r;if("EN"===n[e]){for(r=e-1;r>=0&&"ET"===n[r];r--)n[r]="EN";for(r=e+1;r<t&&"ET"===n[r];r++)n[r]="EN"}}for(let e=0;e<t;e++){let t=n[e];("WS"===t||"ES"===t||"ET"===t||"CS"===t)&&(n[e]="ON")}s=o;for(let e=0;e<t;e++){let t=n[e];"EN"===t?n[e]="L"===s?"L":"EN":("R"===t||"L"===t)&&(s=t)}for(let e=0;e<t;e++){if("ON"!==n[e])continue;let r=e+1;for(;r<t&&"ON"===n[r];)r++;let i=e>0?n[e-1]:o,a=r<t?n[r]:o,s="L"!==i?"R":"L";if(s===("L"!==a?"R":"L"))for(let t=e;t<r;t++)n[t]=s;e=r-1}for(let e=0;e<t;e++)"ON"===n[e]&&(n[e]=o);for(let e=0;e<t;e++){let t=n[e];(1&a[e])==0?"R"===t?a[e]++:("AN"===t||"EN"===t)&&(a[e]+=2):("L"===t||"AN"===t||"EN"===t)&&a[e]++}return a}(e);if(null===n)return null;let r=new Int8Array(t.length);for(let e=0;e<t.length;e++)r[e]=n[t[e]];return r}(e.normalized,x);return null!==w?{widths:h,lineEndFitAdvances:f,lineEndPaintAdvances:p,kinds:g,simpleLineWalkFastPath:v,segLevels:C,breakableFitAdvances:y,letterSpacing:i,spacingGraphemeCounts:b,discretionaryHyphenWidth:c,tabStopAdvance:u,chunks:S,segments:w}:{widths:h,lineEndFitAdvances:f,lineEndPaintAdvances:p,kinds:g,simpleLineWalkFastPath:v,segLevels:C,breakableFitAdvances:y,letterSpacing:i,spacingGraphemeCounts:b,discretionaryHyphenWidth:c,tabStopAdvance:u,chunks:S}}(function(e,n,r="normal",i="normal"){let a,o="pre-wrap"===(a=r??"normal")?{mode:a,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:a,preserveOrdinarySpaces:!1,preserveHardBreaks:!1},s="pre-wrap"===o.mode?/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e:function(e){if(!hq.test(e))return e;let t=e.replace(h$," ");return 32===t.charCodeAt(0)&&(t=t.slice(1)),t.length>0&&32===t.charCodeAt(t.length-1)&&(t=t.slice(0,-1)),t}(e);if(0===s.length)return{normalized:s,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let l=function(e,n,r){var i,a,o,s;let l=(null===hK&&(hK=new Intl.Segmenter(t,{granularity:"word"})),hK),c=0,u=[],d=[],h=[],f=[],p=[],g=[],v=[],x=[],y=[],b=[],w=[],N=[];for(let t of l.segment(e))for(let e of function(e,t,n,r){if(!fu.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];let i=[],a=null,o=[],s=n,l=!1,c=0;for(let u of e){let e=function(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(" "===e)return"preserved-space";if(" "===e)return"tab";if(t.preserveHardBreaks&&"\n"===e)return"hard-break"}return" "===e?"space":" "===e||" "===e||""===e||"\uFEFF"===e?"glue":""===e?"zero-width-break":""===e?"soft-hyphen":"text"}(u,r),d="text"===e&&t;if(null!==a&&e===a&&d===l){o.push(u),c+=u.length;continue}null!==a&&i.push({text:fd(o),isWordLike:l,kind:a,start:s}),a=e,o=[u],s=n+c,l=d,c+=u.length}return null!==a&&i.push({text:fd(o),isWordLike:l,kind:a,start:s}),i}(t.segment,t.isWordLike??!1,t.index,r)){let t="text"===e.kind,r=(i=e.text,a=e.isWordLike,"text"!==e.kind||a||1!==i.length||"-"===i||"—"===i?null:i),s=h1(e.text),l=(o=e.text,hZ.test(o)),k=fi(e.text),S=fc(e.text),C=function(e){let t=fi(e);return null!==t&&fe.has(t)}(e.text),_=c-1;function j(){null!==g[_]&&(d[_]=[fs(u,g,v,_)],g[_]=null),d[_].push(e.text),h[_]=h[_]||e.isWordLike,x[_]=x[_]||s,y[_]=y[_]||l,b[_]=S,w[_]=C,N[_]=fl(y[_],k)}n.carryCJKAfterClosingQuote&&t&&c>0&&"text"===f[_]&&s&&x[_]&&b[_]||t&&c>0&&"text"===f[_]&&function(e){for(let t of e)if(!h4.has(t)&&!h9.has(t))return!1;return e.length>0}(e.text)&&x[_]||t&&c>0&&"text"===f[_]&&w[_]?j():t&&c>0&&"text"===f[_]&&e.isWordLike&&l&&N[_]?(j(),h[_]=!0):null!==r&&c>0&&"text"===f[_]&&g[_]===r?v[_]=(v[_]??1)+1:t&&!e.isWordLike&&c>0&&"text"===f[_]&&!x[_]&&(function(e){if(fn(e))return!0;let t=!1;for(let n of e){if(h9.has(n)||fo(n)){t=!0;continue}if(!(t&&hQ.test(n)))return!1}return t}(e.text)||"-"===e.text&&h[_])?j():(u[c]=e.text,d[c]=[e.text],h[c]=e.isWordLike,f[c]=e.kind,p[c]=e.start,g[c]=r,v[c]=+(null!==r),x[c]=s,y[c]=l,b[c]=S,w[c]=C,N[c]=fl(l,k),c++)}for(let e=0;e<c;e++){if(null!==g[e]){u[e]=fs(u,g,v,e);continue}u[e]=fd(d[e])}for(let e=1;e<c;e++)"text"===f[e]&&!h[e]&&fn(u[e])&&"text"===f[e-1]&&!x[e-1]&&(u[e-1]+=u[e],h[e-1]=h[e-1]||h[e],u[e]="");let k=Array.from({length:c},()=>null),S=-1;for(let e=c-1;e>=0;e--){let t=u[e];if(0!==t.length){if("text"===f[e]&&!h[e]&&S>=0&&"text"===f[S]&&(function(e){if(fn(e))return!0;for(let t of e)if(!h6.has(t)&&!h7.has(t)&&!hQ.test(t)&&!fo(t))return!1;return e.length>0}(t)||"-"===t&&function(e){let t=function(e){for(let t of e)if(!hQ.test(t))return t;return null}(e);return null!==t&&hJ.test(t)}(u[S]))){let n=k[S]??[];n.push(t),k[S]=n,p[S]=p[e],u[e]="";continue}S=e}}for(let e=0;e<c;e++){let t=k[e];null!=t&&(u[e]=function(e,t){let n=[];for(let t=e.length-1;t>=0;t--)n.push(e[t]);return n.push(t),fd(n)}(t,u[e]))}let C=0;for(let e=0;e<c;e++){let t=u[e];0!==t.length&&(C!==e&&(u[C]=t,h[C]=h[e],f[C]=f[e],p[C]=p[e]),C++)}u.length=C,h.length=C,f.length=C,p.length=C;let _=function(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let e=0;e<t.length-1;e++){if("text"!==r[e]||"text"!==r[e+1]||!h1(t[e])||!h1(t[e+1]))continue;let n=function(e){let t=Array.from(e),n=t.length;for(;n>0;){let e=t[n-1];if(hQ.test(e)||h6.has(e)||h7.has(e)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}(t[e]);null!==n&&(t[e]=n.head,t[e+1]=n.tail+t[e+1],i[e+1]=i[e]+n.head.length)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let s=e.texts[o],l=e.kinds[o],c=e.isWordLike[o];if("text"===l&&fg(s)&&(c||function(e){let t=function(e){for(let t=e.length;t>0;){let n=fr(e,t),r=e.slice(n,t);if(!hQ.test(r))return r;t=n}return null}(e);return null!==t&&fo(t)}(s))&&!h1(s)){var a;let l=[s],c=!0,u=o+1;for(;c&&u<e.len&&"text"===e.kinds[u]&&(a=e.texts[u],e.isWordLike[u]&&!h1(a));){let t=e.texts[u];l.push(t),c=fg(t),u++}t.push(fd(l)),n.push(!0),r.push("text"),i.push(e.starts[o]),o=u-1;continue}t.push(s),n.push(c),r.push(l),i.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[];for(let a=0;a<e.len;a++){let o=e.texts[a];if("text"===e.kinds[a]&&o.includes("-")){let s=o.split("-"),l=s.length>1;for(let e=0;e<s.length;e++){let t=s[e];if(!l)break;0!==t.length&&fv(t)&&fx(t)||(l=!1)}if(l){let o=0;for(let l=0;l<s.length;l++){let c=s[l],u=l<s.length-1?`${c}-`:c;t.push(u),n.push(!0),r.push("text"),i.push(e.starts[a]+o),o+=u.length}continue}}t.push(o),n.push(e.isWordLike[a]),r.push(e.kinds[a]),i.push(e.starts[a])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[];for(let a=0;a<e.len;a++){let o=e.texts[a],s=e.kinds[a];if("text"===s&&fx(o)&&fv(o)){let s=[o],l=a+1;for(;l<e.len&&"text"===e.kinds[l]&&fx(e.texts[l]);)s.push(e.texts[l]),l++;t.push(fd(s)),n.push(!0),r.push("text"),i.push(e.starts[a]),a=l-1;continue}t.push(o),n.push(e.isWordLike[a]),r.push(s),i.push(e.starts[a])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[];for(let a=0;a<e.len;a++){let o=e.texts[a];if(t.push(o),n.push(e.isWordLike[a]),r.push(e.kinds[a]),i.push(e.starts[a]),!(o.includes("?")&&(o.includes("://")||o.startsWith("www."))))continue;let s=a+1;if(s>=e.len||fh(e.kinds[s]))continue;let l=[],c=e.starts[s],u=s;for(;u<e.len&&!fh(e.kinds[u]);)l.push(e.texts[u]),u++;l.length>0&&(t.push(fd(l)),n.push(!0),r.push("text"),i.push(c),a=u-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let i=0;i<e.len;i++){if("text"!==r[i]||!function(e,t){let n=e.texts[t];return!!n.startsWith("www.")||ff.test(n)&&t+1<e.len&&"text"===e.kinds[t+1]&&"//"===e.texts[t+1]}(e,i))continue;let a=[t[i]],o=i+1;for(;o<e.len&&!fh(r[o]);){a.push(t[o]),n[i]=!0;let e=t[o].includes("?");if(r[o]="text",t[o]="",o++,e)break}t[i]=fd(a)}let a=0;for(let e=0;e<t.length;e++){let o=t[e];0!==o.length&&(a!==e&&(t[a]=o,n[a]=n[e],r[a]=r[e],i[a]=i[e]),a++)}return t.length=a,n.length=a,r.length=a,i.length=a,{len:a,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[],a=0;for(;a<e.len;){let o=[e.texts[a]],s=e.isWordLike[a],l=e.kinds[a],c=e.starts[a];if("glue"===l){let u=[o[0]],d=c;for(a++;a<e.len&&"glue"===e.kinds[a];)u.push(e.texts[a]),a++;let h=fd(u);if(a<e.len&&"text"===e.kinds[a])o[0]=h,o.push(e.texts[a]),s=e.isWordLike[a],l="text",c=d,a++;else{t.push(h),n.push(!1),r.push("glue"),i.push(d);continue}}else a++;if("text"===l)for(;a<e.len&&"glue"===e.kinds[a];){let t=[];for(;a<e.len&&"glue"===e.kinds[a];)t.push(e.texts[a]),a++;let n=fd(t);if(a<e.len&&"text"===e.kinds[a]){o.push(n,e.texts[a]),s=s||e.isWordLike[a],a++;continue}o.push(n)}t.push(fd(o)),n.push(s),r.push(l),i.push(c)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}({len:C,texts:u,isWordLike:h,kinds:f,starts:p})))))));for(let e=0;e<_.len-1;e++){let t=function(e){if(e.length<2||" "!==e[0])return null;let t=e.slice(1);return/^\p{M}+$/u.test(t)?{space:" ",marks:t}:null}(_.texts[e]);null!==t&&("space"===_.kinds[e]||"preserved-space"===_.kinds[e])&&"text"===_.kinds[e+1]&&(s=_.texts[e+1],hZ.test(s))&&(_.texts[e]=t.space,_.isWordLike[e]=!1,_.kinds[e]="preserved-space"===_.kinds[e]?"preserved-space":"space",_.texts[e+1]=t.marks+_.texts[e+1],_.starts[e+1]=_.starts[e]+t.space.length)}return _}(s,n,o),c="keep-all"===i?function(e,t,n){if(t.len<=1)return t;let r=[],i=[],a=[],o=[],s=-1,l=!1;function c(e){r.push(t.texts[e]),i.push(t.isWordLike[e]),a.push("text"),o.push(t.starts[e])}function u(n){if(!(s<0)){if(l)if(s+1===n)c(s);else{var u=s;let l=!1;for(let e=u;e<n;e++)l=l||t.isWordLike[e];let c=t.starts[u],d=n<t.len?t.starts[n]:e.length;r.push(e.slice(c,d)),i.push(l),a.push("text"),o.push(c)}else for(let e=s;e<n;e++)c(e);s=-1,l=!1}}for(let e=0;e<t.len;e++){let c=t.texts[e],d=t.kinds[e];if("text"===d){s>=0&&!h3(t.texts[e-1],n)&&u(e),s<0&&(s=e),l=l||h1(c);continue}u(e),r.push(c),i.push(t.isWordLike[e]),a.push(d),o.push(t.starts[e])}return u(t.len),{len:r.length,texts:r,isWordLike:i,kinds:a,starts:o}}(s,l,n.breakKeepAllAfterPunctuation):l;return{normalized:s,chunks:function(e,t){if(0===e.len)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];let n=[],r=0;for(let t=0;t<e.len;t++)"hard-break"===e.kinds[t]&&(n.push({startSegmentIndex:r,endSegmentIndex:t,consumedEndSegmentIndex:t+1}),r=t+1);return r<e.len&&n.push({startSegmentIndex:r,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}(c,o),...c}}(e,fE(),i?.whiteSpace,a),n,r,a,o)}function fW(e){let t=[[56,130,220],[170,130,200],[240,100,60]],n=Math.max(0,Math.min(1,e))*(t.length-1),r=Math.min(Math.floor(n),t.length-2),i=n-r,a=t[r],o=t[r+1],s=Math.round(a[0]+(o[0]-a[0])*i),l=Math.round(a[1]+(o[1]-a[1])*i),c=Math.round(a[2]+(o[2]-a[2])*i);return`rgb(${s},${l},${c})`}let fY='11px Inter, -apple-system, "Segoe UI", sans-serif',fG='600 10px Inter, -apple-system, "Segoe UI", sans-serif',fX='11px "SF Mono", "Fira Code", Consolas, monospace',f$={semantic:"#0074d9",temporal:"#009296",entity:"#f59e0b",causal:"#8b5cf6"},fq="#0074d9";function fK({data:e,height:t=700,onNodeClick:n,nodeColorFn:r,linkColorFn:i,nodeSizeFn:a,nodeHeatFn:o,heatLegendLabel:s,heatLegendEndpoints:l,compactLabels:c,sizeLegendLabel:u}){let d=(0,ep.useTranslations)("constellation"),h=(0,eh.useRef)(null),f=(0,eh.useRef)(null),p=(0,eh.useRef)(null),g=function(){let[e,t]=(0,eh.useState)(!1);return(0,eh.useEffect)(()=>{let e=()=>t(document.documentElement.classList.contains("dark"));e();let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>n.disconnect()},[]),e}(),v=(0,eh.useRef)(0),[x,y]=(0,eh.useState)(!1),b=(0,eh.useRef)({panX:0,panY:0,zoom:.5,targetPanX:0,targetPanY:0,targetZoom:.5,mouseX:-1,mouseY:-1,isDragging:!1,dragStartX:0,dragStartY:0,panStartX:0,panStartY:0,hoverIndex:-1,prevHoverIndex:-2,W:0,H:0,dpr:1}),{preparedNodes:w,linksByNode:N,linksWithIndices:j}=(0,eh.useMemo)(()=>{if(!e.nodes.length)return{preparedNodes:[],linksByNode:new Map,linksWithIndices:[]};let t=new Map;e.nodes.forEach((e,n)=>t.set(e.id,n));let n=new Map;for(let t of e.links)n.set(t.source,(n.get(t.source)||0)+1),n.set(t.target,(n.get(t.target)||0)+1);let a=1;for(let e of n.values())e>a&&(a=e);let s=e.nodes.map((t,i)=>{let s=t.label||t.id.substring(0,12),l=r?.(t)||t.color||fq,c=n.get(t.id)||0,u=o?fW(Math.max(0,Math.min(1,o(t)))):fW(Math.sqrt(c/a)),d=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}(t.id),h=e.nodes.length,f=i/h*Math.PI*2+d%100/100*.5,p=30*Math.sqrt(h),g=.3*p+Math.abs(d)%1e3/1e3*p*.7;return{node:t,wx:Math.cos(f)*g+(d%200-100)*.5,wy:Math.sin(f)*g+((d>>8)%200-100)*.5,prepared:fU(s,fY,!0,void 0),preparedHeight:fU(s,fY,!1,void 0),color:l,heatColor:u,linkCount:c}}),l=[],c=new Map;for(let n=0;n<e.links.length;n++){let r=e.links[n],a=t.get(r.source),o=t.get(r.target);if(void 0===a||void 0===o)continue;let s=i?.(r)||r.color||f$[r.type||"semantic"]||fq,u=l.length;l.push({a:a,b:o,color:s,type:r.type||"semantic"}),c.has(a)||c.set(a,[]),c.has(o)||c.set(o,[]),c.get(a).push(u),c.get(o).push(u)}return{preparedNodes:s,linksByNode:c,linksWithIndices:l}},[e,r,i,o]),k=(0,eh.useCallback)(()=>{var e,t,n;let r=f.current;if(!r)return;let i=r.getContext("2d");if(!i)return;let o=b.current;e=o.panX,o.panX=e+(o.targetPanX-e)*.12,t=o.panY,o.panY=t+(o.targetPanY-t)*.12,n=o.zoom,o.zoom=n+(o.targetZoom-n)*.12;let{W:h,H:p,dpr:x,zoom:y,panX:C,panY:_,mouseX:E,mouseY:T,hoverIndex:M}=o,O=h/2+C,A=p/2+_;i.clearRect(0,0,r.width,r.height),i.save(),i.scale(x,x),i.fillStyle=g?"#09090b":"#ffffff",i.fillRect(0,0,h,p);let D=new Float32Array(w.length),P=new Float32Array(w.length),I=new Uint8Array(w.length);for(let e=0;e<w.length;e++){let t=w[e],n=O+t.wx*y,r=A+t.wy*y;D[e]=n,P[e]=r,I[e]=+(n>-60&&n<h+60&&r>-60&&r<p+60)}if(E>=0&&!o.isDragging){let e=y>1.5?80:30,t=-1;for(let n=0;n<w.length;n++){if(!I[n])continue;let r=E-D[n],i=T-P[n],a=Math.sqrt(r*r+i*i);a<e&&(e=a,t=n)}o.hoverIndex=t}let L=new Set;if(M>=0)for(let e of N.get(M)||[])L.add(e);let R=0;if(M>=0){for(let e of L){let t=j[e],n=D[t.a],r=P[t.a],a=D[t.b],o=P[t.b];i.strokeStyle=t.color,i.globalAlpha=.5,i.lineWidth=1.5;let s=(n+a)/2+(o-r)*.08,l=(r+o)/2-(a-n)*.08;i.beginPath(),i.moveTo(n,r),i.quadraticCurveTo(s,l,a,o),i.stroke(),R++}i.globalAlpha=1}else{let e=.06+Math.min(.04*y,.1);for(let t of(i.lineWidth=.4,j)){if(R>=6e3)break;let n=D[t.a],r=P[t.a],a=D[t.b],o=P[t.b];if(n<-60&&a<-60||n>h+60&&a>h+60||r<-60&&o<-60||r>p+60&&o>p+60)continue;i.strokeStyle=t.color,i.globalAlpha=e;let s=(n+a)/2+(o-r)*.08,l=(r+o)/2-(a-n)*.08;i.beginPath(),i.moveTo(n,r),i.quadraticCurveTo(s,l,a,o),i.stroke(),R++}i.globalAlpha=1}let B=c?28:90,F=new Set;function z(e,t,n,r){let i=Math.floor(e/B),a=Math.floor((e+n)/B),o=Math.floor(t/B),s=Math.floor((t+r)/B);for(let e=i;e<=a;e++)for(let t=o;t<=s;t++)if(F.has(`${e},${t}`))return!1;return!0}function V(e,t,n,r){let i=Math.floor(e/B),a=Math.floor((e+n)/B),o=Math.floor(t/B),s=Math.floor((t+r)/B);for(let e=i;e<=a;e++)for(let t=o;t<=s;t++)F.add(`${e},${t}`)}let H=0,U=0,W=[];for(let e=0;e<w.length;e++)I[e]&&e!==M&&W.push(e);for(let e of(M>=0&&I[M]&&W.push(M),W)){let t=w[e],n=D[e],r=P[e];U++;let o=e===M,s=L.size>0&&(N.get(e)||[]).some(e=>L.has(e)),l=Math.max(1.5,(a?a(t.node):2.5+Math.min(.15*t.linkCount,2.5))*Math.min(y,2)),u=.45+Math.min(.03*t.linkCount,.5);if(i.beginPath(),i.arc(n,r,l,0,2*Math.PI),i.fillStyle=t.heatColor,i.globalAlpha=o?1:s?.95:M>=0?.08:u,(o||s)&&(i.shadowColor=t.heatColor,i.shadowBlur=o?20:10),i.fill(),t.linkCount>3&&!o&&M<0&&(i.beginPath(),i.arc(n,r,2*l,0,2*Math.PI),i.fillStyle=t.heatColor,i.globalAlpha=.06+Math.min(.005*t.linkCount,.08),i.fill()),i.shadowBlur=0,i.globalAlpha=1,o)S(i,t,e,n,r,l,!0,!0,g,y),H++;else if(y>1.5){let a=Math.min(200,80+25*y),o=n-a/2,c=r+l+4;z(o,c,a,50)&&(V(o,c,a,50),S(i,t,e,n,r,l,!1,s,g,y),H++)}else if(c||y>.5||s){let a=c?60:155,o=c?12:16,u=n+l+5,d=r-8;z(u,d,a,o)&&(V(u,d,a,o),S(i,t,e,n,r,l,!1,s,g,y),H++)}}i.font=fX,i.fillStyle="#71717a",i.textAlign="left",i.fillText(d("hudStats",{memories:w.length,visible:U,labels:H,links:R,zoom:y.toFixed(2)}),12,p-12),i.textAlign="right";let Y=h-12;i.font=fG;let G={semantic:d("linkTypeSemantic"),temporal:d("linkTypeTemporal"),entity:d("linkTypeEntity")};for(let[e,t]of Object.entries(f$).reverse()){let n=G[e]??e,r=i.measureText(n).width;i.fillStyle=g?"#a1a1aa":"#52525b",i.fillText(n,Y,p-12),Y-=r+4,i.fillStyle=t,i.beginPath(),i.arc(Y,p-15,3,0,2*Math.PI),i.fill(),Y-=14}i.textAlign="left",i.font=fG,i.fillStyle=g?"#a1a1aa":"#52525b",i.fillText((s||d("legendLinks")).toUpperCase(),12,36);let[X,$]=l||[d("legendFew"),d("legendMany")];i.font=fX;let q=Math.max(80,i.measureText(X).width+i.measureText($).width+12);for(let e=0;e<q;e++)i.fillStyle=fW(e/q),i.fillRect(12+e,42,1,6);if(i.fillStyle=g?"#a1a1aa":"#71717a",i.fillText(X,12,60),i.textAlign="right",i.fillText($,12+q,60),u){i.textAlign="left",i.font=fG,i.fillStyle=g?"#a1a1aa":"#52525b",i.fillText(u.toUpperCase(),12,82),i.font=fX;let e=g?"#a1a1aa":"#71717a";i.fillStyle=e,i.fillText("few",12,98);let t=12+i.measureText("few").width+8;i.fillStyle=g?"#a1a1aa":"#52525b",i.beginPath(),i.arc(t+2,94,2,0,2*Math.PI),i.fill(),i.beginPath(),i.arc(t+14,94,4,0,2*Math.PI),i.fill(),i.beginPath(),i.arc(t+30,94,6,0,2*Math.PI),i.fill(),i.fillStyle=e,i.fillText("many",t+42,98)}i.textAlign="left",i.font=fX,i.fillStyle=g?"#52525b":"#a1a1aa",i.fillText(d("instructions"),12,16),i.restore(),v.current=requestAnimationFrame(k)},[g,w,j,N]);function S(e,t,n,r,i,a,o,s,l,c){if(c>1.5||o){let n=Math.min(220,80+25*c),s=n-16,{lines:u}=function(e,t){let n,r=[];if(0===e.widths.length)return{lineCount:0,height:0,lines:r};let i=(void 0!==(n=fR.get(e))||(n=new Map,fR.set(e,n)),n),a=function(e,t,n){if(e.simpleLineWalkFastPath)return function(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:a}=e;if(0===r.length)return 0;let o=t+fE().lineFitEpsilon,s=0,l=0,c=!1,u=0,d=0,h=0,f=0,p=-1,g=0;function v(e=h,t=f,r=l){s++,n?.(r,u,d,e,t),l=0,c=!1,p=-1,g=0}function x(e,t){c=!0,u=e,d=0,h=e+1,f=0,l=t}function y(e,t,n){c=!0,u=e,d=t,h=e,f=t+1,l=n}function b(e,t){c?(l+=t,h=e+1,f=0):x(e,t)}function w(e,t){let n=a[e];for(let r=t;r<n.length;r++){let t=n[r];c?l+t>o?(v(),y(e,r,t)):(l+=t,h=e,f=r+1):y(e,r,t)}c&&h===e&&f===n.length&&(h=e+1,f=0)}let N=0;for(;N<r.length&&!(!c&&(N=fA(e,N))>=r.length);){let e=r[N],t=fO(i[N]);if(!c){e>o&&null!==a[N]?w(N,0):x(N,e),t&&(p=N+1,g=l-e),N++;continue}if(l+e>o){if(t){b(N,e),v(N+1,0,l-e),N++;continue}if(p>=0){if(h>p||h===p&&f>0){v();continue}v(p,0,g);continue}if(e>o&&null!==a[N]){v(),w(N,0),N++;continue}v();continue}b(N,e),t&&(p=N+1,g=l-e),N++}return c&&v(),s}(e,t,n);let{widths:r,kinds:i,breakableFitAdvances:a,discretionaryHyphenWidth:o,chunks:s}=e;if(0===r.length||0===s.length)return 0;let l=fE(),c=t+l.lineFitEpsilon,u=0,d=0,h=!1,f=0,p=0,g=0,v=0,x=-1,y=0,b=0,w=null;function N(){x=-1,y=0,b=0,w=null}function j(t=g,r=v,i){u++,void 0!==n&&n((i??("soft-hyphen"===w&&x===g&&0===v?b:d))+function(e,t,n,r,i){if(0===e.letterSpacing)return 0;if(i>0)return e.spacingGraphemeCounts[r]>0?e.letterSpacing:0;for(let i=r-1;i>=t;i--){let a=e.kinds[i];if("space"!==a&&"zero-width-break"!==a&&"hard-break"!==a){if("soft-hyphen"===a){if(i===r-1)return 0;continue}if(i===t&&n>0)return e.letterSpacing;return e.spacingGraphemeCounts[i]>0?e.letterSpacing:0}}return 0}(e,f,p,t,r),f,p,t,r),d=0,h=!1,N()}function k(e,t){h=!0,f=e,p=0,g=e+1,v=0,d=t}function S(e,t,n){h=!0,f=e,p=t,g=e,v=t+1,d=n}function C(e,t){h?(d+=t,g=e+1,v=0):k(e,t)}function _(t,n,r,i,a,o){if(!n)return;let s=fP(e,t,r,a),l=fI(e,t,r,a,i);x=r+1,y=d-o+s,b=d-o+l,w=t}function E(t,n){let r=a[t];for(let i=n;i<r.length;i++){let n=r[i];if(h){let r=0!==e.letterSpacing?n+e.letterSpacing:n,a=d+r;(0===e.letterSpacing?a:a+e.letterSpacing)>c?(j(),S(t,i,n)):(d=a,g=t,v=i+1)}else S(t,i,n)}h&&g===t&&v===r.length&&(g=t+1,v=0)}for(let t=0;t<s.length;t++){var T,M;let S=s[t];if(S.startSegmentIndex===S.endSegmentIndex){u++,n?.(0,S.startSegmentIndex,0,S.consumedEndSegmentIndex,0),N();continue}h=!1,d=0,f=S.startSegmentIndex,p=0,g=S.startSegmentIndex,v=0,N();let O=S.startSegmentIndex;for(;O<S.endSegmentIndex&&!(!h&&(O=fA(e,O,S.endSegmentIndex))>=S.endSegmentIndex);){;let t=i[O],n=fO(t),s=(T=h,M=O,0!==e.letterSpacing&&T&&e.spacingGraphemeCounts[M]>0?e.letterSpacing:0),u="tab"===t?function(e,t){if(t<=0)return 0;let n=e%t;return 1e-6>=Math.abs(n)?t:t-n}(d+s,e.tabStopAdvance):r[O],f=s+u,p=function(e,t,n,r,i){return fD(r,"tab"===t?i+(0!==e.letterSpacing&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0):e.lineEndFitAdvances[n])}(e,t,O,s,u);if("soft-hyphen"===t){h&&(g=O+1,v=0,x=O+1,y=d+o,b=d+o,w=t),O++;continue}if(!h){p>c&&null!==a[O]?E(O,0):k(O,u),_(t,n,O,u,s,f),O++;continue}if(d+p>c){let r=d+fP(e,t,O,s),i=d+fI(e,t,O,s,u);if("soft-hyphen"===w&&l.preferEarlySoftHyphenBreak&&y<=c){j(x,0,b);continue}if(n&&r<=c){C(O,f),j(O+1,0,i),O++;continue}if(x>=0&&y<=c){if(g>x||g===x&&v>0){j();continue}let e=x;j(e,0,b),O=e;continue}if(p>c&&null!==a[O]){j(),E(O,0),O++;continue}j();continue}C(O,f),_(t,n,O,u,s,f),O++}if(h){let e=x===S.consumedEndSegmentIndex?b:d;j(S.consumedEndSegmentIndex,0,e)}}return u}(e,t,(t,n,a,o,s)=>{r.push({text:function(e,t,n,r,i,a){var o;let s="",l=(o=e.kinds,i>n&&"soft-hyphen"===o[i-1]);for(let a=n;a<i;a++)if("soft-hyphen"!==e.kinds[a]&&"hard-break"!==e.kinds[a])if(a===n&&r>0){let n=fB(a,e.segments,t);s=fF(s,n,r,n.length)}else s+=e.segments[a];if(a>0){l&&(s+="-");s=fF(s,fB(i,e.segments,t),n===i?r:0,a)}else l&&(s+="-");return s}(e,i,n,a,o,s),width:t,start:{segmentIndex:n,graphemeIndex:a},end:{segmentIndex:o,graphemeIndex:s}})});return{lineCount:a,height:15*a,lines:r}}(t.prepared,s),d=o?Math.min(u.length,5):Math.min(u.length,Math.floor(c)),h=8+15*d+8,f=r-n/2,p=i+a+4;e.fillStyle=o?l?"#1c1c1e":"#f4f4f5":l?"rgba(9,9,11,0.92)":"rgba(255,255,255,0.92)",e.beginPath(),e.roundRect(f,p,n,h,6),e.fill(),e.strokeStyle=o?t.color:l?"rgba(63,63,70,0.5)":"rgba(212,212,216,0.6)",e.lineWidth=o?1.5:.5,e.beginPath(),e.roundRect(f,p,n,h,6),e.stroke(),o&&(e.shadowColor=t.color,e.shadowBlur=15,e.beginPath(),e.roundRect(f,p,n,h,6),e.stroke(),e.shadowBlur=0),e.font=fY,e.fillStyle=o?l?"#e4e4e7":"#18181b":"#71717a",e.textAlign="left";for(let t=0;t<d;t++)e.fillText(u[t].text,f+8,p+8+15*t+11)}else{e.font=fY,e.fillStyle=o?l?"#e4e4e7":"#18181b":l?"#52525b":"#a1a1aa",e.globalAlpha=o?1:s?.85:Math.min(1,(c-.3)*2.5),e.textAlign="left";let n=t.node.label||t.node.id.substring(0,12),u=n.length>45?n.slice(0,45)+"...":n;e.fillText(u,r+a+5,i+4),e.globalAlpha=1}}(0,eh.useEffect)(()=>{let e=f.current;if(!e)return;let t=()=>{let t=window.devicePixelRatio||1,n=e.getBoundingClientRect(),r=n.width,i=n.height;e.width=r*t,e.height=i*t,b.current.dpr=t,b.current.W=r,b.current.H=i};if(t(),w.length>0){let e=0;for(let t of w){let n=Math.sqrt(t.wx*t.wx+t.wy*t.wy);n>e&&(e=n)}let t=e>0?Math.min(b.current.W,b.current.H)/(2.5*e):.5;b.current.zoom=t,b.current.targetZoom=t}v.current=requestAnimationFrame(k);let r=()=>t(),i=e=>{e.preventDefault();let t=e.deltaY>0?.9:1.1;b.current.targetZoom=Math.max(.03,Math.min(8,b.current.targetZoom*t))},a=t=>{let n=e.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top;b.current.mouseX=r,b.current.mouseY=i,b.current.isDragging?(b.current.targetPanX=b.current.panStartX+(t.clientX-b.current.dragStartX),b.current.targetPanY=b.current.panStartY+(t.clientY-b.current.dragStartY),e.style.cursor="grabbing",p.current&&(p.current.style.display="none")):(e.style.cursor=b.current.hoverIndex>=0?"pointer":"default",((e,t)=>{let n=p.current;if(!n)return;let r=b.current,i=r.hoverIndex;if(i<0||r.isDragging){n.style.display="none",r.prevHoverIndex=-1;return}let a=w[i]?.node;if(!a){n.style.display="none";return}if(i!==r.prevHoverIndex){r.prevHoverIndex=i;let e=a.metadata,t=e?.text||a.label||a.id,o=e?.entities?String(e.entities).split(",").map(e=>e.trim()).filter(Boolean):[],s=w[i].heatColor,l=w[i].linkCount,c=e?.fact_type||a.group||"memory",u=e?.context&&"N/A"!==e.context?e.context:null,d=Array.isArray(e?.tags)?e.tags:[],h=e?.occurred_start||null,f=e?.occurred_end||null,p=e?.mentioned_at||null,v=e?.proof_count||null,x=e?.document_id||null,y=g?"#a1a1aa":"#71717a",b=g?"#71717a":"#a1a1aa",N=`font-size:10px;color:${b};text-transform:uppercase;letter-spacing:0.04em;font-weight:500`,j=`font-size:12px;color:${g?"#e4e4e7":"#18181b"}`,k="display:flex;justify-content:space-between;align-items:baseline;gap:12px",S='<div style="display:flex;align-items:center;gap:8px;margin-bottom:6px">';S+=`<span style="font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;color:${s};background:${s}18;padding:2px 8px;border-radius:4px">${c}</span><span style="font-size:10px;color:${y}">${l} link${1!==l?"s":""}</span></div><div style="font-size:12px;line-height:1.6;margin-bottom:8px">${t}</div><div style="display:flex;flex-direction:column;gap:4px;border-top:1px solid ${g?"#27272a":"#e4e4e7"};padding-top:8px">`,u&&(S+=`<div style="${k}"><span style="${N}">Context</span><span style="${j}">${u}</span></div>`);let C=e=>e.slice(0,16).replace("T"," ");if(h){let e=C(h),t=f?C(f):null,n=t&&t!==e?`${e} → ${t}`:e;S+=`<div style="${k}"><span style="${N}">Occurred</span><span style="${j}">${n}</span></div>`}if(p&&(S+=`<div style="${k}"><span style="${N}">Mentioned</span><span style="${j}">${C(p)}</span></div>`),v&&v>1&&(S+=`<div style="${k}"><span style="${N}">Evidence</span><span style="${j}">${v} sources</span></div>`),x&&(S+=`<div style="${k}"><span style="${N}">Document</span><span style="font-size:11px;font-family:monospace;color:${y}">${String(x).slice(0,12)}...</span></div>`),S+="</div>",o.length>0&&(1!==o.length||"None"!==o[0])){for(let e of(S+='<div style="margin-top:8px;display:flex;flex-wrap:wrap;gap:4px">',o))S+=`<span style="font-size:10px;background:${g?"#27272a":"#f4f4f5"};color:${g?"#d4d4d8":"#3f3f46"};padding:2px 7px;border-radius:4px">${e}</span>`;S+="</div>"}if(d.length>0){for(let e of(S+='<div style="margin-top:6px;display:flex;flex-wrap:wrap;gap:4px">',d))S+=`<span style="font-size:10px;background:${s}15;color:${s};padding:2px 7px;border-radius:4px">#${e}</span>`;S+="</div>"}n.innerHTML=S+=`<div style="margin-top:8px;font-size:9px;font-family:monospace;color:${b}">${a.id}</div>`}n.style.display="block";let o=n.offsetWidth,s=n.offsetHeight,l=Math.min(e+16,r.W-o-12),c=Math.min(t+16,r.H-s-12);n.style.left=`${Math.max(4,l)}px`,n.style.top=`${Math.max(4,c)}px`})(r,i))},o=e=>{b.current.isDragging=!0,b.current.dragStartX=e.clientX,b.current.dragStartY=e.clientY,b.current.panStartX=b.current.panX,b.current.panStartY=b.current.panY},s=()=>{if(b.current.isDragging){let e=Math.abs(b.current.panX-b.current.panStartX),t=Math.abs(b.current.panY-b.current.panStartY);if(e<3&&t<3&&b.current.hoverIndex>=0){let e=w[b.current.hoverIndex]?.node;e&&n&&n(e)}}b.current.isDragging=!1,e.style.cursor=b.current.hoverIndex>=0?"pointer":"default"},l=()=>{b.current.mouseX=-1,b.current.mouseY=-1,b.current.isDragging=!1,b.current.hoverIndex=-1,p.current&&(p.current.style.display="none")};return window.addEventListener("resize",r),e.addEventListener("wheel",i,{passive:!1}),e.addEventListener("mousemove",a),e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("mouseleave",l),()=>{cancelAnimationFrame(v.current),window.removeEventListener("resize",r),e.removeEventListener("wheel",i),e.removeEventListener("mousemove",a),e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("mouseleave",l)}},[k,w,n,x]);let C=(0,eh.useCallback)(()=>{y(e=>!e)},[]);return(0,eh.useEffect)(()=>{if(!x)return;let e=e=>{"Escape"===e.key&&y(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x]),(0,eh.useEffect)(()=>{if(!f.current)return;let e=setTimeout(()=>{let e=window.devicePixelRatio||1,t=f.current.getBoundingClientRect();f.current.width=t.width*e,f.current.height=t.height*e,b.current.dpr=e,b.current.W=t.width,b.current.H=t.height},50);return()=>clearTimeout(e)},[x]),(0,ed.jsxs)("div",{ref:h,style:x?{position:"fixed",inset:0,zIndex:50,background:g?"#09090b":"#ffffff"}:{position:"relative",width:"100%",height:`${t}px`},children:[(0,ed.jsx)("canvas",{ref:f,style:{width:"100%",height:"100%",display:"block"}}),(0,ed.jsxs)("button",{onClick:C,style:{position:"absolute",top:8,right:8,zIndex:21,padding:"6px 10px",borderRadius:6,border:`1px solid ${g?"#27272a":"#e4e4e7"}`,background:g?"#18181b":"#ffffff",color:g?"#a1a1aa":"#71717a",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",gap:4,opacity:.7,transition:"opacity 0.15s"},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.7"},title:x?d("exitFullscreenTitle"):d("enterFullscreenTitle"),children:[x?(0,ed.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ed.jsx)("polyline",{points:"4 14 10 14 10 20"}),(0,ed.jsx)("polyline",{points:"20 10 14 10 14 4"}),(0,ed.jsx)("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),(0,ed.jsx)("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}):(0,ed.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ed.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,ed.jsx)("polyline",{points:"9 21 3 21 3 15"}),(0,ed.jsx)("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),(0,ed.jsx)("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),x?d("exitFullscreenLabel"):d("enterFullscreenLabel")]}),(0,ed.jsx)("div",{ref:p,style:{display:"none",position:"absolute",pointerEvents:"none",zIndex:22,maxWidth:360,padding:"10px 14px",borderRadius:8,fontSize:12,lineHeight:1.5,boxShadow:"0 8px 24px rgba(0,0,0,0.35)",border:`1px solid ${g?"#27272a":"#e4e4e7"}`,background:g?"#18181b":"#ffffff",color:g?"#e4e4e7":"#18181b"}})]})}function fZ({value:e,onChange:t,bankId:n,fetchSuggestions:r,placeholder:i,className:a,matchMode:o,onMatchModeChange:s,showMatchToggleAt:l=2}){let c=(0,ep.useTranslations)("common"),u=i??c("filterByTagPlaceholder"),[d,h]=(0,eh.useState)(""),[f,p]=(0,eh.useState)([]),[g,v]=(0,eh.useState)(!1),[x,y]=(0,eh.useState)(-1),b=(0,eh.useRef)(null),w=(0,eh.useMemo)(()=>{if(n)return async e=>{let t=e?`${e}*`:void 0;return(await eO.client.listTags(n,t,20)).items.map(e=>e.tag)}},[n]),N=(0,eh.useRef)(void 0);N.current=r??w,(0,eh.useEffect)(()=>{let t=N.current;if(!t)return;let n=!1,r=setTimeout(async()=>{try{let r=await t(d.trim());if(n)return;let i=r.filter(t=>!e.includes(t));p(i),y(i.length>0?0:-1)}catch{n||p([])}},150);return()=>{n=!0,clearTimeout(r)}},[d,e]),(0,eh.useEffect)(()=>{let e=e=>{b.current&&(b.current.contains(e.target)||v(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let j=n=>{let r=n.trim();!r||e.includes(r)?h(""):(t([...e,r]),h(""),y(-1))},k=n=>{t(e.filter(e=>e!==n))},S=null!=o&&null!=s&&e.length>=l;return(0,ed.jsxs)("div",{className:`flex items-center gap-2 flex-wrap ${a??""}`,children:[(0,ed.jsxs)("div",{ref:b,className:"relative w-56",children:[(0,ed.jsx)(tI,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),(0,ed.jsx)(eD.Input,{type:"text",value:d,onChange:e=>{h(e.target.value),v(!0)},onFocus:()=>v(!0),onKeyDown:t=>{if("ArrowDown"===t.key&&f.length>0){t.preventDefault(),v(!0),y(e=>(e+1)%f.length);return}if("ArrowUp"===t.key&&f.length>0){t.preventDefault(),v(!0),y(e=>e<=0?f.length-1:e-1);return}if("Enter"===t.key||","===t.key){t.preventDefault(),g&&x>=0&&f[x]?j(f[x]):d.trim()&&j(d);return}"Escape"===t.key?v(!1):"Backspace"===t.key&&!d&&e.length>0&&k(e[e.length-1])},placeholder:u,className:"pl-8 h-9"}),g&&f.length>0&&(0,ed.jsx)("div",{className:"absolute z-20 mt-1 w-full bg-popover border border-border rounded-md shadow-md max-h-60 overflow-y-auto",children:f.map((e,t)=>(0,ed.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),j(e)},onMouseEnter:()=>y(t),className:`w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 ${t===x?"bg-accent text-accent-foreground":"text-foreground hover:bg-muted"}`,children:[(0,ed.jsx)(tI,{className:"w-3 h-3 text-muted-foreground"}),(0,ed.jsx)("span",{className:"truncate",children:e})]},e))})]}),e.length>0&&(0,ed.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(e=>(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-md bg-primary/10 text-primary border border-primary/20 font-medium leading-none",children:[(0,ed.jsx)("span",{className:"opacity-50 select-none font-mono",children:"#"}),e,(0,ed.jsx)("button",{type:"button",onClick:()=>k(e),className:"opacity-50 hover:opacity-100 transition-opacity ml-0.5","aria-label":c("removeTag",{tag:e}),children:(0,ed.jsx)(tF.X,{className:"w-3 h-3"})})]},e)),(0,ed.jsx)("button",{type:"button",onClick:()=>t([]),className:"text-xs text-muted-foreground hover:text-foreground underline",children:c("clear")})]}),S&&(0,ed.jsxs)("div",{className:"flex items-center gap-1 bg-muted rounded-md p-0.5 h-9 ml-auto",children:[(0,ed.jsx)("button",{type:"button",onClick:()=>s("any"),className:`px-2 py-1 rounded text-xs font-medium ${"any"===o?"bg-background text-foreground shadow-sm":"text-muted-foreground"}`,title:c("matchAnyTooltip"),children:c("matchAny")}),(0,ed.jsx)("button",{type:"button",onClick:()=>s("all"),className:`px-2 py-1 rounded text-xs font-medium ${"all"===o?"bg-background text-foreground shadow-sm":"text-muted-foreground"}`,title:c("matchAllTooltip"),children:c("matchAll")})]})]})}let fQ=(0,eb.default)("chart-scatter",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);var fJ=e.i(7233);function f0({factType:e,documentId:t,chunkId:n,compact:r=!1,onExpandToggle:i}){let a,o,s,l,c=(0,ep.useTranslations)("dataView"),u=(0,ep.useTranslations)("addDocument"),{currentBank:d}=(0,ev.useBank)(),[h,f]=(0,eh.useState)("constellation"),[p,g]=(0,eh.useState)(r),[v,x]=(0,eh.useState)(null),[y,b]=(0,eh.useState)(!1),[w,N]=(0,eh.useState)(""),[j,k]=(0,eh.useState)([]),[S,C]=(0,eh.useState)(1),[_,E]=(0,eh.useState)(null),[T,M]=(0,eh.useState)(null),[O,A]=(0,eh.useState)(1e3),D={mentioned_at:c("recencyBasisMentioned"),occurred_start:c("recencyBasisOccurredStart"),occurred_end:c("recencyBasisOccurredEnd")},[P,I]=(0,eh.useState)("mentioned_at"),[L,R]=(0,eh.useState)(null),[B,F]=(0,eh.useState)(!0),[z,V]=(0,eh.useState)(void 0),[H,U]=(0,eh.useState)(!0),[W,Y]=(0,eh.useState)(new Set(["semantic","temporal","entity","causal"])),G=e=>{Y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,eh.useEffect)(()=>{let e=e=>{"Escape"===e.key&&_&&E(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[_]);let X=async(r,i,a)=>{if(d){b(!0);try{let o=await eO.client.getGraph({bank_id:d,type:e,limit:r??O,q:i,tags:a,document_id:t,chunk_id:n});if(x(o),"observation"===e){let e=await eO.client.getBankStats(d);R({pending_consolidation:e.pending_consolidation||0,last_consolidated_at:e.last_consolidated_at||null})}}catch(e){}finally{b(!1)}}},$=(0,eh.useMemo)(()=>v?.table_rows??[],[v]),q=(0,eh.useMemo)(()=>{if(!v)return{nodes:[],links:[]};let e=hY(v),t=e.links.filter(e=>{var t;let n=(t=e.type)?"semantic"===t||"temporal"===t||"entity"===t?t:["causes","caused_by","enables","prevents"].includes(t)?"causal":"semantic":"semantic";return W.has(n)});return{nodes:e.nodes,links:t}},[v,W]),K=(0,eh.useMemo)(()=>{let e=0,t=0,n=0,r=0,i=0,a={};return q.links.forEach(o=>{i++;let s=o.type||"unknown";"semantic"===s?e++:"temporal"===s?t++:"entity"===s?n++:"causes"===s||"caused_by"===s||"enables"===s||"prevents"===s?r++:a[s]=(a[s]||0)+1}),{semantic:e,temporal:t,entity:n,causal:r,total:i,otherTypes:a}},[q]),Z=(0,eh.useCallback)(e=>{let t=v?.table_rows?.find(t=>t.id===e.id);t&&E(t)},[v]),Q=(0,eh.useCallback)(e=>e.color||"#0074d9",[]),J=(0,eh.useMemo)(()=>{if("observation"!==e||!v?.table_rows)return null;let t=new Map,n=1;for(let e of v.table_rows){let r=e.proof_count??1;t.set(e.id,r),r>n&&(n=r)}return{counts:t,max:n}},[e,v]),ee=(0,eh.useMemo)(()=>{if(!v?.table_rows?.length)return null;let e=new Map,t=1/0,n=-1/0;for(let r of v.table_rows){let i=r[P];if(!i)continue;let a=Date.parse(i);!Number.isNaN(a)&&(e.set(r.id,a),a<t&&(t=a),a>n&&(n=a))}return Number.isFinite(t)&&Number.isFinite(n)&&n!==t?{times:e,minT:t,maxT:n}:null},[v,P]),et=(0,eh.useCallback)(e=>{if(!ee)return .5;let t=ee.times.get(e.id);return void 0===t?0:(t-ee.minT)/(ee.maxT-ee.minT)},[ee]),en=(0,eh.useCallback)(e=>J?3+Math.min(2*Math.sqrt((J.counts.get(e.id)??1)-1),11):3,[J]),er=(0,eh.useCallback)(e=>"temporal"===e.type?"#009296":"entity"===e.type?"#f59e0b":"causes"===e.type||"caused_by"===e.type||"enables"===e.type||"prevents"===e.type?"#8b5cf6":"#0074d9",[]);return(0,eh.useEffect)(()=>{C(1)},[j]),(0,eh.useEffect)(()=>{d&&X(void 0,w||void 0,j.length>0?j:void 0)},[j]),(0,eh.useEffect)(()=>{d&&X()},[e,d,t,n]),(0,eh.useEffect)(()=>{v&&void 0===z&&(q.nodes.length>50?V(20):q.nodes.length>20&&V(20))},[v,q.nodes.length,z]),(0,ed.jsxs)("div",{children:[y&&!v?(0,ed.jsxs)("div",{className:"text-center py-12",children:[(0,ed.jsx)(eV,{className:"w-8 h-8 mx-auto mb-3 text-muted-foreground animate-spin"}),(0,ed.jsx)("p",{className:"text-muted-foreground",children:c("loadingMemories")})]}):v&&0===v.total_units?(0,ed.jsxs)("div",{className:"text-center py-20",children:[(0,ed.jsx)(ej.FileText,{className:"w-10 h-10 mx-auto mb-4 text-muted-foreground/50"}),(0,ed.jsx)("h3",{className:"text-base font-medium text-foreground mb-1",children:c("noMemoriesYet")}),!t&&!n&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("p",{className:"text-sm text-muted-foreground mb-6",children:c("noMemoriesDescription")}),(0,ed.jsxs)(eA.Button,{variant:"default",size:"sm",className:"gap-1.5",onClick:()=>{let e=document.querySelector("[data-add-document]");e?.click()},children:[(0,ed.jsx)(fJ.Plus,{className:"w-4 h-4"}),u("addDocumentButton")]})]})]}):v?(0,ed.jsxs)(ed.Fragment,{children:[!p&&(0,ed.jsx)("div",{className:"mb-4 space-y-2",children:(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsxs)("div",{className:"relative max-w-xs flex-1",children:[y?(0,ed.jsx)(eV,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none animate-spin"}):(0,ed.jsx)(ey.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),(0,ed.jsx)(eD.Input,{type:"text",value:w,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d&&(C(1),X(void 0,w||void 0,j.length>0?j:void 0)))},placeholder:c("filterByTextPlaceholder"),className:"pl-8 h-9"})]}),(0,ed.jsx)(fZ,{value:j,onChange:k,bankId:d})]})}),p?(0,ed.jsxs)("div",{className:"flex items-center justify-between mb-2 px-1",children:[(0,ed.jsxs)("div",{className:"text-xs text-muted-foreground",children:[v.total_units," memories"]}),(0,ed.jsxs)(eA.Button,{variant:"ghost",size:"sm",onClick:()=>{i?i():g(!1)},className:"h-6 px-2 text-xs gap-1",children:[(0,ed.jsx)(eF,{className:"w-3 h-3"}),"Expand"]})]}):(0,ed.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-4",children:[r&&(0,ed.jsxs)(eA.Button,{variant:"ghost",size:"sm",onClick:()=>{i?i():g(!0)},className:"h-7 px-2 text-xs gap-1",children:[(0,ed.jsx)(ez,{className:"w-3 h-3"}),"Compact"]}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:w||j.length>0?c("matchingMemories",{count:$.length}):v.table_rows?.length<v.total_units?(0,ed.jsxs)("span",{children:[c("showingMemories",{shown:v.table_rows?.length??0,total:v.total_units}),(0,ed.jsx)("button",{onClick:()=>{let e=Math.min(v.total_units,O+1e3);A(e),X(e,w||void 0,j.length>0?j:void 0)},className:"ml-2 text-primary hover:underline",children:c("loadMore")})]}):c("totalMemories",{count:v.total_units})}),"observation"===e&&L&&(0,ed.jsx)("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs font-medium border ${0===L.pending_consolidation?"bg-green-500/10 text-green-700 dark:text-green-400 border-green-500/20":"bg-amber-500/10 text-amber-700 dark:text-amber-400 border-amber-500/20"}`,title:0===L.pending_consolidation?L.last_consolidated_at?c("allConsolidatedWithDate",{date:new Date(L.last_consolidated_at).toLocaleString()}):c("allConsolidated"):c("pendingConsolidation",{count:L.pending_consolidation}),children:0===L.pending_consolidation?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(eH,{className:"w-3 h-3"}),c("inSync")]}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(eU,{className:"w-3 h-3"}),c("pendingCount",{count:L.pending_consolidation}),(0,ed.jsx)("button",{onClick:()=>X(O,w||void 0,j.length>0?j:void 0),disabled:y,className:"ml-0.5 opacity-70 hover:opacity-100 disabled:opacity-40 transition-opacity",title:c("refreshMemories"),children:(0,ed.jsx)(eV,{className:`w-3 h-3 ${y?"animate-spin":""}`})})]})})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ed.jsxs)("button",{onClick:()=>f("constellation"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"constellation"===h?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ed.jsx)(fQ,{className:"w-4 h-4"}),c("constellation")]}),(0,ed.jsxs)("button",{onClick:()=>f("graph"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"graph"===h?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ed.jsx)(eW,{className:"w-4 h-4"}),c("graph")]}),(0,ed.jsxs)("button",{onClick:()=>f("table"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"table"===h?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ed.jsx)(eY,{className:"w-4 h-4"}),c("table")]}),(0,ed.jsxs)("button",{onClick:()=>f("timeline"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"timeline"===h?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ed.jsx)(eP,{className:"w-4 h-4"}),c("timeline")]})]})]}),!p&&"graph"===h&&(0,ed.jsxs)("div",{className:"flex gap-0",children:[(0,ed.jsx)("div",{className:"flex-1 min-w-0",children:(0,ed.jsx)(hW,{data:q,height:700,showLabels:B,onNodeClick:Z,maxNodes:z,nodeColorFn:Q,linkColorFn:er})}),(0,ed.jsx)("button",{onClick:()=>U(!H),className:"flex-shrink-0 w-5 h-[700px] bg-transparent hover:bg-muted/50 flex items-center justify-center transition-colors",title:c(H?"hidePanel":"showPanel"),children:H?(0,ed.jsx)(eC.ChevronRight,{className:"w-3 h-3 text-muted-foreground/60"}):(0,ed.jsx)(eS,{className:"w-3 h-3 text-muted-foreground/60"})}),(0,ed.jsx)("div",{className:`${H?"w-80":"w-0"} transition-all duration-300 overflow-hidden flex-shrink-0`,children:(0,ed.jsx)("div",{className:"w-80 h-[700px] bg-card border-l border-border overflow-y-auto",children:_?(0,ed.jsx)(tQ,{memory:_,onClose:()=>E(null),inPanel:!0,bankId:d||void 0}):(0,ed.jsxs)("div",{className:"p-4 space-y-5",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold mb-3 text-foreground",children:c("graphTitle")}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:"#0074d9"}}),(0,ed.jsx)("span",{className:"text-foreground",children:c("nodes")})]}),(0,ed.jsxs)("span",{className:"font-mono text-foreground",children:[Math.min(z??q.nodes.length,q.nodes.length),"/",q.nodes.length]})]}),(0,ed.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mt-2 mb-1",children:[c("linksWithCount",{count:K.total})," ",(0,ed.jsx)("span",{className:"text-muted-foreground/60",children:c("clickToFilter")})]}),(0,ed.jsxs)("button",{onClick:()=>G("semantic"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${W.has("semantic")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("div",{className:"w-4 h-0.5 bg-[#0074d9]"}),(0,ed.jsx)("span",{className:"text-foreground",children:c("semantic")})]}),(0,ed.jsx)("span",{className:`font-mono ${0===K.semantic?"text-destructive":"text-foreground"}`,children:K.semantic})]}),(0,ed.jsxs)("button",{onClick:()=>G("temporal"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${W.has("temporal")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("div",{className:"w-4 h-0.5 bg-[#009296]"}),(0,ed.jsx)("span",{className:"text-foreground",children:c("temporal")})]}),(0,ed.jsx)("span",{className:`font-mono ${0===K.temporal?"text-destructive":"text-foreground"}`,children:K.temporal})]}),(0,ed.jsxs)("button",{onClick:()=>G("entity"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${W.has("entity")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("div",{className:"w-4 h-0.5 bg-[#f59e0b]"}),(0,ed.jsx)("span",{className:"text-foreground",children:c("entity")})]}),(0,ed.jsx)("span",{className:"font-mono text-foreground",children:K.entity})]}),(0,ed.jsxs)("button",{onClick:()=>G("causal"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${W.has("causal")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("div",{className:"w-4 h-0.5 bg-[#8b5cf6]"}),(0,ed.jsx)("span",{className:"text-foreground",children:c("causal")})]}),(0,ed.jsx)("span",{className:`font-mono ${0===K.causal?"text-muted-foreground":"text-foreground"}`,children:K.causal})]}),Object.entries(K.otherTypes||{}).map(([e,t])=>(0,ed.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ed.jsx)("span",{className:"text-muted-foreground capitalize ml-6",children:e}),(0,ed.jsx)("span",{className:"font-mono text-muted-foreground",children:t})]},e))]})]}),(0,ed.jsx)("div",{className:"border-t border-border"}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold mb-3 text-foreground",children:c("displayTitle")}),(0,ed.jsx)("div",{className:"space-y-4",children:(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsx)(e3,{htmlFor:"show-labels",className:"text-sm text-foreground",children:c("showLabels")}),(0,ed.jsx)(tD.Switch,{id:"show-labels",checked:B,onCheckedChange:F})]})})]}),(0,ed.jsx)("div",{className:"border-t border-border"}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold mb-3 text-foreground",children:c("performanceTitle")}),(0,ed.jsxs)("div",{className:"space-y-4",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ed.jsx)(e3,{className:"text-sm text-foreground",children:c("maxNodes")}),(0,ed.jsx)("span",{className:"text-xs text-muted-foreground",children:q.nodes.length>50?`${z??50} / ${q.nodes.length}`:`${z??"All"} / ${q.nodes.length}`})]}),(0,ed.jsx)(tA,{value:[q.nodes.length>50?z||20:z||Math.min(q.nodes.length,20)],min:10,max:Math.min(Math.max(q.nodes.length,10),50),step:10,onValueChange:([e])=>{let t=Math.min(q.nodes.length,50);q.nodes.length>50?V(e):V(e>=t?void 0:e)},className:"w-full"})]}),(0,ed.jsxs)("p",{className:"text-xs text-muted-foreground",children:[c("allLinksVisible"),q.nodes.length>50&&(0,ed.jsx)("span",{className:"block text-amber-600 dark:text-amber-400 mt-1",children:c("limitedTo50Nodes",{count:q.nodes.length})})]})]})]}),(0,ed.jsx)("div",{className:"border-t border-border"}),(0,ed.jsx)("div",{className:"text-xs text-muted-foreground/60 text-center pt-2",children:c("clickNodeForDetails")})]})})})]}),(p||"constellation"===h)&&(0,ed.jsxs)("div",{className:"flex gap-0",children:[(0,ed.jsx)("div",{className:"flex-1 min-w-0 border border-border rounded-lg overflow-hidden",children:(0,ed.jsx)(fK,{data:q,height:p?300:700,onNodeClick:Z,nodeColorFn:Q,linkColorFn:er,nodeSizeFn:"observation"===e?en:void 0,sizeLegendLabel:"observation"===e?c("sourceFactsLabel"):void 0,nodeHeatFn:ee?et:void 0,heatLegendLabel:ee?c("recencyLabel",{basis:D[P]}):void 0,heatLegendEndpoints:ee?[new Date(ee.minT).toISOString().slice(0,10),new Date(ee.maxT).toISOString().slice(0,10)]:void 0},p?"compact":"full")}),!p&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("button",{onClick:()=>U(!H),className:"flex-shrink-0 w-5 h-[700px] bg-transparent hover:bg-muted/50 flex items-center justify-center transition-colors",title:c(H?"hidePanel":"showPanel"),children:H?(0,ed.jsx)(eC.ChevronRight,{className:"w-3 h-3 text-muted-foreground"}):(0,ed.jsx)(eS,{className:"w-3 h-3 text-muted-foreground"})}),H&&(0,ed.jsx)("div",{className:"w-72 flex-shrink-0 border border-border rounded-lg bg-muted/20 overflow-y-auto h-[700px]",children:_?(0,ed.jsx)(tQ,{memory:_,onClose:()=>E(null),inPanel:!0,bankId:d||void 0}):(0,ed.jsxs)("div",{className:"p-4 space-y-4",children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:c("constellationViewTitle")}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:c("constellationViewDescription")}),(0,ed.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,ed.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:c("colorBy")}),(0,ed.jsxs)(tP.Select,{value:P,onValueChange:e=>I(e),children:[(0,ed.jsx)(tP.SelectTrigger,{className:"h-8 w-full text-xs",children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"mentioned_at",children:c("mentioned")}),(0,ed.jsx)(tP.SelectItem,{value:"occurred_start",children:c("occurredStart")}),(0,ed.jsx)(tP.SelectItem,{value:"occurred_end",children:c("occurredEnd")})]})]})]}),(0,ed.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,ed.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:c("linkTypes")}),Object.entries({semantic:"#0074d9",temporal:"#009296",entity:"#f59e0b",causal:"#8b5cf6"}).map(([e,t])=>(0,ed.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer",onClick:()=>G(e),children:[(0,ed.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:t,opacity:W.has(e)?1:.2}}),(0,ed.jsx)("span",{className:`text-xs capitalize ${W.has(e)?"text-foreground":"text-muted-foreground line-through"}`,children:e})]},e))]}),(0,ed.jsxs)("div",{className:"text-xs text-muted-foreground space-y-1 pt-2",children:[(0,ed.jsxs)("div",{children:[c("nodes"),":"," ",(0,ed.jsx)("span",{className:"text-foreground",children:q.nodes.length})]}),(0,ed.jsxs)("div",{children:[c("links"),":"," ",(0,ed.jsx)("span",{className:"text-foreground",children:q.links.length})]})]})]})})]})]}),!p&&"table"===h&&(0,ed.jsx)("div",{children:(0,ed.jsx)("div",{className:"w-full",children:(0,ed.jsx)("div",{className:"pb-4",children:$.length>0?(a=Math.ceil($.length/100),s=(o=(S-1)*100)+100,l=$.slice(o,s),(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)(eG,{className:"table-fixed",children:[(0,ed.jsx)(eX,{children:(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eK,{className:"observation"===e?"w-[35%]":"w-[38%]",children:c("observation"===e?"columnObservation":"columnMemory")}),(0,ed.jsx)(eK,{className:"w-[15%]",children:c("columnEntities")}),(0,ed.jsx)(eK,{className:"w-[15%]",children:c("columnTags")}),"observation"===e&&(0,ed.jsx)(eK,{className:"w-[10%]",children:c("columnSources")}),(0,ed.jsx)(eK,{className:"observation"===e?"w-[12%]":"w-[16%]",children:c("columnOccurred")}),(0,ed.jsx)(eK,{className:"observation"===e?"w-[13%]":"w-[16%]",children:c("columnMentioned")})]})}),(0,ed.jsx)(e$,{children:l.map((t,n)=>{let r=t.occurred_start?new Date(t.occurred_start).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,i=t.mentioned_at?new Date(t.mentioned_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null;return(0,ed.jsxs)(eq,{onClick:()=>M(t.id),className:"cursor-pointer hover:bg-muted/50",children:[(0,ed.jsxs)(eZ,{className:"py-2",children:[(0,ed.jsx)("div",{className:"line-clamp-2 text-sm leading-snug text-foreground",children:t.text}),t.context&&"observation"!==e&&(0,ed.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:t.context})]}),(0,ed.jsx)(eZ,{className:"py-2",children:t.entities?(0,ed.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[t.entities.split(", ").slice(0,2).map((e,t)=>(0,ed.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:e},t)),t.entities.split(", ").length>2&&(0,ed.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["+",t.entities.split(", ").length-2]})]}):(0,ed.jsx)("span",{className:"text-xs text-muted-foreground",children:"-"})}),(0,ed.jsx)(eZ,{className:"py-2",children:t.tags&&t.tags.length>0?(0,ed.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[t.tags.slice(0,2).map((e,t)=>(0,ed.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-amber-500/10 text-amber-700 border border-amber-500/20 font-medium font-mono",children:["#",e]},t)),t.tags.length>2&&(0,ed.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["+",t.tags.length-2]})]}):(0,ed.jsx)("span",{className:"text-xs text-muted-foreground",children:"-"})}),"observation"===e&&(0,ed.jsx)(eZ,{className:"text-xs py-2 text-foreground",children:t.proof_count??1}),(0,ed.jsx)(eZ,{className:"text-xs py-2 text-foreground",children:r||(0,ed.jsx)("span",{className:"text-muted-foreground",children:"-"})}),(0,ed.jsx)(eZ,{className:"text-xs py-2 text-foreground",children:i||(0,ed.jsx)("span",{className:"text-muted-foreground",children:"-"})})]},t.id||n)})})]}),a>1&&(0,ed.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ed.jsxs)("div",{className:"text-xs text-muted-foreground",children:[o+1,"-",Math.min(s,$.length)," of"," ",$.length]}),(0,ed.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>C(1),disabled:1===S,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eR,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>C(e=>Math.max(1,e-1)),disabled:1===S,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eS,{className:"h-3 w-3"})}),(0,ed.jsxs)("span",{className:"text-xs px-2",children:[S," / ",a]}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>C(e=>Math.min(a,e+1)),disabled:S===a,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eC.ChevronRight,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>C(a),disabled:S===a,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eB,{className:"h-3 w-3"})})]})]})]})):(0,ed.jsx)("div",{className:"text-center py-12 text-muted-foreground",children:c(v.table_rows?.length>0?"noMemoriesMatchFilter":"noMemoriesFound")})})})}),!p&&"timeline"===h&&(0,ed.jsx)(f1,{data:v,filteredRows:$,bankId:d||void 0,onMemoryClick:e=>M(e)})]}):(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"📊"}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:c("noDataAvailable")})]})}),(0,ed.jsx)(tZ,{memoryId:T,onClose:()=>M(null)})]})}function f1({data:e,filteredRows:t,bankId:n,onMemoryClick:r}){let i=(0,ep.useTranslations)("dataView"),[a,o]=(0,eh.useState)("month"),[s,l]=(0,eh.useState)(0),c=(0,eh.useRef)(null),{sortedItems:u,itemsWithoutDates:d}=(0,eh.useMemo)(()=>t&&0!==t.length?{sortedItems:t.filter(e=>e.occurred_start).sort((e,t)=>new Date(e.occurred_start).getTime()-new Date(t.occurred_start).getTime()),itemsWithoutDates:t.filter(e=>!e.occurred_start)}:{sortedItems:[],itemsWithoutDates:[]},[t]),h=(0,eh.useMemo)(()=>{if(0===u.length)return[];let e={};return u.forEach(t=>{let n=new Date(t.occurred_start),r=(e=>{let t=e.getFullYear(),n=e.getMonth(),r=e.getDate();switch(a){case"year":return`${t}`;case"month":return`${t}-${String(n+1).padStart(2,"0")}`;case"week":let i=new Date(e);return i.setDate(r-e.getDay()),`${i.getFullYear()}-W${String(Math.ceil(i.getDate()/7)).padStart(2,"0")}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`;case"day":return`${t}-${String(n+1).padStart(2,"0")}-${String(r).padStart(2,"0")}`}})(n);if(!e[r]){let t=n;if("week"===a){let e=r.split("-");t=new Date(parseInt(e[0]),parseInt(e[2])-1,parseInt(e[3]))}e[r]={items:[],date:t}}e[r].items.push(t)}),Object.entries(e).sort(([,e],[,t])=>e.date.getTime()-t.date.getTime()).map(([e,{items:t,date:n}])=>({key:e,label:((e,t)=>{switch(a){case"year":return e;case"month":return t.toLocaleDateString("en-US",{year:"numeric",month:"short"});case"week":let n=new Date(t);return n.setDate(t.getDate()+6),`${t.toLocaleDateString("en-US",{month:"short",day:"numeric"})} - ${n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`;case"day":return t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric"})}})(e,n),items:t,date:n}))},[u,a]),f=(0,eh.useMemo)(()=>0===u.length?null:{first:new Date(u[0].occurred_start),last:new Date(u[u.length-1].occurred_start)},[u]),p=e=>{let t=Math.max(0,Math.min(e,h.length-1));l(t);let n=document.getElementById(`timeline-group-${t}`);n?.scrollIntoView({behavior:"smooth",block:"start"})};if(0===u.length)return(0,ed.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,ed.jsx)(eP,{className:"w-12 h-12 text-muted-foreground mb-3"}),(0,ed.jsx)("div",{className:"text-base font-medium text-foreground mb-1",children:i("noTimelineData")}),(0,ed.jsxs)("div",{className:"text-xs text-muted-foreground text-center max-w-md",children:[i("noTimelineDataDescription"),d.length>0&&(0,ed.jsx)("span",{className:"block mt-1",children:i("memoriesWithoutDatesInTable",{count:d.length})})]})]});let g=e=>{let t=new Date(e);return{date:t.toLocaleDateString("en-US",{month:"short",day:"numeric"}),time:t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}},v={year:i("granularityYear"),month:i("granularityMonth"),week:i("granularityWeek"),day:i("granularityDay")};return(0,ed.jsx)("div",{className:"px-4",children:(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between mb-3 gap-4",children:[(0,ed.jsxs)("div",{className:"text-xs text-muted-foreground",children:[i("timelineMemoriesCount",{count:u.length}),d.length>0&&` ${i("timelineWithoutDates",{count:d.length})}`,f&&(0,ed.jsxs)("span",{className:"ml-2 text-foreground",children:["(",f.first.toLocaleDateString("en-US",{month:"short",year:"numeric"})," ","→ ",f.last.toLocaleDateString("en-US",{month:"short",year:"numeric"}),")"]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ed.jsxs)("div",{className:"flex items-center border border-border rounded mr-2",children:[(0,ed.jsx)(eA.Button,{variant:"secondary",size:"sm",onClick:()=>{let e=["year","month","week","day"],t=e.indexOf(a);t>0&&o(e[t-1])},disabled:"year"===a,className:"h-7 w-7 p-0",title:i("zoomOut"),children:(0,ed.jsx)(eL,{className:"h-3 w-3"})}),(0,ed.jsx)("span",{className:"text-[10px] px-2 min-w-[50px] text-center border-x border-border text-foreground",children:v[a]}),(0,ed.jsx)(eA.Button,{variant:"secondary",size:"sm",onClick:()=>{let e=["year","month","week","day"],t=e.indexOf(a);t<e.length-1&&o(e[t+1])},disabled:"day"===a,className:"h-7 w-7 p-0",title:i("zoomIn"),children:(0,ed.jsx)(eI,{className:"h-3 w-3"})})]}),(0,ed.jsxs)("div",{className:"flex items-center border border-border rounded",children:[(0,ed.jsx)(eA.Button,{variant:"secondary",size:"sm",onClick:()=>p(0),disabled:h.length<=1,className:"h-7 w-7 p-0",title:i("first"),children:(0,ed.jsx)(eR,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"secondary",size:"sm",onClick:()=>p(s-1),disabled:0===s,className:"h-7 w-7 p-0",title:i("previous"),children:(0,ed.jsx)(eS,{className:"h-3 w-3"})}),(0,ed.jsxs)("span",{className:"text-[10px] px-2 min-w-[60px] text-center border-x border-border text-foreground",children:[s+1," / ",h.length]}),(0,ed.jsx)(eA.Button,{variant:"secondary",size:"sm",onClick:()=>p(s+1),disabled:s>=h.length-1,className:"h-7 w-7 p-0",title:i("next"),children:(0,ed.jsx)(eC.ChevronRight,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"secondary",size:"sm",onClick:()=>p(h.length-1),disabled:h.length<=1,className:"h-7 w-7 p-0",title:i("last"),children:(0,ed.jsx)(eB,{className:"h-3 w-3"})})]})]})]}),(0,ed.jsxs)("div",{ref:c,className:"relative max-h-[550px] overflow-y-auto pr-2",children:[(0,ed.jsx)("div",{className:"absolute left-[60px] top-0 bottom-0 w-0.5 bg-border"}),h.map((e,t)=>(0,ed.jsxs)("div",{id:`timeline-group-${t}`,className:"mb-4",children:[(0,ed.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer hover:opacity-80",onClick:()=>l(t),children:[(0,ed.jsx)("div",{className:"w-[60px] text-right pr-3",children:(0,ed.jsx)("span",{className:"text-xs font-semibold text-primary",children:e.label})}),(0,ed.jsx)("div",{className:"w-2 h-2 rounded-full bg-primary z-10"}),(0,ed.jsxs)("span",{className:"ml-2 text-[10px] text-muted-foreground",children:[e.items.length," ",1===e.items.length?i("timelineItem"):i("timelineItems")]})]}),(0,ed.jsx)("div",{className:"space-y-1",children:e.items.map((e,t)=>(0,ed.jsxs)("div",{onClick:()=>r(e.id),className:"flex items-start cursor-pointer group hover:opacity-80",children:[(0,ed.jsxs)("div",{className:"w-[60px] text-right pr-3 pt-1 flex-shrink-0",children:[(0,ed.jsx)("div",{className:"text-[10px] text-muted-foreground",children:g(e.occurred_start).date}),(0,ed.jsx)("div",{className:"text-[9px] text-muted-foreground/70",children:g(e.occurred_start).time})]}),(0,ed.jsx)("div",{className:"flex-shrink-0 pt-2",children:(0,ed.jsx)("div",{className:"w-1.5 h-1.5 rounded-full z-10 bg-muted-foreground/50 group-hover:bg-primary"})}),(0,ed.jsxs)("div",{className:"ml-3 flex-1 p-2 rounded border transition-colors bg-card border-border hover:border-primary/50",children:[(0,ed.jsx)("p",{className:"text-xs text-foreground line-clamp-2 leading-relaxed",children:e.text}),e.context&&(0,ed.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1 truncate",children:e.context}),e.entities&&(0,ed.jsxs)("div",{className:"flex gap-1 mt-1 flex-wrap",children:[e.entities.split(", ").slice(0,3).map((e,t)=>(0,ed.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:e},t)),e.entities.split(", ").length>3&&(0,ed.jsxs)("span",{className:"text-[9px] text-muted-foreground",children:["+",e.entities.split(", ").length-3]})]})]})]},e.id||t))})]},e.key))]})]})})}var f2=e.i(3075),f5=e.i(26999),f3=Symbol("radix.slottable"),f4="AlertDialog",[f6,f7]=(0,e9.createContextScope)(f4,[f5.createDialogScope]),f9=(0,f5.createDialogScope)(),f8=e=>{let{__scopeAlertDialog:t,...n}=e,r=f9(t);return(0,ed.jsx)(f5.Root,{...r,...n,modal:!0})};f8.displayName=f4,eh.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=f9(n);return(0,ed.jsx)(f5.Trigger,{...i,...r,ref:t})}).displayName="AlertDialogTrigger";var pe=e=>{let{__scopeAlertDialog:t,...n}=e,r=f9(t);return(0,ed.jsx)(f5.Portal,{...r,...n})};pe.displayName="AlertDialogPortal";var pt=eh.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=f9(n);return(0,ed.jsx)(f5.Overlay,{...i,...r,ref:t})});pt.displayName="AlertDialogOverlay";var pn="AlertDialogContent",[pr,pi]=f6(pn),pa=((n=({children:e})=>(0,ed.jsx)(ed.Fragment,{children:e})).displayName="AlertDialogContent.Slottable",n.__radixId=f3,n),po=eh.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=f9(n),o=eh.useRef(null),s=(0,e7.useComposedRefs)(t,o),l=eh.useRef(null);return(0,ed.jsx)(f5.WarningProvider,{contentName:pn,titleName:ps,docsSlug:"alert-dialog",children:(0,ed.jsx)(pr,{scope:n,cancelRef:l,children:(0,ed.jsxs)(f5.Content,{role:"alertdialog",...a,...i,ref:s,onOpenAutoFocus:(0,e6.composeEventHandlers)(i.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,ed.jsx)(pa,{children:r}),(0,ed.jsx)(pp,{contentRef:o})]})})})});po.displayName=pn;var ps="AlertDialogTitle",pl=eh.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=f9(n);return(0,ed.jsx)(f5.Title,{...i,...r,ref:t})});pl.displayName=ps;var pc="AlertDialogDescription",pu=eh.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=f9(n);return(0,ed.jsx)(f5.Description,{...i,...r,ref:t})});pu.displayName=pc;var pd=eh.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=f9(n);return(0,ed.jsx)(f5.Close,{...i,...r,ref:t})});pd.displayName="AlertDialogAction";var ph="AlertDialogCancel",pf=eh.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=pi(ph,n),a=f9(n),o=(0,e7.useComposedRefs)(t,i);return(0,ed.jsx)(f5.Close,{...a,...r,ref:o})});pf.displayName=ph;var pp=({contentRef:e})=>{let t=`\`${pn}\` requires a description for the component to be accessible for screen reader users.
|
|
2
|
-
|
|
3
|
-
You can add a description to the \`${pn}\` by passing a \`${pc}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
4
|
-
|
|
5
|
-
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${pn}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
6
|
-
|
|
7
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return eh.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null};let pm=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)(pt,{className:(0,eE.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));pm.displayName=pt.displayName;let pg=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsxs)(pe,{children:[(0,ed.jsx)(pm,{}),(0,ed.jsx)(po,{ref:n,className:(0,eE.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));pg.displayName=po.displayName;let pv=({className:e,...t})=>(0,ed.jsx)("div",{className:(0,eE.cn)("flex flex-col space-y-2 text-center sm:text-left",e),...t});pv.displayName="AlertDialogHeader";let px=({className:e,...t})=>(0,ed.jsx)("div",{className:(0,eE.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});px.displayName="AlertDialogFooter";let py=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)(pl,{ref:n,className:(0,eE.cn)("text-lg font-semibold",e),...t}));py.displayName=pl.displayName;let pb=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)(pu,{ref:n,className:(0,eE.cn)("text-sm text-muted-foreground",e),...t}));pb.displayName=pu.displayName;let pw=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)(pd,{ref:n,className:(0,eE.cn)((0,eA.buttonVariants)(),e),...t}));pw.displayName=pd.displayName;let pN=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)(pf,{ref:n,className:(0,eE.cn)((0,eA.buttonVariants)({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));pN.displayName=pf.displayName;let pj=(0,eb.default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),pk=(0,eb.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),pS=(0,eb.default)("ellipsis-vertical",[["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"}]]);var pC=e.i(64659);function p_(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);if(i<30)return`${i}d ago`;let a=Math.floor(i/30);return a<12?`${a}mo ago`:`${Math.floor(a/12)}y ago`}function pE(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function pT({metadata:e}){let t=Object.entries(e);return 0===t.length?(0,ed.jsx)("span",{children:"-"}):(0,ed.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.slice(0,3).map(([e,t])=>(0,ed.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium",children:[e,"=",String(t)]},e)),t.length>3&&(0,ed.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",t.length-3]})]})}function pM({children:e}){return(0,ed.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground mb-1",children:e})}function pO({title:e,icon:t,children:n}){return(0,ed.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[t,e]}),(0,ed.jsx)("div",{className:"p-4 space-y-4",children:n})]})}function pA({label:e,value:t}){return(0,ed.jsxs)("div",{children:[(0,ed.jsx)(pM,{children:e}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:t})]})}function pD({nodesByFactType:e}){let t=(0,ep.useTranslations)("dataView"),n=e??{world:0,experience:0,observation:0},r=n.world+n.experience+n.observation,i=[{name:"World",value:n.world,color:"#8b5cf6"},{name:"Experience",value:n.experience,color:"#ec4899"},{name:"Observations",value:n.observation,color:"#6366f1"}];return(0,ed.jsxs)("div",{className:"space-y-3",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:t("memoryComposition")}),(0,ed.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:r.toLocaleString()})]}),0===r?(0,ed.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:t("noMemoriesYet")}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:i.filter(e=>e.value>0).map(e=>(0,ed.jsx)("div",{className:"h-full",style:{width:`${e.value/r*100}%`,backgroundColor:e.color},title:`${e.name}: ${e.value.toLocaleString()}`},e.name))}),(0,ed.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:i.map(e=>(0,ed.jsxs)("div",{className:"space-y-0.5",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color}}),(0,ed.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:e.name})]}),(0,ed.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,ed.jsx)("span",{className:"text-base font-semibold tabular-nums",children:e.value.toLocaleString()}),(0,ed.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:r>0?`${(e.value/r*100).toFixed(0)}%`:"0%"})]})]},e.name))})]})]})}function pP({chunkFactType:e,setChunkFactType:t}){return(0,ed.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border bg-muted/30",children:["world","experience","observation"].map(n=>(0,ed.jsx)("button",{onClick:()=>t(n),className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${e===n?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"observation"===n?"Obs":n.charAt(0).toUpperCase()+n.slice(1)},n))})}function pI({chunk:e}){let[t,n]=(0,eh.useState)(!1),[r,i]=(0,eh.useState)(!1),[a,o]=(0,eh.useState)("world"),s=e.chunk_text??"",l=s.length>150?s.slice(0,150)+"...":s;return(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("button",{className:"w-full flex items-center gap-3 px-4 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>n(!t),children:[(0,ed.jsx)(pC.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform ${t?"":"-rotate-90"}`}),(0,ed.jsxs)("span",{className:"text-xs font-mono text-muted-foreground shrink-0",children:["#",e.chunk_index]}),(0,ed.jsxs)("span",{className:"text-[11px] text-muted-foreground/60 shrink-0",children:[s.length.toLocaleString()," chars"]}),!t&&(0,ed.jsx)("span",{className:"text-xs text-foreground/50 truncate",children:l})]}),t&&(r?(0,ed.jsxs)("div",{style:{height:"500px"},className:"flex flex-col border-t border-border",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/30 border-b border-border",children:[(0,ed.jsx)(pP,{chunkFactType:a,setChunkFactType:o}),(0,ed.jsx)("div",{className:"flex-1"}),(0,ed.jsxs)(eA.Button,{variant:"ghost",size:"sm",onClick:()=>i(!1),className:"h-6 px-2 text-xs gap-1",children:[(0,ed.jsx)(ez,{className:"w-3 h-3"}),"Compact"]})]}),(0,ed.jsx)("div",{className:"flex-1 min-h-0",children:(0,ed.jsx)(f0,{factType:a,chunkId:e.chunk_id},`${e.chunk_id}-${a}-full`)})]}):(0,ed.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border",style:{height:"350px"},children:[(0,ed.jsx)("div",{className:"overflow-y-auto",children:(0,ed.jsx)("pre",{className:"px-4 py-3 text-[11px] leading-5 text-foreground/80 whitespace-pre-wrap font-mono",children:s})}),(0,ed.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,ed.jsx)(pP,{chunkFactType:a,setChunkFactType:o}),(0,ed.jsx)("div",{className:"flex-1 min-h-0",children:(0,ed.jsx)(f0,{factType:a,chunkId:e.chunk_id,compact:!0,onExpandToggle:()=>i(!0)},`${e.chunk_id}-${a}-compact`)})]})]}))]})}function pL(){let e=(0,ep.useTranslations)("documentsView"),t=(0,ep.useTranslations)("common"),{currentBank:n}=(0,ev.useBank)(),[r,i]=(0,eh.useState)([]),[a,o]=(0,eh.useState)(!1),[s,l]=(0,eh.useState)(""),[c,u]=(0,eh.useState)(0),[d,h]=(0,eh.useState)(1),f=Math.ceil(c/50),p=(d-1)*50,[g,v]=(0,eh.useState)(null),[x,y]=(0,eh.useState)(!1),[b,w]=(0,eh.useState)(null),[N,j]=(0,eh.useState)(!1),[k,S]=(0,eh.useState)(""),[C,_]=(0,eh.useState)(!1),[E,T]=(0,eh.useState)(!1),[M,O]=(0,eh.useState)(""),[A,D]=(0,eh.useState)(!1),[P,I]=(0,eh.useState)([]),[L,R]=(0,eh.useState)(0),[B,F]=(0,eh.useState)(!1),[z,V]=(0,eh.useState)(!1),[H,U]=(0,eh.useState)(!1),[W,Y]=(0,eh.useState)(null),[G,X]=(0,eh.useState)(null),[$,q]=(0,eh.useState)(null),K=async(e=1)=>{if(n){o(!0);try{let t=await eO.client.listDocuments({bank_id:n,q:s,limit:50,offset:(e-1)*50});i(t.items||[]),u(t.total||0)}catch(e){}finally{o(!1)}}},Z=e=>{h(e),K(e)},Q=async e=>{if(n){y(!0),v({id:e}),j(!1),S(""),T(!1),O(""),I([]),R(0),V(!1);try{let t=await eO.client.getDocument(e,n);v(t)}catch(e){v(null)}finally{y(!1)}}},J=async e=>{if(n){F(!0);try{let t=await eO.client.listDocumentChunks({document_id:e,bank_id:n,limit:100});I(t.items||[]),R(t.total||0),V(!0)}catch(e){}finally{F(!1)}}},ee=async()=>{if(n&&g){U(!0);try{let e=await eO.client.reprocessDocument(g.id,n);Y({success:!0,message:`Reprocessing started (operation: ${e.operation_id})`})}catch(e){Y({success:!1,message:"Error reprocessing document: "+e.message})}finally{U(!1)}}},et=async()=>{if(!n||!G)return;let t=G.id;w(t),X(null);try{let r=await eO.client.deleteDocument(t,n);q({success:!0,message:e("toastDeletedDocumentAndUnits",{count:r.memory_units_deleted})}),g?.id===t&&v(null),K(d)}catch(t){console.error("Error deleting document:",t),q({success:!1,message:e("toastErrorDeletingDocument")+t.message})}finally{w(null)}},en=()=>{j(!1),S("")},er=async()=>{if(!n||!g||!M.trim())return;let e=g.retain_params??{},t={content:M,document_id:g.id};e.context&&(t.context=e.context),e.event_date&&(t.timestamp=e.event_date),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata=e.metadata),g.tags&&g.tags.length>0&&(t.tags=g.tags),D(!0);try{await eO.client.retain({bank_id:n,items:[t],async:!1});let e=await eO.client.getDocument(g.id,n);v(e),T(!1),O(""),K(d)}catch(e){console.error("Error updating document content:",e)}finally{D(!1)}},ei=async()=>{if(!n||!g)return;let e=k.split(",").map(e=>e.trim()).filter(e=>e.length>0);_(!0);try{await eO.client.updateDocument(g.id,n,e),v({...g,tags:e}),i(t=>t.map(t=>t.id===g.id?{...t,tags:e}:t)),j(!1),S("")}catch(e){console.error("Error updating document tags:",e)}finally{_(!1)}};return(0,eh.useEffect)(()=>{n&&(h(1),K(1))},[n]),(0,eh.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>{h(1),K(1)},300);return()=>clearTimeout(e)},[s]),(0,ed.jsxs)("div",{children:[a?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:e("loadingDocuments")})]})}):r.length>0?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("div",{className:"mb-4 text-sm text-muted-foreground",children:e("totalDocuments",{total:c})}),(0,ed.jsxs)("div",{className:"w-full",children:[(0,ed.jsx)("div",{className:"px-5 mb-4",children:(0,ed.jsx)(eD.Input,{type:"text",value:s,onChange:e=>l(e.target.value),placeholder:e("searchPlaceholder"),className:"max-w-2xl"})}),(0,ed.jsx)("div",{className:"overflow-x-auto px-5 pb-5",children:(0,ed.jsxs)(eG,{children:[(0,ed.jsx)(eX,{children:(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eK,{children:e("colDocumentId")}),(0,ed.jsx)(eK,{children:e("colCreated")}),(0,ed.jsx)(eK,{children:e("colUpdated")}),(0,ed.jsx)(eK,{children:e("colTags")}),(0,ed.jsx)(eK,{children:e("colMetadata")}),(0,ed.jsx)(eK,{children:e("colSize")}),(0,ed.jsx)(eK,{children:e("colMemoryUnits")})]})}),(0,ed.jsx)(e$,{children:r.length>0?r.map(e=>(0,ed.jsxs)(eq,{className:`cursor-pointer hover:bg-muted/50 ${g?.id===e.id?"bg-primary/10":""}`,onClick:()=>Q(e.id),children:[(0,ed.jsx)(eZ,{className:"text-card-foreground font-mono text-xs break-all",children:e.id}),(0,ed.jsx)(eZ,{className:"text-card-foreground",title:e.created_at?new Date(e.created_at).toLocaleString():"",children:e.created_at?p_(e.created_at):"N/A"}),(0,ed.jsx)(eZ,{className:"text-card-foreground",title:e.updated_at?new Date(e.updated_at).toLocaleString():"",children:e.updated_at?p_(e.updated_at):"N/A"}),(0,ed.jsx)(eZ,{className:"text-card-foreground",children:e.tags&&e.tags.length>0?(0,ed.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.tags.slice(0,3).map((e,t)=>(0,ed.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t)),e.tags.length>3&&(0,ed.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",e.tags.length-3]})]}):"-"}),(0,ed.jsx)(eZ,{className:"text-card-foreground",children:e.document_metadata&&Object.keys(e.document_metadata).length>0?(0,ed.jsx)(pT,{metadata:e.document_metadata}):"-"}),(0,ed.jsx)(eZ,{className:"text-card-foreground",children:pE(e.text_length||0)}),(0,ed.jsx)(eZ,{className:"text-card-foreground",children:e.memory_unit_count})]},e.id)):(0,ed.jsx)(eq,{children:(0,ed.jsx)(eZ,{colSpan:7,className:"text-center",children:e("clickLoadDocumentsToView")})})})]})}),f>1&&(0,ed.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t px-5",children:[(0,ed.jsxs)("div",{className:"text-xs text-muted-foreground",children:[p+1,"-",Math.min(p+50,c)," of ",c]}),(0,ed.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>Z(1),disabled:1===d||a,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eR,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>Z(d-1),disabled:1===d||a,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eS,{className:"h-3 w-3"})}),(0,ed.jsxs)("span",{className:"text-xs px-2",children:[d," / ",f]}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>Z(d+1),disabled:d===f||a,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eC.ChevronRight,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>Z(f),disabled:d===f||a,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eB,{className:"h-3 w-3"})})]})]})]})]}):(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:e("noDocumentsFound")})]})}),(0,ed.jsx)(tH.Dialog,{open:!!g,onOpenChange:e=>!e&&v(null),children:(0,ed.jsxs)(tH.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,ed.jsx)(tH.DialogHeader,{className:"pr-10",children:(0,ed.jsx)(tH.DialogTitle,{className:"flex items-center gap-2",children:(0,ed.jsx)("span",{className:"truncate font-mono text-sm",children:g?.id??"Document"})})}),x?(0,ed.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:e("loadingDocument")})]})}):g?(0,ed.jsxs)(tW.Tabs,{defaultValue:"general",className:"flex-1 flex flex-col overflow-hidden",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ed.jsxs)(tW.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,ed.jsxs)(tW.TabsTrigger,{value:"general",className:"flex items-center gap-1.5",children:[(0,ed.jsx)(e_,{className:"w-3.5 h-3.5"}),"General"]}),(0,ed.jsxs)(tW.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,ed.jsx)(ej.FileText,{className:"w-3.5 h-3.5"}),"Content"]}),(0,ed.jsxs)(tW.TabsTrigger,{value:"chunks",className:"flex items-center gap-1.5",onClick:()=>{!z&&g?.id&&J(g.id)},children:[(0,ed.jsx)(tY,{className:"w-3.5 h-3.5"}),"Chunks",z?` (${L})`:""]})]}),(0,ed.jsxs)(f2.DropdownMenu,{children:[(0,ed.jsx)(f2.DropdownMenuTrigger,{asChild:!0,children:(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:H,"aria-label":t("actions"),children:(0,ed.jsx)(pS,{className:"h-4 w-4"})})}),(0,ed.jsxs)(f2.DropdownMenuContent,{align:"end",children:[(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:ee,disabled:H,children:[(0,ed.jsx)(eV,{className:"h-4 w-4 mr-2"}),"Reprocess"]}),(0,ed.jsx)(f2.DropdownMenuSeparator,{}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>{X({id:g.id,memoryCount:g.memory_unit_count})},className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ed.jsx)(pj,{className:"h-4 w-4 mr-2"}),e("deleteButton")]})]})]})]}),(0,ed.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ed.jsx)(tW.TabsContent,{value:"content",className:"mt-0",children:void 0!==g.original_text&&(E?(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("div",{className:"flex items-center justify-end mb-2",children:(0,ed.jsxs)("div",{className:"flex gap-2",children:[(0,ed.jsxs)(eA.Button,{size:"sm",onClick:er,disabled:A||!M.trim(),className:"h-7 px-3 gap-1 text-xs",children:[A?(0,ed.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,ed.jsx)(tB.Check,{className:"h-3 w-3"}),e("saveButton")]}),(0,ed.jsxs)(eA.Button,{variant:"outline",size:"sm",onClick:()=>{T(!1),O("")},disabled:A,className:"h-7 px-3 gap-1 text-xs",children:[(0,ed.jsx)(tF.X,{className:"h-3 w-3"}),e("cancelButton")]})]})}),(0,ed.jsx)("textarea",{value:M,onChange:e=>O(e.target.value),className:"w-full min-h-[400px] max-h-[600px] p-4 bg-muted/50 rounded-lg border border-border text-sm font-mono leading-relaxed text-card-foreground resize-y",autoFocus:!0}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:e("saveHint")})]}):(0,ed.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)(ej.FileText,{className:"w-3.5 h-3.5"}),(0,ed.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:e("storedContent")}),(0,ed.jsxs)("span",{className:"text-muted-foreground/70",children:["·"," ",g.original_text?.length?.toLocaleString()??0," chars"]})]}),(0,ed.jsxs)(eA.Button,{variant:"ghost",size:"sm",onClick:()=>{O(g?.original_text??""),T(!0)},className:"h-6 px-2 gap-1 text-xs",children:[(0,ed.jsx)(pk,{className:"h-3 w-3"}),e("editButton")]})]}),(0,ed.jsx)("pre",{className:"p-4 text-[11px] leading-5 text-foreground/80 whitespace-pre-wrap font-mono",children:g.original_text})]}))}),(0,ed.jsx)(tW.TabsContent,{value:"general",className:"mt-0",children:(0,ed.jsxs)("div",{className:"space-y-4",children:[(0,ed.jsxs)(tW.Tabs,{defaultValue:"world",className:"flex flex-col",children:[(0,ed.jsxs)(tW.TabsList,{className:"w-fit",children:[(0,ed.jsx)(tW.TabsTrigger,{value:"world",children:"World"}),(0,ed.jsx)(tW.TabsTrigger,{value:"experience",children:"Experience"}),(0,ed.jsx)(tW.TabsTrigger,{value:"observation",children:"Observations"})]}),(0,ed.jsxs)("div",{className:"mt-2",children:[(0,ed.jsx)(tW.TabsContent,{value:"world",className:"mt-0",children:(0,ed.jsx)(f0,{factType:"world",documentId:g.id,compact:!0})}),(0,ed.jsx)(tW.TabsContent,{value:"experience",className:"mt-0",children:(0,ed.jsx)(f0,{factType:"experience",documentId:g.id,compact:!0})}),(0,ed.jsx)(tW.TabsContent,{value:"observation",className:"mt-0",children:(0,ed.jsx)(f0,{factType:"observation",documentId:g.id,compact:!0})})]})]}),(0,ed.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ed.jsxs)(pO,{title:"Document",icon:(0,ed.jsx)(ej.FileText,{className:"w-3.5 h-3.5"}),children:[g.created_at&&(0,ed.jsx)(pA,{label:e("labelCreated"),value:new Date(g.created_at).toLocaleString()}),g.updated_at&&(0,ed.jsx)(pA,{label:e("labelUpdated"),value:new Date(g.updated_at).toLocaleString()}),g.original_text&&(0,ed.jsx)(pA,{label:e("colSize"),value:pE(new Blob([g.original_text]).size)}),(0,ed.jsx)(pA,{label:e("labelTags"),value:N?(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)(eD.Input,{value:k,onChange:e=>S(e.target.value),placeholder:e("tagsInputPlaceholder"),className:"text-sm h-7 w-64",onKeyDown:e=>{"Enter"===e.key&&ei(),"Escape"===e.key&&en()},autoFocus:!0}),(0,ed.jsx)(eA.Button,{size:"sm",onClick:ei,disabled:C,className:"h-7 w-7 p-0",children:C?(0,ed.jsx)("span",{className:"animate-spin text-xs",children:"⏳"}):(0,ed.jsx)(tB.Check,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:en,disabled:C,className:"h-7 w-7 p-0",children:(0,ed.jsx)(tF.X,{className:"h-3 w-3"})})]}):(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[g.tags&&g.tags.length>0?(0,ed.jsx)("div",{className:"flex flex-wrap gap-1.5",children:g.tags.map((e,t)=>(0,ed.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t))}):(0,ed.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"none"}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",onClick:()=>{S((g?.tags??[]).join(", ")),j(!0)},className:"h-6 w-6 p-0",children:(0,ed.jsx)(pk,{className:"h-3 w-3"})})]})}),g.retain_params?.context&&(0,ed.jsx)(pA,{label:"Context",value:g.retain_params.context}),g.retain_params?.event_date&&(0,ed.jsx)(pA,{label:e("labelEventDate"),value:new Date(g.retain_params.event_date).toLocaleString()}),g.retain_params?.metadata&&Object.keys(g.retain_params.metadata).length>0&&(0,ed.jsx)(pA,{label:"Metadata",value:(0,ed.jsx)(pT,{metadata:g.retain_params.metadata})})]}),(0,ed.jsx)(pO,{title:e("memoryCompositionTitle"),icon:(0,ed.jsx)(eW,{className:"w-3.5 h-3.5"}),children:(0,ed.jsx)(pD,{nodesByFactType:g.nodes_by_fact_type})})]})]})}),(0,ed.jsx)(tW.TabsContent,{value:"chunks",className:"mt-0",children:B?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:e("loadingChunks")})]})}):P.length>0?(0,ed.jsx)("div",{className:"rounded-lg border border-border overflow-hidden divide-y divide-border",children:P.map(e=>(0,ed.jsx)(pI,{chunk:e},e.chunk_id))}):z?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:e("noChunksFound")})]})}):(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsx)("div",{className:"text-center",children:(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:e("clickChunksTabToLoad")})})})})]})]}):null]})}),(0,ed.jsx)(f8,{open:!!G,onOpenChange:e=>!e&&X(null),children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:e("deleteDialogTitle")}),(0,ed.jsxs)(pb,{children:[e("deleteDialogDescription")," ",(0,ed.jsxs)("span",{className:"font-mono font-semibold",children:['"',G?.id,'"']}),"?",(0,ed.jsx)("br",{}),(0,ed.jsx)("br",{}),e("deleteDialogWillDelete")," ",G?.memoryCount!==void 0?(0,ed.jsx)("span",{className:"font-semibold",children:e("deleteDialogMemoryUnits",{count:G.memoryCount})}):e("deleteDialogAllMemoryUnits")," ",e("deleteDialogExtracted"),(0,ed.jsx)("br",{}),(0,ed.jsx)("br",{}),(0,ed.jsx)("span",{className:"text-destructive font-semibold",children:e("deleteDialogCannotUndo")})]})]}),(0,ed.jsxs)(px,{children:[(0,ed.jsx)(pN,{children:e("cancelButton")}),(0,ed.jsx)(pw,{onClick:et,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:e("deleteButton")})]})]})}),(0,ed.jsx)(f8,{open:!!$,onOpenChange:e=>!e&&q(null),children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:$?.success?e("deleteResultSuccessTitle"):e("deleteResultErrorTitle")}),(0,ed.jsx)(pb,{children:$?.message})]}),(0,ed.jsx)(px,{children:(0,ed.jsx)(pw,{onClick:()=>q(null),children:e("okButton")})})]})}),(0,ed.jsx)(f8,{open:!!W,onOpenChange:e=>!e&&Y(null),children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:W?.success?"Reprocessing Started":e("deleteResultErrorTitle")}),(0,ed.jsx)(pb,{children:W?.message})]}),(0,ed.jsx)(px,{children:(0,ed.jsx)(pw,{onClick:()=>Y(null),children:e("okButton")})})]})})]})}function pR(){let e=(0,ep.useTranslations)("entitiesView"),{currentBank:t}=(0,ev.useBank)(),[n,r]=(0,eh.useState)([]),[i,a]=(0,eh.useState)(!1),[o,s]=(0,eh.useState)(null),[l,c]=(0,eh.useState)(!1),[u,d]=(0,eh.useState)("relations"),[h,f]=(0,eh.useState)(null),[p,g]=(0,eh.useState)(!1),[v,x]=(0,eh.useState)(1),[y,b]=(0,eh.useState)(0),w=Math.ceil(y/50),N=(v-1)*50,j=async(e=1)=>{if(t){a(!0);try{let n=await eO.client.listEntities({bank_id:t,limit:50,offset:(e-1)*50});r(n.items||[]),b(n.total||0)}catch(e){}finally{a(!1)}}},k=async e=>{if(t){c(!0);try{let n=await eO.client.getEntity(e,t);s(n)}catch(e){}finally{c(!1)}}},S=e=>{x(e),j(e)},C=(0,eh.useCallback)(async()=>{if(t){g(!0);try{let e=await eO.client.getEntityGraph({bank_id:t,limit:2e3,min_count:1});f(e)}catch(e){}finally{g(!1)}}},[t]);(0,eh.useEffect)(()=>{t&&(x(1),j(1),s(null),f(null))},[t]),(0,eh.useEffect)(()=>{"relations"!==u||!t||h||p||C()},[u,t,h,p,C]);let _=(0,eh.useMemo)(()=>h?hY(h):{nodes:[],links:[]},[h]),E=(0,eh.useMemo)(()=>{let e=new Map;for(let t of _.links){let n="number"==typeof t.weight&&t.weight>0?t.weight:1;e.set(t.source,(e.get(t.source)||0)+n),e.set(t.target,(e.get(t.target)||0)+n)}return e},[_]),T=(0,eh.useMemo)(()=>{let e=1;for(let t of E.values())t>e&&(e=t);return e},[E]),M=(0,eh.useCallback)(e=>3+11*Math.sqrt((E.get(e.id)||0)/T),[E,T]),O=(0,eh.useMemo)(()=>{let e=h?.edges||[];if(!e.length)return null;let t=new Map,n=1/0,r=-1/0;for(let i of e){let e=i.data.lastCooccurred;if(!e)continue;let a=Date.parse(e);if(!Number.isNaN(a)){for(let e of[i.data.source,i.data.target]){let n=t.get(e);(void 0===n||a>n)&&t.set(e,a)}a<n&&(n=a),a>r&&(r=a)}}return Number.isFinite(n)&&Number.isFinite(r)&&r!==n?{times:t,minT:n,maxT:r}:null},[h]),A=(0,eh.useCallback)(e=>{if(!O)return .5;let t=O.times.get(e.id);return void 0===t?0:(t-O.minT)/(O.maxT-O.minT)},[O]),D=(0,eh.useCallback)(e=>{k(e.id)},[t]),P=t=>t?new Date(t).toLocaleDateString():e("na");return(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"mb-4 flex items-center justify-end",children:(0,ed.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ed.jsxs)("button",{onClick:()=>d("relations"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"relations"===u?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ed.jsx)(fQ,{className:"w-4 h-4"}),e("viewRelations")]}),(0,ed.jsxs)("button",{onClick:()=>d("list"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"list"===u?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ed.jsx)(eY,{className:"w-4 h-4"}),e("viewList")]})]})}),"relations"===u&&(0,ed.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:p?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:e("loadingEntityGraph")})]})}):_.nodes.length>0?(0,ed.jsx)(fK,{data:_,height:700,onNodeClick:D,nodeSizeFn:M,nodeHeatFn:O?A:void 0,heatLegendLabel:O?e("heatLegendLabel"):void 0,heatLegendEndpoints:O?[new Date(O.minT).toISOString().slice(0,10),new Date(O.maxT).toISOString().slice(0,10)]:void 0,sizeLegendLabel:e("sizeLegendLabel"),compactLabels:!0}):(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:e("noCooccurrences")}),(0,ed.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:e("noCooccurrencesDescription")})]})})}),"list"===u&&(0,ed.jsx)("div",{children:i?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:e("loadingEntities")})]})}):n.length>0?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("div",{className:"mb-4 text-sm text-muted-foreground",children:e("entityCount",{count:y})}),(0,ed.jsx)("div",{className:"overflow-x-auto",children:(0,ed.jsxs)(eG,{children:[(0,ed.jsx)(eX,{children:(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eK,{children:e("colName")}),(0,ed.jsx)(eK,{children:e("colMentions")}),(0,ed.jsx)(eK,{children:e("colFirstSeen")}),(0,ed.jsx)(eK,{children:e("colLastSeen")})]})}),(0,ed.jsx)(e$,{children:n.map(e=>(0,ed.jsxs)(eq,{onClick:()=>k(e.id),className:`cursor-pointer hover:bg-muted/50 ${o?.id===e.id?"bg-primary/10":""}`,children:[(0,ed.jsx)(eZ,{className:"font-medium text-card-foreground",children:e.canonical_name}),(0,ed.jsx)(eZ,{className:"text-card-foreground",children:e.mention_count}),(0,ed.jsx)(eZ,{className:"text-card-foreground",children:P(e.first_seen)}),(0,ed.jsx)(eZ,{className:"text-card-foreground",children:P(e.last_seen)})]},e.id))})]})}),w>1&&(0,ed.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ed.jsxs)("div",{className:"text-xs text-muted-foreground",children:[N+1,"-",Math.min(N+50,y)," of ",y]}),(0,ed.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>S(1),disabled:1===v||i,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eR,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>S(v-1),disabled:1===v||i,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eS,{className:"h-3 w-3"})}),(0,ed.jsxs)("span",{className:"text-xs px-2",children:[v," / ",w]}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>S(v+1),disabled:v===w||i,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eC.ChevronRight,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>S(w),disabled:v===w||i,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eB,{className:"h-3 w-3"})})]})]})]}):(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsxs)("div",{className:"text-center",children:[(0,ed.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:e("noEntitiesFound")}),(0,ed.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:e("noEntitiesDescription")})]})})}),o&&(0,ed.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l-2 border-primary shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:(0,ed.jsxs)("div",{className:"p-5",children:[(0,ed.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-xl font-bold text-card-foreground",children:o.canonical_name}),(0,ed.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:e("entityDetails")})]}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",onClick:()=>s(null),className:"h-8 w-8 p-0",children:(0,ed.jsx)("span",{className:"text-lg",children:"x"})})]}),(0,ed.jsxs)("div",{className:"space-y-5",children:[(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ed.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:e("mentionsLabel")}),(0,ed.jsx)("div",{className:"text-lg font-semibold text-card-foreground",children:o.mention_count})]}),(0,ed.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:e("firstSeenLabel")}),(0,ed.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:P(o.first_seen)})]})]}),(0,ed.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ed.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:e("entityIdLabel")}),(0,ed.jsx)("code",{className:"text-xs font-mono break-all text-muted-foreground",children:o.id})]})]})]})})]})}var pB=e.i(32089);let pF=["world","experience","observation"],pz={world:{active:"bg-violet-500/15 text-violet-700 border-violet-400 dark:text-violet-300 dark:border-violet-500",inactive:"border-border text-muted-foreground hover:border-violet-300 hover:text-violet-600 dark:hover:text-violet-400",dot:"bg-violet-500"},experience:{active:"bg-pink-500/15 text-pink-700 border-pink-400 dark:text-pink-300 dark:border-pink-500",inactive:"border-border text-muted-foreground hover:border-pink-300 hover:text-pink-600 dark:hover:text-pink-400",dot:"bg-pink-500"},observation:{active:"bg-indigo-500/15 text-indigo-700 border-indigo-400 dark:text-indigo-300 dark:border-indigo-500",inactive:"border-border text-muted-foreground hover:border-indigo-300 hover:text-indigo-600 dark:hover:text-indigo-400",dot:"bg-indigo-500"}};function pV({ft:e,active:t,onToggle:n}){let r=(0,ep.useTranslations)("factTypeFilter"),i=pz[e];return(0,ed.jsxs)("button",{type:"button",onClick:n,className:(0,eE.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-all",t?i.active:i.inactive),children:[(0,ed.jsx)("span",{className:(0,eE.cn)("h-1.5 w-1.5 rounded-full",t?i.dot:"bg-muted-foreground/50")}),r(e)]})}function pH({value:e,onChange:t,label:n}){let r=(0,ep.useTranslations)("factTypeFilter"),i=n??r("defaultLabel");return(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[i&&(0,ed.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:i}),(0,ed.jsx)("div",{className:"flex gap-1.5",children:pF.map(n=>(0,ed.jsx)(pV,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})]})}function pU({value:e,onChange:t}){return(0,ed.jsx)("div",{className:"flex flex-wrap gap-1.5",children:pF.map(n=>(0,ed.jsx)(pV,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})}var pW=e.i(73104),pY=e.i(52571);let pG=(0,eb.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),pX=(0,eb.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),p$=(0,eb.default)("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"}]]),pq=(0,eb.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var pK=e.i(1864);"function"==typeof SuppressedError&&SuppressedError;var pZ=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}},pQ={"text/plain":"Text","text/html":"Url",default:"Text"},pJ=function(e,t){var n,r,i,a,o,s,l,c,u=!1;t||(t={}),i=t.debug||!1;try{if(o=pZ(),s=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=pQ[t.format]||pQ.default;window.clipboardData.setData(r,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),l.addRange(s),!document.execCommand("copy"))throw Error("copy command was unsuccessful");u=!0}catch(o){i&&console.error("unable to copy using execCommand: ",o),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(o){i&&console.error("unable to copy using clipboardData: ",o),i&&console.error("falling back to prompt"),n="message"in t?t.message:"Copy to clipboard: #{key}, Enter",r=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",a=n.replace(/#{\s*key\s*}/g,r),window.prompt(a,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(s):l.removeAllRanges()),c&&document.body.removeChild(c),o()}return u};function p0(e){return"[object Object]"===Object.prototype.toString.call(e)}function p1(e){return Array.isArray(e)?e.length:p0(e)?Object.keys(e).length:0}function p2(e,t,n,r,i,a){if(a&&void 0!==a.collapsed)return!!a.collapsed;if("boolean"==typeof r)return r;if("number"==typeof r&&t>r)return!0;let o=p1(e);if("function"==typeof r){let i=p4(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||p0(e)&&o>i)}function p5(e,t,n,r,i,a){if(a&&void 0!==a.collapsed)return!!a.collapsed;if("boolean"==typeof r)return r;if("number"==typeof r&&t>r)return!0;let o=Math.ceil(e.length/100);if("function"==typeof r){let i=p4(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||p0(e)&&o>i)}function p3(e,t,n){return"boolean"==typeof e?e:"number"==typeof e&&!!(t>e)||"collapsed"===e&&!!n||"expanded"===e&&!n}function p4(e,t){try{return e(...t)}catch(e){reportError(e)}}function p6(e){if(!0===e||p0(e)&&!0===e.add)return!0}function p7(e){if(!0===e||p0(e)&&!0===e.edit)return!0}function p9(e){if(!0===e||p0(e)&&!0===e.delete)return!0}function p8(e){return!e||void 0===e.add||!!e.add}function me(e){return!e||void 0===e.edit||!!e.edit}function mt(e){return!e||void 0===e.delete||!!e.delete}function mn(e){return!e||void 0===e.enableClipboard||!!e.enableClipboard}function mr(){return(mr=Object.assign.bind()).apply(this,arguments)}var mi=function(e){return eh.createElement("svg",mr({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),x||(x=eh.createElement("path",{fill:"currentColor",d:"M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"})))};function ma(){return(ma=Object.assign.bind()).apply(this,arguments)}var mo=function(e){return eh.createElement("svg",ma({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),y||(y=eh.createElement("path",{fill:"currentColor",d:"M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"})))};function ms(){return(ms=Object.assign.bind()).apply(this,arguments)}var ml=function(e){return eh.createElement("svg",ms({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),b||(b=eh.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"})),w||(w=eh.createElement("path",{fill:"#14C786",d:"M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"})))};function mc({node:e,nodeMeta:t}){let{customizeCopy:n,CopyComponent:r,CopiedComponent:i}=(0,eh.useContext)(mT),[a,o]=(0,eh.useState)(!1),s=r=>{r.stopPropagation();let i=n(e,t);"string"==typeof i&&i&&function(e){var t,n,r,i;t=this,n=void 0,r=void 0,i=function*(){try{yield navigator.clipboard.writeText(e)}catch(t){pJ(e)}},new(r||(r=Promise))(function(e,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(o,s)}l((i=i.apply(t,n||[])).next())})}(i),o(!0),setTimeout(()=>o(!1),3e3)};return a?"function"==typeof i?(0,ed.jsx)(i,{className:"json-view--copy",style:{display:"inline-block"}}):(0,ed.jsx)(ml,{className:"json-view--copy",style:{display:"inline-block"}}):"function"==typeof r?(0,ed.jsx)(r,{onClick:s,className:"json-view--copy"}):(0,ed.jsx)(mo,{onClick:s,className:"json-view--copy"})}function mu({indexOrName:e,value:t,depth:n,deleteHandle:r,editHandle:i,parent:a,parentPath:o}){let{displayArrayIndex:s}=(0,eh.useContext)(mT),l=Array.isArray(a);return(0,ed.jsxs)("div",Object.assign({className:"json-view--pair"},{children:[!l||l&&s?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("span",Object.assign({className:"number"==typeof e?"json-view--index":"json-view--property"},{children:e})),":"," "]}):(0,ed.jsx)(ed.Fragment,{}),(0,ed.jsx)(m_,{node:t,depth:n+1,deleteHandle:(e,t)=>r(e,t),editHandle:(e,t,n,r)=>i(e,t,n,r),parent:a,indexOrName:e,parentPath:o})]}))}function md(){return(md=Object.assign.bind()).apply(this,arguments)}var mh=function(e){return eh.createElement("svg",md({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),N||(N=eh.createElement("path",{fill:"currentColor",d:"M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"})),j||(j=eh.createElement("path",{fill:"#DA0000",d:"M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"})))};function mf(){return(mf=Object.assign.bind()).apply(this,arguments)}var mp=function(e){return eh.createElement("svg",mf({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),k||(k=eh.createElement("path",{fill:"currentColor",d:"M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"})),S||(S=eh.createElement("path",{fill:"#14C786",d:"M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"})))};function mm(){return(mm=Object.assign.bind()).apply(this,arguments)}var mg=function(e){return eh.createElement("svg",mm({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),C||(C=eh.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})),_||(_=eh.createElement("path",{fill:"#14C786",d:"m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"})))};function mv(){return(mv=Object.assign.bind()).apply(this,arguments)}var mx=function(e){return eh.createElement("svg",mv({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),E||(E=eh.createElement("path",{fill:"#DA0000",d:"M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"})),T||(T=eh.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})))};function my({originNode:e,node:t,depth:n,index:r,deleteHandle:i,customOptions:a,startIndex:o,parent:s,parentPath:l}){let{enableClipboard:c,src:u,onEdit:d,onChange:h,forceUpdate:f,displaySize:p,CustomOperation:g}=(0,eh.useContext)(mT),v=[...l,String(r)],[x,y]=(0,eh.useState)(!0),b=(0,eh.useCallback)((t,r,i)=>{e[t]=r,d&&d({newValue:r,oldValue:i,depth:n,src:u,indexOrName:t,parentType:"array",parentPath:l}),h&&h({type:"edit",depth:n,src:u,indexOrName:t,parentType:"array",parentPath:l}),f()},[t,d,h,f]),w=t=>{e.splice(t,1),i&&i(t,l),f()},N=(0,ed.jsxs)(ed.Fragment,{children:[!x&&(0,ed.jsxs)("span",Object.assign({onClick:()=>y(!0),className:"jv-size-chevron"},{children:[p3(p,n,x)&&(0,ed.jsxs)("span",Object.assign({className:"jv-size"},{children:[p1(t)," Items"]})),(0,ed.jsx)(mi,{className:"jv-chevron"})]})),!x&&c&&mn(a)&&(0,ed.jsx)(mc,{node:t,nodeMeta:{depth:n,indexOrName:r,parent:s,parentPath:l,currentPath:v}}),"function"==typeof g?(0,ed.jsx)(g,{node:t}):null]});return(0,ed.jsxs)("div",{children:[(0,ed.jsx)("span",{children:"["}),N,x?(0,ed.jsxs)("button",Object.assign({onClick:()=>y(!1),className:"jv-button"},{children:[o," ... ",o+t.length-1]})):(0,ed.jsx)("div",Object.assign({className:"jv-indent"},{children:t.map((e,i)=>(0,ed.jsx)(mu,{indexOrName:i+o,value:e,depth:n,parent:t,deleteHandle:w,editHandle:b,parentPath:l},String(r)+String(i)))})),(0,ed.jsx)("span",{children:"]"})]})}function mb({node:e,depth:t,deleteHandle:n,indexOrName:r,customOptions:i,parent:a,parentPath:o}){let s=void 0!==r?[...o,String(r)]:o,l=[];for(let t=0;t<e.length;t+=100)l.push(e.slice(t,t+100));let{collapsed:c,enableClipboard:u,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,CustomOperation:v,onChange:x,forceUpdate:y,displaySize:b}=(0,eh.useContext)(mT),[w,N]=(0,eh.useState)(p5(e,t,r,c,d,i));(0,eh.useEffect)(()=>{N(p5(e,t,r,c,d,i))},[c,d]);let[j,k]=(0,eh.useState)(!1),[S,C]=(0,eh.useState)(!1),_=()=>{e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),x&&x({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),y()},E=j||S,T=(0,ed.jsxs)(ed.Fragment,{children:[!w&&!E&&(0,ed.jsxs)("span",Object.assign({onClick:()=>N(!0),className:"jv-size-chevron"},{children:[p3(b,t,w)&&(0,ed.jsxs)("span",Object.assign({className:"jv-size"},{children:[e.length," Items"]})),(0,ed.jsx)(mi,{className:"jv-chevron"})]})),E&&(0,ed.jsx)(mg,{className:"json-view--edit",style:{display:"inline-block"},onClick:S?_:()=>{k(!1),n&&n(r,o),f&&f({value:e,depth:t,src:p,indexOrName:r,parentType:"array",parentPath:o}),x&&x({type:"delete",depth:t,src:p,indexOrName:r,parentType:"array",parentPath:o})}}),E&&(0,ed.jsx)(mx,{className:"json-view--edit",style:{display:"inline-block"},onClick:()=>{k(!1),C(!1)}}),!w&&!E&&u&&mn(i)&&(0,ed.jsx)(mc,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:a,parentPath:o,currentPath:s}}),!w&&!E&&p6(h)&&p8(i)&&(0,ed.jsx)(mp,{className:"json-view--edit",onClick:()=>{_()}}),!w&&!E&&p9(h)&&mt(i)&&n&&(0,ed.jsx)(mh,{className:"json-view--edit",onClick:()=>k(!0)}),"function"==typeof v?(0,ed.jsx)(v,{node:e}):null]});return(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("span",{children:"["}),T,w?(0,ed.jsx)("button",Object.assign({onClick:()=>N(!1),className:"jv-button"},{children:"..."})):(0,ed.jsx)("div",Object.assign({className:"jv-indent"},{children:l.map((a,s)=>(0,ed.jsx)(my,{originNode:e,node:a,depth:t,index:s,startIndex:100*s,deleteHandle:n,customOptions:i,parentPath:o},String(r)+String(s)))})),(0,ed.jsx)("span",{children:"]"}),w&&p3(b,t,w)&&(0,ed.jsxs)("span",Object.assign({onClick:()=>N(!1),className:"jv-size"},{children:[e.length," Items"]}))]})}function mw({node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parent:a,parentPath:o}){let{collapsed:s,onCollapse:l,enableClipboard:c,ignoreLargeArray:u,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,onEdit:v,onChange:x,forceUpdate:y,displaySize:b,CustomOperation:w}=(0,eh.useContext)(mT),N=void 0!==n?[...o,String(n)]:o;if(!u&&Array.isArray(e)&&e.length>100)return(0,ed.jsx)(mb,{node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parentPath:N});let j=p0(e),[k,S]=(0,eh.useState)(p2(e,t,n,s,d,i)),C=r=>{null==l||l({isCollapsing:!r,node:e,depth:t,indexOrName:n}),S(r)};(0,eh.useEffect)(()=>{C(p2(e,t,n,s,d,i))},[s,d]);let _=(0,eh.useCallback)((n,r,i)=>{Array.isArray(e)?e[+n]=r:e&&(e[n]=r),v&&v({newValue:r,oldValue:i,depth:t,src:p,indexOrName:n,parentType:j?"object":"array",parentPath:N}),x&&x({type:"edit",depth:t,src:p,indexOrName:n,parentType:j?"object":"array",parentPath:N}),y()},[e,v,x,y]),E=t=>{Array.isArray(e)?e.splice(+t,1):e&&delete e[t],y()},[T,M]=(0,eh.useState)(!1),[O,A]=(0,eh.useState)(!1),D=(0,eh.useRef)(null),P=()=>{var n;if(j){let r=null==(n=D.current)?void 0:n.value;r&&(e[r]=null,D.current&&(D.current.value=""),A(!1),g&&g({indexOrName:r,depth:t,src:p,parentType:"object",parentPath:N}),x&&x({type:"add",indexOrName:r,depth:t,src:p,parentType:"object",parentPath:N}))}else Array.isArray(e)&&(e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:N}),x&&x({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:N}));y()},I=T||O,L=()=>{M(!1),A(!1)},R=(0,ed.jsxs)(ed.Fragment,{children:[!k&&!I&&(0,ed.jsxs)("span",Object.assign({onClick:()=>C(!0),className:"jv-size-chevron"},{children:[p3(b,t,k)&&(0,ed.jsxs)("span",Object.assign({className:"jv-size"},{children:[p1(e)," Items"]})),(0,ed.jsx)(mi,{className:"jv-chevron"})]})),O&&j&&(0,ed.jsx)("input",{className:"json-view--input",placeholder:"property",ref:D,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),P()):"Escape"===e.key&&L()}}),I&&(0,ed.jsx)(mg,{className:"json-view--edit",style:{display:"inline-block"},onClick:O?P:()=>{M(!1),r&&r(n,N),f&&f({value:e,depth:t,src:p,indexOrName:n,parentType:j?"object":"array",parentPath:N}),x&&x({type:"delete",depth:t,src:p,indexOrName:n,parentType:j?"object":"array",parentPath:N})}}),I&&(0,ed.jsx)(mx,{className:"json-view--edit",style:{display:"inline-block"},onClick:L}),!k&&!I&&c&&mn(i)&&(0,ed.jsx)(mc,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:a,parentPath:o,currentPath:N}}),!k&&!I&&p6(h)&&p8(i)&&(0,ed.jsx)(mp,{className:"json-view--edit",onClick:()=>{j?(A(!0),setTimeout(()=>{var e;return null==(e=D.current)?void 0:e.focus()})):P()}}),!k&&!I&&p9(h)&&mt(i)&&r&&(0,ed.jsx)(mh,{className:"json-view--edit",onClick:()=>M(!0)}),"function"==typeof w?(0,ed.jsx)(w,{node:e}):null]});return Array.isArray(e)?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("span",{children:"["}),R,k?(0,ed.jsx)("button",Object.assign({onClick:()=>C(!1),className:"jv-button"},{children:"..."})):(0,ed.jsx)("div",Object.assign({className:"jv-indent"},{children:e.map((r,i)=>(0,ed.jsx)(mu,{indexOrName:i,value:r,depth:t,parent:e,deleteHandle:E,editHandle:_,parentPath:N},String(n)+String(i)))})),(0,ed.jsx)("span",{children:"]"}),k&&p3(b,t,k)&&(0,ed.jsxs)("span",Object.assign({onClick:()=>C(!1),className:"jv-size"},{children:[p1(e)," Items"]}))]}):j?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("span",{children:"{"}),R,k?(0,ed.jsx)("button",Object.assign({onClick:()=>C(!1),className:"jv-button"},{children:"..."})):(0,ed.jsx)("div",Object.assign({className:"jv-indent"},{children:Object.entries(e).map(([r,i])=>(0,ed.jsx)(mu,{indexOrName:r,value:i,depth:t,parent:e,deleteHandle:E,editHandle:_,parentPath:N},String(n)+String(r)))})),(0,ed.jsx)("span",{children:"}"}),k&&p3(b,t,k)&&(0,ed.jsxs)("span",Object.assign({onClick:()=>C(!1),className:"jv-size"},{children:[p1(e)," Items"]}))]}):(0,ed.jsx)("span",{children:String(e)})}let mN=eh.default.forwardRef(({str:e,className:t,ctrlClick:n},r)=>{let{collapseStringMode:i,collapseStringsAfterLength:a,customizeCollapseStringUI:o}=(0,eh.useContext)(mT),[s,l]=(0,eh.useState)(!0),c=(0,eh.useRef)(null);a=a>0?a:0;let u=e.replace(/\s+/g," "),d="function"==typeof o?o(u,s):"string"==typeof o?o:"...",h=e=>{var t;if((e.ctrlKey||e.metaKey)&&n)n(e);else{let e=window.getSelection();if(e&&e.anchorOffset!==e.focusOffset&&(null==(t=e.anchorNode)?void 0:t.parentElement)===c.current)return;l(!s)}};if(e.length<=a)return(0,ed.jsxs)("span",Object.assign({ref:c,className:t,onClick:n},{children:['"',e,'"']}));if("address"===i)return e.length<=10?(0,ed.jsxs)("span",Object.assign({ref:c,className:t,onClick:n},{children:['"',e,'"']})):(0,ed.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[u.slice(0,6),d,u.slice(-4)]:e,'"']}));if("directly"===i)return(0,ed.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[u.slice(0,a),d]:e,'"']}));if("word"===i){let n=a,r=a+1,i=u,o=1;for(;;){if(/\W/.test(e[n])){i=e.slice(0,n);break}if(/\W/.test(e[r])){i=e.slice(0,r);break}if(6===o){i=e.slice(0,a);break}o++,n--,r++}return(0,ed.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[i,d]:e,'"']}))}return(0,ed.jsxs)("span",Object.assign({ref:c,className:t},{children:['"',e,'"']}))});function mj(){return(mj=Object.assign.bind()).apply(this,arguments)}var mk=function(e){return eh.createElement("svg",mj({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),M||(M=eh.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"})))};function mS(){return(mS=Object.assign.bind()).apply(this,arguments)}var mC=function(e){return eh.createElement("svg",mS({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),O||(O=eh.createElement("path",{fill:"currentColor",d:"M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"})),A||(A=eh.createElement("path",{fill:"currentColor",d:"M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"})))};function m_({node:e,depth:t,deleteHandle:n,indexOrName:r,parent:i,editHandle:a,parentPath:o}){let s,{collapseStringsAfterLength:l,enableClipboard:c,editable:u,src:d,onDelete:h,onChange:f,customizeNode:p,matchesURL:g,urlRegExp:v,EditComponent:x,DoneComponent:y,CancelComponent:b,CustomOperation:w}=(0,eh.useContext)(mT);if("function"==typeof p&&(s=p4(p,[{node:e,depth:t,indexOrName:r}])),s){if((0,eh.isValidElement)(s))return s;else if("function"==typeof s){let n=s;return(0,ed.jsx)(n,{node:e,depth:t,indexOrName:r})}}if(Array.isArray(e)||p0(e))return(0,ed.jsx)(mw,{parent:i,node:e,depth:t,indexOrName:r,deleteHandle:n,parentPath:o,customOptions:"object"==typeof s?s:void 0});{var N;let p=typeof e,j=void 0!==r?[...o,String(r)]:o,[k,S]=(0,eh.useState)(!1),[C,_]=(0,eh.useState)(!1),E=(0,eh.useRef)(null),T=()=>{S(!0),setTimeout(()=>{var e,t;null==(e=window.getSelection())||e.selectAllChildren(E.current),null==(t=E.current)||t.focus()})},M=(0,eh.useCallback)(()=>{let t=E.current.innerText;try{let n=JSON.parse(t);a&&a(r,n,e,o)}catch(i){let n="string"===p?t.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):t;a&&a(r,n,e,o)}S(!1)},[a,r,e,o,p]),O=()=>{S(!1),_(!1)},A=()=>{_(!1),n&&n(r,o),h&&h({value:e,depth:t,src:d,indexOrName:r,parentType:Array.isArray(i)?"array":"object",parentPath:o}),f&&f({depth:t,src:d,indexOrName:r,parentType:Array.isArray(i)?"array":"object",type:"delete",parentPath:o})},D=(0,eh.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),M()):"Escape"===e.key&&O()},[M]),P=k||C,I=!P&&p7(u)&&me(s)&&a?e=>{(e.ctrlKey||e.metaKey)&&T()}:void 0,L=(0,ed.jsxs)(ed.Fragment,{children:[P&&("function"==typeof y?(0,ed.jsx)(y,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?A:M}):(0,ed.jsx)(mg,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?A:M})),P&&("function"==typeof b?(0,ed.jsx)(b,{className:"json-view--edit",style:{display:"inline-block"},onClick:O}):(0,ed.jsx)(mx,{className:"json-view--edit",style:{display:"inline-block"},onClick:O})),!P&&c&&mn(s)&&(0,ed.jsx)(mc,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:i,parentPath:o,currentPath:j}}),!P&&g&&"string"===p&&v.test(e)&&(!(N=s)||void 0===N.matchesURL||!!N.matchesURL)&&(0,ed.jsx)("a",Object.assign({href:e,target:"_blank",className:"json-view--link"},{children:(0,ed.jsx)(mC,{})})),!P&&p7(u)&&me(s)&&a&&("function"==typeof x?(0,ed.jsx)(x,{className:"json-view--edit",onClick:T}):(0,ed.jsx)(mk,{className:"json-view--edit",onClick:T})),!P&&p9(u)&&mt(s)&&n&&(0,ed.jsx)(mh,{className:"json-view--edit",onClick:()=>_(!0)}),"function"==typeof w?(0,ed.jsx)(w,{node:e}):null]}),R="json-view--string";switch(p){case"number":case"bigint":R="json-view--number";break;case"boolean":R="json-view--boolean";break;case"object":R="json-view--null"}"string"==typeof(null==s?void 0:s.className)&&(R+=" "+s.className),C&&(R+=" json-view--deleting");let B=String(e);"bigint"===p&&(B+="n");let F=(0,eh.useMemo)(()=>(0,ed.jsx)("span",{contentEditable:!0,className:R,dangerouslySetInnerHTML:{__html:"string"===p?`"${B}"`:B},ref:E,onKeyDown:D}),[B,p,D]);return"string"===p?(0,ed.jsxs)(ed.Fragment,{children:[k?F:e.length>l?(0,ed.jsx)(mN,{str:e,ref:E,className:R,ctrlClick:I}):(0,ed.jsxs)("span",Object.assign({className:R,onClick:I},{children:['"',B,'"']})),L]}):(0,ed.jsxs)(ed.Fragment,{children:[k?F:(0,ed.jsx)("span",Object.assign({className:R,onClick:I},{children:B})),L]})}}let mE=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,mT=(0,eh.createContext)({src:void 0,collapseStringsAfterLength:99,collapseStringMode:"directly",customizeCollapseStringUI:void 0,collapseObjectsAfterLength:20,collapsed:!1,onCollapse:void 0,enableClipboard:!0,editable:!1,onEdit:void 0,onDelete:void 0,onAdd:void 0,onChange:void 0,forceUpdate:()=>{},customizeNode:void 0,customizeCopy:()=>{},displaySize:void 0,displayArrayIndex:!0,matchesURL:!1,urlRegExp:mE,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function mM({src:e,collapseStringsAfterLength:t=99,collapseStringMode:n="directly",customizeCollapseStringUI:r,collapseObjectsAfterLength:i=99,collapsed:a,onCollapse:o,enableClipboard:s=!0,editable:l=!1,onEdit:c,onDelete:u,onAdd:d,onChange:h,dark:f=!1,theme:p="default",customizeNode:g,customizeCopy:v=e=>(function(e){if("string"==typeof e)return e;try{return JSON.stringify(e,(e,t)=>{switch(typeof t){case"bigint":return String(t)+"n";case"number":case"boolean":case"object":case"string":return t;default:return String(t)}},void 0)}catch(e){return`${e.name}: ${e.message}`||"JSON.stringify failed"}})(e),displaySize:x,displayArrayIndex:y=!0,style:b,className:w,matchesURL:N=!1,urlRegExp:j=mE,ignoreLargeArray:k=!1,CopyComponent:S,CopiedComponent:C,EditComponent:_,CancelComponent:E,DoneComponent:T,CustomOperation:M}){let[O,A]=(0,eh.useState)(0),D=(0,eh.useCallback)(()=>A(e=>++e),[]),[P,I]=(0,eh.useState)(e);return(0,eh.useEffect)(()=>I(e),[e]),(0,ed.jsx)(mT.Provider,Object.assign({value:{src:P,collapseStringsAfterLength:t,collapseStringMode:n,customizeCollapseStringUI:r,collapseObjectsAfterLength:i,collapsed:a,onCollapse:o,enableClipboard:s,editable:l,onEdit:c,onDelete:u,onAdd:d,onChange:h,forceUpdate:D,customizeNode:g,customizeCopy:v,displaySize:x,displayArrayIndex:y,matchesURL:N,urlRegExp:j,ignoreLargeArray:k,CopyComponent:S,CopiedComponent:C,EditComponent:_,CancelComponent:E,DoneComponent:T,CustomOperation:M}},{children:(0,ed.jsx)("code",Object.assign({className:"json-view"+(f?" dark":"")+(p&&"default"!==p?" json-view_"+p:"")+(w?" "+w:""),style:b},{children:(0,ed.jsx)(m_,{node:P,depth:1,editHandle:(e,t,n,r)=>{I(t),c&&c({newValue:t,oldValue:n,depth:1,src:P,indexOrName:e,parentType:null,parentPath:r}),h&&h({type:"edit",depth:1,src:P,indexOrName:e,parentType:null,parentPath:r})},deleteHandle:(e,t)=>{I(void 0),u&&u({value:P,depth:1,src:P,indexOrName:e,parentType:null,parentPath:t}),h&&h({depth:1,src:P,indexOrName:e,parentType:null,type:"delete",parentPath:t})},parentPath:[]})}))}))}var tz=tz;let mO=(0,eb.default)("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"}]]),mA=(0,eb.default)("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]);function mD(){}function mP(){}let mI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mR={};function mB(e,t){return((t||mR).jsx?mL:mI).test(e)}let mF=/[ \t\n\f\r]/g;function mz(e){return""===e.replace(mF,"")}class mV{constructor(e,t){this.attribute=t,this.property=e}}mV.prototype.attribute="",mV.prototype.booleanish=!1,mV.prototype.boolean=!1,mV.prototype.commaOrSpaceSeparated=!1,mV.prototype.commaSeparated=!1,mV.prototype.defined=!1,mV.prototype.mustUseProperty=!1,mV.prototype.number=!1,mV.prototype.overloadedBoolean=!1,mV.prototype.property="",mV.prototype.spaceSeparated=!1,mV.prototype.space=void 0;let mH=0,mU=mK(),mW=mK(),mY=mK(),mG=mK(),mX=mK(),m$=mK(),mq=mK();function mK(){return 2**++mH}e.s(["boolean",0,mU,"booleanish",0,mW,"commaOrSpaceSeparated",0,mq,"commaSeparated",0,m$,"number",0,mG,"overloadedBoolean",0,mY,"spaceSeparated",0,mX],744);var mZ=e.i(744);let mQ=Object.keys(mZ);class mJ extends mV{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<mQ.length;){const e=mQ[i];!function(e,t,n){n&&(e[t]=n)}(this,mQ[i],(n&mZ[e])===mZ[e])}}}function m0(e){return e.toLowerCase()}mJ.prototype.defined=!0;let m1=/[A-Z]/g,m2=/-[a-z]/g,m5=/^data[-\w.:]+$/i;function m3(e){return"-"+e.toLowerCase()}function m4(e){return e.charAt(1).toUpperCase()}let m6={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"};class m7{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function m9(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new m7(n,r,t)}function m8(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new mJ(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[m0(r)]=r,n[m0(a.attribute)]=r}return new m7(t,n,e.space)}m7.prototype.normal={},m7.prototype.property={},m7.prototype.space=void 0;let ge=m8({properties:{ariaActiveDescendant:null,ariaAtomic:mW,ariaAutoComplete:null,ariaBusy:mW,ariaChecked:mW,ariaColCount:mG,ariaColIndex:mG,ariaColSpan:mG,ariaControls:mX,ariaCurrent:null,ariaDescribedBy:mX,ariaDetails:null,ariaDisabled:mW,ariaDropEffect:mX,ariaErrorMessage:null,ariaExpanded:mW,ariaFlowTo:mX,ariaGrabbed:mW,ariaHasPopup:null,ariaHidden:mW,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:mX,ariaLevel:mG,ariaLive:null,ariaModal:mW,ariaMultiLine:mW,ariaMultiSelectable:mW,ariaOrientation:null,ariaOwns:mX,ariaPlaceholder:null,ariaPosInSet:mG,ariaPressed:mW,ariaReadOnly:mW,ariaRelevant:null,ariaRequired:mW,ariaRoleDescription:mX,ariaRowCount:mG,ariaRowIndex:mG,ariaRowSpan:mG,ariaSelected:mW,ariaSetSize:mG,ariaSort:null,ariaValueMax:mG,ariaValueMin:mG,ariaValueNow:mG,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function gt(e,t){return t in e?e[t]:t}function gn(e,t){return gt(e,t.toLowerCase())}let gr=m8({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:m$,acceptCharset:mX,accessKey:mX,action:null,allow:null,allowFullScreen:mU,allowPaymentRequest:mU,allowUserMedia:mU,alt:null,as:null,async:mU,autoCapitalize:null,autoComplete:mX,autoFocus:mU,autoPlay:mU,blocking:mX,capture:null,charSet:null,checked:mU,cite:null,className:mX,cols:mG,colSpan:null,content:null,contentEditable:mW,controls:mU,controlsList:mX,coords:mG|m$,crossOrigin:null,data:null,dateTime:null,decoding:null,default:mU,defer:mU,dir:null,dirName:null,disabled:mU,download:mY,draggable:mW,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:mU,formTarget:null,headers:mX,height:mG,hidden:mY,high:mG,href:null,hrefLang:null,htmlFor:mX,httpEquiv:mX,id:null,imageSizes:null,imageSrcSet:null,inert:mU,inputMode:null,integrity:null,is:null,isMap:mU,itemId:null,itemProp:mX,itemRef:mX,itemScope:mU,itemType:mX,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:mU,low:mG,manifest:null,max:null,maxLength:mG,media:null,method:null,min:null,minLength:mG,multiple:mU,muted:mU,name:null,nonce:null,noModule:mU,noValidate:mU,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:mU,optimum:mG,pattern:null,ping:mX,placeholder:null,playsInline:mU,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:mU,referrerPolicy:null,rel:mX,required:mU,reversed:mU,rows:mG,rowSpan:mG,sandbox:mX,scope:null,scoped:mU,seamless:mU,selected:mU,shadowRootClonable:mU,shadowRootDelegatesFocus:mU,shadowRootMode:null,shape:null,size:mG,sizes:null,slot:null,span:mG,spellCheck:mW,src:null,srcDoc:null,srcLang:null,srcSet:null,start:mG,step:null,style:null,tabIndex:mG,target:null,title:null,translate:null,type:null,typeMustMatch:mU,useMap:null,value:mW,width:mG,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:mX,axis:null,background:null,bgColor:null,border:mG,borderColor:null,bottomMargin:mG,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:mU,declare:mU,event:null,face:null,frame:null,frameBorder:null,hSpace:mG,leftMargin:mG,link:null,longDesc:null,lowSrc:null,marginHeight:mG,marginWidth:mG,noResize:mU,noHref:mU,noShade:mU,noWrap:mU,object:null,profile:null,prompt:null,rev:null,rightMargin:mG,rules:null,scheme:null,scrolling:mW,standby:null,summary:null,text:null,topMargin:mG,valueType:null,version:null,vAlign:null,vLink:null,vSpace:mG,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:mU,disableRemotePlayback:mU,prefix:null,property:null,results:mG,security:null,unselectable:null},space:"html",transform:gn}),gi=m8({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:mq,accentHeight:mG,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:mG,amplitude:mG,arabicForm:null,ascent:mG,attributeName:null,attributeType:null,azimuth:mG,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:mG,by:null,calcMode:null,capHeight:mG,className:mX,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:mG,diffuseConstant:mG,direction:null,display:null,dur:null,divisor:mG,dominantBaseline:null,download:mU,dx:null,dy:null,edgeMode:null,editable:null,elevation:mG,enableBackground:null,end:null,event:null,exponent:mG,externalResourcesRequired:null,fill:null,fillOpacity:mG,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:m$,g2:m$,glyphName:m$,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:mG,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:mG,horizOriginX:mG,horizOriginY:mG,id:null,ideographic:mG,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:mG,k:mG,k1:mG,k2:mG,k3:mG,k4:mG,kernelMatrix:mq,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:mG,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:mG,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:mG,overlineThickness:mG,paintOrder:null,panose1:null,path:null,pathLength:mG,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:mX,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:mG,pointsAtY:mG,pointsAtZ:mG,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:mq,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:mq,rev:mq,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:mq,requiredFeatures:mq,requiredFonts:mq,requiredFormats:mq,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:mG,specularExponent:mG,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:mG,strikethroughThickness:mG,string:null,stroke:null,strokeDashArray:mq,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:mG,strokeOpacity:mG,strokeWidth:null,style:null,surfaceScale:mG,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:mq,tabIndex:mG,tableValues:null,target:null,targetX:mG,targetY:mG,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:mq,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:mG,underlineThickness:mG,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:mG,values:null,vAlphabetic:mG,vMathematical:mG,vectorEffect:null,vHanging:mG,vIdeographic:mG,version:null,vertAdvY:mG,vertOriginX:mG,vertOriginY:mG,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:mG,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:gt}),ga=m8({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),go=m8({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gn}),gs=m8({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),gl=m9([ge,gr,ga,go,gs],"html"),gc=m9([ge,gi,ga,go,gs],"svg");var gu=e.i(15511);let gd=gf("end"),gh=gf("start");function gf(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function gp(e){return e&&"object"==typeof e?"position"in e||"type"in e?gg(e.position):"start"in e||"end"in e?gg(e):"line"in e||"column"in e?gm(e):"":""}function gm(e){return gv(e&&e.line)+":"+gv(e&&e.column)}function gg(e){return gm(e&&e.start)+"-"+gm(e&&e.end)}function gv(e){return e&&"number"==typeof e?e:1}class gx extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},a=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.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=r,this.line=o?o.line:void 0,this.name=gp(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=a&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gx.prototype.file="",gx.prototype.name="",gx.prototype.reason="",gx.prototype.message="",gx.prototype.stack="",gx.prototype.column=void 0,gx.prototype.line=void 0,gx.prototype.ancestors=void 0,gx.prototype.cause=void 0,gx.prototype.fatal=void 0,gx.prototype.place=void 0,gx.prototype.ruleId=void 0,gx.prototype.source=void 0;let gy={}.hasOwnProperty,gb=new Map,gw=/[A-Z]/g,gN=new Set(["table","tbody","thead","tfoot","tr"]),gj=new Set(["td","th"]),gk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gS(e,t,n){var r,i,a,o,s,l,c,u,d;let h,f,p,g,v,x,y,b,w,N,j;return"element"===t.type?(r=e,i=t,a=n,f=h=r.schema,"svg"===i.tagName.toLowerCase()&&"html"===h.space&&(r.schema=gc),r.ancestors.push(i),p=gT(r,i.tagName,!1),g=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&gy.call(t.properties,r)){let a=function(e,t,n){let r=function(e,t){let n=m0(t),r=t,i=mV;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&m5.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(m2,m4);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!m2.test(e)){let n=e.replace(m1,m3);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=mJ}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){var i;let t;if(Array.isArray(n)&&(n=r.commaSeparated?(t={},(""===(i=n)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,gu.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new gx("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=gk+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)gy.call(e,t)&&(n[function(e){let t=e.replace(gw,gO);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?m6[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(a){let[r,o]=a;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof o&&gj.has(t.tagName)?n=o:i[r]=o}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(r,i),v=gE(r,i),gN.has(i.tagName)&&(v=v.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&mz(e.value):mz(e))})),gC(r,g,p,i),g_(g,v),r.ancestors.pop(),r.schema=h,r.create(i,p,g,a)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return mD("ExpressionStatement"===n.type),e.evaluater.evaluateExpression(n.expression)}gM(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=n,y=x=o.schema,"svg"===s.name&&"html"===x.space&&(o.schema=gc),o.ancestors.push(s),b=null===s.name?o.Fragment:gT(o,s.name,!0),w=function(e,t){let n={};for(let r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];mD("ExpressionStatement"===t.type);let i=t.expression;mD("ObjectExpression"===i.type);let a=i.properties[0];mD("SpreadElement"===a.type),Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else gM(e,t.position);else{let i,a=r.name;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];mD("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else gM(e,t.position);else i=null===r.value||r.value;n[a]=i}return n}(o,s),N=gE(o,s),gC(o,w,b,s),g_(w,N),o.ancestors.pop(),o.schema=x,o.create(s,b,w,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);gM(e,t.position)}(e,t):"root"===t.type?(c=e,u=t,d=n,g_(j={},gE(c,u)),c.create(u,c.Fragment,j,d)):"text"===t.type?t.value:void 0}function gC(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function g_(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function gE(e,t){let n=[],r=-1,i=e.passKeys?new Map:gb;for(;++r<t.children.length;){let a,o=t.children[r];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=i.get(e)||0;a=e+"-"+t,i.set(e,t+1)}}let s=gS(e,o,a);void 0!==s&&n.push(s)}return n}function gT(e,t,n){let r;if(n)if(t.includes(".")){let e,n=t.split("."),i=-1;for(;++i<n.length;){let t=mB(n[i])?{type:"Identifier",name:n[i]}:{type:"Literal",value:n[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}mD(e,"always a result"),r=e}else r=mB(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){let t=r.value;return gy.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);gM(e)}function gM(e,t){let n=new gx("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=gk+"#cannot-handle-mdx-estrees-without-createevaluater",n}function gO(e){return"-"+e.toLowerCase()}let gA={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"]},gD={};function gP(e,t){let n=t||gD;return gI(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function gI(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return gL(e.children,t,n)}return Array.isArray(e)?gL(e,t,n):""}function gL(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=gI(e[i],t,n);return r.join("")}function gR(e,t,n,r){let i,a=e.length,o=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)(i=r.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function gB(e,t){return e.length>0?(gR(e,e.length,0,t),e):t}let gF={}.hasOwnProperty;function gz(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(gF.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];if(a)for(r in a){gF.call(i,r)||(i[r]=[]);let e=a[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);gR(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}function gV(e){return null!==e&&e<-2}function gH(e){return -2===e||-1===e||32===e}function gU(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function gW(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return gH(r)?(e.enter(n),function r(o){return gH(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}gU(/[A-Za-z]/),gU(/[\dA-Za-z]/),gU(/[#-'*+\--9=?A-Z^-~]/),gU(/\d/),gU(/[\dA-Fa-f]/),gU(/[!-/:-@[-`{-~]/),gU(/\p{P}|\p{S}/u),gU(/\s/);let gY={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),gW(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return gV(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},gG={tokenize:function(e){let t,n,r,i=this,a=[],o=0;return s;function s(t){if(o<a.length){let n=a[o];return i.containerState=n[1],e.attempt(n[0].continuation,l,c)(t)}return c(t)}function l(e){if(o++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&x();let r=i.events.length,a=r;for(;a--;)if("exit"===i.events[a][0]&&"chunkFlow"===i.events[a][1].type){n=i.events[a][1].end;break}v(o);let s=r;for(;s<i.events.length;)i.events[s][1].end={...n},s++;return gR(i.events,a+1,0,i.events.slice(r)),i.events.length=s,c(e)}return s(e)}function c(n){if(o===a.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return p(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(gX,u,d)(n)}function u(e){return t&&x(),v(o),h(e)}function d(e){return i.parser.lazy[i.now().line]=o!==a.length,r=i.now().offset,p(e)}function h(t){return i.containerState={},e.attempt(gX,f,p)(t)}function f(e){return o++,a.push([i.currentConstruct,i.containerState]),h(e)}function p(r){if(null===r){t&&x(),v(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){g(e.exit("chunkFlow"),!0),v(0),e.consume(n);return}return gV(n)?(e.consume(n),g(e.exit("chunkFlow")),o=0,i.interrupt=void 0,s):(e.consume(n),t)}(r)}function g(e,a){let s=i.sliceStream(e);if(a&&s.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(s),i.parser.lazy[e.start.line]){let e,n,a=t.events.length;for(;a--;)if(t.events[a][1].start.offset<r&&(!t.events[a][1].end||t.events[a][1].end.offset>r))return;let s=i.events.length,l=s;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(v(o),a=s;a<i.events.length;)i.events[a][1].end={...n},a++;gR(i.events,l+1,0,i.events.slice(s)),i.events.length=a}}function v(t){let n=a.length;for(;n-- >t;){let t=a[n];i.containerState=t[1],t[0].exit.call(i,e)}a.length=t}function x(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},gX={tokenize:function(e,t,n){return gW(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},g$=g5(/[A-Za-z]/),gq=g5(/[\dA-Za-z]/),gK=g5(/[#-'*+\--9=?A-Z^-~]/),gZ=g5(/\d/),gQ=g5(/[\dA-Fa-f]/),gJ=g5(/[!-/:-@[-`{-~]/);function g0(e){return null!==e&&e<-2}function g1(e){return null!==e&&(e<0||32===e)}function g2(e){return -2===e||-1===e||32===e}function g5(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function g3(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return g2(r)?(e.enter(n),function r(o){return g2(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}g5(/\p{P}|\p{S}/u),g5(/\s/);let g4={partial:!0,tokenize:function(e,t,n){return function(t){return g2(t)?g3(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||g0(e)?t(e):n(e)}}};class g6{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&g7(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),g7(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),g7(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);g7(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);g7(this.left,t.reverse())}}}function g7(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 g9(e){let t,n,r,i,a,o,s,l={},c=-1,u=new g6(e);for(;++c<u.length;){for(;c in l;)c=l[c];if(t=u.get(c),c&&"chunkFlow"===t[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&((r=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[r][1].type&&(r+=2),r<o.length&&"content"===o[r][1].type))for(;++r<o.length&&"content"!==o[r][1].type;)"chunkText"===o[r][1].type&&(o[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],a=e.get(t)[2],o=t-1,s=[],l=i._tokenizer;!l&&(l=a.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let c=l.events,u=[],d={},h=-1,f=i,p=0,g=0,v=[0];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),!f._tokenizer&&(n=a.sliceStream(f),f.next||n.push(null),r&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=f,f=f.next}for(f=i;++h<c.length;)"exit"===c[h][0]&&"enter"===c[h-1][0]&&c[h][1].type===c[h-1][1].type&&c[h][1].start.line!==c[h][1].end.line&&(g=h+1,v.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),h=v.length;h--;){let t=c.slice(v[h],v[h+1]),n=s.pop();u.push([n,n+t.length-1]),e.splice(n,2,t)}for(u.reverse(),h=-1;++h<u.length;)d[p+u[h][0]]=p+u[h][1],p+=u[h][1]-u[h][0]-1;return d}(u,c)),c=l[c],s=!0);else if(t[1]._container){for(r=c,n=void 0;r--;)if("lineEnding"===(i=u.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(u.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...u.get(n)[1].start},(a=u.slice(n,c)).unshift(t),u.splice(n,c-n+1,a))}}return gR(e,0,1/0,u.slice(0)),!s}let g8={resolve:function(e){return g9(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):g0(t)?e.check(ve,a,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function a(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},ve={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),g3(e,i,"linePrefix")};function i(i){if(null===i||g0(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},vt={tokenize:function(e){let t=this,n=e.attempt(g4,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,gW(e,e.attempt(this.parser.constructs.flow,r,e.attempt(g8,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},vn={resolveAll:vo()},vr=va("string"),vi=va("text");function va(e){return{resolveAll:vo("text"===e?vs:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function vo(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function vs(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],a=t.sliceStream(i),o=a.length,s=-1,l=0;for(;o--;){let e=a[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let a={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):(e.splice(n,0,["enter",a,t],["exit",a,t]),n+=2)}n++}return e}vu(/[A-Za-z]/),vu(/[\dA-Za-z]/),vu(/[#-'*+\--9=?A-Z^-~]/),vu(/\d/),vu(/[\dA-Fa-f]/),vu(/[!-/:-@[-`{-~]/);let vl=vu(/\p{P}|\p{S}/u),vc=vu(/\s/);function vu(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function vd(e){return null===e||null!==e&&(e<0||32===e)||vc(e)?1:vl(e)?2:void 0}function vh(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}let vf={name:"attention",resolveAll:function(e,t){let n,r,i,a,o,s,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close){for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;let d={...e[n][1].end},h={...e[u][1].start};vp(d,-s),vp(h,s),a={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:h},i={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:s>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[n][1].end={...a.start},e[u][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=gB(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=gB(l,[["enter",r,t],["enter",a,t],["exit",a,t],["enter",i,t]]),l=gB(l,vh(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=gB(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=gB(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,gR(e,n-1,u-n+3,l),u=n+l.length-c-2;break}}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,a=vd(i);return function(o){return n=o,e.enter("attentionSequence"),function o(s){if(s===n)return e.consume(s),o;let l=e.exit("attentionSequence"),c=vd(s),u=!c||2===c&&a||r.includes(s),d=!a||2===a&&c||r.includes(i);return l._open=!!(42===n?u:u&&(a||!d)),l._close=!!(42===n?d:d&&(c||!u)),t(s)}(o)}}};function vp(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let vm={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return g2(t)?g3(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(vm,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return g2(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},vg={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return gJ(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},vv=document.createElement("i");function vx(e){let t="&"+e+";";vv.innerHTML=t;let n=vv.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let vy={name:"characterReference",tokenize:function(e,t,n){let r,i,a=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=gq,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=gQ,c):(e.enter("characterReferenceValue"),r=7,i=gZ,c(t))}function c(s){if(59===s&&o){let r=e.exit("characterReferenceValue");return i!==gq||vx(a.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(s)}return i(s)&&o++<r?(e.consume(s),c):n(s)}}},vb={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},vw={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,a={partial:!0,tokenize:function(e,t,n){let a=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),g2(t)?g3(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a>=s?(e.exit("codeFencedFenceSequence"),g2(i)?g3(e,c,"whitespace")(i):c(i)):n(i)}(t)):n(t)}function c(r){return null===r||g0(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},o=0,s=0;return function(t){var a;let c;return a=t,o=(c=i.events[i.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,r=a,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(s++,e.consume(i),t):s<3?n(i):(e.exit("codeFencedFenceSequence"),g2(i)?g3(e,l,"whitespace")(i):l(i))}(a)};function l(a){return null===a||g0(a)?(e.exit("codeFencedFence"),i.interrupt?t(a):e.check(vb,u,p)(a)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||g0(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):g2(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g3(e,c,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(a))}function c(t){return null===t||g0(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||g0(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function u(t){return e.attempt(a,p,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return o>0&&g2(t)?g3(e,f,"linePrefix",o+1)(t):f(t)}function f(t){return null===t||g0(t)?e.check(vb,u,p)(t):(e.enter("codeFlowValue"),function t(n){return null===n||g0(n)?(e.exit("codeFlowValue"),f(n)):(e.consume(n),t)}(t))}function p(n){return e.exit("codeFenced"),t(n)}}},vN={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),g3(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?a(n):g0(n)?e.attempt(vj,t,a)(n):(e.enter("codeFlowValue"),function n(r){return null===r||g0(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function a(n){return e.exit("codeIndented"),t(n)}}},vj={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):g0(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):g3(e,a,"linePrefix",5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):g0(e)?i(e):n(e)}}};function vk(e){return null!==e&&(e<32||127===e)}function vS(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function vC(e,t,n,r,i,a,o,s,l){let c=l||1/0,u=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),d):null===t||32===t||41===t||vk(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),p(t))};function d(n){return 62===n?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(s),d(t)):null===t||60===t||null!==t&&t<-2?n(t):(e.consume(t),92===t?f:h)}function f(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function p(i){return!u&&(null===i||41===i||null!==i&&(i<0||32===i))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(i)):u<c&&40===i?(e.consume(i),u++,p):41===i?(e.consume(i),u--,p):null===i||32===i||40===i||vk(i)?n(i):(e.consume(i),92===i?g:p)}function g(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function v_(e){return null!==e&&e<-2}function vE(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function vT(e,t,n,r,i,a){let o,s=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),c};function c(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):93===d?(e.exit(a),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):v_(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||v_(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),o||(o=-2!==t&&-1!==t&&32!==t),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function vM(e){return null!==e&&e<-2}function vO(e){return -2===e||-1===e||32===e}function vA(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function vD(e,t,n,r,i,a){let o;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,s):n(t)};function s(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){if(t===o)return e.exit(a),s(o);if(null===t)return n(t);if(vM(t)){var r,i;let n,a;return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),r=l,i="linePrefix",n=1/0,a=0,function(t){return vO(t)?(e.enter(i),function t(o){return vO(o)&&a++<n?(e.consume(o),t):(e.exit(i),r(o))}(t)):r(t)}}return e.enter("chunkString",{contentType:"string"}),c(t)}function c(t){return t===o||null===t||vM(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===o||92===t?(e.consume(t),c):c(t)}}function vP(e){return -2===e||-1===e||32===e}function vI(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function vL(e,t){let n;return function r(i){var a,o;if(null!==i&&i<-2)return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r;if(vP(i)){let t,s;return(a=r,o=n?"linePrefix":"lineSuffix",t=1/0,s=0,function(n){return vP(n)?(e.enter(o),function n(r){return vP(r)&&s++<t?(e.consume(r),n):(e.exit(o),a(r))}(n)):a(n)})(i)}return t(i)}}function vR(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}vS(/[A-Za-z]/),vS(/[\dA-Za-z]/),vS(/[#-'*+\--9=?A-Z^-~]/),vS(/\d/),vS(/[\dA-Fa-f]/),vS(/[!-/:-@[-`{-~]/),vS(/\p{P}|\p{S}/u),vS(/\s/),vE(/[A-Za-z]/),vE(/[\dA-Za-z]/),vE(/[#-'*+\--9=?A-Z^-~]/),vE(/\d/),vE(/[\dA-Fa-f]/),vE(/[!-/:-@[-`{-~]/),vE(/\p{P}|\p{S}/u),vE(/\s/),vA(/[A-Za-z]/),vA(/[\dA-Za-z]/),vA(/[#-'*+\--9=?A-Z^-~]/),vA(/\d/),vA(/[\dA-Fa-f]/),vA(/[!-/:-@[-`{-~]/),vA(/\p{P}|\p{S}/u),vA(/\s/),vI(/[A-Za-z]/),vI(/[\dA-Za-z]/),vI(/[#-'*+\--9=?A-Z^-~]/),vI(/\d/),vI(/[\dA-Fa-f]/),vI(/[!-/:-@[-`{-~]/),vI(/\p{P}|\p{S}/u),vI(/\s/);let vB={partial:!0,tokenize:function(e,t,n){return function(t){return g1(t)?vL(e,r)(t):n(t)};function r(t){return vD(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return g2(t)?g3(e,a,"whitespace")(t):a(t)}function a(e){return null===e||g0(e)?t(e):n(e)}}},vF=["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"],vz=["pre","script","style","textarea"],vV={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(g4,t,n)}}},vH={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return g0(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},vU={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&gR(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,a,o=e.length,s=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){s=2;break}}else"labelEnd"===n.type&&(i=o);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},u={type:"labelText",start:{...e[r+s+2][1].end},end:{...e[i-2][1].start}};return a=gB(a=[["enter",l,t],["enter",c,t]],e.slice(r+1,r+s+3)),a=gB(a,[["enter",u,t]]),a=gB(a,vh(t.parser.constructs.insideSpan.null,e.slice(r+s+4,i-3),t)),a=gB(a,[["exit",u,t],e[i-2],e[i-1],["exit",c,t]]),a=gB(a,e.slice(i+1)),a=gB(a,[["exit",l,t]]),gR(e,r,e.length,a),e},tokenize:function(e,t,n){let r,i,a=this,o=a.events.length;for(;o--;)if(("labelImage"===a.events[o][1].type||"labelLink"===a.events[o][1].type)&&!a.events[o][1]._balanced){r=a.events[o][1];break}return function(t){return r?r._inactive?u(t):(i=a.parser.defined.includes(vR(a.sliceSerialize({start:r.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):n(t)};function s(t){return 40===t?e.attempt(vW,c,i?c:u)(t):91===t?e.attempt(vY,c,i?l:u)(t):i?c(t):u(t)}function l(t){return e.attempt(vG,c,u)(t)}function c(e){return t(e)}function u(e){return r._balanced=!0,n(e)}}},vW={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return g1(t)?vL(e,i)(t):i(t)}function i(t){return 41===t?c(t):vC(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return g1(t)?vL(e,s)(t):c(t)}function o(e){return n(e)}function s(t){return 34===t||39===t||40===t?vD(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return g1(t)?vL(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},vY={tokenize:function(e,t,n){let r=this;return function(t){return vT.call(r,e,i,a,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(vR(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function a(e){return n(e)}}},vG={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},vX={name:"labelStartImage",resolveAll:vU.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),a):n(t)}function a(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},v$={name:"labelStartLink",resolveAll:vU.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},vq={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),g3(e,t,"linePrefix")}}},vK={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(a){var o;return e.enter("thematicBreak"),r=o=a,function a(o){return o===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),g2(n)?g3(e,a,"whitespace")(n):a(n))}(o)):i>=3&&(null===o||g0(o))?(e.exit("thematicBreak"),t(o)):n(o)}(o)}}},vZ={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(g4,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,g3(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!g2(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(vJ,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,g3(e,e.attempt(vZ,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:gZ(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(vK,n,s)(t):s(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return gZ(i)&&++o<10?(e.consume(i),t):(!r.interrupt||o<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),s(i)):n(i)}(t)}return n(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(g4,r.interrupt?n:l,e.attempt(vQ,u,c))}function l(e){return r.containerState.initialBlankLine=!0,a++,u(e)}function c(t){return g2(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},vQ={partial:!0,tokenize:function(e,t,n){let r=this;return g3(e,function(e){let i=r.events[r.events.length-1];return!g2(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},vJ={partial:!0,tokenize:function(e,t,n){let r=this;return g3(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},v0={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){n=a;break}"paragraph"===e[a][1].type&&(r=a)}else"content"===e[a][1].type&&e.splice(a,1),i||"definition"!==e[a][1].type||(i=a);let o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var o;let s,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){s="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||s)?(e.enter("setextHeadingLine"),r=t,o=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),g2(n)?g3(e,a,"lineSuffix")(n):a(n))}(o)):n(t)};function a(r){return null===r||g0(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,vT.call(i,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function a(t){return(r=vR(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return g1(t)?vL(e,s)(t):s(t)}function s(t){return vC(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(vB,c,c)(t)}function c(t){return g2(t)?g3(e,u,"whitespace")(t):u(t)}function u(a){return null===a||g0(a)?(e.exit("definition"),i.parser.defined.push(r),t(a)):n(a)}}}},"disable",0,{null:[]},"document",0,{42:vZ,43:vZ,45:vZ,48:vZ,49:vZ,50:vZ,51:vZ,52:vZ,53:vZ,54:vZ,55:vZ,56:vZ,57:vZ,62:vm},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,a=3;return"whitespace"===e[3][1].type&&(a+=2),i-2>a&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(a===i-1||i-4>a&&"whitespace"===e[i-2][1].type)&&(i-=a+1===i?2:4),i>a&&(n={type:"atxHeadingText",start:e[a][1].start,end:e[i][1].end},r={type:"chunkText",start:e[a][1].start,end:e[i][1].end,contentType:"text"},gR(e,a,i-a+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var a;return e.enter("atxHeading"),a=i,e.enter("atxHeadingSequence"),function i(a){return 35===a&&r++<6?(e.consume(a),i):null===a||g1(a)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||g0(r)?(e.exit("atxHeading"),t(r)):g2(r)?g3(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||g1(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(a)):n(a)}(a)}}},42:vK,45:[v0,vK],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(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},tokenize:function(e,t,n){let r,i,a,o,s,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(o){return 33===o?(e.consume(o),u):47===o?(e.consume(o),i=!0,f):63===o?(e.consume(o),r=3,l.interrupt?t:D):g$(o)?(e.consume(o),a=String.fromCharCode(o),p):n(o)}function u(i){return 45===i?(e.consume(i),r=2,d):91===i?(e.consume(i),r=5,o=0,h):g$(i)?(e.consume(i),r=4,l.interrupt?t:D):n(i)}function d(r){return 45===r?(e.consume(r),l.interrupt?t:D):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(o++)?(e.consume(r),o===i.length)?l.interrupt?t:S:h:n(r)}function f(t){return g$(t)?(e.consume(t),a=String.fromCharCode(t),p):n(t)}function p(o){if(null===o||47===o||62===o||g1(o)){let s=47===o,c=a.toLowerCase();return!s&&!i&&vz.includes(c)?(r=1,l.interrupt?t(o):S(o)):vF.includes(a.toLowerCase())?(r=6,s)?(e.consume(o),g):l.interrupt?t(o):S(o):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(o):i?function t(n){return g2(n)?(e.consume(n),t):j(n)}(o):v(o))}return 45===o||gq(o)?(e.consume(o),a+=String.fromCharCode(o),p):n(o)}function g(r){return 62===r?(e.consume(r),l.interrupt?t:S):n(r)}function v(t){return 47===t?(e.consume(t),j):58===t||95===t||g$(t)?(e.consume(t),x):g2(t)?(e.consume(t),v):j(t)}function x(t){return 45===t||46===t||58===t||95===t||gq(t)?(e.consume(t),x):y(t)}function y(t){return 61===t?(e.consume(t),b):g2(t)?(e.consume(t),y):v(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),s=t,w):g2(t)?(e.consume(t),b):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||g1(n)?y(n):(e.consume(n),t)}(t)}function w(t){return t===s?(e.consume(t),s=null,N):null===t||g0(t)?n(t):(e.consume(t),w)}function N(e){return 47===e||62===e||g2(e)?v(e):n(e)}function j(t){return 62===t?(e.consume(t),k):n(t)}function k(t){return null===t||g0(t)?S(t):g2(t)?(e.consume(t),k):n(t)}function S(t){return 45===t&&2===r?(e.consume(t),T):60===t&&1===r?(e.consume(t),M):62===t&&4===r?(e.consume(t),P):63===t&&3===r?(e.consume(t),D):93===t&&5===r?(e.consume(t),A):g0(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(vV,I,C)(t)):null===t||g0(t)?(e.exit("htmlFlowData"),C(t)):(e.consume(t),S)}function C(t){return e.check(vH,_,I)(t)}function _(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),E}function E(t){return null===t||g0(t)?C(t):(e.enter("htmlFlowData"),S(t))}function T(t){return 45===t?(e.consume(t),D):S(t)}function M(t){return 47===t?(e.consume(t),a="",O):S(t)}function O(t){if(62===t){let n=a.toLowerCase();return vz.includes(n)?(e.consume(t),P):S(t)}return g$(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),O):S(t)}function A(t){return 93===t?(e.consume(t),D):S(t)}function D(t){return 62===t?(e.consume(t),P):45===t&&2===r?(e.consume(t),D):S(t)}function P(t){return null===t||g0(t)?(e.exit("htmlFlowData"),I(t)):(e.consume(t),P)}function I(n){return e.exit("htmlFlow"),t(n)}}},61:v0,95:vK,96:vw,126:vw},"flowInitial",0,{[-2]:vN,[-1]:vN,32:vN},"insideSpan",0,{null:[vf,vn]},"string",0,{38:vy,92:vg},"text",0,{[-5]:vq,[-4]:vq,[-3]:vq,33:vX,38:vy,42:vf,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return g$(t)?(e.consume(t),a):64===t?n(t):s(t)}function a(t){return 43===t||45===t||46===t||gq(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,o):(43===n||45===n||46===n||gq(n))&&r++<32?(e.consume(n),t):(r=0,s(n))}(t)):s(t)}function o(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||null!==r&&(r<32||127===r)?n(r):(e.consume(r),o)}function s(t){return 64===t?(e.consume(t),l):gK(t)?(e.consume(t),s):n(t)}function l(i){return gq(i)?function i(a){return 46===a?(e.consume(a),r=0,l):62===a?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(a),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(a){if((45===a||gq(a))&&r++<63){let n=45===a?t:i;return e.consume(a),n}return n(a)}(a)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,a,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),w):63===t?(e.consume(t),y):g$(t)?(e.consume(t),j):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,f):g$(t)?(e.consume(t),x):n(t)}function c(t){return 45===t?(e.consume(t),h):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):g0(t)?(a=u,O(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),h):u(t)}function h(e){return 62===e?M(e):45===e?d(e):u(e)}function f(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?p:f):n(t)}function p(t){return null===t?n(t):93===t?(e.consume(t),g):g0(t)?(a=p,O(t)):(e.consume(t),p)}function g(t){return 93===t?(e.consume(t),v):p(t)}function v(t){return 62===t?M(t):93===t?(e.consume(t),v):p(t)}function x(t){return null===t||62===t?M(t):g0(t)?(a=x,O(t)):(e.consume(t),x)}function y(t){return null===t?n(t):63===t?(e.consume(t),b):g0(t)?(a=y,O(t)):(e.consume(t),y)}function b(e){return 62===e?M(e):y(e)}function w(t){return g$(t)?(e.consume(t),N):n(t)}function N(t){return 45===t||gq(t)?(e.consume(t),N):function t(n){return g0(n)?(a=t,O(n)):g2(n)?(e.consume(n),t):M(n)}(t)}function j(t){return 45===t||gq(t)?(e.consume(t),j):47===t||62===t||g1(t)?k(t):n(t)}function k(t){return 47===t?(e.consume(t),M):58===t||95===t||g$(t)?(e.consume(t),S):g0(t)?(a=k,O(t)):g2(t)?(e.consume(t),k):M(t)}function S(t){return 45===t||46===t||58===t||95===t||gq(t)?(e.consume(t),S):function t(n){return 61===n?(e.consume(n),C):g0(n)?(a=t,O(n)):g2(n)?(e.consume(n),t):k(n)}(t)}function C(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,_):g0(t)?(a=C,O(t)):g2(t)?(e.consume(t),C):(e.consume(t),E)}function _(t){return t===r?(e.consume(t),r=void 0,T):null===t?n(t):g0(t)?(a=_,O(t)):(e.consume(t),_)}function E(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||g1(t)?k(t):(e.consume(t),E)}function T(e){return 47===e||62===e||g1(e)?k(e):n(e)}function M(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function O(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A}function A(t){return g2(t)?g3(e,D,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):D(t)}function D(t){return e.enter("htmlTextData"),a(t)}}}],91:v$,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return g0(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},vg],93:vU,95:vf,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),a++,t):(e.exit("codeTextSequence"),o(n))}(t)};function o(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),r=0,function n(o){return 96===o?(e.consume(o),r++,n):r===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",s(o))}(l)):g0(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||g0(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var v1=e.i(4127);let v2=/[\0\t\n\r]/g;function v5(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let v3=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function v4(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return v5(n.slice(t?2:1),t?16:10)}return vx(n)||e}let v6={}.hasOwnProperty;function v7(e){return{line:e.line,column:e.column,offset:e.offset}}function v9(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+gp({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+gp({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+gp({start:t.start,end:t.end})+") is still open")}function v8(e){let t=this;t.parser=function(n){var r,i;let a,o,s,l;return"string"!=typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(x),autolinkProtocol:c,autolinkEmail:c,atxHeading:r(p),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:r(f),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(f,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:c,data:c,codeFlowValue:c,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(g),hardBreakTrailing:r(g),htmlFlow:r(v,i),htmlFlowData:c,htmlText:r(v,i),htmlTextData:c,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(x),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(y),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(p),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){u.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){u.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:u,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=v5(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=vx(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=v7(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:u,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:u,data:u,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=vR(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:u,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:u,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(v3,v4),n.identifier=vR(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=v7(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(c.call(this,e),u.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=vR(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(v6.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},o={stack:[r],tokenStack:[],config:t,enter:a,exit:s,buffer:i,resume:l,data:n},c=[],u=-1;for(;++u<e.length;)("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)&&("enter"===e[u][0]?c.push(u):u=function(e,t,n){let r,i,a,o,s=t-1,l=-1,c=!1;for(;++s<=n;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||a||(a=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=s;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}a&&(!i||a<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||s,0,["exit",r,t[2]]),s++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(s,0,["enter",i,t[2]]),s++,n++,a=void 0,o=!0}}}return e[t][1]._spread=c,n}(e,c.pop(),u));for(u=-1;++u<e.length;){let n=t[e[u][0]];v6.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},o),e[u][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||v9).call(o,void 0,e[0])}for(r.position={start:v7(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:v7(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)r=t.transforms[u](r)||r;return r};function r(e,t){return function(n){a.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:v7(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||v9).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+gp({start:e.start,end:e.end})+"): it’s not open");n.position.end=v7(e.end)}function l(){return gP(this.stack.pop())}function c(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:v7(e.start),end:void 0},t.push(n)),this.stack.push(n)}function u(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=v7(e.end)}function d(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function p(){return{type:"heading",depth:0,children:[]}}function g(){return{type:"break"}}function v(){return{type:"html",value:""}}function x(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!g9(e););return e}((function(e){let t={constructs:gz([v1,...(e||{}).extensions||[]]),content:n(gY),defined:[],document:n(gG),flow:n(vt),lazy:{},string:n(vr),text:n(vi)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],l={attempt:p(function(e,t){g(e,t.from)}),check:p(f),consume:function(e){gV(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),c.events.push(["enter",n,c]),s.push(n),n},exit:function(e){let t=s.pop();return t.end=h(),c.events.push(["exit",t,c]),t},interrupt:p(f,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let a,o=e[r];if("string"==typeof o)a=o;else switch(o){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":" ";break;case -1:if(!t&&n)continue;a=" ";break;default:a=String.fromCharCode(o)}n=-2===o,i.push(a)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=gB(o,e),function(){let e;for(;r._index<o.length;){let n=o[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),u=u(t)}else u=u(n)}}(),null!==o[o.length-1])?[]:(g(t,0),c.events=vh(a,c.events,c),c.events)}},u=t.tokenize.call(c,l);return t.resolveAll&&a.push(t),c;function d(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;if(r===a)n=[e[r].slice(i,o)];else{if(n=e.slice(r,a),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}o>0&&n.push(e[a].slice(0,o))}return n}(o,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function f(e,t){t.restore()}function p(e,t){return function(n,i,a){var o;let u,d,f,p;return Array.isArray(n)?g(n):"tokenize"in n?g([n]):(o=n,function(e){let t=null!==e&&o[e],n=null!==e&&o.null;return g([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function g(e){return(u=e,d=0,0===e.length)?a:x(e[d])}function x(e){return function(n){let i,a,o,u,d;return(i=h(),a=c.previous,o=c.currentConstruct,u=c.events.length,d=Array.from(s),p={from:u,restore:function(){r=i,c.previous=a,c.currentConstruct=o,c.events.length=u,s=d,v()}},f=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?b(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,y,b)(n)}}function y(t){return e(f,p),i}function b(e){return(p.restore(),++d<u.length)?x(u[d]):a}}}function g(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&gR(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((o=1,s="",l=!0,function(e,t,n){let r,i,c,u,d,h=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),c=0,s="",l&&(65279===e.charCodeAt(0)&&c++,l=void 0);c<e.length;){if(v2.lastIndex=c,u=(r=v2.exec(e))&&void 0!==r.index?r.index:e.length,d=e.charCodeAt(u),!r){s=e.slice(c);break}if(10===d&&c===u&&a)h.push(-3),a=void 0;else switch(a&&(h.push(-5),a=void 0),c<u&&(h.push(e.slice(c,u)),o+=u-c),d){case 0:h.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),h.push(-2);o++<i;)h.push(-1);break;case 10:h.push(-4),o=1;break;default:a=!0,o=1}c=u+1}return n&&(a&&h.push(-5),s&&h.push(s),h.push(null)),h})(n,r,!0))))}}let xe="object"==typeof self?self:globalThis,xt=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[a,o]=e[i];switch(a){case 0:case -1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new xe[e](t),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new xe[a](o),i)})(0)},{toString:xn}={},{keys:xr}=Object,xi=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=xn.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},xa=([e,t])=>0===e&&("function"===t||"symbol"===t),xo=(e,{json:t,lossy:n}={})=>{var r,i,a;let o,s,l=[];return(r=!(t||n),i=!!t,a=new Map,o=(e,t)=>{let n=l.push(e)-1;return a.set(t,n),n},s=e=>{if(a.has(e))return a.get(e);let[t,n]=xi(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),o([n,[...t]],e)}let r=[],i=o([t,r],e);for(let t of e)r.push(s(t));return i}case 2:{if(n)switch(n){case"BigInt":return o([n,e.toString()],e);case"Boolean":case"Number":case"String":return o([n,e.valueOf()],e)}if(i&&"toJSON"in e)return s(e.toJSON());let a=[],l=o([t,a],e);for(let t of xr(e))(r||!xa(xi(e[t])))&&a.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return o([t,{source:n,flags:r}],e)}case 5:{let n=[],i=o([t,n],e);for(let[t,i]of e)(r||!(xa(xi(t))||xa(xi(i))))&&n.push([s(t),s(i)]);return i}case 6:{let n=[],i=o([t,n],e);for(let t of e)(r||!xa(xi(t)))&&n.push(s(t));return i}}let{message:l}=e;return o([t,{name:n,message:l}],e)})(e),l},xs="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?xt(xo(e,t)):structuredClone(e):(e,t)=>xt(xo(e,t));xc(/[A-Za-z]/);let xl=xc(/[\dA-Za-z]/);function xc(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xu(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o="";if(37===a&&xl(e.charCodeAt(n+1))&&xl(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function xd(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function xh(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}xc(/[#-'*+\--9=?A-Z^-~]/),xc(/\d/),xc(/[\dA-Fa-f]/),xc(/[!-/:-@[-`{-~]/),xc(/\p{P}|\p{S}/u),xc(/\s/);let xf=function(e){var t,n;if(null==e)return xm;if("function"==typeof e)return xp(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=xf(e[n]);return xp(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,xp(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,xp(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function xp(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function xm(){return!0}let xg=[];function xv(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let a=xf(i),o=r?-1:1;(function e(i,s,l){let c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){let e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return u;function u(){var c;let u,d,h,f=xg;if((!t||a(i,s,l[l.length-1]||void 0))&&!1===(f=Array.isArray(c=n(i,l))?c:"number"==typeof c?[!0,c]:null==c?xg:[c])[0])return f;if("children"in i&&i.children&&i.children&&"skip"!==f[0])for(d=(r?i.children.length:-1)+o,h=l.concat(i);d>-1&&d<i.children.length;){if(!1===(u=e(i.children[d],d,h)())[0])return u;d="number"==typeof u[1]?u[1]:d+o}return f}})(e,void 0,[])()}function xx(e,t,n,r){let i,a,o;"function"==typeof t&&"function"!=typeof n?(a=void 0,o=t,i=n):(a=t,o=n,i=r),xv(e,a,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},i)}function xy(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),a=i[0];a&&"text"===a.type?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=r:i.push({type:"text",value:r}),i}function xb(e){let t=e.spread;return null==t?e.children.length>1:t}function xw(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}let xN={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a={type:"element",tagName:"pre",properties:{},children:[a=e.applyData(t,a)]},e.patch(t,a),a},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=xu(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),s=e.footnoteCounts.get(i);void 0===s?(s=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=o+1,s+=1,e.footnoteCounts.set(i,s);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xy(e,t);let i={src:xu(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)},image:function(e,t){let n={src:xu(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xy(e,t);let i={href:xu(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)},link:function(e,t){let n={href:xu(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=xb(n[r])}return t}(n):xb(t),a={},o=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<r.length;){let e=r[s];(i||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=gh(t.children[1]),o=gd(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",a=n&&"table"===n.type?n.align:void 0,o=a?a.length:t.children.length,s=-1,l=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}let c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(xw(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(xw(t.slice(i),i>0,!1)),a.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:xj,yaml:xj,definition:xj,footnoteDefinition:xj};function xj(){}let xk={}.hasOwnProperty,xS={};function xC(e,t){e.position&&(t.position=function(e){let t=gh(e),n=gd(e);if(t&&n)return{start:t,end:n}}(e))}function x_(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,xs(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function xE(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function xT(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function xM(e,t){let n,r,i,a,o=(n=t||xS,r=new Map,i=new Map,a={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=xT(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=xT(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:x_,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...xN,...n.handlers},one:function(e,t){let n=e.type,r=a.handlers[n];if(xk.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=xs(n);return r.children=a.all(e),r}return xs(e)}return(a.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(xk.call(n,"hProperties")||xk.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)})(a,e,t)},options:n,patch:xC,wrap:xE},xx(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||xd,r=e.options.footnoteBackLabel||xh,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),c=xu(o.toLowerCase()),u=0,d=[],h=e.footnoteCounts.get(o);for(;void 0!==h&&++u<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=a[a.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else a.push(...d);let p={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(a,!0)};e.patch(i,p),s.push(p)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...xs(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(mD("children"in c),c.children.push({type:"text",value:"\n"},l)),c}function xO(e,t){return e&&"run"in e?async function(n,r){let i=xM(n,{file:r,...t});await e.run(i,r)}:function(n,r){return xM(n,{file:r,...e||t})}}function xA(e){if(e)throw e}var xD=e.i(4100);function xP(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let xI=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');xF(e);let r=0,i=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else i<0&&(n=!0,i=a+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let o=-1,s=t.length-1;for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else o<0&&(n=!0,o=a+1),s>-1&&(e.codePointAt(a)===t.codePointAt(s--)?s<0&&(i=a):(s=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)},xL=function(e){let t;if(xF(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},xR=function(e){let t;xF(e);let n=e.length,r=-1,i=0,a=-1,o=0;for(;n--;){let s=e.codePointAt(n);if(47===s){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===s?a<0?a=n:1!==o&&(o=1):a>-1&&(o=-1)}return a<0||r<0||0===o||1===o&&a===r-1&&a===i+1?"":e.slice(a,r)},xB=function(...e){var t;let n,r,i,a=-1;for(;++a<e.length;)xF(e[a]),e[a]&&(i=void 0===i?e[a]:i+"/"+e[a]);return void 0===i?".":(xF(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",a=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(i.length<2||2!==a||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",a=0):a=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),o=l,s=0;continue}}else if(i.length>0){i="",a=0,o=l,s=0;continue}}t&&(i=i.length>0?i+"/..":"..",a=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else 46===n&&s>-1?s++:s=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function xF(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function xz(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let xV=["history","path","basename","stem","extname","dirname"];class xH{constructor(e){let t,n;t=e?xz(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<xV.length;){const e=xV[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)xV.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?xI(this.path):void 0}set basename(e){xW(e,"basename"),xU(e,"basename"),this.path=xB(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?xL(this.path):void 0}set dirname(e){xY(this.basename,"dirname"),this.path=xB(e||"",this.basename)}get extname(){return"string"==typeof this.path?xR(this.path):void 0}set extname(e){if(xU(e,"extname"),xY(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=xB(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){xz(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!xz(e)){let t=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("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),xW(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?xI(this.path,this.extname):void 0}set stem(e){xW(e,"stem"),xU(e,"stem"),this.path=xB(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new gx(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function xU(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function xW(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function xY(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let xG=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},xX={}.hasOwnProperty;class x$ extends xG{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=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(a,...o){let s=e[++n],l=-1;if(a)return void r(a);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let n;return function(...t){let a,o=e.length>t.length;o&&t.push(r);try{a=e.apply(this,t)}catch(e){if(o&&n)throw e;return r(e)}o||(a&&a.then&&"function"==typeof a.then?a.then(i,r):a instanceof Error?r(a):i(a))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(s,i)(...o):r(null,...o)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new x$,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,xD.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(xQ("data",this.frozen),this.namespace[e]=t,this):xX.call(this.namespace,e)&&this.namespace[e]||void 0:e?(xQ("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=x1(e),n=this.parser||this.Parser;return xK("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),xK("process",this.parser||this.Parser),xZ("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=x1(e),o=n.parse(a);function s(e,n){e||!n?i(e):r?r(n):(mD(t,"`done` is defined if `resolve` is not"),t(void 0,n))}n.run(o,a,function(e,t,r){var i,a;if(e||!t||!r)return s(e);let o=n.stringify(t,r);"string"==typeof(i=o)||(a=i)&&"object"==typeof a&&"byteLength"in a&&"byteOffset"in a?r.value=o:r.result=o,s(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),xK("processSync",this.parser||this.Parser),xZ("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,xA(e),t=r}),x0("processSync","process",n),mD(t,"we either bailed on an error or have a tree"),t}run(e,t,n){xJ(e),this.freeze();let r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){mD("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=x1(t);r.run(e,o,function(t,r,o){let s=r||e;t?a(t):i?i(s):(mD(n,"`done` is defined if `resolve` is not"),n(void 0,s,o))})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){xA(e),n=t,r=!0}),x0("runSync","run",r),mD(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=x1(t),r=this.compiler||this.Compiler;return xZ("stringify",r),xJ(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(xQ("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?a(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw 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");a(e.plugins),e.settings&&(r.settings=(0,xD.default)(!0,r.settings,e.settings))}function a(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;o(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];xP(o)&&xP(r)&&(r=(0,xD.default)(!0,o,r)),n[i]=[e,r,...a]}}}}let xq=new x$().freeze();function xK(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function xZ(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function xQ(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xJ(e){if(!xP(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function x0(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function x1(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new xH(e)}let x2=[],x5={allowDangerousHtml:!0},x3=/^(https?|ircs?|mailto|xmpp)$/i,x4=[{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 x6(e){var t;let n,r,i,a,o,s=(n=(t=e).rehypePlugins||x2,r=t.remarkPlugins||x2,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...x5}:x5,xq().use(v8).use(r).use(xO,i).use(n)),l=(a=e.children||"",o=new xH,"string"==typeof a?o.value=a:mP("Unexpected value `"+a+"` for `children` prop, expected `string`"),o);return function(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||x7;for(let e of x4)Object.hasOwn(t,e.from)&&mP("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return n&&a&&mP("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),xx(e,function(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return o?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in gA)if(Object.hasOwn(gA,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=gA[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let o=n?!n.includes(e.tagName):!!a&&a.includes(e.tagName);if(!o&&r&&"number"==typeof t&&(o=!r(e,t,i)),o&&i&&"number"==typeof t)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}),function(e,t){var n,r,i,a;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=s,r=t.jsxDEV,o=function(e,t,i,a){let o=Array.isArray(i.children),s=gh(e);return r(t,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:n,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,a=t.jsxs,o=function(e,t,n,r){let o=Array.isArray(n.children)?a:i;return r?o(t,n,r):o(t,n)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?gc:gl,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},c=gS(l,e,void 0);return c&&"string"!=typeof c?c:l.create(e,l.Fragment,{children:c||void 0},void 0)}(e,{Fragment:ed.Fragment,components:i,ignoreInvalidStyle:!0,jsx:ed.jsx,jsxs:ed.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function x7(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||x3.test(e.slice(0,t))?e:""}function x9(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}yt(/[A-Za-z]/),yt(/[\dA-Za-z]/),yt(/[#-'*+\--9=?A-Z^-~]/),yt(/\d/),yt(/[\dA-Fa-f]/),yt(/[!-/:-@[-`{-~]/);let x8=yt(/\p{P}|\p{S}/u),ye=yt(/\s/);function yt(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let yn="phrasing",yr=["autolink","link","image","label"];function yi(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ya(e){this.config.enter.autolinkProtocol.call(this,e)}function yo(e){this.config.exit.autolinkProtocol.call(this,e)}function ys(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];mD("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function yl(e){this.config.exit.autolinkEmail.call(this,e)}function yc(e){this.exit(e)}function yu(e){!function(e,t,n){let r=xf((n||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<i.length;)xv(e,"text",o);function o(e,t){let n,o=-1;for(;++o<t.length;){let e=t[o],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,l=n.children.indexOf(e),c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?r.lastIndex=n+1:(s!==n&&u.push({type:"text",value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}return c?(s<e.value.length&&u.push({type:"text",value:e.value.slice(s)}),n.children.splice(l,1,...u)):u=[e],l+u.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,yd],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,yh]],{ignore:["link","linkReference"]})}function yd(e,t,n,r,i){let a,o="";if(!yf(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),(a=n.split(".")).length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),i=x9(e,"("),a=x9(e,")");for(;-1!==r&&i>a;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),a++;return[e,n]}(n+r);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function yh(e,t,n,r){return!(!yf(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function yf(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||ye(n)||x8(n))&&(!t||47!==n)}function yp(){this.buffer()}function ym(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function yg(){this.buffer()}function yv(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function yx(e){let t=this.resume(),n=this.stack[this.stack.length-1];mD("footnoteReference"===n.type),n.identifier=vR(this.sliceSerialize(e)).toLowerCase(),n.label=t}function yy(e){this.exit(e)}function yb(e){let t=this.resume(),n=this.stack[this.stack.length-1];mD("footnoteDefinition"===n.type),n.identifier=vR(this.sliceSerialize(e)).toLowerCase(),n.label=t}function yw(e){this.exit(e)}function yN(e,t,n,r){let i=n.createTracker(r),a=i.move("[^"),o=n.enter("footnoteReference"),s=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]")}function yj(e,t,n){return 0===t?e:yk(e,t,n)}function yk(e,t,n){return(n?"":" ")+e}yN.peek=function(){return"["};let yS=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function yC(e){this.enter({type:"delete",children:[]},e)}function y_(e){this.exit(e)}function yE(e,t,n,r){let i=n.createTracker(r),a=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function yT(e){return e.length}function yM(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}yE.peek=function(){return"~"};function yO(e,t,n){let r=e.value||"",i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){let e,t=n.unsafe[a],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}yO.peek=function(){return"`"};xf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let yA=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),a=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(a=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+a);let o=a.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=n.createTracker(r);s.move(a+" ".repeat(o-a.length)),s.shift(o);let l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,s.current()),function(e,t,n){return t?(n?"":" ".repeat(o))+e:(n?a:a+" ".repeat(o-a.length))+e});return l(),c};function yD(e){let t=e._align;mD(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function yP(e){this.exit(e),this.data.inTable=void 0}function yI(e){this.enter({type:"tableRow",children:[]},e)}function yL(e){this.exit(e)}function yR(e){this.enter({type:"tableCell",children:[]},e)}function yB(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,yF));let n=this.stack[this.stack.length-1];mD("inlineCode"===n.type),n.value=t,this.exit(e)}function yF(e,t){return"|"===t?t:e}function yz(e){let t=this.stack[this.stack.length-2];mD("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function yV(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];mD("paragraph"===e.type);let n=e.children[0];if(n&&"text"===n.type){let r,i=t.children,a=-1;for(;++a<i.length;){let e=i[a];if("paragraph"===e.type){r=e;break}}r===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function yH(e,t,n,r){let i=e.children[0],a="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);a&&s.move(o);let l=yA(e,t,n,{...r,...s.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let yU=y$(/[A-Za-z]/),yW=y$(/[\dA-Za-z]/);function yY(e){return null!==e&&(e<0||32===e)}y$(/[#-'*+\--9=?A-Z^-~]/),y$(/\d/),y$(/[\dA-Fa-f]/),y$(/[!-/:-@[-`{-~]/);let yG=y$(/\p{P}|\p{S}/u),yX=y$(/\s/);function y$(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let yq={tokenize:function(e,t,n){let r=0;return function t(a){return(87===a||119===a)&&r<3?(r++,e.consume(a),t):46===a&&3===r?(e.consume(a),i):n(a)};function i(e){return null===e?n(e):t(e)}},partial:!0},yK={tokenize:function(e,t,n){let r,i,a;return o;function o(t){return 46===t||95===t?e.check(yQ,l,s)(t):null===t||yY(t)||yX(t)||45!==t&&yG(t)?l(t):(a=!0,e.consume(t),o)}function s(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),o}function l(e){return i||r||!a?n(e):t(e)}},partial:!0},yZ={tokenize:function(e,t){let n=0,r=0;return i;function i(o){return 40===o?(n++,e.consume(o),i):41===o&&r<n?a(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(yQ,t,a)(o):null===o||yY(o)||yX(o)?t(o):(e.consume(o),i)}function a(t){return 41===t&&r++,e.consume(t),i}},partial:!0},yQ={tokenize:function(e,t,n){return r;function r(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),r):38===o?(e.consume(o),a):93===o?(e.consume(o),i):60===o||null===o||yY(o)||yX(o)?t(o):n(o)}function i(e){return null===e||40===e||91===e||yY(e)||yX(e)?t(e):r(e)}function a(t){return yU(t)?function t(i){return 59===i?(e.consume(i),r):yU(i)?(e.consume(i),t):n(i)}(t):n(t)}},partial:!0},yJ={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return yW(e)?n(e):t(e)}},partial:!0},y0={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!y4.call(r,r.previous)||y8(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(yq,e.attempt(yK,e.attempt(yZ,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:y4},y1={name:"protocolAutolink",tokenize:function(e,t,n){let r=this,i="",a=!1;return function(t){return(72===t||104===t)&&y6.call(r,r.previous)&&!y8(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),o):n(t)};function o(t){if(yU(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),s}return n(t)}function s(t){return 47===t?(e.consume(t),a)?l:(a=!0,s):n(t)}function l(t){return null===t||null!==t&&(t<32||127===t)||yY(t)||yX(t)||yG(t)?n(t):e.attempt(yK,e.attempt(yZ,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:y6},y2={name:"emailAutolink",tokenize:function(e,t,n){let r,i,a=this;return function(t){return!y9(t)||!y7.call(a,a.previous)||y8(a.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return y9(r)?(e.consume(r),t):64===r?(e.consume(r),o):n(r)}(t))};function o(t){return 46===t?e.check(yJ,l,s)(t):45===t||95===t||yW(t)?(i=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),r=!0,o}function l(o){return i&&r&&yU(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:y7},y5={},y3=48;for(;y3<123;)y5[y3]=y2,58==++y3?y3=65:91===y3&&(y3=97);function y4(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||yY(e)}function y6(e){return!yU(e)}function y7(e){return!(47===e||y9(e))}function y9(e){return 43===e||45===e||46===e||95===e||yW(e)}function y8(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function be(e){return null!==e&&(e<0||32===e)}function bt(e){return -2===e||-1===e||32===e}function bn(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function br(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return bt(r)?(e.enter(n),function r(o){return bt(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}y5[43]=y2,y5[45]=y2,y5[46]=y2,y5[95]=y2,y5[72]=[y2,y1],y5[104]=[y2,y1],y5[87]=[y2,y0],y5[119]=[y2,y0],bn(/[A-Za-z]/),bn(/[\dA-Za-z]/),bn(/[#-'*+\--9=?A-Z^-~]/),bn(/\d/),bn(/[\dA-Fa-f]/),bn(/[!-/:-@[-`{-~]/),bn(/\p{P}|\p{S}/u),bn(/\s/);let bi={tokenize:function(e,t,n){let r=this;return br(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function ba(e,t,n){let r,i=this,a=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;a--;){let e=i.events[a][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!r||!r._balanced)return n(a);let s=vR(i.sliceSerialize({start:r.end,end:i.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)):n(a)}}function bo(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function bs(e,t,n){let r,i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!r||null===s||91===s||be(s))return n(s);if(93===s){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return a.includes(vR(i.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(s)}return be(s)||(r=!0),o++,e.consume(s),92===s?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function bl(e,t,n){let r,i,a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(s>999||93===t&&!i||null===t||91===t||be(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=vR(a.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return be(t)||(i=!0),s++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),s++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(r)||o.push(r),br(e,h,"gfmFootnoteDefinitionWhitespace")):n(t)}function h(e){return t(e)}}function bc(e,t,n){return e.check(g4,t,e.attempt(bi,t,n))}function bu(e){e.exit("gfmFootnoteDefinition")}function bd(e){return null!==e&&e<-2}function bh(e){return null!==e&&(e<0||32===e)}function bf(e){return -2===e||-1===e||32===e}function bp(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function bm(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return bf(r)?(e.enter(n),function r(o){return bf(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}bp(/[A-Za-z]/),bp(/[\dA-Za-z]/),bp(/[#-'*+\--9=?A-Z^-~]/),bp(/\d/),bp(/[\dA-Fa-f]/),bp(/[!-/:-@[-`{-~]/),bp(/\p{P}|\p{S}/u),bp(/\s/);class bg{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function bv(e,t,n){let r,i=this,a=0,o=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?i.events[t][1].type:null,a="tableHead"===r||"tableRow"===r?y:s;return a===y&&i.parser.lazy[i.now().line]?n(e):a(e)};function s(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(r=!0,o+=1),l(n)}function l(t){return null===t?n(t):bd(t)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):bf(t)?bm(e,l,"whitespace")(t):(o+=1,r&&(r=!1,a+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,l):(e.enter("data"),c(t))}function c(t){return null===t||124===t||bh(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,bf(t))?bm(e,h,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t)}function h(t){return 45===t||58===t?p(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):n(t)}function f(t){return bf(t)?bm(e,p,"whitespace")(t):p(t)}function p(t){return 58===t?(o+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(o+=1,g(t)):null===t||bd(t)?x(t):n(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(n))}(t)):n(t)}function v(t){return bf(t)?bm(e,x,"whitespace")(t):x(t)}function x(i){if(124===i)return h(i);if(null===i||bd(i))return r&&a===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):n(i);return n(i)}function y(t){return e.enter("tableRow"),b(t)}function b(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),b):null===n||bd(n)?(e.exit("tableRow"),t(n)):bf(n)?bm(e,b,"whitespace")(n):(e.enter("data"),w(n))}function w(t){return null===t||124===t||bh(t)?(e.exit("data"),b(t)):(e.consume(t),92===t?N:w)}function N(t){return 92===t||124===t?(e.consume(t),w):w(t)}}function bx(e,t){let n,r,i,a=-1,o=!0,s=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0,h=new bg;for(;++a<e.length;){let f=e[a],p=f[1];"enter"===f[0]?"tableHead"===p.type?(u=!1,0!==d&&(bb(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",n,t]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(o=!0,i=void 0,l=[0,0,0,0],c=[0,a+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",r,t]])),s="tableDelimiterRow"===p.type?2:r?3:1):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)?(o=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=by(h,t,l,s,void 0,i),l=[0,0,0,0]),c[2]=a)):"tableCellDivider"===p.type&&(o?o=!1:(0!==l[1]&&(c[0]=c[1],i=by(h,t,l,s,void 0,i)),c=[(l=c)[1],a,0,0])):"tableHead"===p.type?(u=!0,d=a):"tableRow"===p.type||"tableDelimiterRow"===p.type?(d=a,0!==l[1]?(c[0]=c[1],i=by(h,t,l,s,a,i)):0!==c[1]&&(i=by(h,t,c,s,a,i)),s=0):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)&&(c[3]=a)}for(0!==d&&bb(h,t,d,n,r),h.consume(t.events),a=-1;++a<t.events.length;){let e=t.events[a];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,a))}return e}function by(e,t,n,r,i,a){0!==n[0]&&(a.end=Object.assign({},bw(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));let o=bw(t.events,n[1]);if(a={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",a,t]]),0!==n[2]){let i=bw(t.events,n[2]),a=bw(t.events,n[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==i&&(a.end=Object.assign({},bw(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function bb(e,t,n,r,i){let a=[],o=bw(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function bw(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}function bN(e){return -2===e||-1===e||32===e}function bj(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}bj(/[A-Za-z]/),bj(/[\dA-Za-z]/),bj(/[#-'*+\--9=?A-Z^-~]/),bj(/\d/),bj(/[\dA-Fa-f]/),bj(/[!-/:-@[-`{-~]/),bj(/\p{P}|\p{S}/u),bj(/\s/);let bk={name:"tasklistCheck",tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return null!==t&&(t<0||32===t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),a):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),a):n(t)}function a(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(t)}function o(r){return null!==r&&r<-2?t(r):bN(r)?e.check({tokenize:bS},t,n)(r):n(r)}}};function bS(e,t,n){var r,i;let a,o;return r=function(e){return null===e?n(e):t(e)},i="whitespace",a=1/0,o=0,function(t){return bN(t)?(e.enter(i),function t(n){return bN(n)&&o++<a?(e.consume(n),t):(e.exit(i),r(n))}(t)):r(t)}}let bC={};function b_(e){let t,n,r,i=e||bC,a=this.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),s=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(gz([{text:y5},{document:{91:{name:"gfmFootnoteDefinition",tokenize:bl,continuation:{tokenize:bc},exit:bu}},text:{91:{name:"gfmFootnoteCall",tokenize:bs},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ba,resolveTo:bo}}},(t=(i||{}).singleTilde,n={name:"strikethrough",tokenize:function(e,n,r){let i=this.previous,a=this.events,o=0;return function(s){return 126===i&&"characterEscape"!==a[a.length-1][1].type?r(s):(e.enter("strikethroughSequenceTemporary"),function a(s){let l=vd(i);if(126===s)return o>1?r(s):(e.consume(s),o++,a);if(o<2&&!t)return r(s);let c=e.exit("strikethroughSequenceTemporary"),u=vd(s);return c._open=!u||2===u&&!!l,c._close=!l||2===l&&!!u,n(s)}(s))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",a,t]],s=t.parser.constructs.insideSpan.null;s&&gR(o,o.length,0,vh(s,e.slice(r+1,n),t)),gR(o,o.length,0,[["exit",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),gR(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:bv,resolveAll:bx}}},{text:{91:bk}}])),s.push([{transforms:[yu],enter:{literalAutolink:yi,literalAutolinkEmail:ya,literalAutolinkHttp:ya,literalAutolinkWww:ya},exit:{literalAutolink:yc,literalAutolinkEmail:yl,literalAutolinkHttp:yo,literalAutolinkWww:ys}},{enter:{gfmFootnoteCallString:yp,gfmFootnoteCall:ym,gfmFootnoteDefinitionLabelString:yg,gfmFootnoteDefinition:yv},exit:{gfmFootnoteCallString:yx,gfmFootnoteCall:yy,gfmFootnoteDefinitionLabelString:yb,gfmFootnoteDefinition:yw}},{canContainEols:["delete"],enter:{strikethrough:yC},exit:{strikethrough:y_}},{enter:{table:yD,tableData:yR,tableHeader:yR,tableRow:yI},exit:{codeText:yB,table:yP,tableData:yL,tableHeader:yL,tableRow:yL}},{exit:{taskListCheckValueChecked:yz,taskListCheckValueUnchecked:yz,paragraph:yV}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:yn,notInConstruct:yr},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:yn,notInConstruct:yr},{character:":",before:"[ps]",after:"\\/",inConstruct:yn,notInConstruct:yr}]},(r=!1,i&&i.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:function(e,t,n,i){let a=n.createTracker(i),o=a.move("[^"),s=n.enter("footnoteDefinition"),l=n.enter("label");return o+=a.move(n.safe(n.associationId(e),{before:o,after:"]"})),l(),o+=a.move("]:"),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((r?"\n":" ")+n.indentLines(n.containerFlow(e,a.current()),r?yk:yj))),s(),o},footnoteReference:yN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:yS}],handlers:{delete:yE}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=yO(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return s(function(e,t,n){let r=e.children,i=-1,a=[],o=t.enter("table");for(;++i<r.length;)a[i]=l(r[i],t,n);return o(),a}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){let i=s([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,n,r){let i=n.enter("tableCell"),o=n.enter("phrasing"),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function s(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||yT,a=[],o=[],s=[],l=[],c=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>c&&(c=e[u].length);++a<e[u].length;){var d;let o=null==(d=e[u][a])?"":String(d);if(!1!==n.alignDelimiters){let e=i(o);r[a]=e,(void 0===l[a]||e>l[a])&&(l[a]=e)}t.push(o)}o[u]=t,s[u]=r}let h=-1;if("object"==typeof r&&"length"in r)for(;++h<c;)a[h]=yM(r[h]);else{let e=yM(r);for(;++h<c;)a[h]=e}h=-1;let f=[],p=[];for(;++h<c;){let e=a[h],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[h]-t.length-r.length),o=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[h]&&(l[h]=i),p[h]=i),f[h]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let g=[];for(;++u<o.length;){let e=o[u],t=s[u];h=-1;let r=[];for(;++h<c;){let i=e[h]||"",o="",s="";if(!1!==n.alignDelimiters){let e=l[h]-(t[h]||0),n=a[h];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===n.delimiterStart||h||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||h)&&r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(i),!1!==n.alignDelimiters&&r.push(s),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||h!==c-1)&&r.push("|")}g.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return g.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,a=[],s=t.enter("tableRow");for(;++i<r.length;)a[i]=o(r[i],e,t,n);return s(),a}}(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:yH}}]})}let bE=/^\s*\|.*\|\s*$/,bT=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/;function bM({children:e,className:t}){return(0,ed.jsx)("div",{className:(0,eE.cn)("text-[13px] leading-6 text-foreground/90 space-y-2 [&>:first-child]:mt-0",t),children:(0,ed.jsx)(x6,{remarkPlugins:[b_],components:{h1:e=>(0,ed.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...e}),h2:e=>(0,ed.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...e}),h3:e=>(0,ed.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...e}),h4:e=>(0,ed.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...e}),p:e=>(0,ed.jsx)("p",{className:"my-1.5",...e}),ul:e=>(0,ed.jsx)("ul",{className:"list-disc pl-5 my-1.5 space-y-0.5",...e}),ol:e=>(0,ed.jsx)("ol",{className:"list-decimal pl-5 my-1.5 space-y-0.5",...e}),li:e=>(0,ed.jsx)("li",{className:"leading-6",...e}),strong:e=>(0,ed.jsx)("strong",{className:"font-semibold text-foreground",...e}),code:e=>(0,ed.jsx)("code",{className:"text-[12px] font-mono bg-muted/70 px-1 py-0.5 rounded",...e}),a:e=>(0,ed.jsx)("a",{className:"text-primary underline",...e}),table:e=>(0,ed.jsx)("div",{className:"overflow-x-auto my-3 rounded-md border border-border",children:(0,ed.jsx)("table",{className:"text-[12px] w-full border-collapse",...e})}),thead:e=>(0,ed.jsx)("thead",{className:"bg-muted/60",...e}),th:e=>(0,ed.jsx)("th",{className:"text-left font-semibold px-3 py-1.5 border-b border-border whitespace-nowrap",...e}),td:e=>(0,ed.jsx)("td",{className:"px-3 py-1.5 border-b border-border/40 align-top [tr:last-child_&]:border-b-0",...e}),hr:e=>(0,ed.jsx)("hr",{className:"my-3 border-border/60",...e}),blockquote:e=>(0,ed.jsx)("blockquote",{className:"border-l-2 border-border/60 pl-3 my-2 text-muted-foreground italic",...e})},children:function(e){let t=e.split("\n"),n=[],r=0;for(;r<t.length;){let e=t[r],i=t[r+1];if(e&&i&&bE.test(e)&&bT.test(i)){for(n.length>0&&""!==n[n.length-1].trim()&&n.push("");r<t.length&&bE.test(t[r]);)n.push(t[r].replace(/^\s+/,"")),r++;r<t.length&&""!==t[r].trim()&&n.push("");continue}n.push(e),r++}return n.join("\n")}(e)})})}var bO=e.i(59411),tz=tz;function bA({directiveId:e,onClose:t}){let n,r=(0,ep.useTranslations)("directiveDetailModal"),{currentBank:i}=(0,ev.useBank)(),[a,o]=(0,eh.useState)(null),[s,l]=(0,eh.useState)(!1),[c,u]=(0,eh.useState)(null);(0,eh.useEffect)(()=>{e&&i&&(async()=>{l(!0),u(null),o(null);try{let t=await eO.client.getDirective(i,e);o(t)}catch(e){console.error("Error loading directive:",e),u(e.message)}finally{l(!1)}})()},[e,i]);let d=null!==e;return(0,ed.jsx)(tH.Dialog,{open:d,onOpenChange:e=>!e&&t(),children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-6",children:[(0,ed.jsx)(bO.VisuallyHidden,{children:(0,ed.jsx)(tH.DialogTitle,{children:r("title")})}),s?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsx)(tz.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):c?(0,ed.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ed.jsx)("div",{className:"text-center text-destructive",children:(0,ed.jsx)("div",{className:"text-sm",children:r("errorPrefix",{error:c})})})}):a?(0,ed.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-6",children:[(0,ed.jsxs)("div",{className:"pb-5 border-b border-border",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("h3",{className:"text-xl font-bold text-foreground",children:a.name}),!a.is_active&&(0,ed.jsx)("span",{className:"px-2 py-0.5 rounded-full bg-red-500/10 text-red-600 dark:text-red-400 text-xs font-medium",children:r("inactive")})]}),(0,ed.jsx)("code",{className:"text-xs font-mono text-muted-foreground/70",children:a.id})]}),(0,ed.jsxs)("div",{className:"flex gap-8",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:r("created")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:(n=new Date(a.created_at),`${n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`)})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:r("priority")}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:a.priority})]})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:r("content")}),(0,ed.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ed.jsx)(x6,{remarkPlugins:[b_],children:a.content})})]}),a.tags&&a.tags.length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:r("tags")}),(0,ed.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.tags.map((e,t)=>(0,ed.jsx)("span",{className:"px-2 py-0.5 bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded text-xs",children:e},t))})]})]}):null]})})}function bD(e){let t=new Date(e).getTime(),n=Math.round((Date.now()-t)/1e3);if(60>Math.abs(n))return n>=0?"just now":"in a moment";let r=n,i="second";for(let[e,t]of[[60,"second"],[60,"minute"],[24,"hour"],[7,"day"],[4.345,"week"],[12,"month"],[1/0,"year"]]){if(Math.abs(r)<e)break;r/=e,i=t}return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(-Math.round(r),i)}function bP(e){let t=new Date(e);return`${t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}var bI=e.i(42408);let bL={light:{body:"#1a1a1a",removedLineBg:"#ffeef0",addedLineBg:"#e6ffec",removedWordBg:"#fdb8c0",removedWordText:"#67060c",addedWordBg:"#acf2bc",addedWordText:"#0a3622"},dark:{body:"#e6edf3",removedLineBg:"#3d1419",addedLineBg:"#0d2818",removedWordBg:"#7d2530",removedWordText:"#ffd0d6",addedWordBg:"#1a4d2c",addedWordText:"#b8e6c1"}};function bR(e,t){return"directives"===e?{label:t?t("factTypeDirective"):"directive",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}:"mental-models"===e?{label:t?t("factTypeMentalModel"):"mental model",color:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}:"world"===e?{label:t?t("factTypeWorld"):"world",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"}:"experience"===e?{label:t?t("factTypeExperience"):"experience",color:"bg-green-500/10 text-green-600 dark:text-green-400"}:"observation"===e?{label:t?t("factTypeObservation"):"observation",color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"}:{label:e,color:"bg-slate-500/10 text-slate-600 dark:text-slate-400"}}let bB=["observation","experience","world","directives","mental-models"];function bF({based_on:e,onViewMemory:t,onViewDirective:n}){let r=(0,ep.useTranslations)("mentalModelDetailModal"),i=(0,eh.useMemo)(()=>{if(!e)return[];let t=Object.entries(e).map(([e,t])=>({factType:e,facts:t??[]})).filter(e=>e.facts.length>0);return t.sort((e,t)=>{let n=bB.indexOf(e.factType),r=bB.indexOf(t.factType);return(-1===n?999:n)-(-1===r?999:r)}),t},[e]);return 0===i.length?(0,ed.jsx)("p",{className:"text-sm text-muted-foreground italic",children:r("noBasedOnData")}):(0,ed.jsx)("div",{className:"space-y-4",children:i.map(e=>{let i=bR(e.factType,r);return(0,ed.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,ed.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${i.color}`,children:i.label}),(0,ed.jsx)("span",{className:"text-xs text-muted-foreground",children:e.facts.length})]}),(0,ed.jsx)("ul",{className:"divide-y divide-border/50",children:e.facts.map((i,a)=>{let o="directives"===e.factType&&!!n||"directives"!==e.factType&&"mental-models"!==e.factType&&!!t;return(0,ed.jsxs)("li",{className:"group flex items-start gap-3 px-3 py-2 hover:bg-muted/30",children:[(0,ed.jsxs)("p",{className:"text-sm text-foreground leading-relaxed flex-1 min-w-0",children:[i.text,i.context&&(0,ed.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5",children:i.context})]}),o&&(0,ed.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===e.factType?n?.(i.id):t?.(i.id)},children:r("viewArrow")})]},i.id||a)})})]},e.factType)})})}function bz(e){return e.match(/\s+|[A-Za-z0-9_]+|[^\s\w]/g)||[]}function bV(e){return/^\s+$/.test(e)?" ":e}function bH(e,t,n){let r={backgroundColor:n.removedWordBg,color:n.removedWordText,fontWeight:600,borderRadius:"2px"},i={backgroundColor:n.addedWordBg,color:n.addedWordText,fontWeight:600,borderRadius:"2px"};return e.map((e,n)=>"same"===e.type?(0,ed.jsx)("span",{children:e.text},n):(0,ed.jsx)("span",{style:"left"===t?r:i,children:e.text},n))}function bU({before:e,after:t}){let n=(0,ep.useTranslations)("mentalModelDetailModal"),{theme:r}=(0,bI.useTheme)(),i=bL[r],{left:a,right:o}=function(e,t){let n=e.split("\n"),r=t.split("\n"),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=n[e-1]===r[t-1]?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],l=i,c=a;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(s.push({type:"same",text:n[l-1]}),l--,c--):c>0&&(0===l||o[l][c-1]>=o[l-1][c])?(s.push({type:"added",text:r[c-1]}),c--):(s.push({type:"removed",text:n[l-1]}),l--);s.reverse();let u=[],d=[],h=0;for(;h<s.length;){let e=s[h];if("same"===e.type){u.push({type:"same",spans:[{type:"same",text:e.text}]}),d.push({type:"same",spans:[{type:"same",text:e.text}]}),h++;continue}let t=[],n=[];for(;h<s.length&&"same"!==s[h].type;)"removed"===s[h].type?t.push(s[h].text):n.push(s[h].text),h++;let r=Math.max(t.length,n.length);for(let e=0;e<r;e++){let r=e<t.length?t[e]:null,i=e<n.length?n[e]:null;if(null!==r&&null!==i){let e=function(e,t){let n=bz(e),r=bz(t),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=bV(n[e-1])===bV(r[t-1])?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],l=[],c=i,u=a,d=[],h=[];for(;c>0||u>0;)if(c>0&&u>0&&bV(n[c-1])===bV(r[u-1]))d.push({type:"same",text:n[c-1]}),h.push({type:"same",text:r[u-1]}),c--,u--;else if(u>0&&(0===c||o[c][u-1]>=o[c-1][u])){let e=r[u-1];h.push({type:/^\s+$/.test(e)?"same":"added",text:e}),u--}else{let e=n[c-1];d.push({type:/^\s+$/.test(e)?"same":"removed",text:e}),c--}for(;d.length;)s.push(d.pop());for(;h.length;)l.push(h.pop());return{left:s,right:l}}(r,i),t=e.left.some(e=>"same"!==e.type)?"removed":"same",n=e.right.some(e=>"same"!==e.type)?"added":"same";u.push({type:t,spans:e.left}),d.push({type:n,spans:e.right})}else null!==r?(u.push({type:"removed",spans:[{type:"removed",text:r}]}),d.push({type:"same",spans:[{type:"same",text:""}]})):null!==i&&(u.push({type:"same",spans:[{type:"same",text:""}]}),d.push({type:"added",spans:[{type:"added",text:i}]}))}}return{left:u,right:d}}(e,t);return a.some(e=>"same"!==e.type)||o.some(e=>"same"!==e.type)?(0,ed.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border border border-border rounded-md overflow-hidden text-[13px] font-mono",style:{color:i.body},children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"px-3 py-1.5 bg-muted text-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:n("diffBefore")}),a.map((e,t)=>(0,ed.jsx)("div",{className:"px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem]",style:"removed"===e.type?{backgroundColor:i.removedLineBg}:void 0,children:bH(e.spans,"left",i)},t))]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"px-3 py-1.5 bg-muted text-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:n("diffAfter")}),o.map((e,t)=>(0,ed.jsx)("div",{className:"px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem]",style:"added"===e.type?{backgroundColor:i.addedLineBg}:void 0,children:bH(e.spans,"right",i)},t))]})]}):(0,ed.jsx)("span",{className:"text-sm text-muted-foreground italic",children:n("unchanged")})}function bW({before:e,after:t,onViewMemory:n,onViewDirective:r}){let i=(0,ep.useTranslations)("mentalModelDetailModal"),a=(0,eh.useMemo)(()=>{let n=new Set([...Object.keys(e??{}),...Object.keys(t??{})]),r=[];for(let i of n){let n=(e?.[i]??[]).filter(Boolean),a=(t?.[i]??[]).filter(Boolean),o=new Set(n.map(e=>e.id)),s=new Set(a.map(e=>e.id)),l=a.filter(e=>!o.has(e.id)),c=n.filter(e=>!s.has(e.id)),u=a.filter(e=>o.has(e.id));(0!==l.length||0!==c.length||0!==u.length)&&r.push({factType:i,added:l,removed:c,kept:u})}return r.sort((e,t)=>{let n=bB.indexOf(e.factType),r=bB.indexOf(t.factType);return(-1===n?999:n)-(-1===r?999:r)}),r},[e,t]);if(0===a.length)return(0,ed.jsx)("p",{className:"text-sm text-muted-foreground italic",children:i("noBasedOnData")});let o=(e,t,a)=>(0,ed.jsxs)("li",{className:`group flex items-start gap-2 px-3 py-2 ${"added"===a?"bg-green-500/15 dark:bg-green-500/10 border-l-2 border-green-600 dark:border-green-500 text-green-950 dark:text-green-100":"removed"===a?"bg-red-500/15 dark:bg-red-500/10 border-l-2 border-red-600 dark:border-red-500 text-red-950 dark:text-red-200 line-through decoration-red-700/70 dark:decoration-red-400/70":""}`,children:[(0,ed.jsx)("span",{className:`font-mono text-sm shrink-0 ${"added"===a?"text-green-700 dark:text-green-400":"removed"===a?"text-red-700 dark:text-red-400":"text-muted-foreground/40"}`,children:"added"===a?"+":"removed"===a?"−":" "}),(0,ed.jsxs)("p",{className:"text-sm leading-relaxed flex-1 min-w-0",children:[e.text,e.context&&(0,ed.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5 no-underline",children:e.context})]}),("directives"===t&&!!r||"directives"!==t&&"mental-models"!==t&&!!n)&&"removed"!==a&&(0,ed.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===t?r(e.id):n(e.id)},children:i("viewArrow")})]},`${a}-${e.id}`);return(0,ed.jsx)("div",{className:"space-y-4",children:a.map(e=>{let t=bR(e.factType,i);return(0,ed.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,ed.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${t.color}`,children:t.label}),e.added.length>0&&(0,ed.jsxs)("span",{className:"text-xs text-green-600 dark:text-green-400",children:["+",e.added.length]}),e.removed.length>0&&(0,ed.jsxs)("span",{className:"text-xs text-red-600 dark:text-red-400",children:["−",e.removed.length]}),e.kept.length>0&&(0,ed.jsx)("span",{className:"text-xs text-muted-foreground",children:i("keptCount",{count:e.kept.length})})]}),(0,ed.jsxs)("ul",{className:"divide-y divide-border/40",children:[e.added.map(t=>o(t,e.factType,"added")),e.removed.map(t=>o(t,e.factType,"removed")),e.kept.map(t=>o(t,e.factType,"kept"))]})]},e.factType)})})}function bY({history:e,currentContent:t,currentBasedOn:n,onViewMemory:r,onViewDirective:i}){let a=(0,ep.useTranslations)("mentalModelDetailModal"),[o,s]=(0,eh.useState)(0),l=e[o],c=0===o?t:e[o-1].previous_content??"",u=l.previous_reflect_response?.based_on,d=0===o?n:e[o-1].previous_reflect_response?.based_on,h=l.previous_reflect_response??null;return(0,ed.jsxs)("div",{className:"space-y-4",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ed.jsxs)("span",{className:"font-semibold text-foreground",children:["v",e.length-o]})," →"," ",(0,ed.jsxs)("span",{className:"font-semibold text-foreground",children:["v",e.length-o+1,0===o?a("versionCurrent"):""]})," ","· ",a("changedAt",{date:new Date(l.changed_at).toLocaleString()})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:o===e.length-1,onClick:()=>s(o+1),children:(0,ed.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:0===o,onClick:()=>s(o-1),children:(0,ed.jsx)(eC.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)(bZ,{children:a("contentDiff")}),null!==l.previous_content?(0,ed.jsx)(bU,{before:l.previous_content,after:c}):(0,ed.jsx)("div",{className:"border border-border rounded-lg p-3",children:(0,ed.jsx)("span",{className:"text-sm text-muted-foreground italic",children:a("previousContentNotAvailable")})})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)(bZ,{children:a("basedOnDiff")}),h?.based_on?(0,ed.jsx)(bW,{before:u,after:d,onViewMemory:r,onViewDirective:i}):(0,ed.jsx)("p",{className:"text-sm text-muted-foreground italic",children:a("basedOnNotCaptured")})]})]})}function bG({mentalModelId:e,onClose:t,onEdit:n,onDelete:r,onClear:i,onRefreshed:a,initialTab:o="content"}){let s=(0,ep.useTranslations)("mentalModelDetailModal"),{currentBank:l}=(0,ev.useBank)(),[c,u]=(0,eh.useState)(null),[d,h]=(0,eh.useState)(!1),[f,p]=(0,eh.useState)(null),[g,v]=(0,eh.useState)(o),[x,y]=(0,eh.useState)(!1),[b,w]=(0,eh.useState)(!1),[N,j]=(0,eh.useState)(null),[k,S]=(0,eh.useState)(null),[C,_]=(0,eh.useState)(null),[E,T]=(0,eh.useState)(!1);(0,eh.useEffect)(()=>{e&&l&&(async()=>{h(!0),p(null),u(null),_(null),v(o);try{let t=await eO.client.getMentalModel(l,e);u(t)}catch(e){console.error("Error loading mental model:",e),p(e.message)}finally{h(!1)}})()},[e,l,o]),(0,eh.useEffect)(()=>{"history"===g&&c&&l&&null===C&&(async()=>{T(!0);try{let e=await eO.client.getMentalModelHistory(l,c.id);_(e)}catch(e){console.error("Error loading mental model history:",e),_([])}finally{T(!1)}})()},[g,c,l,C]);let M=async()=>{if(l&&c){w(!0);try{let e=await eO.client.getMentalModel(l,c.id);u(e),_(null)}catch(e){console.error("Error reloading mental model:",e)}finally{w(!1)}}},O=async()=>{if(!l||!c)return;y(!0);let e=c.last_refreshed_at;try{await eO.client.refreshMentalModel(l,c.id);let t=0,n=async()=>{t++;try{let r=await eO.client.getMentalModel(l,c.id);if(r.last_refreshed_at!==e){u(r),_(null),a?.(r),y(!1);return}if(t>=120){y(!1),em.toast.error(s("refreshTimeoutTitle"),{description:s("refreshTimeoutDescription")});return}setTimeout(n,1e3)}catch(e){console.error("Error polling mental model:",e),y(!1)}};setTimeout(n,1e3)}catch{y(!1)}},A=null!==e,D=c?.reflect_response?.based_on,P=D?Object.values(D).reduce((e,t)=>e+(t?.length??0),0):0;return(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tH.Dialog,{open:A,onOpenChange:e=>!e&&t(),children:(0,ed.jsxs)(tH.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,ed.jsx)(tH.DialogHeader,{className:"pr-10",children:(0,ed.jsxs)(tH.DialogTitle,{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"truncate",children:c?.name??s("mentalModelFallback")}),c&&(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:M,disabled:b,title:s("reloadData"),children:(0,ed.jsx)(eV,{className:`h-3.5 w-3.5 ${b?"animate-spin":""}`})}),c?.trigger?.refresh_after_consolidation&&(0,ed.jsxs)("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-500/10 text-green-600 dark:text-green-400 text-xs font-medium",children:[(0,ed.jsx)(mO,{className:"w-3 h-3"}),s("autoRefresh")]})]})}),d?(0,ed.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ed.jsx)(tz.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):f?(0,ed.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ed.jsx)("div",{className:"text-center text-destructive",children:(0,ed.jsx)("div",{className:"text-sm",children:s("errorPrefix",{error:f})})})}):c?(0,ed.jsxs)(tW.Tabs,{value:g,onValueChange:e=>v(e),className:"flex-1 flex flex-col overflow-hidden",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ed.jsxs)(tW.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,ed.jsxs)(tW.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,ed.jsx)(ej.FileText,{className:"w-3.5 h-3.5"}),s("tabContent")]}),(0,ed.jsxs)(tW.TabsTrigger,{value:"configuration",className:"flex items-center gap-1.5",children:[(0,ed.jsx)(e_,{className:"w-3.5 h-3.5"}),s("tabConfiguration")]}),(0,ed.jsxs)(tW.TabsTrigger,{value:"history",className:"flex items-center gap-1.5",children:[(0,ed.jsx)(tV,{className:"w-3.5 h-3.5"}),s("tabHistory")]})]}),(0,ed.jsxs)(f2.DropdownMenu,{children:[(0,ed.jsx)(f2.DropdownMenuTrigger,{asChild:!0,children:(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:x,"aria-label":s("actionsAriaLabel"),children:(0,ed.jsx)(pS,{className:"h-4 w-4"})})}),(0,ed.jsxs)(f2.DropdownMenuContent,{align:"end",children:[n&&(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>n(c),children:[(0,ed.jsx)(pk,{className:"h-4 w-4 mr-2"}),s("actionEdit")]}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:O,disabled:x,children:[(0,ed.jsx)(eV,{className:"h-4 w-4 mr-2"}),s("actionRefreshManually")]}),i&&(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>i(c),children:[(0,ed.jsx)(mA,{className:"h-4 w-4 mr-2"}),s("actionClearContent")]}),r&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(f2.DropdownMenuSeparator,{}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>r(c),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ed.jsx)(pj,{className:"h-4 w-4 mr-2"}),s("actionDelete")]})]})]})]})]}),(0,ed.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ed.jsxs)(tW.TabsContent,{value:"content",className:"mt-0 space-y-6",children:[(0,ed.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)(ej.FileText,{className:"w-3.5 h-3.5"}),(0,ed.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:s("storedContent")}),(0,ed.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",s("charsCount",{count:c.content.length})]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[!0===c.is_stale?(0,ed.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-amber-500/15 text-amber-700 dark:text-amber-400",title:s("staleTitle"),children:s("stale")}):!1===c.is_stale?(0,ed.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-green-500/15 text-green-700 dark:text-green-400",title:s("inSyncTitle"),children:s("inSync")}):null,(0,ed.jsxs)("span",{title:bP(c.last_refreshed_at),className:"flex items-center gap-1",children:[(0,ed.jsx)(eV,{className:"w-3 h-3"}),s("lastRefreshed",{time:bD(c.last_refreshed_at)})]})]})]}),(0,ed.jsx)(bM,{className:"p-4",children:c.content})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)(bZ,{children:P>0?s("basedOnWithCount",{count:P}):s("basedOn")}),c.reflect_response?(0,ed.jsx)(bF,{based_on:D,onViewMemory:e=>j(e),onViewDirective:e=>S(e)}):(0,ed.jsx)("p",{className:"text-sm text-muted-foreground",children:s("noSourceData")})]})]}),(0,ed.jsx)(tW.TabsContent,{value:"configuration",className:"mt-0",children:(0,ed.jsx)(bK,{mentalModel:c})}),(0,ed.jsx)(tW.TabsContent,{value:"history",className:"mt-0",children:E?(0,ed.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ed.jsx)(tz.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):C&&C.length>0?(0,ed.jsx)(bY,{history:C,currentContent:c.content,currentBasedOn:D,onViewMemory:e=>j(e),onViewDirective:e=>S(e)}):(0,ed.jsx)("p",{className:"text-sm text-muted-foreground italic",children:s("noHistory")})})]})]}):null]})}),N&&(0,ed.jsx)(tZ,{memoryId:N,onClose:()=>j(null)}),k&&(0,ed.jsx)(bA,{directiveId:k,onClose:()=>S(null)})]})}function bX({label:e,value:t}){return(0,ed.jsxs)("div",{children:[(0,ed.jsx)(bZ,{children:e}),(0,ed.jsx)("div",{className:"text-sm text-foreground",children:t})]})}function b$({title:e,icon:t,children:n}){return(0,ed.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[t,e]}),(0,ed.jsx)("div",{className:"p-4 space-y-4",children:n})]})}function bq({label:e,color:t}){return(0,ed.jsx)("span",{className:`px-2 py-0.5 rounded text-xs ${t??"bg-muted text-foreground border border-border/60"}`,children:e})}function bK({mentalModel:e}){let t=(0,ep.useTranslations)("mentalModelDetailModal"),n=e.trigger??{refresh_after_consolidation:!1},r=n.fact_types??[],i=n.tag_groups??[],a=n.exclude_mental_model_ids??[];return(0,ed.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ed.jsxs)(b$,{title:t("identityTitle"),icon:(0,ed.jsx)(ej.FileText,{className:"w-3.5 h-3.5"}),children:[(0,ed.jsx)(bX,{label:t("labelId"),value:(0,ed.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:e.id})}),(0,ed.jsx)(bX,{label:t("labelName"),value:e.name}),e.source_query&&(0,ed.jsx)(bX,{label:t("labelSourceQuery"),value:(0,ed.jsx)("pre",{className:"text-sm font-mono text-foreground bg-muted/30 border border-border/60 rounded p-2 leading-6 m-0",style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace)"},children:e.source_query})}),(0,ed.jsx)(bX,{label:t("labelTags"),value:e.tags?.length>0?(0,ed.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.tags.map(e=>(0,ed.jsx)(bq,{label:e,color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"},e))}):(0,ed.jsx)("span",{className:"text-muted-foreground italic text-sm",children:t("noTags")})})]}),(0,ed.jsxs)(b$,{title:t("timingTitle"),icon:(0,ed.jsx)(eV,{className:"w-3.5 h-3.5"}),children:[(0,ed.jsx)(bX,{label:t("labelCreated"),value:bP(e.created_at)}),(0,ed.jsx)(bX,{label:t("labelLastRefreshed"),value:(0,ed.jsx)("span",{title:bP(e.last_refreshed_at),children:bD(e.last_refreshed_at)})}),(0,ed.jsx)(bX,{label:t("labelMaxTokens"),value:e.max_tokens.toLocaleString()})]}),(0,ed.jsxs)(b$,{title:t("refreshTriggerTitle"),icon:(0,ed.jsx)(mO,{className:"w-3.5 h-3.5"}),children:[(0,ed.jsx)(bX,{label:t("labelRefreshMode"),value:"delta"===n.mode?(0,ed.jsx)(bq,{label:t("pillDelta"),color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}):(0,ed.jsx)(bq,{label:t("pillFull")})}),(0,ed.jsx)(bX,{label:t("labelAutoRefreshAfterConsolidation"),value:n.refresh_after_consolidation?(0,ed.jsx)(bq,{label:t("pillEnabled"),color:"bg-green-500/10 text-green-600 dark:text-green-400"}):(0,ed.jsx)(bq,{label:t("pillDisabled")})}),(0,ed.jsx)(bX,{label:t("labelFactTypes"),value:r.length>0?(0,ed.jsx)("div",{className:"flex flex-wrap gap-1.5",children:r.map(e=>{let n=bR(e,t);return(0,ed.jsx)(bq,{label:n.label,color:n.color},e)})}):(0,ed.jsx)("span",{className:"text-muted-foreground italic text-sm",children:t("factTypesAll")})}),(0,ed.jsx)(bX,{label:t("labelExcludeMentalModels"),value:n.exclude_mental_models?t("valueYes"):t("valueNo")}),a.length>0&&(0,ed.jsx)(bX,{label:t("labelExcludedIds"),value:(0,ed.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map(e=>(0,ed.jsx)("code",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-muted border border-border/60",children:e},e))})})]}),(0,ed.jsxs)(b$,{title:t("recallParamsTitle"),icon:(0,ed.jsx)(e_,{className:"w-3.5 h-3.5"}),children:[(0,ed.jsx)(bX,{label:t("labelIncludeChunks"),value:null==n.include_chunks?t("includeChunksDefault"):n.include_chunks?t("valueYes"):t("valueNo")}),(0,ed.jsx)(bX,{label:t("labelRecallMaxTokens"),value:null!=n.recall_max_tokens?n.recall_max_tokens.toLocaleString():t("recallMaxTokensDefault")}),(0,ed.jsx)(bX,{label:t("labelRecallChunksMaxTokens"),value:null!=n.recall_chunks_max_tokens?n.recall_chunks_max_tokens.toLocaleString():t("recallChunksMaxTokensDefault")}),(0,ed.jsx)(bX,{label:t("labelTagsMatch"),value:n.tags_match?(0,ed.jsx)(bq,{label:n.tags_match}):t("tagsMatchDefault")})]}),i.length>0&&(0,ed.jsx)("div",{className:"md:col-span-2",children:(0,ed.jsx)(b$,{title:t("tagGroupsTitle"),icon:(0,ed.jsx)(e_,{className:"w-3.5 h-3.5"}),children:(0,ed.jsx)("pre",{className:"text-xs font-mono bg-muted/40 rounded p-3 overflow-x-auto border border-border/60",children:JSON.stringify(i,null,2)})})})]})}function bZ({children:e}){return(0,ed.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:e})}function bQ(){let e,t,n,r,i,a,o,s,l,c,u,d=(0,ep.useTranslations)("thinkView"),{currentBank:h}=(0,ev.useBank)(),[f,p]=(0,eh.useState)(""),[g,v]=(0,eh.useState)("mid"),[x,y]=(0,eh.useState)(4096),[b,w]=(0,eh.useState)(!0),[N,j]=(0,eh.useState)(!0),[k,S]=(0,eh.useState)("answer"),[C,_]=(0,eh.useState)(null),[E,T]=(0,eh.useState)(!1),[M,O]=(0,eh.useState)(""),[A,D]=(0,eh.useState)("any"),[P,I]=(0,eh.useState)([]),[L,R]=(0,eh.useState)(!1),[B,F]=(0,eh.useState)(""),[z,V]=(0,eh.useState)(""),[H,U]=(0,eh.useState)(!1),[W,Y]=(0,eh.useState)(!1),[G,X]=(0,eh.useState)(null),[$,q]=(0,eh.useState)(null),[K,Z]=(0,eh.useState)(null),[Q,J]=(0,eh.useState)(!1),[ee,et]=(0,eh.useState)(null),[en,er]=(0,eh.useState)(null),[ei,ea]=(0,eh.useState)(!1),[eo,es]=(0,eh.useState)(null),[el,ec]=(0,eh.useState)("world"),eu="General Feedback",ef=async e=>{if(et(e),er(null),h&&e?.id){ea(!0);try{let t=await eO.client.listObservations(h),n=t.items?.find(t=>t.id===e.id);er(n||e)}catch(t){console.error("Failed to load observation:",t),er(e)}finally{ea(!1)}}},em=async()=>{if(h&&z.trim()){U(!0);try{let e=await eO.client.listDirectives(h),t=e.items?.find(e=>e.name===eu);if(t){let e=t.content?`${t.content}
|
|
8
|
-
${z.trim()}`:z.trim();await eO.client.updateDirective(h,t.id,{content:e})}else await eO.client.createDirective(h,{name:eu,content:z.trim()});V(""),Y(!0),setTimeout(()=>Y(!1),3e3)}catch(e){}finally{U(!1)}}},eg=async()=>{if(h&&f){T(!0),S("answer");try{let e=M.split(",").map(e=>e.trim()).filter(e=>e.length>0),t=B.split(",").map(e=>e.trim()).filter(e=>e.length>0),n=await eO.client.reflect({bank_id:h,query:f,budget:g,max_tokens:x,include_facts:b,include_tool_calls:N,...e.length>0&&{tags:e,tags_match:A},...P.length>0&&{fact_types:P},...L&&{exclude_mental_models:!0},...t.length>0&&{exclude_mental_model_ids:t}});_(n)}catch(e){}finally{T(!1)}}};return h?(0,ed.jsxs)("div",{className:"space-y-6",children:[(0,ed.jsx)(pW.Card,{children:(0,ed.jsxs)(pW.CardContent,{className:"pt-6",children:[(0,ed.jsxs)("div",{className:"flex gap-3",children:[(0,ed.jsxs)("div",{className:"flex-1 relative",children:[(0,ed.jsx)(ew,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ed.jsx)(eD.Input,{type:"text",value:f,onChange:e=>p(e.target.value),placeholder:d("queryPlaceholder"),className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&eg()})]}),(0,ed.jsx)(eA.Button,{onClick:eg,disabled:E||!f,className:"h-12 px-8",children:E?d("reflecting"):d("reflect")})]}),(0,ed.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:d("budgetLabel")}),(0,ed.jsxs)(tP.Select,{value:g,onValueChange:e=>v(e),children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-24 h-8",children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"low",children:d("budgetLow")}),(0,ed.jsx)(tP.SelectItem,{value:"mid",children:d("budgetMid")}),(0,ed.jsx)(tP.SelectItem,{value:"high",children:d("budgetHigh")})]})]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-sm text-muted-foreground",children:d("tokensLabel")}),(0,ed.jsx)(eD.Input,{type:"number",value:x,onChange:e=>y(parseInt(e.target.value)||4096),className:"w-24 h-8"})]}),(0,ed.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ed.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ed.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ed.jsx)(pB.Checkbox,{checked:b,onCheckedChange:e=>w(e)}),(0,ed.jsx)("span",{className:"text-sm",children:d("includeSource")})]}),(0,ed.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ed.jsx)(pB.Checkbox,{checked:N,onCheckedChange:e=>j(e)}),(0,ed.jsx)("span",{className:"text-sm",children:d("includeTools")})]})]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ed.jsx)(tI,{className:"h-4 w-4 text-muted-foreground"}),(0,ed.jsx)("div",{className:"flex-1 max-w-md",children:(0,ed.jsx)(eD.Input,{type:"text",value:M,onChange:e=>O(e.target.value),placeholder:d("tagsPlaceholder"),className:"h-8"})}),(0,ed.jsxs)(tP.Select,{value:A,onValueChange:e=>D(e),children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-40 h-8",children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"any",children:d("tagsMatchAny")}),(0,ed.jsx)(tP.SelectItem,{value:"all",children:d("tagsMatchAll")}),(0,ed.jsx)(tP.SelectItem,{value:"any_strict",children:d("tagsMatchAnyStrict")}),(0,ed.jsx)(tP.SelectItem,{value:"all_strict",children:d("tagsMatchAllStrict")})]})]})]}),(0,ed.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ed.jsx)(pH,{value:P,onChange:I}),(0,ed.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ed.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ed.jsx)(pB.Checkbox,{checked:L,onCheckedChange:e=>R(e)}),(0,ed.jsx)("span",{className:"text-sm",children:d("excludeMentalModels")})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-sm text-muted-foreground",children:d("excludeIdsLabel")}),(0,ed.jsx)(eD.Input,{type:"text",value:B,onChange:e=>F(e.target.value),placeholder:d("excludeIdsPlaceholder"),className:"h-8 w-48"})]})]})]})}),E&&(0,ed.jsx)(pW.Card,{children:(0,ed.jsxs)(pW.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ed.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ed.jsx)("p",{className:"text-muted-foreground",children:d("reflectingOnMemories")})]})}),!E&&C&&(0,ed.jsxs)("div",{className:"space-y-4",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[C.usage&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:d("inputTokensLabel")}),(0,ed.jsx)("span",{className:"font-semibold",children:C.usage.input_tokens?.toLocaleString()})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:d("outputTokensLabel")}),(0,ed.jsx)("span",{className:"font-semibold",children:C.usage.output_tokens?.toLocaleString()})]})]}),C.trace?.tool_calls&&(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:d("toolCallsLabel")}),(0,ed.jsx)("span",{className:"font-semibold",children:C.trace.tool_calls.length}),(0,ed.jsxs)("span",{className:"text-muted-foreground",children:["(",C.trace.tool_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),C.trace?.llm_calls&&(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:d("llmCallsLabel")}),(0,ed.jsx)("span",{className:"font-semibold",children:C.trace.llm_calls.length}),(0,ed.jsxs)("span",{className:"text-muted-foreground",children:["(",C.trace.llm_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),(0,ed.jsx)("div",{className:"flex-1"}),(0,ed.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["answer","trace","json"].map(e=>(0,ed.jsx)("button",{onClick:()=>S(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${k===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"answer"===e?d("viewAnswer"):"trace"===e?d("viewTrace"):d("viewJson")},e))})]}),"answer"===k&&(0,ed.jsxs)("div",{className:"space-y-6",children:[(0,ed.jsxs)(pW.Card,{children:[(0,ed.jsx)(pW.CardHeader,{children:(0,ed.jsx)(pW.CardTitle,{children:d("answerTitle")})}),(0,ed.jsx)(pW.CardContent,{children:(0,ed.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:(0,ed.jsx)(x6,{remarkPlugins:[b_],children:C.text})})})]}),(0,ed.jsxs)(pW.Card,{className:"border-blue-200 dark:border-blue-800",children:[(0,ed.jsxs)(pW.CardHeader,{className:"py-4",children:[(0,ed.jsxs)(pW.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,ed.jsx)(pX,{className:"w-4 h-4"}),d("addDirectiveTitle")]}),(0,ed.jsx)(pW.CardDescription,{className:"text-xs",children:d("addDirectiveDescription")})]}),(0,ed.jsx)(pW.CardContent,{className:"pt-0",children:W?(0,ed.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,ed.jsx)("span",{className:"text-lg",children:"✓"}),(0,ed.jsx)("span",{className:"text-sm font-medium",children:d("directiveSaved",{name:eu})})]}):(0,ed.jsxs)("div",{className:"flex gap-3",children:[(0,ed.jsx)(pK.Textarea,{value:z,onChange:e=>V(e.target.value),placeholder:d("directivePlaceholder"),className:"flex-1 min-h-[60px] resize-none",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&em()}}),(0,ed.jsx)(eA.Button,{onClick:em,disabled:H||!z.trim(),className:"self-end",children:H?d("savingDirective"):d("saveDirective")})]})})]})]}),"trace"===k&&(0,ed.jsxs)("div",{className:"space-y-4",children:[C.observations_created&&C.observations_created.length>0&&(0,ed.jsxs)(pW.Card,{className:"border-emerald-200 dark:border-emerald-800",children:[(0,ed.jsxs)(pW.CardHeader,{className:"bg-emerald-50 dark:bg-emerald-950 py-3",children:[(0,ed.jsxs)(pW.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,ed.jsx)(pG,{className:"w-4 h-4 text-emerald-600"}),d("observationsCreatedTitle",{count:C.observations_created.length})]}),(0,ed.jsx)(pW.CardDescription,{className:"text-xs",children:d("observationsCreatedDescription")})]}),(0,ed.jsx)(pW.CardContent,{className:"pt-4",children:(0,ed.jsx)("div",{className:"space-y-2",children:C.observations_created.map((e,t)=>(0,ed.jsxs)("div",{className:"p-3 bg-emerald-50 dark:bg-emerald-950/50 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,ed.jsx)("div",{className:"font-medium text-sm text-emerald-900 dark:text-emerald-100",children:e.name}),(0,ed.jsx)("div",{className:"text-xs text-emerald-700 dark:text-emerald-300 mt-1",children:e.description}),(0,ed.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-2 font-mono",children:["ID: ",e.id]})]},t))})})]}),(0,ed.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,ed.jsxs)(pW.Card,{className:"h-fit",children:[(0,ed.jsxs)(pW.CardHeader,{className:"pb-3",children:[(0,ed.jsx)(pW.CardTitle,{className:"text-base",children:d("executionTraceTitle")}),(0,ed.jsx)(pW.CardDescription,{className:"text-xs",children:d("executionTraceDescription",{iterations:C.iterations||0,iterationsPlural:1!==(C.iterations||0)?"s":"",totalMs:(C.trace?.llm_calls?.reduce((e,t)=>e+t.duration_ms,0)||0)+(C.trace?.tool_calls?.reduce((e,t)=>e+t.duration_ms,0)||0)})})]}),(0,ed.jsx)(pW.CardContent,{children:N?C.trace?.llm_calls&&C.trace.llm_calls.length>0||C.trace?.tool_calls&&C.trace.tool_calls.length>0?(0,ed.jsx)("div",{className:"max-h-[500px] overflow-y-auto pr-2",children:(e=C.trace?.llm_calls||[],t=C.trace?.tool_calls||[],n=[],e.forEach((r,i)=>{let a=t.filter(e=>e.iteration===i+1),o=i===e.length-1,s=r.scope.includes("final")||o&&0===a.length,l=s?e.length:i+1;n.push({type:"llm",llm:r,iteration:l,isFinal:s}),a.length>0&&n.push({type:"tools",tools:a,iteration:i+1})}),n.map((e,t)=>(0,ed.jsxs)("div",{className:"relative",children:[t<n.length-1&&(0,ed.jsx)("div",{className:"absolute left-3 top-6 bottom-0 w-0.5 bg-border"}),"llm"===e.type?(0,ed.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ed.jsx)("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${e.isFinal?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-primary/10 text-primary"}`,children:e.isFinal?(0,ed.jsx)(tB.Check,{className:"w-3.5 h-3.5",strokeWidth:2.5}):(0,ed.jsx)("span",{className:"text-[10px] font-semibold",children:e.iteration})}),(0,ed.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsx)("span",{className:"font-medium text-sm",children:e.isFinal?d("responseGenerated"):d("agentDecided")}),(0,ed.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ed.jsx)(eU,{className:"w-3 h-3"}),e.llm.duration_ms,"ms"]})]}),(0,ed.jsx)("span",{className:"text-xs text-muted-foreground",children:e.isFinal?d("finalAnswer"):d("calledToolsBelow")})]})]}):(0,ed.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ed.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-blue-500/15 text-blue-600 dark:text-blue-400 flex-shrink-0",children:(0,ed.jsx)(pq,{className:"w-3 h-3",fill:"currentColor"})}),(0,ed.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,ed.jsx)("div",{className:"text-xs text-muted-foreground",children:(e.tools?.length??0)!==1?d("executingToolsPlural",{count:e.tools?.length??0}):d("executingTools",{count:e.tools?.length??0})}),e.tools?.map((e,t)=>(0,ed.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted/50",children:[(0,ed.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.tool}),(0,ed.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ed.jsx)(eU,{className:"w-3 h-3"}),e.duration_ms,"ms"]})]}),(0,ed.jsxs)("div",{className:"p-2 space-y-2",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:d("toolInputLabel")}),(0,ed.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ed.jsx)(mM,{src:e.input,collapsed:1,theme:"default"})})]}),e.output&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:d("toolOutputLabel")}),(0,ed.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ed.jsx)(mM,{src:e.output,collapsed:1,theme:"default"})})]})]})]},t))]})]})]},t)))}):(0,ed.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ed.jsx)(pY.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"font-medium text-sm text-foreground",children:d("noOperations")}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:d("noOperationsDescription")})]})]}):(0,ed.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ed.jsx)(pY.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"font-medium text-sm text-foreground",children:d("notIncluded")}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:d("enableIncludeTools")})]})]})})]}),(0,ed.jsxs)(pW.Card,{className:"h-fit",children:[(0,ed.jsxs)(pW.CardHeader,{className:"pb-3",children:[(0,ed.jsx)(pW.CardTitle,{className:"text-base",children:d("basedOnTitle")}),(0,ed.jsx)(pW.CardDescription,{className:"text-xs",children:d("basedOnDescription",{count:(C.based_on?.memories?.length||0)+(C.based_on?.observations?.filter(e=>"directive"!==e.subtype)?.length||0)+(C.based_on?.directives?.length||0)})})]}),(0,ed.jsx)(pW.CardContent,{children:b?C.based_on?.memories&&C.based_on.memories.length>0||C.based_on?.mental_models&&C.based_on.mental_models.length>0||C.based_on?.directives&&C.based_on.directives.length>0||C.based_on?.observations&&C.based_on.observations.length>0?(i=(r=C.based_on?.memories||[]).filter(e=>"world"===e.type),a=r.filter(e=>"experience"===e.type),o=C.based_on?.mental_models||[],s=(C.based_on?.observations||[]).filter(e=>"directive"!==e.subtype),l=C.based_on?.directives||[],c=[{id:"directives",label:d("tabDirectives"),count:l.length},{id:"mental_models",label:d("tabMentalModels"),count:o.length},{id:"observations",label:d("tabObservations"),count:s.length},{id:"world",label:d("tabWorld"),count:i.length},{id:"experience",label:d("tabExperience"),count:a.length}],u=(()=>{switch(el){case"directives":return l;case"mental_models":return o;case"observations":return s;case"world":return i;case"experience":return a;default:return[]}})(),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1 mb-4",children:c.map(e=>(0,ed.jsxs)("button",{onClick:()=>ec(e.id),className:`flex-1 px-3 py-1.5 rounded-md text-sm font-medium transition-all ${el===e.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.label," (",e.count,")"]},e.id))}),u.length>0?(0,ed.jsx)("div",{className:"max-h-[400px] overflow-y-auto pr-2 space-y-3",children:u.map((e,t)=>{let n,r;return(0,ed.jsx)("div",{className:`p-4 bg-muted/50 rounded-lg border border-border/50 ${"directives"!==el?"cursor-pointer hover:bg-muted/80 transition-colors":""}`,onClick:()=>{"directives"!==el&&("observations"===el?ef(e):"mental_models"===el?es(e.id):X(e.id))},children:"directives"===el?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("div",{className:"font-medium text-sm",children:e.name}),e.content&&(0,ed.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:e.content})]}):"observations"===el?(0,ed.jsx)("div",{className:"font-medium text-sm",children:e.name}):"mental_models"===el?(r=(n=e.text?.indexOf(": ")??-1)>0?e.text.slice(0,n):e.id,(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("div",{className:"font-medium text-sm",children:r}),(0,ed.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:e.id})]})):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:e.text}),e.context&&(0,ed.jsx)("div",{className:"text-xs text-muted-foreground mt-2",children:e.context})]})},e.id||t)})}):(0,ed.jsx)("p",{className:"text-sm text-muted-foreground text-center py-4",children:d("noTabItems",{tab:el})})]})):(0,ed.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:[(0,ed.jsx)(pY.Info,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"font-medium text-sm text-amber-900 dark:text-amber-100",children:d("noFactsFound")}),(0,ed.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300 mt-0.5",children:d("noFactsFoundDescription")})]})]}):(0,ed.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ed.jsx)(pY.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"font-medium text-sm text-foreground",children:d("notIncludedBasedOn")}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:d("enableIncludeSource")})]})]})})]})]})]}),"json"===k&&(0,ed.jsxs)(pW.Card,{children:[(0,ed.jsx)(pW.CardHeader,{children:(0,ed.jsx)(pW.CardTitle,{className:"text-lg",children:d("rawResponseTitle")})}),(0,ed.jsx)(pW.CardContent,{children:(0,ed.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ed.jsx)(mM,{src:C,collapsed:2,theme:"default"})})})]})]}),!E&&!C&&(0,ed.jsx)(pW.Card,{className:"border-dashed",children:(0,ed.jsxs)(pW.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ed.jsx)(ew,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ed.jsx)("h3",{className:"text-lg font-semibold mb-2",children:d("readyToReflect")}),(0,ed.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:d("readyToReflectDescription")})]})}),(0,ed.jsx)(tZ,{memoryId:G,onClose:()=>X(null)}),$&&(0,ed.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ed.jsxs)("div",{className:"p-6",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)(p$,{className:"w-5 h-5"}),(0,ed.jsx)("h2",{className:"text-lg font-semibold",children:"Directive"})]}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"icon",onClick:()=>{q(null),Z(null)},children:(0,ed.jsx)(tF.X,{className:"w-4 h-4"})})]}),Q?(0,ed.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ed.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ed.jsxs)("div",{className:"space-y-4",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),(0,ed.jsx)("p",{className:"mt-1 font-medium",children:K?.name||$.name})]}),K?.description&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),(0,ed.jsx)("p",{className:"mt-1 text-sm",children:K.description})]}),K?.tags&&K.tags.length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ed.jsx)("div",{className:"flex flex-wrap gap-1",children:K.tags.map(e=>(0,ed.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ed.jsx)(tI,{className:"w-2.5 h-2.5"}),e]},e))})]}),(K?.content||$.content)&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Content"}),(0,ed.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ed.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:K?.content||$.content})})]}),(0,ed.jsxs)("div",{className:"pt-2 border-t",children:[(0,ed.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ed.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:$.id})]})]})]})}),ee&&(0,ed.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ed.jsxs)("div",{className:"p-6",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)(pG,{className:"w-5 h-5"}),(0,ed.jsx)("h2",{className:"text-lg font-semibold",children:d("observationPanelTitle")})]}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"icon",onClick:()=>{et(null),er(null)},children:(0,ed.jsx)(tF.X,{className:"w-4 h-4"})})]}),ei?(0,ed.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ed.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ed.jsxs)("div",{className:"space-y-4",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:d("observationTextField")}),(0,ed.jsx)("div",{className:"mt-1 prose prose-sm max-w-none dark:prose-invert",children:(0,ed.jsx)(x6,{remarkPlugins:[b_],children:en?.text||ee.text})})]}),en?.tags&&en.tags.length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:d("observationTagsField")}),(0,ed.jsx)("div",{className:"flex flex-wrap gap-1",children:en.tags.map(e=>(0,ed.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ed.jsx)(tI,{className:"w-2.5 h-2.5"}),e]},e))})]}),en?.source_memories&&en.source_memories.length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:d("observationSourceMemoriesField",{count:en.source_memories.length})}),(0,ed.jsx)("div",{className:"space-y-2",children:en.source_memories.map((e,t)=>(0,ed.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ed.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.text||("string"==typeof e?e:"")})},t))})]}),(0,ed.jsxs)("div",{className:"pt-2 border-t",children:[(0,ed.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:d("observationIdField")}),(0,ed.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:ee.id})]})]})]})}),(0,ed.jsx)(bG,{mentalModelId:eo,onClose:()=>es(null)})]}):(0,ed.jsx)(pW.Card,{className:"border-dashed",children:(0,ed.jsxs)(pW.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ed.jsx)(eN,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ed.jsx)("h3",{className:"text-xl font-semibold mb-2",children:d("noBankSelected")}),(0,ed.jsx)("p",{className:"text-muted-foreground",children:d("noBankSelectedDescription")})]})})}let bJ=(0,eb.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function b0(){let e,t,n,r,i,a,o,s,l,c,u,d,h,f,p=(0,ep.useTranslations)("searchDebug"),{currentBank:g}=(0,ev.useBank)(),[v,x]=(0,eh.useState)(""),[y,b]=(0,eh.useState)(["world"]),[w,N]=(0,eh.useState)("mid"),[j,k]=(0,eh.useState)(4096),[S,C]=(0,eh.useState)(""),[_,E]=(0,eh.useState)(!1),[T,M]=(0,eh.useState)(!1),[O,A]=(0,eh.useState)(""),[D,P]=(0,eh.useState)("any"),[I,L]=(0,eh.useState)(null),[R,B]=(0,eh.useState)(null),[F,z]=(0,eh.useState)(null),[V,H]=(0,eh.useState)(null),[U,W]=(0,eh.useState)(null),[Y,G]=(0,eh.useState)(!1),[X,$]=(0,eh.useState)("results"),[q,K]=(0,eh.useState)(null),[Z,Q]=(0,eh.useState)(new Set),[J,ee]=(0,eh.useState)(new Set),et=e=>{Q(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},en=e=>{ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},er=e=>{let t=e.id||e.node_id;K(I?.find(e=>e.id===t||e.node_id===t)||e)},ei=async()=>{if(!g)return void em.toast.error(p("errorSelectBank"));if(v){if(0===y.length)return void em.toast.error(p("errorSelectFactType"));G(!0);try{let e=O.split(",").map(e=>e.trim()).filter(e=>e.length>0),t={bank_id:g,query:v,types:y,budget:w,max_tokens:j,trace:!0,include:{entities:T?{max_tokens:500}:null,chunks:_?{max_tokens:8192}:null},...S&&{query_timestamp:S},...e.length>0&&{tags:e,tags_match:D}},n=await eO.client.recall(t);L(n.results||[]),B(n.entities||null),z(n.chunks||null),H(n.observations||null),W(n.trace||null),$("results")}catch(e){}finally{G(!1)}}};return g?(0,ed.jsxs)("div",{className:"space-y-6",children:[(0,ed.jsx)(pW.Card,{children:(0,ed.jsxs)(pW.CardContent,{className:"pt-6",children:[(0,ed.jsxs)("div",{className:"flex gap-3",children:[(0,ed.jsxs)("div",{className:"flex-1 relative",children:[(0,ed.jsx)(ey.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ed.jsx)(eD.Input,{type:"text",value:v,onChange:e=>x(e.target.value),placeholder:p("queryPlaceholder"),className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&ei()})]}),(0,ed.jsx)(eA.Button,{onClick:ei,disabled:Y||!v,className:"h-12 px-8",children:Y?p("searching"):p("recall")})]}),(0,ed.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ed.jsx)(pH,{value:y,onChange:b,label:p("typesLabel")}),(0,ed.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)(mO,{className:"h-4 w-4 text-muted-foreground"}),(0,ed.jsxs)(tP.Select,{value:w,onValueChange:e=>N(e),children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-24 h-8",children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"low",children:p("budgetLow")}),(0,ed.jsx)(tP.SelectItem,{value:"mid",children:p("budgetMid")}),(0,ed.jsx)(tP.SelectItem,{value:"high",children:p("budgetHigh")})]})]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-sm text-muted-foreground",children:p("tokensLabel")}),(0,ed.jsx)(eD.Input,{type:"number",value:j,onChange:e=>k(parseInt(e.target.value)),className:"w-24 h-8"})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)(eU,{className:"h-4 w-4 text-muted-foreground"}),(0,ed.jsx)(eD.Input,{type:"datetime-local",value:S,onChange:e=>C(e.target.value),className:"h-8",placeholder:p("queryDatePlaceholder")})]}),(0,ed.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ed.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ed.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ed.jsx)(pB.Checkbox,{checked:_,onCheckedChange:e=>E(e)}),(0,ed.jsx)(ej.FileText,{className:"h-4 w-4 text-muted-foreground"}),(0,ed.jsx)("span",{className:"text-sm",children:p("chunks")})]}),(0,ed.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ed.jsx)(pB.Checkbox,{checked:T,onCheckedChange:e=>M(e)}),(0,ed.jsx)(ek,{className:"h-4 w-4 text-muted-foreground"}),(0,ed.jsx)("span",{className:"text-sm",children:p("entities")})]})]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ed.jsx)(tI,{className:"h-4 w-4 text-muted-foreground"}),(0,ed.jsx)("div",{className:"flex-1 max-w-md",children:(0,ed.jsx)(eD.Input,{type:"text",value:O,onChange:e=>A(e.target.value),placeholder:p("tagsPlaceholder"),className:"h-8"})}),(0,ed.jsxs)(tP.Select,{value:D,onValueChange:e=>P(e),children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-40 h-8",children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"any",children:p("tagsMatchAny")}),(0,ed.jsx)(tP.SelectItem,{value:"all",children:p("tagsMatchAll")}),(0,ed.jsx)(tP.SelectItem,{value:"any_strict",children:p("tagsMatchAnyStrict")}),(0,ed.jsx)(tP.SelectItem,{value:"all_strict",children:p("tagsMatchAllStrict")})]})]})]})]})}),Y&&(0,ed.jsx)(pW.Card,{children:(0,ed.jsxs)(pW.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ed.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ed.jsx)("p",{className:"text-muted-foreground",children:p("searchingMemories")})]})}),!Y&&I&&(0,ed.jsxs)("div",{className:"space-y-4",children:[U?.summary&&(0,ed.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:p("resultsLabel")}),(0,ed.jsx)("span",{className:"font-semibold",children:I.length})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:p("durationLabel")}),(0,ed.jsxs)("span",{className:"font-semibold",children:[U.summary.total_duration_seconds?.toFixed(2),"s"]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:p("nodesVisitedLabel")}),(0,ed.jsx)("span",{className:"font-semibold",children:U.summary.total_nodes_visited})]}),(0,ed.jsx)("div",{className:"flex-1"}),(0,ed.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["results","trace","json"].map(e=>(0,ed.jsx)("button",{onClick:()=>$(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${X===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"results"===e?p("viewResults"):"trace"===e?p("viewTrace"):p("viewJson")},e))})]}),"results"===X&&(0,ed.jsxs)("div",{className:"space-y-4",children:[V&&V.length>0&&(0,ed.jsxs)(pW.Card,{className:"border-orange-500/30 bg-orange-500/5",children:[(0,ed.jsx)(pW.CardHeader,{className:"py-3",children:(0,ed.jsxs)(pW.CardTitle,{className:"text-base flex items-center gap-2",children:[(0,ed.jsx)(eN,{className:"h-4 w-4 text-orange-500"}),(0,ed.jsx)("span",{children:"Observations"}),(0,ed.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",V.length,")"]})]})}),(0,ed.jsx)(pW.CardContent,{className:"pt-0 space-y-2",children:V.map((e,t)=>(0,ed.jsxs)("div",{className:"p-3 bg-background rounded-lg border border-orange-500/20",children:[(0,ed.jsx)("p",{className:"text-sm text-foreground",children:e.text}),(0,ed.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,ed.jsx)("span",{className:"px-2 py-0.5 rounded bg-orange-500/10 text-orange-600",children:"Observation"}),(0,ed.jsx)("span",{children:p("proofCount",{count:e.proof_count||1})}),(0,ed.jsx)("span",{children:p("relevance",{value:(e.relevance||0).toFixed(3)})})]})]},e.id||t))})]}),(0,ed.jsx)("div",{className:"space-y-3",children:0!==I.length||V&&0!==V.length?I.map((e,t)=>{let n=U?.visits?.find(t=>t.node_id===e.id),r=n?n.weights.final_weight:e.score||0;return(0,ed.jsx)(pW.Card,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>K(e),children:(0,ed.jsx)(pW.CardContent,{className:"py-4",children:(0,ed.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ed.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:(0,ed.jsx)("span",{className:"text-sm font-semibold text-primary",children:t+1})}),(0,ed.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ed.jsx)("p",{className:"text-foreground",children:e.text}),(0,ed.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[(0,ed.jsx)("span",{className:"px-2 py-0.5 rounded bg-muted capitalize",children:e.type||"world"}),e.context&&(0,ed.jsx)("span",{className:"truncate max-w-xs",children:e.context}),e.occurred_start&&(0,ed.jsx)("span",{children:new Date(e.occurred_start).toLocaleDateString()})]})]}),(0,ed.jsxs)("div",{className:"flex-shrink-0 text-right",children:[(0,ed.jsx)("div",{className:"text-sm font-semibold",children:(r??0).toFixed(3)}),(0,ed.jsx)("div",{className:"text-xs text-muted-foreground",children:p("scoreLabel")})]}),(0,ed.jsx)(eC.ChevronRight,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},t)}):(0,ed.jsx)(pW.Card,{children:(0,ed.jsxs)(pW.CardContent,{className:"flex flex-col items-center justify-center py-12",children:[(0,ed.jsx)(ey.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ed.jsx)("p",{className:"text-muted-foreground",children:p("noMemoriesFound")})]})})})]}),"trace"===X&&U&&(0,ed.jsxs)("div",{className:"space-y-4",children:[U.retrieval_results&&U.retrieval_results.length>0&&(e={},U.retrieval_results.forEach(t=>{let n=t.fact_type||"all";e[n]||(e[n]=[]),e[n].push(t)}),t=Object.keys(e),(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-3 flex items-center gap-2",children:[(0,ed.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,ed.jsx)("span",{children:p("parallelRetrieval")}),(0,ed.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,ed.jsx)("div",{className:"space-y-2",children:t.map((t,n)=>{let r=e[t],i=`lane-${t}`,a=Z.has(i),o=r.reduce((e,t)=>e+(t.results?.length||0),0),s=Math.max(...r.map(e=>e.duration_seconds||0)),l={world:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/30"},experience:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},opinion:{bg:"bg-purple-500/10",text:"text-purple-500",border:"border-purple-500/30"},all:{bg:"bg-gray-500/10",text:"text-gray-500",border:"border-gray-500/30"}},c=l[t]||l.all;return(0,ed.jsx)(pW.Card,{className:`transition-colors ${a?"border-primary":c.border}`,children:(0,ed.jsxs)(pW.CardContent,{className:"py-3 px-4",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>et(i),children:[(0,ed.jsx)("div",{className:`w-8 h-8 rounded-lg ${c.bg} flex items-center justify-center`,children:(0,ed.jsx)("span",{className:`text-sm font-bold ${c.text} capitalize`,children:t.charAt(0).toUpperCase()})}),(0,ed.jsxs)("div",{className:"flex-1",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"font-semibold text-foreground capitalize",children:t}),(0,ed.jsx)("span",{className:"text-xs text-muted-foreground",children:p("methodsCount",{count:r.length})})]}),(0,ed.jsx)("div",{className:"flex gap-1.5 mt-1",children:r.map((e,t)=>(0,ed.jsxs)("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-muted text-muted-foreground capitalize",children:[e.method_name,": ",e.results?.length||0]},t))})]}),(0,ed.jsxs)("div",{className:"text-right",children:[(0,ed.jsx)("div",{className:"text-2xl font-bold text-foreground",children:o}),(0,ed.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[s.toFixed(2),"s"]})]}),a?(0,ed.jsx)(pC.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ed.jsx)(eC.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]}),a&&(0,ed.jsx)("div",{className:"mt-4 pt-4 border-t border-border",children:(0,ed.jsx)("div",{className:`grid gap-3 ${1===r.length?"grid-cols-1":2===r.length?"grid-cols-2":3===r.length?"grid-cols-3":"grid-cols-4"}`,children:r.map((e,t)=>{let n,r,a,o,s=`${i}-method-${t}`,l=Z.has(s),c=e.results||[];return(0,ed.jsxs)("div",{className:"flex flex-col",children:[(0,ed.jsxs)("div",{className:`p-3 rounded-lg cursor-pointer transition-colors ${l?"bg-primary/10 border border-primary":"bg-muted/50 hover:bg-muted"}`,onClick:e=>{e.stopPropagation(),et(s)},children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"font-medium text-sm text-foreground capitalize",children:e.method_name}),"temporal"===e.method_name&&e.metadata?.constraint&&(0,ed.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[(0,ed.jsx)(eP,{className:"h-3 w-3"}),e.metadata.constraint.start?new Date(e.metadata.constraint.start).toLocaleDateString():"any"," → ",e.metadata.constraint.end?new Date(e.metadata.constraint.end).toLocaleDateString():"any"]})]}),l?(0,ed.jsx)(pC.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ed.jsx)(eC.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),(0,ed.jsxs)("div",{className:"flex items-end justify-between",children:[(0,ed.jsx)("div",{className:"text-2xl font-bold text-foreground",children:c.length}),(0,ed.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[e.duration_seconds?.toFixed(2),"s"]})]})]}),l&&c.length>0&&(n=`results-${s}`,a=(r=J.has(n))?c:c.slice(0,5),o=c.length>5,(0,ed.jsxs)("div",{className:"mt-2 space-y-1.5 max-h-[300px] overflow-y-auto",children:[a.map((e,t)=>(0,ed.jsx)("div",{className:"p-2 bg-background rounded cursor-pointer hover:bg-muted/50 transition-colors border border-border",onClick:t=>{t.stopPropagation(),er(e)},children:(0,ed.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ed.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:t+1}),(0,ed.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ed.jsx)("p",{className:"text-xs text-foreground line-clamp-2",children:e.text}),(0,ed.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,ed.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(e.score||e.similarity||0).toFixed(4)})})]})]})},t)),o&&(0,ed.jsx)("button",{className:"w-full text-[10px] text-primary hover:text-primary/80 py-1.5 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),en(n)},children:r?p("showLess"):p("viewAllResults",{count:c.length})})]}))]},s)})})})]})},i)})}),(0,ed.jsx)("div",{className:"flex justify-center py-2",children:(0,ed.jsx)("div",{className:"flex items-center gap-2",children:t.map((e,t)=>{let n={world:"bg-blue-500",experience:"bg-green-500",opinion:"bg-purple-500",all:"bg-gray-500"};return(0,ed.jsx)("div",{className:"flex flex-col items-center",children:(0,ed.jsx)("div",{className:`w-1 h-4 ${n[e]||n.all} rounded-full opacity-50`})},t)})})}),(0,ed.jsx)("div",{className:"flex justify-center",children:(0,ed.jsx)(bJ,{className:"h-5 w-5 text-muted-foreground/50"})})]})),U.rrf_merged&&(n="rrf-merge",r=Z.has(n),(0,ed.jsxs)("div",{children:[(0,ed.jsx)(pW.Card,{className:`cursor-pointer transition-colors ${r?"border-primary":"hover:border-primary/50"}`,onClick:()=>et(n),children:(0,ed.jsx)(pW.CardContent,{className:"py-4",children:(0,ed.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ed.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-purple-500/10 flex items-center justify-center",children:(0,ed.jsx)("span",{className:"text-sm font-bold text-purple-500",children:"∪"})}),(0,ed.jsxs)("div",{className:"flex-1",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"font-semibold text-foreground",children:p("rrfFusion")}),(0,ed.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:p("rrfMerge")})]}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:p("rrfDescription")})]}),(0,ed.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.rrf_merged.length}),r?(0,ed.jsx)(pC.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ed.jsx)(eC.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),r&&U.rrf_merged.length>0&&(i="results-rrf",o=(a=J.has(i))?U.rrf_merged:U.rrf_merged.slice(0,5),s=U.rrf_merged.length>5,(0,ed.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[o.map((e,t)=>(0,ed.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),er(e)},children:(0,ed.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ed.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ed.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ed.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ed.jsxs)("div",{className:"text-xs text-muted-foreground mt-1",children:[p("rrfScore")," ",(e.rrf_score||e.score||0).toFixed(4)]})]})]})},t)),s&&(0,ed.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),en(i)},children:a?p("showLess"):p("viewAllResults",{count:U.rrf_merged.length})})]})),(0,ed.jsx)("div",{className:"flex justify-center py-2",children:(0,ed.jsx)(bJ,{className:"h-4 w-4 text-muted-foreground/50"})})]})),U.reranked&&(l="reranking",c=Z.has(l),(0,ed.jsxs)("div",{children:[(0,ed.jsx)(pW.Card,{className:`cursor-pointer transition-colors ${c?"border-primary":"hover:border-primary/50"}`,onClick:()=>et(l),children:(0,ed.jsx)(pW.CardContent,{className:"py-4",children:(0,ed.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ed.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-amber-500/10 flex items-center justify-center",children:(0,ed.jsx)("span",{className:"text-sm font-bold text-amber-500",children:"⚡"})}),(0,ed.jsxs)("div",{className:"flex-1",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"font-semibold text-foreground",children:p("combinedScoring")}),(0,ed.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:p("rerank")})]}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:(0,ed.jsx)("span",{className:"font-mono text-xs",children:"ce × recency_boost(±10%) × temporal_boost(±10%)"})})]}),(0,ed.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.reranked.length}),c?(0,ed.jsx)(pC.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ed.jsx)(eC.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),c&&U.reranked.length>0&&(u="results-rerank",h=(d=J.has(u))?U.reranked:U.reranked.slice(0,5),f=U.reranked.length>5,(0,ed.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[h.map((e,t)=>{let n=e.score_components||{};return(0,ed.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),er(e)},children:(0,ed.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ed.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ed.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ed.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ed.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-2 text-[10px] text-muted-foreground font-mono",children:[(0,ed.jsxs)("span",{className:"font-semibold text-foreground",children:["= ",(e.rerank_score||e.score||0).toFixed(4)]}),void 0!==n.cross_encoder_score_normalized&&(0,ed.jsxs)("span",{title:p("tooltipCrossEncoder"),children:["CE: ",n.cross_encoder_score_normalized.toFixed(3)]}),void 0!==n.temporal&&.5!==n.temporal&&(0,ed.jsxs)("span",{title:p("tooltipTemporal"),children:["Tmp: ",n.temporal.toFixed(3)]}),void 0!==n.recency&&(0,ed.jsxs)("span",{title:p("tooltipRecency"),children:["Rec: ",n.recency.toFixed(3)]})]})]})]})},t)}),f&&(0,ed.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),en(u)},children:d?p("showLess"):p("viewAllResults",{count:U.reranked.length})})]})),(0,ed.jsx)("div",{className:"flex justify-center py-2",children:(0,ed.jsx)(bJ,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,ed.jsx)(pW.Card,{className:"border-primary bg-primary/5",children:(0,ed.jsx)(pW.CardContent,{className:"py-4",children:(0,ed.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ed.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:(0,ed.jsx)("span",{className:"text-sm font-bold text-primary",children:"✓"})}),(0,ed.jsxs)("div",{className:"flex-1",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"font-semibold text-foreground",children:p("finalResults")}),(0,ed.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-primary/20 text-primary",children:p("output")})]}),(0,ed.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:p("finalResultsDescription")})]}),(0,ed.jsx)("div",{className:"text-2xl font-bold text-primary",children:I?.length||0})]})})})]}),"json"===X&&(0,ed.jsxs)(pW.Card,{children:[(0,ed.jsx)(pW.CardHeader,{children:(0,ed.jsx)(pW.CardTitle,{className:"text-lg",children:p("rawResponse")})}),(0,ed.jsx)(pW.CardContent,{children:(0,ed.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ed.jsx)(mM,{src:{results:I,...R&&{entities:R},...F&&{chunks:F},...V&&{observations:V},trace:U},collapsed:2,theme:"default"})})})]})]}),!Y&&!I&&(0,ed.jsx)(pW.Card,{className:"border-dashed",children:(0,ed.jsxs)(pW.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ed.jsx)(ey.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ed.jsx)("h3",{className:"text-lg font-semibold mb-2",children:p("readyToRecall")}),(0,ed.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:p("readyToRecallDescription")})]})}),q&&(0,ed.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ed.jsx)(tQ,{memory:q,onClose:()=>K(null),inPanel:!0,bankId:g||void 0})})]}):(0,ed.jsx)(pW.Card,{className:"border-dashed",children:(0,ed.jsxs)(pW.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ed.jsx)(eN,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ed.jsx)("h3",{className:"text-xl font-semibold mb-2",children:p("noBankSelected")}),(0,ed.jsx)("p",{className:"text-muted-foreground",children:p("noBankSelectedDescription")})]})})}var b1=e.i(78152);let b2=(0,eb.default)("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"}]]);var b5=e.i(82458),b5=b5,tz=tz;let b3=["skepticism","literalism","empathy"];function b4(){let e=(0,ep.useTranslations)("bankProfile");return{skepticism:{label:e("skepticismLabel"),shortLabel:"S",description:e("skepticismDescription"),lowLabel:e("skepticismLow"),highLabel:e("skepticismHigh")},literalism:{label:e("literalismLabel"),shortLabel:"L",description:e("literalismDescription"),lowLabel:e("literalismLow"),highLabel:e("literalismHigh")},empathy:{label:e("empathyLabel"),shortLabel:"E",description:e("empathyDescription"),lowLabel:e("empathyLow"),highLabel:e("empathyHigh")}}}function b6({hideReflectFields:e=!1}){let t=(0,ef.useRouter)(),n=(0,ep.useTranslations)("bankProfile"),r=(0,ep.useTranslations)("common"),i=(0,ep.useTranslations)("bank"),a=b4(),{currentBank:o,setCurrentBank:s,loadBanks:l}=(0,ev.useBank)(),{features:c}=(0,b1.useFeatures)();c?.observations;let[u,d]=(0,eh.useState)(null),[h,f]=(0,eh.useState)(null),[p,g]=(0,eh.useState)([]),[v,x]=(0,eh.useState)(0),[y,b]=(0,eh.useState)([]),[w,N]=(0,eh.useState)(0),[j,k]=(0,eh.useState)(!1),[S,C]=(0,eh.useState)(!1),[_,E]=(0,eh.useState)(!1),[T,M]=(0,eh.useState)(!1),[O,A]=(0,eh.useState)(null),[D,P]=(0,eh.useState)(null),[I,L]=(0,eh.useState)(!1),[R,B]=(0,eh.useState)(!1),[F,z]=(0,eh.useState)(!1),[V,H]=(0,eh.useState)(!1),[U,W]=(0,eh.useState)(!1),[Y,G]=(0,eh.useState)(!1),[X,$]=(0,eh.useState)(null),[q]=(0,eh.useState)(10),[K,Z]=(0,eh.useState)(0),[Q,J]=(0,eh.useState)(null),ee=async(e=X,t=K)=>{if(o)try{let n=await eO.client.listOperations(o,{status:e||void 0,limit:q,offset:t});g(n.operations||[]),x(n.total||0)}catch(e){console.error("Error loading operations:",e)}},et=async(e=!1)=>{if(o){if(e){try{let[e,t,n]=await Promise.all([eO.client.getBankStats(o),eO.client.listDirectives(o),eO.client.listMentalModels(o)]);f(e),b(t.items||[]),N(n.items?.length||0)}catch(e){console.error("Error refreshing stats:",e)}return}k(!0);try{let[e,t,n,r]=await Promise.all([eO.client.getBankProfile(o),eO.client.getBankStats(o),eO.client.listDirectives(o),eO.client.listMentalModels(o)]);d(e),f(t),b(n.items||[]),N(r.items?.length||0),await ee()}catch(e){}finally{k(!1)}}},en=async()=>{if(o){z(!0);try{await eO.client.deleteBank(o),B(!1),s(null),await l(),t.push("/")}catch(e){}finally{z(!1)}}},er=async()=>{if(o){W(!0);try{let e=await eO.client.clearObservations(o);H(!1),await et(),em.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{W(!1)}}},ei=async()=>{if(o&&D){L(!0);try{await eO.client.deleteDirective(o,D.id),b(e=>e.filter(e=>e.id!==D.id)),O?.id===D.id&&A(null),P(null)}catch(e){}finally{L(!1)}}};return((0,eh.useEffect)(()=>{if(o){et();let e=setInterval(()=>et(!0),5e3);return()=>clearInterval(e)}},[o]),(0,eh.useEffect)(()=>{let e=e=>{"Escape"===e.key&&A(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),o)?j&&!u?(0,ed.jsx)(pW.Card,{children:(0,ed.jsxs)(pW.CardContent,{className:"text-center py-10",children:[(0,ed.jsx)(eU,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"}),(0,ed.jsx)("div",{className:"text-lg text-muted-foreground",children:n("loadingProfile")})]})}):(0,ed.jsxs)("div",{className:"space-y-6",children:[!e&&(0,ed.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,ed.jsxs)(pW.Card,{children:[(0,ed.jsx)(pW.CardHeader,{className:"pb-2",children:(0,ed.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsxs)(pW.CardTitle,{className:"flex items-center gap-2 text-lg",children:[(0,ed.jsx)(pG,{className:"w-5 h-5 text-primary"}),n("dispositionProfileTitle")]}),(0,ed.jsx)(pW.CardDescription,{children:n("editDispositionDescription")})]}),(0,ed.jsx)(eA.Button,{onClick:()=>C(!0),variant:"ghost",size:"sm",children:(0,ed.jsx)(pk,{className:"h-4 w-4"})})]})}),(0,ed.jsx)(pW.CardContent,{children:u&&(0,ed.jsx)("div",{className:"space-y-4",children:b3.map(e=>(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:a[e].label}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:a[e].description})]}),(0,ed.jsxs)("span",{className:"text-sm font-bold text-primary",children:[u.disposition[e],"/5"]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:"text-xs text-muted-foreground",children:a[e].lowLabel}),(0,ed.jsx)("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:(0,ed.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${(u.disposition[e]-1)/4*100}%`}})}),(0,ed.jsx)("span",{className:"text-xs text-muted-foreground",children:a[e].highLabel})]})]},e))})})]}),(0,ed.jsxs)(pW.Card,{children:[(0,ed.jsx)(pW.CardHeader,{className:"pb-2",children:(0,ed.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsxs)(pW.CardTitle,{className:"flex items-center gap-2 text-lg",children:[(0,ed.jsx)(b2,{className:"w-5 h-5 text-primary"}),n("missionTitle")]}),(0,ed.jsx)(pW.CardDescription,{children:n("editMissionDescription")})]}),(0,ed.jsx)(eA.Button,{onClick:()=>E(!0),variant:"ghost",size:"sm",children:(0,ed.jsx)(pk,{className:"h-4 w-4"})})]})}),(0,ed.jsx)(pW.CardContent,{children:(0,ed.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:u?.mission||n("noMissionSet")})})]})]}),(0,ed.jsxs)("div",{className:"space-y-4",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,ed.jsx)(b5.default,{className:"w-5 h-5 text-rose-500"}),n("directivesTitle")]}),(0,ed.jsx)("p",{className:"text-sm text-muted-foreground",children:n("directivesDescription")})]}),(0,ed.jsxs)(eA.Button,{onClick:()=>M(!0),variant:"outline",size:"sm",className:"h-8",children:[(0,ed.jsx)(fJ.Plus,{className:"w-4 h-4 mr-1"}),n("addDirective")]})]}),y.length>0?(0,ed.jsx)("div",{className:"grid grid-cols-2 gap-3",children:y.map(e=>(0,ed.jsx)(pW.Card,{className:`cursor-pointer transition-colors border-rose-500/30 ${O?.id===e.id?"bg-rose-500/10 border-rose-500":"hover:bg-rose-500/5"}`,onClick:()=>A(e),children:(0,ed.jsx)(pW.CardContent,{className:"p-3",children:(0,ed.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ed.jsx)(b5.default,{className:"w-4 h-4 text-rose-500 shrink-0 mt-0.5"}),(0,ed.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ed.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.name}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:e.content}),e.tags&&e.tags.length>0&&(0,ed.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[(0,ed.jsx)(tI,{className:"w-3 h-3 text-muted-foreground"}),e.tags.map(e=>(0,ed.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:e},e))]})]})]})})},e.id))}):(0,ed.jsxs)("div",{className:"p-6 border border-dashed border-rose-500/30 rounded-lg text-center",children:[(0,ed.jsx)(b5.default,{className:"w-6 h-6 mx-auto mb-2 text-rose-500/50"}),(0,ed.jsx)("p",{className:"text-sm text-muted-foreground",children:n("noDirectivesMessage")})]})]}),(0,ed.jsx)(f8,{open:R,onOpenChange:B,children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:i("deleteMemoryBank")}),(0,ed.jsx)(pb,{asChild:!0,children:(0,ed.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ed.jsx)("p",{children:i.rich("deleteBankPrompt",{bankName:()=>(0,ed.jsx)("span",{className:"font-semibold text-foreground",children:o})})}),(0,ed.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:i("deleteBankWarning")}),h&&(0,ed.jsx)("p",{children:i("deleteWillDeleteDetails",{memories:h.total_nodes,documents:h.total_documents,links:h.total_links})})]})})]}),(0,ed.jsxs)(px,{children:[(0,ed.jsx)(pN,{disabled:F,children:r("cancel")}),(0,ed.jsx)(pw,{onClick:en,disabled:F,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:F?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(eV,{className:"w-4 h-4 mr-2 animate-spin"}),i("deleting")]}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(pj,{className:"w-4 h-4 mr-2"}),i("deleteBank")]})})]})]})}),(0,ed.jsx)(f8,{open:V,onOpenChange:H,children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:i("clearObservationsTitle")}),(0,ed.jsx)(pb,{asChild:!0,children:(0,ed.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ed.jsx)("p",{children:i.rich("clearObservationsPrompt",{bankName:()=>(0,ed.jsx)("span",{className:"font-semibold text-foreground",children:o})})}),(0,ed.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:i("clearObservationsWarning")}),h&&h.total_observations>0&&(0,ed.jsx)("p",{children:i("deleteWillDeleteObservations",{count:h.total_observations})})]})})]}),(0,ed.jsxs)(px,{children:[(0,ed.jsx)(pN,{disabled:U,children:r("cancel")}),(0,ed.jsx)(pw,{onClick:er,disabled:U,className:"bg-amber-500 text-white hover:bg-amber-600",children:U?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),i("clearing")]}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(pj,{className:"w-4 h-4 mr-2"}),i("clearObservations")]})})]})]})}),(0,ed.jsx)(b8,{open:T,mode:"create",onClose:()=>M(!1),onCreated:e=>{b(t=>[e,...t]),M(!1)}}),(0,ed.jsx)(f8,{open:!!D,onOpenChange:e=>!e&&P(null),children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:n("deleteDirectiveTitle")}),(0,ed.jsxs)(pb,{children:[n("deleteDirectiveConfirm",{name:`"${D?.name??""}"`}),(0,ed.jsx)("br",{}),(0,ed.jsx)("br",{}),(0,ed.jsx)("span",{className:"text-destructive font-semibold",children:n("deleteDirectiveWarning")})]})]}),(0,ed.jsxs)(px,{className:"flex-row justify-end space-x-2",children:[(0,ed.jsx)(pN,{className:"mt-0",children:r("cancel")}),(0,ed.jsxs)(pw,{onClick:ei,disabled:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[I?(0,ed.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}):null,r("delete")]})]})]})}),O&&(0,ed.jsx)(we,{directive:O,onClose:()=>A(null),onDelete:()=>P({id:O.id,name:O.name}),onUpdated:e=>{b(t=>t.map(t=>t.id===e.id?e:t)),A(e)}}),S&&u&&(0,ed.jsx)(b7,{disposition:u.disposition,onClose:()=>C(!1),onSaved:async()=>{await et(),C(!1)}}),_&&u&&(0,ed.jsx)(b9,{mission:u.mission||"",onClose:()=>E(!1),onSaved:async()=>{await et(),E(!1)}})]}):(0,ed.jsx)(pW.Card,{children:(0,ed.jsxs)(pW.CardContent,{className:"p-10 text-center",children:[(0,ed.jsx)("h3",{className:"text-xl font-semibold mb-2 text-card-foreground",children:n("noBankSelected")}),(0,ed.jsx)("p",{className:"text-muted-foreground",children:n("noBankSelectedDescription")})]})})}function b7({disposition:e,onClose:t,onSaved:n}){let r=(0,ep.useTranslations)("bankProfile"),i=b4(),{currentBank:a}=(0,ev.useBank)(),[o,s]=(0,eh.useState)(!1),[l,c]=(0,eh.useState)(e),u=async()=>{if(a){s(!0);try{await eO.client.updateBankConfig(a,{disposition_skepticism:l.skepticism,disposition_literalism:l.literalism,disposition_empathy:l.empathy}),n()}catch(e){}finally{s(!1)}}};return(0,ed.jsx)(tH.Dialog,{open:!0,onOpenChange:t,children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-xl",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsx)(tH.DialogTitle,{children:r("editDispositionTitle")}),(0,ed.jsx)(tH.DialogDescription,{children:r("editDispositionDescription")})]}),(0,ed.jsx)("div",{className:"space-y-4 py-4",children:b3.map(e=>(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i[e].label}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:i[e].description})]}),(0,ed.jsxs)("span",{className:"text-sm font-bold text-primary",children:[l[e],"/5"]})]}),(0,ed.jsxs)("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[(0,ed.jsx)("span",{children:i[e].lowLabel}),(0,ed.jsx)("span",{children:i[e].highLabel})]}),(0,ed.jsx)("input",{type:"range",min:"1",max:"5",step:"1",value:l[e],onChange:t=>c(n=>({...n,[e]:parseInt(t.target.value)})),className:"w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"})]},e))}),(0,ed.jsxs)(tH.DialogFooter,{children:[(0,ed.jsx)(eA.Button,{onClick:t,variant:"outline",disabled:o,children:r("cancel")}),(0,ed.jsx)(eA.Button,{onClick:u,disabled:o,children:o?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(eV,{className:"w-4 h-4 mr-2 animate-spin"}),r("saving")]}):r("saveChanges")})]})]})})}function b9({mission:e,onClose:t,onSaved:n}){let r=(0,ep.useTranslations)("bankProfile"),{currentBank:i}=(0,ev.useBank)(),[a,o]=(0,eh.useState)(!1),[s,l]=(0,eh.useState)(e),c=async()=>{if(i){o(!0);try{await eO.client.updateBankConfig(i,{reflect_mission:s||null}),n()}catch(e){}finally{o(!1)}}};return(0,ed.jsx)(tH.Dialog,{open:!0,onOpenChange:t,children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-xl",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsx)(tH.DialogTitle,{children:r("editMissionTitle")}),(0,ed.jsx)(tH.DialogDescription,{children:r("editMissionDescription")})]}),(0,ed.jsx)("div",{className:"space-y-2 py-4",children:(0,ed.jsx)(pK.Textarea,{value:s,onChange:e=>l(e.target.value),placeholder:r("missionPlaceholder"),rows:8,className:"resize-none"})}),(0,ed.jsxs)(tH.DialogFooter,{children:[(0,ed.jsx)(eA.Button,{onClick:t,variant:"outline",disabled:a,children:r("cancel")}),(0,ed.jsx)(eA.Button,{onClick:c,disabled:a,children:a?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(eV,{className:"w-4 h-4 mr-2 animate-spin"}),r("saving")]}):r("saveChanges")})]})]})})}function b8({open:e,mode:t,directive:n,onClose:r,onCreated:i,onSaved:a}){let o=(0,ep.useTranslations)("bankProfile"),{currentBank:s}=(0,ev.useBank)(),[l,c]=(0,eh.useState)(!1),[u,d]=(0,eh.useState)({name:"",content:"",tags:""});(0,eh.useEffect)(()=>{"edit"===t&&n?d({name:n.name,content:n.content,tags:(n.tags||[]).join(", ")}):"create"===t&&d({name:"",content:"",tags:""})},[e,t,n]);let h=async()=>{if(s&&u.name.trim()&&u.content.trim()){c(!0);try{let e=u.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0);if("create"===t){let t=await eO.client.createDirective(s,{name:u.name.trim(),content:u.content.trim(),tags:e.length>0?e:void 0});d({name:"",content:"",tags:""}),i?.(t)}else if(n){let t=await eO.client.updateDirective(s,n.id,{name:u.name.trim(),content:u.content.trim(),tags:e});a?.(t),r()}}catch(e){}finally{c(!1)}}},f=()=>{"create"===t&&d({name:"",content:"",tags:""}),r()};return(0,ed.jsx)(tH.Dialog,{open:e,onOpenChange:e=>!e&&f(),children:(0,ed.jsxs)(tH.DialogContent,{className:"sm:max-w-lg",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsxs)(tH.DialogTitle,{className:"flex items-center gap-2",children:[(0,ed.jsx)(b5.default,{className:"w-5 h-5 text-rose-500"}),o("create"===t?"directiveFormCreateTitle":"directiveFormEditTitle")]}),(0,ed.jsx)(tH.DialogDescription,{children:o("directiveFormDescription")})]}),(0,ed.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:o("directiveNameLabel")}),(0,ed.jsx)(eD.Input,{value:u.name,onChange:e=>d({...u,name:e.target.value}),placeholder:o("directiveNamePlaceholder")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:o("directiveRuleLabel")}),(0,ed.jsx)(pK.Textarea,{value:u.content,onChange:e=>d({...u,content:e.target.value}),placeholder:o("directiveRulePlaceholder"),className:"min-h-[120px]"})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsxs)("label",{className:"text-sm font-medium text-foreground",children:[o("directiveTagsLabel")," ",(0,ed.jsx)("span",{className:"text-muted-foreground font-normal",children:o("directiveTagsOptional")})]}),(0,ed.jsx)(eD.Input,{value:u.tags,onChange:e=>d({...u,tags:e.target.value}),placeholder:o("directiveTagsPlaceholder")})]})]}),(0,ed.jsxs)(tH.DialogFooter,{children:[(0,ed.jsx)(eA.Button,{variant:"outline",onClick:f,disabled:l,children:o("cancel")}),(0,ed.jsxs)(eA.Button,{onClick:h,disabled:l||!u.name.trim()||!u.content.trim(),className:"bg-rose-500 hover:bg-rose-600",children:[l?(0,ed.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}):null,o("create"===t?"create":"save")]})]})]})})}function we({directive:e,onClose:t,onDelete:n,onUpdated:r}){let i=(0,ep.useTranslations)("bankProfile"),[a,o]=(0,eh.useState)(!1);return(0,ed.jsxs)("div",{className:"fixed right-0 top-0 h-screen w-1/2 bg-card border-l-2 border-rose-500 shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:[(0,ed.jsxs)("div",{className:"p-6",children:[(0,ed.jsxs)("div",{className:"flex justify-between items-start mb-8 pb-5 border-b border-border",children:[(0,ed.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ed.jsx)(b5.default,{className:"w-5 h-5 text-rose-500"}),(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("h3",{className:"text-xl font-bold text-foreground",children:e.name}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",onClick:()=>o(!0),className:"h-7 w-7 p-0",children:(0,ed.jsx)(pk,{className:"h-3.5 w-3.5"})})]}),(0,ed.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-rose-500/10 text-rose-600 dark:text-rose-400",children:i("directiveDetailBadge")})]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0 text-muted-foreground hover:text-rose-500",children:(0,ed.jsx)(pj,{className:"h-4 w-4"})}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ed.jsx)(tF.X,{className:"h-4 w-4"})})]})]}),(0,ed.jsxs)("div",{className:"space-y-6",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:i("directiveDetailRuleLabel")}),(0,ed.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ed.jsx)(x6,{remarkPlugins:[b_],children:e.content})})]}),e.tags&&e.tags.length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:i("directiveDetailTagsLabel")}),(0,ed.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tags.map(e=>(0,ed.jsx)("span",{className:"px-2 py-1 rounded bg-muted text-muted-foreground text-sm",children:e},e))})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:i("directiveDetailIdLabel")}),(0,ed.jsx)("code",{className:"text-sm font-mono break-all text-muted-foreground",children:e.id})]})]})]}),(0,ed.jsx)(b8,{open:a,mode:"edit",directive:e,onClose:()=>o(!1),onSaved:r})]})}let wt=(0,e2.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),wn=eh.forwardRef(({className:e,variant:t,...n},r)=>(0,ed.jsx)("div",{ref:r,role:"alert",className:(0,eE.cn)(wt({variant:t}),e),...n}));wn.displayName="Alert",eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)("h5",{ref:n,className:(0,eE.cn)("mb-1 font-medium leading-none tracking-tight",e),...t})).displayName="AlertTitle";let wr=eh.forwardRef(({className:e,...t},n)=>(0,ed.jsx)("div",{ref:n,className:(0,eE.cn)("text-sm [&_p]:leading-relaxed",e),...t}));wr.displayName="AlertDescription";var tz=tz;let wi=(0,eb.default)("circle-alert",[["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"}]]),wa=["HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT"].map(e=>({category:e,threshold:"BLOCK_NONE"})),wo=["retain","sync_retain","recall","reflect","list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories","list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model","clear_mental_model","list_directives","create_directive","delete_directive","list_memories","get_memory","list_documents","get_document","delete_document","list_operations","get_operation","cancel_operation","list_tags"];function ws(e){return Array.isArray(e)?e:e&&"object"==typeof e&&Array.isArray(e.attributes)?e.attributes:null}function wl(e){return{retain_chunk_size:e.retain_chunk_size??null,retain_extraction_mode:e.retain_extraction_mode??null,retain_mission:e.retain_mission??null,retain_custom_instructions:e.retain_custom_instructions??null,entities_allow_free_form:e.entities_allow_free_form??null,entity_labels:ws(e.entity_labels)}}function wc(e){return{retain_default_strategy:e.retain_default_strategy??null,retain_strategies:e.retain_strategies??null}}function wu(e){return{enable_observations:e.enable_observations??null,consolidation_llm_batch_size:e.consolidation_llm_batch_size??null,consolidation_source_facts_max_tokens:e.consolidation_source_facts_max_tokens??null,consolidation_source_facts_max_tokens_per_observation:e.consolidation_source_facts_max_tokens_per_observation??null,observations_mission:e.observations_mission??null,max_observations_per_scope:e.max_observations_per_scope??null}}function wd(e){return{mcp_enabled_tools:e.mcp_enabled_tools??null}}function wh(e){return{llm_gemini_safety_settings:e.llm_gemini_safety_settings??null}}let wf={reflect_mission:"",disposition_skepticism:3,disposition_literalism:3,disposition_empathy:3};function wp(){let e=(0,ep.useTranslations)("bankConfig"),{currentBank:t}=(0,ev.useBank)(),{features:n}=(0,b1.useFeatures)(),r=n?.bank_config_api??!0,[i,a]=(0,eh.useState)(!0),[o,s]=(0,eh.useState)({}),[l,c]=(0,eh.useState)(wf),[u,d]=(0,eh.useState)(wl({})),[h,f]=(0,eh.useState)(wc({})),[p,g]=(0,eh.useState)(wu({})),[v,x]=(0,eh.useState)(wf),[y,b]=(0,eh.useState)(wd({})),[w,N]=(0,eh.useState)(wh({})),[j,k]=(0,eh.useState)(!1),[S,C]=(0,eh.useState)(!1),[_,E]=(0,eh.useState)(!1),[T,M]=(0,eh.useState)(!1),[O,A]=(0,eh.useState)(!1),[D,P]=(0,eh.useState)(null),[I,L]=(0,eh.useState)(null),[R,B]=(0,eh.useState)(null),[F,z]=(0,eh.useState)(null),[V,H]=(0,eh.useState)(null),U=(0,eh.useMemo)(()=>JSON.stringify(u)!==JSON.stringify(wl(o))||JSON.stringify(h)!==JSON.stringify(wc(o)),[u,h,o]),W=(0,eh.useMemo)(()=>JSON.stringify(p)!==JSON.stringify(wu(o)),[p,o]),Y=(0,eh.useMemo)(()=>JSON.stringify(v)!==JSON.stringify(l),[v,l]),G=(0,eh.useMemo)(()=>JSON.stringify(y)!==JSON.stringify(wd(o)),[y,o]),X=(0,eh.useMemo)(()=>JSON.stringify(w)!==JSON.stringify(wh(o)),[w,o]);(0,eh.useEffect)(()=>{t&&$()},[t]);let $=async()=>{if(t){a(!0);try{let[e,n]=await Promise.all([eO.client.getBankConfig(t),eO.client.getBankProfile(t)]),r=e.config,i={reflect_mission:n.mission??"",disposition_skepticism:r.disposition_skepticism??n.disposition?.skepticism??3,disposition_literalism:r.disposition_literalism??n.disposition?.literalism??3,disposition_empathy:r.disposition_empathy??n.disposition?.empathy??3};s(r),c(i),d(wl(r)),f(wc(r)),g(wu(r)),x(i),b(wd(r)),N(wh(r))}catch(e){console.error("Failed to load bank data:",e)}finally{a(!1)}}},q=async()=>{if(t){k(!0),P(null);try{let e={...u,...h};await eO.client.updateBankConfig(t,e),s(t=>({...t,...e}))}catch(t){P(t.message||e("retainFailedToSave"))}finally{k(!1)}}},K=async()=>{if(t){C(!0),L(null);try{await eO.client.updateBankConfig(t,p),s(e=>({...e,...p}))}catch(t){L(t.message||e("observationsFailedToSave"))}finally{C(!1)}}},Z=async()=>{if(t){E(!0),B(null);try{await eO.client.updateBankConfig(t,{reflect_mission:v.reflect_mission||null,disposition_skepticism:v.disposition_skepticism,disposition_literalism:v.disposition_literalism,disposition_empathy:v.disposition_empathy}),c(v)}catch(t){B(t.message||e("reflectFailedToSave"))}finally{E(!1)}}},Q=async()=>{if(t){M(!0),z(null);try{await eO.client.updateBankConfig(t,y),s(e=>({...e,...y}))}catch(t){z(t.message||e("mcpFailedToSave"))}finally{M(!1)}}},J=async()=>{if(t){A(!0),H(null);try{await eO.client.updateBankConfig(t,w),s(e=>({...e,...w}))}catch(t){H(t.message||e("geminiFailedToSave"))}finally{A(!1)}}};return t?r?i?(0,ed.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ed.jsx)(tz.default,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,ed.jsx)(ed.Fragment,{children:(0,ed.jsxs)("div",{className:"space-y-8",children:[(0,ed.jsxs)(ww,{title:e("retainTitle"),description:e("retainSectionDescription"),error:D,dirty:U,saving:j,onSave:q,children:[(0,ed.jsx)(wN,{label:e("defaultStrategyLabel"),description:e("defaultStrategyDescription"),children:(0,ed.jsxs)(tP.Select,{value:h.retain_default_strategy??"__none__",onValueChange:e=>f(t=>({...t,retain_default_strategy:"__none__"===e?null:e})),children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-full",children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"__none__",children:(0,ed.jsx)("span",{className:"text-muted-foreground italic",children:e("default")})}),Object.keys(h.retain_strategies??{}).map(e=>(0,ed.jsx)(tP.SelectItem,{value:e,children:e},e))]})]})}),(0,ed.jsx)(wy,{defaultValues:u,onDefaultChange:e=>d(t=>({...t,...e})),strategies:h.retain_strategies,onStrategiesChange:e=>f(t=>({...t,retain_strategies:e}))})]}),(0,ed.jsxs)(ww,{title:e("observationsTitle"),description:e("observationsDescription"),error:I,dirty:W,saving:S,onSave:K,children:[(0,ed.jsx)(wN,{label:e("enableObservationsLabel"),description:e("enableObservationsDescription"),children:(0,ed.jsx)("div",{className:"flex justify-end",children:(0,ed.jsx)(tD.Switch,{checked:p.enable_observations??!1,onCheckedChange:e=>g(t=>({...t,enable_observations:e}))})})}),(0,ed.jsx)(wj,{label:e("missionLabel"),description:e("observationsMissionDescription"),value:p.observations_mission??"",onChange:e=>g(t=>({...t,observations_mission:e||null})),placeholder:e("observationsMissionPlaceholder"),rows:3}),(0,ed.jsx)(wN,{label:e("llmBatchSizeLabel"),description:e("llmBatchSizeDescription"),children:(0,ed.jsx)(eD.Input,{type:"number",min:1,max:64,value:p.consolidation_llm_batch_size??"",onChange:e=>g(t=>({...t,consolidation_llm_batch_size:e.target.value?parseInt(e.target.value,10):null})),placeholder:e("serverDefault")})}),(0,ed.jsx)(wN,{label:e("sourceFactsMaxTokensLabel"),description:e("sourceFactsMaxTokensDescription"),children:(0,ed.jsx)(eD.Input,{type:"number",min:-1,value:p.consolidation_source_facts_max_tokens??"",onChange:e=>g(t=>({...t,consolidation_source_facts_max_tokens:e.target.value?parseInt(e.target.value,10):null})),placeholder:e("serverDefault")})}),(0,ed.jsx)(wN,{label:e("sourceFactsMaxTokensPerObservationLabel"),description:e("sourceFactsMaxTokensPerObservationDescription"),children:(0,ed.jsx)(eD.Input,{type:"number",min:-1,value:p.consolidation_source_facts_max_tokens_per_observation??"",onChange:e=>g(t=>({...t,consolidation_source_facts_max_tokens_per_observation:e.target.value?parseInt(e.target.value,10):null})),placeholder:e("serverDefault")})}),(0,ed.jsx)(wN,{label:e("maxObservationsPerScopeLabel"),description:e("maxObservationsPerScopeDescription"),children:(0,ed.jsx)(eD.Input,{type:"number",min:-1,value:p.max_observations_per_scope??"",onChange:e=>g(t=>({...t,max_observations_per_scope:e.target.value?parseInt(e.target.value,10):null})),placeholder:e("serverDefault")})})]}),(0,ed.jsxs)(ww,{title:e("reflectTitle"),description:e("reflectDescription"),error:R,dirty:Y,saving:_,onSave:Z,children:[(0,ed.jsx)(wj,{label:e("missionLabel"),description:e("reflectMissionDescription"),value:v.reflect_mission,onChange:e=>x(t=>({...t,reflect_mission:e})),placeholder:e("reflectMissionPlaceholder"),rows:3}),(0,ed.jsx)(wk,{label:e("skepticismLabel"),description:e("skepticismDescription"),lowLabel:e("skepticismLowLabel"),highLabel:e("skepticismHighLabel"),value:v.disposition_skepticism,onChange:e=>x(t=>({...t,disposition_skepticism:e}))}),(0,ed.jsx)(wk,{label:e("literalismLabel"),description:e("literalismDescription"),lowLabel:e("literalismLowLabel"),highLabel:e("literalismHighLabel"),value:v.disposition_literalism,onChange:e=>x(t=>({...t,disposition_literalism:e}))}),(0,ed.jsx)(wk,{label:e("empathyLabel"),description:e("empathyDescription"),lowLabel:e("empathyLowLabel"),highLabel:e("empathyHighLabel"),value:v.disposition_empathy,onChange:e=>x(t=>({...t,disposition_empathy:e}))})]}),(0,ed.jsxs)(ww,{title:e("mcpToolsTitle"),description:e("mcpToolsDescription"),error:F,dirty:G,saving:T,onSave:Q,children:[(0,ed.jsx)(wN,{label:e("restrictToolsLabel"),description:e("restrictToolsDescription"),children:(0,ed.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ed.jsx)(tD.Switch,{checked:null!==y.mcp_enabled_tools,onCheckedChange:e=>b({mcp_enabled_tools:e?[...wo]:null})}),(0,ed.jsx)(e3,{className:"text-xs text-muted-foreground",children:null!==y.mcp_enabled_tools?e("enabled"):e("disabled")})]})}),null!==y.mcp_enabled_tools&&(0,ed.jsx)(wb,{selected:y.mcp_enabled_tools,onChange:e=>b({mcp_enabled_tools:e})})]}),(0,ed.jsx)(ww,{title:e("modelsTitle"),description:e("modelsDescription"),error:V,dirty:X,saving:O,onSave:J,children:(0,ed.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ed.jsx)("p",{className:"text-sm font-semibold",children:e("geminiSubsectionTitle")}),(0,ed.jsxs)("div",{className:"pl-4 border-l-2 border-border/40 space-y-4",children:[(0,ed.jsx)(wN,{label:e("safetySettingsLabel"),description:(0,ed.jsxs)(ed.Fragment,{children:[e("safetySettingsDescriptionPart1")," ",(0,ed.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:e("safetySettingsLearnMore")})]}),children:(0,ed.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ed.jsx)(tD.Switch,{checked:null!==w.llm_gemini_safety_settings,onCheckedChange:e=>N({llm_gemini_safety_settings:e?[...wa]:null})}),(0,ed.jsx)(e3,{className:"text-xs text-muted-foreground",children:null!==w.llm_gemini_safety_settings?e("custom"):e("default")})]})}),null!==w.llm_gemini_safety_settings&&(0,ed.jsx)(w_,{value:w.llm_gemini_safety_settings,onChange:e=>N({llm_gemini_safety_settings:e})})]})]})})]})}):(0,ed.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[(0,ed.jsx)("p",{className:"text-base font-medium text-foreground",children:e("apiDisabledTitle")}),(0,ed.jsx)("p",{className:"text-sm text-muted-foreground max-w-sm",children:e.rich("apiDisabledDescription",{code:e=>(0,ed.jsx)("code",{className:"font-mono text-xs bg-muted px-1 py-0.5 rounded",children:e})})})]}):(0,ed.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ed.jsx)("p",{className:"text-muted-foreground",children:e("noBankSelected")})})}let wm=["concise","verbose","verbatim","chunks","custom"],wg="__inherit__";function wv({values:e,onChange:t,isOverride:n=!1}){let r=(0,ep.useTranslations)("bankConfig"),i=e.retain_extraction_mode??(n?wg:""),a="custom"===e.retain_extraction_mode;return(0,ed.jsxs)("div",{className:"divide-y divide-border/40",children:[(0,ed.jsx)(wN,{label:r("extractionModeLabel"),description:r("extractionModeDescription"),children:(0,ed.jsxs)(tP.Select,{value:i,onValueChange:e=>t({retain_extraction_mode:e===wg?null:e||null}),children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-full",children:(0,ed.jsx)(tP.SelectValue,{placeholder:n?r("inherited"):void 0})}),(0,ed.jsxs)(tP.SelectContent,{children:[n&&(0,ed.jsx)(tP.SelectItem,{value:wg,children:(0,ed.jsx)("span",{className:"text-muted-foreground italic",children:r("inherited")})}),wm.map(e=>(0,ed.jsx)(tP.SelectItem,{value:e,children:e},e))]})]})}),(0,ed.jsx)(wN,{label:r("chunkSizeLabel"),description:r("chunkSizeDescription"),children:(0,ed.jsx)(eD.Input,{type:"number",min:500,max:8e3,value:e.retain_chunk_size??"",onChange:e=>t({retain_chunk_size:e.target.value?parseFloat(e.target.value):null}),placeholder:n?r("inherited"):void 0})}),(0,ed.jsx)(wj,{label:r("missionLabel"),description:r("retainMissionDescription"),value:e.retain_mission??"",onChange:e=>t({retain_mission:e||null}),placeholder:r(n?"inherited":"retainMissionPlaceholder"),rows:3}),a&&(0,ed.jsx)(wj,{label:r("customExtractionPromptLabel"),description:r("customExtractionPromptDescription"),value:e.retain_custom_instructions??"",onChange:e=>t({retain_custom_instructions:e||null}),rows:5}),(0,ed.jsx)(wN,{label:r("freeFormEntitiesLabel"),description:r("freeFormEntitiesDescription"),children:(0,ed.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,ed.jsx)(e3,{className:"text-sm text-muted-foreground cursor-pointer select-none",children:r(e.entities_allow_free_form??!0?"enabled":"disabled")}),(0,ed.jsx)(tD.Switch,{checked:e.entities_allow_free_form??!0,onCheckedChange:e=>t({entities_allow_free_form:e})})]})}),(0,ed.jsx)(wC,{value:e.entity_labels??[],onChange:e=>t({entity_labels:e.length>0?e:null})})]})}function wx(e){return e?Object.entries(e).map(([e,t],n)=>({id:n,name:e,values:{retain_extraction_mode:t.retain_extraction_mode??null,retain_chunk_size:t.retain_chunk_size??null,retain_mission:t.retain_mission??null,retain_custom_instructions:t.retain_custom_instructions??null,entities_allow_free_form:t.entities_allow_free_form??null,entity_labels:ws(t.entity_labels)}})):[]}function wy({defaultValues:e,onDefaultChange:t,strategies:n,onStrategiesChange:r}){let i=(0,ep.useTranslations)("bankConfig"),a=(0,ep.useTranslations)("common"),[o,s]=(0,eh.useState)(()=>wx(n)),[l,c]=(0,eh.useState)("default"),[u,d]=(0,eh.useState)(null),h=(0,eh.useRef)(!1),f=JSON.stringify(n);(0,eh.useEffect)(()=>{if(h.current){h.current=!1;return}s(wx(n))},[f]);let p=e=>{h.current=!0,s(e),r(function(e){let t={};for(let n of e){if(!n.name.trim())continue;let e={};null!==n.values.retain_extraction_mode&&(e.retain_extraction_mode=n.values.retain_extraction_mode),null!==n.values.retain_chunk_size&&(e.retain_chunk_size=n.values.retain_chunk_size),n.values.retain_mission&&(e.retain_mission=n.values.retain_mission),n.values.retain_custom_instructions&&(e.retain_custom_instructions=n.values.retain_custom_instructions),null!==n.values.entities_allow_free_form&&(e.entities_allow_free_form=n.values.entities_allow_free_form),null!==n.values.entity_labels&&(e.entity_labels=n.values.entity_labels),t[n.name.trim()]=e}return Object.keys(t).length>0?t:null}(e))},g=(e,t)=>{p(o.map(n=>n.id===e?{...n,...t}:n))},v="default"!==l?o.find(e=>e.id===l):null;return(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"border-b border-border px-6 flex items-stretch gap-1 flex-wrap",children:[(0,ed.jsx)("button",{type:"button",onClick:()=>c("default"),className:`relative py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px ${"default"===l?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,children:i("default")}),o.map(e=>(0,ed.jsxs)("div",{className:`relative flex items-center gap-2 py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px cursor-pointer ${l===e.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,onClick:()=>c(e.id),children:[(0,ed.jsx)("span",{className:"font-mono",children:e.name||(0,ed.jsx)("span",{className:"italic font-normal opacity-50",children:i("unnamed")})}),(0,ed.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),d(e)},className:"opacity-40 hover:opacity-100 hover:text-destructive transition-opacity text-base leading-none",children:"×"})]},e.id)),(0,ed.jsxs)("button",{type:"button",onClick:()=>{let e=Date.now();p([...o,{id:e,name:"",values:{retain_extraction_mode:null,retain_chunk_size:null,retain_mission:null,retain_custom_instructions:null,entities_allow_free_form:null,entity_labels:null}}]),c(e)},className:"py-3 px-3 text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1.5",children:[(0,ed.jsx)(fJ.Plus,{className:"h-3.5 w-3.5"}),i("addStrategy")]})]}),(0,ed.jsx)("div",{children:"default"===l?(0,ed.jsx)(wv,{values:e,onChange:t}):v?(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"px-6 py-3 flex items-center gap-3 border-b border-border/40",children:[(0,ed.jsx)("label",{className:"text-xs text-muted-foreground shrink-0",children:i("nameLabel")}),(0,ed.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ed.jsx)(eD.Input,{value:v.name,onChange:e=>g(v.id,{name:e.target.value}),placeholder:i("strategyNamePlaceholder"),className:`h-7 text-xs font-mono max-w-[200px] ${!v.name.trim()?"border-destructive focus-visible:ring-destructive":""}`}),!v.name.trim()&&(0,ed.jsx)("p",{className:"text-xs text-destructive",children:i("nameIsRequired")})]})]}),(0,ed.jsx)(wv,{values:v.values,onChange:e=>g(v.id,{values:{...v.values,...e}}),isOverride:!0})]}):null}),(0,ed.jsx)(f8,{open:null!==u,onOpenChange:e=>{e||d(null)},children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:i("deleteStrategyTitle",{name:u?.name||i("unnamed")})}),(0,ed.jsx)(pb,{children:i("deleteStrategyDescription")})]}),(0,ed.jsxs)(px,{children:[(0,ed.jsx)(pN,{children:a("cancel")}),(0,ed.jsx)(pw,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(u){var e;e=u.id,p(o.filter(t=>t.id!==e)),l===e&&c("default"),d(null)}},children:a("delete")})]})]})})]})}function wb({selected:e,onChange:t}){let n=(0,ep.useTranslations)("bankConfig"),r=[{key:"core",label:n("mcpGroupCore"),tools:["retain","sync_retain","recall","reflect"]},{key:"bankManagement",label:n("mcpGroupBankManagement"),tools:["list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories"]},{key:"mentalModels",label:n("mcpGroupMentalModels"),tools:["list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model","clear_mental_model"]},{key:"directives",label:n("mcpGroupDirectives"),tools:["list_directives","create_directive","delete_directive"]},{key:"memories",label:n("mcpGroupMemories"),tools:["list_memories","get_memory"]},{key:"documents",label:n("mcpGroupDocuments"),tools:["list_documents","get_document","delete_document"]},{key:"operations",label:n("mcpGroupOperations"),tools:["list_operations","get_operation","cancel_operation"]},{key:"tags",label:n("mcpGroupTags"),tools:["list_tags"]}],i=new Set(e),a=wo.every(e=>i.has(e)),o=0===e.length;return(0,ed.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:n("toolsEnabled",{selected:e.length,total:wo.length})}),(0,ed.jsx)("button",{type:"button",onClick:()=>{t(a?[]:[...wo])},className:"text-xs text-primary hover:underline",children:a?n("deselectAll"):n("selectAll")})]}),(0,ed.jsx)("div",{className:"space-y-4",children:r.map(e=>{let r=e.tools.filter(e=>i.has(e)).length===e.tools.length;return(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,ed.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e.label}),(0,ed.jsx)("button",{type:"button",onClick:()=>{let n=new Set(i);r?e.tools.forEach(e=>n.delete(e)):e.tools.forEach(e=>n.add(e)),t(wo.filter(e=>n.has(e)))},className:"text-xs text-primary hover:underline",children:r?n("deselect"):n("selectAll")})]}),(0,ed.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tools.map(e=>{let n=i.has(e);return(0,ed.jsx)("button",{type:"button",onClick:()=>{let n;(n=new Set(i)).has(e)?n.delete(e):n.add(e),t(wo.filter(e=>n.has(e)))},className:`px-2.5 py-1 rounded text-xs font-mono transition-colors border ${n?"bg-primary text-primary-foreground border-primary":"bg-muted/30 text-muted-foreground border-border/40 hover:border-primary/40"}`,children:e},e)})})]},e.key)})}),o&&(0,ed.jsx)("p",{className:"text-xs text-destructive",children:n("noToolsWarning")})]})}function ww({title:e,description:t,children:n,error:r,dirty:i,saving:a,onSave:o}){let s=(0,ep.useTranslations)("bankConfig");return(0,ed.jsxs)("section",{className:"space-y-3",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h2",{className:"text-lg font-semibold",children:e}),(0,ed.jsx)("p",{className:"text-sm text-muted-foreground",children:t})]}),(0,ed.jsxs)(pW.Card,{className:"bg-muted/20 border-border/40",children:[(0,ed.jsx)("div",{className:"divide-y divide-border/40",children:n}),r&&(0,ed.jsx)("div",{className:"px-6 pb-2 pt-2",children:(0,ed.jsxs)(wn,{variant:"destructive",children:[(0,ed.jsx)(wi,{className:"h-4 w-4"}),(0,ed.jsx)(wr,{children:r})]})}),(0,ed.jsx)("div",{className:"px-6 py-4 flex justify-end border-t border-border/40",children:(0,ed.jsx)(eA.Button,{size:"sm",disabled:!i||a,onClick:o,children:a?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tz.default,{className:"h-4 w-4 mr-2 animate-spin"}),s("saving")]}):s("saveChanges")})})]})]})}function wN({label:e,description:t,children:n}){return(0,ed.jsx)("div",{className:"px-6 py-4",children:(0,ed.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[(0,ed.jsxs)("div",{className:"flex-1",children:[(0,ed.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ed.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ed.jsx)("div",{className:"md:w-64 shrink-0",children:n})]})})}function wj({label:e,description:t,value:n,onChange:r,placeholder:i,rows:a}){return(0,ed.jsx)("div",{className:"px-6 py-4",children:(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ed.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ed.jsx)(pK.Textarea,{value:n,onChange:e=>r(e.target.value),placeholder:i,rows:a??3,className:"font-mono text-sm"})]})})}function wk({label:e,description:t,lowLabel:n,highLabel:r,value:i,onChange:a}){return(0,ed.jsx)("div",{className:"px-6 py-4",children:(0,ed.jsxs)("div",{className:"space-y-3",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ed.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[n&&(0,ed.jsx)("span",{className:"text-xs text-muted-foreground w-16 text-right shrink-0",children:n}),(0,ed.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(e=>(0,ed.jsx)("button",{type:"button",onClick:()=>a(e),className:`w-4 h-4 rounded-full transition-colors hover:opacity-80 ${e<=i?"bg-primary":"bg-muted"}`},e))}),r&&(0,ed.jsx)("span",{className:"text-xs text-muted-foreground w-20 shrink-0",children:r}),(0,ed.jsxs)("span",{className:"text-xs font-mono text-muted-foreground ml-1 shrink-0",children:[i,"/5"]})]})]})})}function wS({fields:e,onChange:t,depth:n,extraControls:r,examplePrefix:i}){let a=(0,ep.useTranslations)("bankConfig"),o={text:a("fieldTypeText"),value:a("fieldTypeValue"),"multi-values":a("fieldTypeMultiValues"),map:a("fieldTypeMap")},[s,l]=(0,eh.useState)({}),c=(n,r)=>{let i={};for(let[t,a]of Object.entries(e))i[t]=t===n?{...a,...r}:a;t(i)},u=0===n;return(0,ed.jsxs)("div",{className:u?"space-y-1.5 py-1":"space-y-1.5 py-1 ml-3 border-l-2 border-border/40 pl-3",children:[0===Object.keys(e).length&&(0,ed.jsx)("p",{className:"text-xs text-muted-foreground italic",children:a("noFieldsYet")}),Object.entries(e).map(([d,h],f)=>{let p="map"===h.type,g="value"===h.type||"multi-values"===h.type,v=s[f]??!0,x=p||g;return(0,ed.jsxs)("div",{className:"space-y-1",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[x?(0,ed.jsx)("button",{type:"button",onClick:()=>l(e=>({...e,[f]:!v})),className:"text-muted-foreground hover:text-foreground shrink-0 p-0.5 rounded hover:bg-muted/50",children:v?(0,ed.jsx)(pC.ChevronDown,{className:"h-3.5 w-3.5"}):(0,ed.jsx)(eC.ChevronRight,{className:"h-3.5 w-3.5"})}):(0,ed.jsx)("span",{className:"w-[18px] shrink-0"}),(0,ed.jsx)(eD.Input,{placeholder:a("fieldNamePlaceholder"),value:d,onChange:n=>((n,r)=>{let i={};for(let[t,a]of Object.entries(e))i[t===n?r:t]=a;t(i)})(d,n.target.value),className:"h-7 text-xs font-mono w-28 shrink-0"}),(0,ed.jsx)(eD.Input,{placeholder:a("extractorHintWhatPlaceholder"),value:h.description,onChange:e=>c(d,{description:e.target.value}),className:"h-7 text-xs flex-1 min-w-0"}),(0,ed.jsxs)(tP.Select,{value:h.type,onValueChange:e=>c(d,{type:e,..."map"===e?{fields:h.fields??{},values:void 0}:{},..."text"===e?{fields:void 0,values:void 0}:{},..."value"===e||"multi-values"===e?{fields:void 0,values:h.values??[]}:{}}),children:[(0,ed.jsx)(tP.SelectTrigger,{className:"h-7 text-xs w-[120px] shrink-0 px-2 py-0",children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsx)(tP.SelectContent,{children:Object.entries(o).map(([e,t])=>(0,ed.jsx)(tP.SelectItem,{value:e,className:"text-xs",children:t},e))})]}),r,(0,ed.jsx)("button",{type:"button",onClick:()=>{let n;return n={...e},void(delete n[d],t(n))},className:"text-muted-foreground hover:text-destructive shrink-0 p-0.5 rounded hover:bg-destructive/10",children:(0,ed.jsx)(pj,{className:"h-3.5 w-3.5"})})]}),u&&i&&d&&(0,ed.jsx)("div",{className:"ml-[18px] pl-1.5",children:(0,ed.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground/60 leading-none",children:"map"===h.type&&h.fields&&Object.keys(h.fields).length>0?`e.g. ${Object.keys(h.fields).slice(0,2).map(e=>`${i}:${e}:<value>`).join(", ")}`:"text"===h.type?`e.g. ${i}:<any text>`:(h.values?.length??0)>0?`e.g. ${i}:${h.values[0].value||"<value>"}`:`e.g. ${i}:<value>`})}),v&&p&&(0,ed.jsx)(wS,{fields:h.fields??{},onChange:e=>c(d,{fields:e}),depth:n+1,examplePrefix:i?`${i}:${d}`:void 0}),v&&g&&(0,ed.jsxs)("div",{className:"ml-6 space-y-0.5 py-1",children:[0===(h.values??[]).length&&(0,ed.jsx)("p",{className:"text-[11px] text-muted-foreground italic",children:a("noValuesYet")}),(h.values??[]).map((e,t)=>(0,ed.jsxs)("div",{className:"flex items-center gap-1.5 group/val",children:[(0,ed.jsx)("span",{className:"text-muted-foreground/50 text-[10px] shrink-0",children:"•"}),(0,ed.jsx)(eD.Input,{placeholder:a("addValueShort"),value:e.value,onChange:n=>{let r=[...h.values??[]];r[t]={...e,value:n.target.value},c(d,{values:r})},className:"h-6 text-[11px] font-mono w-24 shrink-0 border-dashed"}),(0,ed.jsx)(eD.Input,{placeholder:a("extractorHintWhichPlaceholder"),value:e.description,onChange:n=>{let r=[...h.values??[]];r[t]={...e,description:n.target.value},c(d,{values:r})},className:"h-6 text-[11px] flex-1 min-w-0 border-dashed"}),(0,ed.jsx)("button",{type:"button",onClick:()=>{c(d,{values:(h.values??[]).filter((e,n)=>n!==t)})},className:"text-muted-foreground/40 hover:text-destructive shrink-0 p-0.5 rounded hover:bg-destructive/10 opacity-0 group-hover/val:opacity-100 transition-opacity",children:(0,ed.jsx)(pj,{className:"h-3 w-3"})})]},t)),(0,ed.jsxs)("button",{type:"button",onClick:()=>{c(d,{values:[...h.values??[],{value:"",description:""}]})},className:"text-[11px] text-muted-foreground/60 hover:text-foreground inline-flex items-center gap-1 ml-2.5",children:[(0,ed.jsx)(fJ.Plus,{className:"h-2.5 w-2.5"}),a("addValueShort")]})]})]},f)}),(0,ed.jsxs)("button",{type:"button",onClick:()=>{t({...e,"":{type:"text",description:""}})},className:"text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1",children:[(0,ed.jsx)(fJ.Plus,{className:"h-3 w-3"}),a("addField")]})]})}function wC({value:e,onChange:t}){let n=(0,ep.useTranslations)("entityLabelsEditor"),r=(n,r)=>{t(e.map((e,t)=>t===n?{...e,...r}:e))};return(0,ed.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-sm font-medium",children:n("entityLabelsTitle")}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:n("entityLabelsDescription")})]}),e.length>0&&(0,ed.jsx)("span",{className:"text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full shrink-0",children:n("labelCount",{count:e.length})})]}),0===e.length&&(0,ed.jsx)("p",{className:"text-xs text-muted-foreground italic",children:n("noEntityLabelsDefined")}),(0,ed.jsx)("div",{className:"space-y-2",children:e.map((i,a)=>(0,ed.jsx)("div",{className:"border border-border/50 rounded-md bg-background",children:(0,ed.jsx)(wS,{fields:{[i.key]:{type:i.type,description:i.description,values:i.values,fields:i.fields}},onChange:n=>{let i=Object.entries(n);if(0===i.length)t(e.filter((e,t)=>t!==a));else{let[e,t]=i[0];r(a,{key:e,type:t.type,description:t.description,values:t.values??[],fields:t.fields??{}})}},depth:0,extraControls:(0,ed.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 cursor-pointer select-none",title:n("alsoStoreAsTagTooltip"),children:[(0,ed.jsx)(pB.Checkbox,{checked:i.tag,onCheckedChange:e=>r(a,{tag:!!e}),className:"h-4 w-4"}),n("plusTag")]}),examplePrefix:i.key})},a))}),(0,ed.jsxs)("button",{type:"button",onClick:()=>{t([...e,{key:"",description:"",type:"value",optional:!0,tag:!1,values:[],fields:{}}])},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[(0,ed.jsx)(fJ.Plus,{className:"h-3.5 w-3.5"}),n("addLabel")]})]})}function w_({value:e,onChange:t}){let n=(0,ep.useTranslations)("bankConfig"),r=[{value:"HARM_CATEGORY_HARASSMENT",label:n("geminiCategoryHarassment")},{value:"HARM_CATEGORY_HATE_SPEECH",label:n("geminiCategoryHateSpeech")},{value:"HARM_CATEGORY_SEXUALLY_EXPLICIT",label:n("geminiCategorySexuallyExplicit")},{value:"HARM_CATEGORY_DANGEROUS_CONTENT",label:n("geminiCategoryDangerousContent")}],i=[{value:"HARM_BLOCK_THRESHOLD_UNSPECIFIED",label:n("geminiThresholdUnspecified")},{value:"OFF",label:n("geminiThresholdOff")},{value:"BLOCK_NONE",label:n("geminiThresholdBlockNone")},{value:"BLOCK_LOW_AND_ABOVE",label:n("geminiThresholdBlockLowAndAbove")},{value:"BLOCK_MEDIUM_AND_ABOVE",label:n("geminiThresholdBlockMediumAndAbove")},{value:"BLOCK_ONLY_HIGH",label:n("geminiThresholdBlockOnlyHigh")}],a=t=>e.find(e=>e.category===t)?.threshold??"BLOCK_MEDIUM_AND_ABOVE";return(0,ed.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ed.jsxs)("p",{className:"text-xs text-muted-foreground",children:[n("geminiSafetyEditorDescriptionPart1")," ",(0,ed.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:n("geminiSafetyEditorLearnMore")})]}),(0,ed.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,ed.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,ed.jsx)("span",{className:"text-sm",children:e.label}),(0,ed.jsxs)(tP.Select,{value:a(e.value),onValueChange:n=>{var i;return i=e.value,void t(r.map(e=>({category:e.value,threshold:e.value===i?n:a(e.value)})))},children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-48 h-8 text-xs",children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsx)(tP.SelectContent,{children:i.map(e=>(0,ed.jsx)(tP.SelectItem,{value:e.value,className:"text-xs",children:e.label},e.value))})]})]},e.value))})]})}let wE=(0,eb.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),wT=(0,eb.default)("folder-open",[["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"}]]),wM=(0,eb.default)("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"}]]);var wO=e.i(23287),wO=wO;let wA=(0,eb.default)("circle-x",[["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"}]]),wD=(0,eb.default)("external-link",[["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"}]]);e.i(47167);var wP=Symbol.for("immer-nothing"),wI=Symbol.for("immer-draftable"),wL=Symbol.for("immer-state");function wR(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var wB=Object,wF=wB.getPrototypeOf,wz="constructor",wV="prototype",wH="configurable",wU="enumerable",wW="writable",wY="value",wG=e=>!!e&&!!e[wL];function wX(e){return!!e&&(wK(e)||w2(e)||!!e[wI]||!!e[wz]?.[wI]||w5(e)||w3(e))}var w$=wB[wV][wz].toString(),wq=new WeakMap;function wK(e){if(!e||!w4(e))return!1;let t=wF(e);if(null===t||t===wB[wV])return!0;let n=wB.hasOwnProperty.call(t,wz)&&t[wz];if(n===Object)return!0;if(!w6(n))return!1;let r=wq.get(n);return void 0===r&&(r=Function.toString.call(n),wq.set(n,r)),r===w$}function wZ(e,t,n=!0){0===wQ(e)?(n?Reflect.ownKeys(e):wB.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function wQ(e){let t=e[wL];return t?t.type_:w2(e)?1:w5(e)?2:3*!!w3(e)}var wJ=(e,t,n=wQ(e))=>2===n?e.has(t):wB[wV].hasOwnProperty.call(e,t),w0=(e,t,n=wQ(e))=>2===n?e.get(t):e[t],w1=(e,t,n,r=wQ(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},w2=Array.isArray,w5=e=>e instanceof Map,w3=e=>e instanceof Set,w4=e=>"object"==typeof e,w6=e=>"function"==typeof e,w7=e=>e.modified_?e.copy_:e.base_;function w9(e,t){if(w5(e))return new Map(e);if(w3(e))return new Set(e);if(w2(e))return Array[wV].slice.call(e);let n=wK(e);if(!0!==t&&("class_only"!==t||n)){let t=wF(e);if(null!==t&&n)return{...e};let r=wB.create(t);return wB.assign(r,e)}{let t=wB.getOwnPropertyDescriptors(e);delete t[wL];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a[wW]&&(a[wW]=!0,a[wH]=!0),(a.get||a.set)&&(t[i]={[wH]:!0,[wW]:!0,[wU]:a[wU],[wY]:e[i]})}return wB.create(wF(e),t)}}function w8(e,t=!1){return Nt(e)||wG(e)||!wX(e)||(wQ(e)>1&&wB.defineProperties(e,{set:Ne,add:Ne,clear:Ne,delete:Ne}),wB.freeze(e),t&&wZ(e,(e,t)=>{w8(t,!0)},!1)),e}var Ne={[wY]:function(){wR(2)}};function Nt(e){return!(null!==e&&w4(e))||wB.isFrozen(e)}var Nn="MapSet",Nr="Patches",Ni="ArrayMethods",Na={};function No(e){let t=Na[e];return t||wR(0,e),t}var Ns=e=>!!Na[e];function Nl(e,t){t&&(e.patchPlugin_=No(Nr),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Nc(e){Nu(e),e.drafts_.forEach(Nh),e.drafts_=null}function Nu(e){e===D&&(D=e.parent_)}var Nd=e=>D={drafts_:[],parent_:D,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ns(Nn)?No(Nn):void 0,arrayMethodsPlugin_:Ns(Ni)?No(Ni):void 0};function Nh(e){let t=e[wL];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Nf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(void 0!==e&&e!==n){n[wL].modified_&&(Nc(t),wR(4)),wX(e)&&(e=Np(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[wL].base_,e,t)}else e=Np(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&w8(t,n)}(t,e,!0),Nc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==wP?e:void 0}function Np(e,t){if(Nt(t))return t;let n=t[wL];if(!n)return Nb(t,e.handledSet_,e);if(!Ng(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);Ny(n,e)}return n.copy_}function Nm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ng=(e,t)=>e.scope_===t,Nv=[];function Nx(e,t,n,r){let i=e.copy_||e.base_,a=e.type_;if(void 0!==r&&w0(i,r,a)===t)return void w1(i,r,n,a);if(!e.draftLocations_){let t=e.draftLocations_=new Map;wZ(i,(e,n)=>{if(wG(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}for(let r of e.draftLocations_.get(t)??Nv)w1(i,r,n,a)}function Ny(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Nm(e)}}function Nb(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||wG(e)||t.has(e)||!wX(e)||Nt(e)||(t.add(e),wZ(e,(r,i)=>{if(wG(i)){let t=i[wL];Ng(t,n)&&(w1(e,r,w7(t),e.type_),Nm(t))}else wX(i)&&Nb(i,t,n)})),e}var Nw={get(e,t){let n;if(t===wL)return e;let r=e.scope_.arrayMethodsPlugin_,i=1===e.type_&&"string"==typeof t;if(i&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let a=e.copy_||e.base_;if(!wJ(a,t,e.type_)){var o;let n;return o=e,(n=Nk(a,t))?wY in n?n[wY]:n.get?.call(o.draft_):void 0}let s=a[t];if(e.finalized_||!wX(s)||i&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Number.isInteger(n=+t)&&String(n)===t)return s;if(s===Nj(e.base_,t)){NC(e);let n=1===e.type_?+t:t,r=N_(e.scope_,s,e,n);return e.copy_[n]=r}return s},has:(e,t)=>t in(e.copy_||e.base_),ownKeys:e=>Reflect.ownKeys(e.copy_||e.base_),set(e,t,n){let r=Nk(e.copy_||e.base_,t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Nj(e.copy_||e.base_,t),i=r?.[wL];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||wJ(e.base_,t,e.type_)))return!0;NC(e),NS(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_.set(t,!0),!function(e,t,n){let{scope_:r}=e;if(wG(n)){let i=n[wL];Ng(i,r)&&i.callbacks_.push(function(){NC(e),Nx(e,n,w7(i),t)})}else wX(n)&&e.callbacks_.push(function(){let i=e.copy_||e.base_;3===e.type_?i.has(n)&&Nb(n,r.handledSet_,r):w0(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Nb(w0(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n),!0)},deleteProperty:(e,t)=>(NC(e),void 0!==Nj(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),NS(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=e.copy_||e.base_,r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[wW]:!0,[wH]:1!==e.type_||"length"!==t,[wU]:r[wU],[wY]:n[t]}:r},defineProperty(){wR(11)},getPrototypeOf:e=>wF(e.base_),setPrototypeOf(){wR(12)}},NN={};for(let e in Nw){let t=Nw[e];NN[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function Nj(e,t){let n=e[wL];return(n?n.copy_||n.base_:e)[t]}function Nk(e,t){if(!(t in e))return;let n=wF(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=wF(n)}}function NS(e){!e.modified_&&(e.modified_=!0,e.parent_&&NS(e.parent_))}function NC(e){e.copy_||(e.assigned_=new Map,e.copy_=w9(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function N_(e,t,n,r){let[i,a]=w5(t)?No(Nn).proxyMap_(t,n):w3(t)?No(Nn).proxySet_(t,n):function(e,t){let n=w2(e),r={type_:+!!n,scope_:t?t.scope_:D,modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=Nw;n&&(i=[r],a=NN);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}(t,n);if((n?.scope_??D).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&void 0!==r)n.callbacks_.push(function(e){if(!a||!Ng(a,e))return;e.mapSetPlugin_?.fixSetContents(a);let t=w7(a);Nx(n,a.draft_??a,t,r),Ny(a,e)});else a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)});return i}function NE(e){return wG(e)||wR(10,e),function e(t){let n;if(!wX(t)||Nt(t))return t;let r=t[wL],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=w9(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=w9(t,!0);return wZ(n,(t,r)=>{w1(n,t,e(r))},i),r&&(r.finalized_=!1),n}(e)}NN.deleteProperty=function(e,t){return NN.set.call(this,e,t,void 0)},NN.set=function(e,t,n){return Nw.set.call(this,e[0],t,n,e[0])};var NT=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{let r;if(w6(e)&&!w6(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if(w6(t)||wR(6),void 0===n||w6(n)||wR(7),wX(e)){let i=Nd(this),a=N_(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Nc(i):Nu(i)}return Nl(i,n),Nf(r,i)}if(e&&w4(e))wR(1,e);else{if(void 0===(r=t(e))&&(r=e),r===wP&&(r=void 0),this.autoFreeze_&&w8(r,!0),n){let t=[],i=[];No(Nr).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return w6(e)?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},(e=>"boolean"==typeof e)(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),(e=>"boolean"==typeof e)(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),(e=>"boolean"==typeof e)(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){wX(e)||wR(8),wG(e)&&(e=NE(e));let t=Nd(this),n=N_(t,e,void 0);return n[wL].isManual_=!0,Nu(t),n}finishDraft(e,t){let n=e&&e[wL];n&&n.isManual_||wR(9);let{scope_:r}=n;return Nl(r,t),Nf(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=No(Nr).applyPatches_;return wG(e)?r(e,t):this.produce(e,e=>r(e,t))}}().produce,NM=e=>Array.isArray(e)?e:[e],NO=0,NA=class{revision=NO;_value;_lastValue;_isEqual=ND;constructor(e,t=ND){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++NO)}};function ND(e,t){return e===t}function NP(e){return e instanceof NA||console.warn("Not a valid cell! ",e),e.value}var NI=(e,t)=>!1;function NL(){return function(e=ND){return new NA(null,e)}(NI)}var NR=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=NL()),NP(t)};Symbol();var NB=0,NF=Object.getPrototypeOf({}),Nz=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,NV);tag=NL();tags={};children={};collectionTag=null;id=NB++},NV={get:(e,t)=>(function(){let{value:n}=e,r=Reflect.get(n,t);if("symbol"==typeof t||t in NF)return r;if("object"==typeof r&&null!==r){var i;let n=e.children[t];return void 0===n&&(n=e.children[t]=Array.isArray(i=r)?new NH(i):new Nz(i)),n.tag&&NP(n.tag),n.proxy}{let n=e.tags[t];return void 0===n&&((n=e.tags[t]=NL()).value=r),NP(n),r}})(),ownKeys:e=>(NR(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},NH=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],NU);tag=NL();tags={};children={};collectionTag=null;id=NB++},NU={get:([e],t)=>("length"===t&&NR(e),NV.get(e,t)),ownKeys:([e])=>NV.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>NV.getOwnPropertyDescriptor(e,t),has:([e],t)=>NV.has(e,t)},NW="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function NY(){return{s:0,v:void 0,o:null,p:null}}function NG(e,t={}){let n,r=NY(),{resultEqualityCheck:i}=t,a=0;function o(){let t,o=r,{length:s}=arguments;for(let e=0;e<s;e++){let t=arguments[e];if("function"==typeof t||"object"==typeof t&&null!==t){let e=o.o;null===e&&(o.o=e=new WeakMap);let n=e.get(t);void 0===n?(o=NY(),e.set(t,o)):o=n}else{let e=o.p;null===e&&(o.p=e=new Map);let n=e.get(t);void 0===n?(o=NY(),e.set(t,o)):o=n}}let l=o;if(1===o.s)t=o.v;else if(t=e.apply(null,arguments),a++,i){let e=n?.deref?.()??n;null!=e&&i(e,t)&&(t=e,0!==a&&a--),n="object"==typeof t&&null!==t||"function"==typeof t?new NW(t):t}return l.s=1,l.v=t,t}return o.clearCache=()=>{r=NY(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}var NX=function(e,...t){let n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r,i=0,a=0,o={},s=e.pop();"object"==typeof s&&(o=s,s=e.pop()),function(e,t=`expected a function, instead received ${typeof e}`){if("function"!=typeof e)throw TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);let{memoize:l,memoizeOptions:c=[],argsMemoize:u=NG,argsMemoizeOptions:d=[],devModeChecks:h={}}={...n,...o},f=NM(c),p=NM(d),g=(!function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){let n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw TypeError(`${t}[${n}]`)}}(t=Array.isArray(e[0])?e[0]:e,"createSelector expects all input-selectors to be functions, but received the following types: "),t),v=l(function(){return i++,s.apply(null,arguments)},...f);return Object.assign(u(function(){a++;let e=function(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}(g,arguments);return r=v.apply(null,e)},...p),{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>r,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:l,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}(NG),N$=Object.assign((e,t=NX)=>{!function(e,t=`expected an object, instead received ${typeof e}`){if("object"!=typeof e)throw TypeError(t)}(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>N$});function Nq(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var NK="function"==typeof Symbol&&Symbol.observable||"@@observable",NZ=()=>Math.random().toString(36).substring(7).split("").join("."),NQ={INIT:`@@redux/INIT${NZ()}`,REPLACE:`@@redux/REPLACE${NZ()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${NZ()}`};function NJ(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function N0(e){let t,n=Object.keys(e),r={};for(let t=0;t<n.length;t++){let i=n[t];"function"==typeof e[i]&&(r[i]=e[i])}let i=Object.keys(r);try{Object.keys(r).forEach(e=>{let t=r[e];if(void 0===t(void 0,{type:NQ.INIT}))throw Error(Nq(12));if(void 0===t(void 0,{type:NQ.PROBE_UNKNOWN_ACTION()}))throw Error(Nq(13))})}catch(e){t=e}return function(e={},n){if(t)throw t;let a=!1,o={};for(let t=0;t<i.length;t++){let s=i[t],l=r[s],c=e[s],u=l(c,n);if(void 0===u)throw n&&n.type,Error(Nq(14));o[s]=u,a=a||u!==c}return(a=a||i.length!==Object.keys(e).length)?o:e}}function N1(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function N2(e){return NJ(e)&&"type"in e&&"string"==typeof e.type}function N5(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var N3=N5(),N4="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?N1:N1.apply(null,arguments)};function N6(e,t){function n(...r){if(t){let n=t(...r);if(!n)throw Error(jF(0));return{type:e,payload:n.payload,..."meta"in n&&{meta:n.meta},..."error"in n&&{error:n.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>N2(t)&&t.type===e,n}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var N7=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function N9(e){return wX(e)?NT(e,()=>{}):e}function N8(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var je="RTK_autoBatch",jt=()=>e=>({payload:e,meta:{[je]:!0}}),jn=e=>t=>{setTimeout(t,e)},jr=(e={type:"raf"})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"u">typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:jn(10):"callback"===e.type?e.queueNotification:jn(e.timeout),c=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return(a=!(i=!e?.meta?.[je]))&&!o&&(o=!0,l(c)),r.dispatch(e)}finally{i=!0}}})};function ji(e){let t,n={},r=[],i={addCase(e,t){let r="string"==typeof e?e:e.type;if(!r)throw Error(jF(28));if(r in n)throw Error(jF(29));return n[r]=t,i},addAsyncThunk:(e,t)=>(t.pending&&(n[e.pending.type]=t.pending),t.rejected&&(n[e.rejected.type]=t.rejected),t.fulfilled&&(n[e.fulfilled.type]=t.fulfilled),t.settled&&r.push({matcher:e.settled,reducer:t.settled}),i),addMatcher:(e,t)=>(r.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(t=e,i)};return e(i),[n,r,t]}var ja=Symbol.for("rtk-slice-createasyncthunk"),jo=((o=jo||{}).reducer="reducer",o.reducerWithPrepare="reducerWithPrepare",o.asyncThunk="asyncThunk",o),js=function({creators:e}={}){let t=e?.asyncThunk?.[ja];return function(e){let n,{name:r,reducerPath:i=r}=e;if(!r)throw Error(jF(11));let a=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},o=Object.keys(a),s={},l={},c={},u=[],d={addCase(e,t){let n="string"==typeof e?e:e.type;if(!n)throw Error(jF(12));if(n in l)throw Error(jF(13));return l[n]=t,d},addMatcher:(e,t)=>(u.push({matcher:e,reducer:t}),d),exposeAction:(e,t)=>(c[e]=t,d),exposeCaseReducer:(e,t)=>(s[e]=t,d)};function h(){let[t={},n=[],r]="function"==typeof e.extraReducers?ji(e.extraReducers):[e.extraReducers],i={...t,...l};return function(e,t){let n,[r,i,a]=ji(t);if("function"==typeof e)n=()=>N9(e());else{let t=N9(e);n=()=>t}function o(e=n(),t){let s=[r[t.type],...i.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===s.filter(e=>!!e).length&&(s=[a]),s.reduce((e,n)=>{if(n)if(wG(e)){let r=n(e,t);return void 0===r?e:r}else{if(wX(e))return NT(e,e=>n(e,t));let r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e},e)}return o.getInitialState=n,o}(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of u)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}o.forEach(n=>{let i=a[n],o={reducerName:n,type:`${r}/${n}`,createNotation:"function"==typeof e.reducers};"asyncThunk"===i._reducerDefinitionType?function({type:e,reducerName:t},n,r,i){if(!i)throw Error(jF(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:c,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),l&&r.addCase(d.rejected,l),c&&r.addMatcher(d.settled,c),r.exposeCaseReducer(t,{fulfilled:o||jl,pending:s||jl,rejected:l||jl,settled:c||jl})}(o,i,d,t):function({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&"reducerWithPrepare"!==r._reducerDefinitionType)throw Error(jF(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?N6(e,o):N6(e))}(o,i,d)});let f=e=>e,p=new Map,g=new WeakMap;function v(e,t){return n||(n=h()),n(e,t)}function x(){return n||(n=h()),n.getInitialState()}function y(t,n=!1){function r(e){let i=e[t];return void 0===i&&n&&(i=N8(g,r,x)),i}function i(t=f){let r=N8(p,n,()=>new WeakMap);return N8(r,t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=function(e,t,n,r){function i(a,...o){let s=t(a);return void 0===s&&r&&(s=n()),e(s,...o)}return i.unwrapped=e,i}(a,t,()=>N8(g,t,x),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let b={name:r,reducer:v,actions:c,caseReducers:s,getInitialState:x,...y(i),injectInto(e,{reducerPath:t,...n}={}){let r=t??i;return e.inject({reducerPath:r,reducer:v},n),{...b,...y(r,!0)}}};return b}}();function jl(){}var jc="listener",ju="completed",jd="cancelled",jh=`task-${jd}`,jf=`task-${ju}`,jp=`${jc}-${jd}`,jm=`${jc}-${ju}`,jg=class{constructor(e){this.code=e,this.message=`task ${jd} (reason: ${e})`}name="TaskAbortError";message},jv=(e,t)=>{if("function"!=typeof e)throw TypeError(jF(32))},jx=()=>{},jy=(e,t=jx)=>(e.catch(t),e),jb=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),jw=e=>{if(e.aborted)throw new jg(e.reason)};function jN(e,t){let n=jx;return new Promise((r,i)=>{let a=()=>i(new jg(e.reason));e.aborted?a():(n=jb(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=jx})}var jj=async(e,t)=>{try{await Promise.resolve();let t=await e();return{status:"ok",value:t}}catch(e){return{status:e instanceof jg?"cancelled":"rejected",error:e}}finally{t?.()}},jk=e=>t=>jy(jN(e,t).then(t=>(jw(e),t))),jS=e=>{let t=jk(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:jC}=Object,j_={},jE="listenerMiddleware",jT=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=N6(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(i);else throw Error(jF(21));return jv(a,"options.listener"),{predicate:i,type:t,effect:a}},jM=jC(e=>{let{type:t,predicate:n,effect:r}=jT(e);return{id:((e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t})(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(jF(22))}}},{withTypes:()=>jM}),jO=(e,t)=>{let{type:n,effect:r,predicate:i}=jT(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},jA=e=>{e.pending.forEach(e=>{e.abort(jp)})},jD=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},jP=jC(N6(`${jE}/add`),{withTypes:()=>jP}),jI=N6(`${jE}/removeAll`),jL=jC(N6(`${jE}/remove`),{withTypes:()=>jL}),jR=(...e)=>{console.error(`${jE}/error`,...e)},jB=(e={})=>{let t=new Map,n=new Map,{extra:r,onError:i=jR}=e;jv(i,"onError");let a=e=>{var n;return(n=jO(t,e)??jM(e)).unsubscribe=()=>t.delete(n.id),t.set(n.id,n),e=>{n.unsubscribe(),e?.cancelActive&&jA(n)}};jC(a,{withTypes:()=>a});let o=e=>{let n=jO(t,e);return n&&(n.unsubscribe(),e.cancelActive&&jA(n)),!!n};jC(o,{withTypes:()=>o});let s=async(e,o,s,l)=>{var c,u;let d,h=new AbortController,f=(c=h.signal,d=async(e,t)=>{jw(c);let n=()=>{},r=[new Promise((t,r)=>{let i=a({predicate:e,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});n=()=>{i(),r()}})];null!=t&&r.push(new Promise(e=>setTimeout(e,t,null)));try{let e=await jN(c,Promise.race(r));return jw(c),e}finally{n()}},(e,t)=>jy(d(e,t))),p=[];try{let i;e.pending.add(h),i=n.get(e)??0,n.set(e,i+1),await Promise.resolve(e.effect(o,jC({},s,{getOriginalState:l,condition:(e,t)=>f(e,t).then(Boolean),take:f,delay:jS(h.signal),pause:jk(h.signal),extra:r,signal:h.signal,fork:(u=h.signal,(e,t)=>{jv(e,"taskExecutor");let n=new AbortController;jb(u,()=>n.abort(u.reason));let r=jj(async()=>{jw(u),jw(n.signal);let t=await e({pause:jk(n.signal),delay:jS(n.signal),signal:n.signal});return jw(n.signal),t},()=>n.abort(jf));return t?.autoJoin&&p.push(r.catch(jx)),{result:jk(u)(r),cancel(){n.abort(jh)}}}),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==h&&(e.abort(jp),n.delete(e))})},cancel:()=>{h.abort(jp),e.pending.delete(h)},throwIfCancelled:()=>{jw(h.signal)}})))}catch(e){e instanceof jg||jD(i,e,{raisedBy:"effect"})}finally{let t;await Promise.all(p),h.abort(jm),1===(t=n.get(e)??1)?n.delete(e):n.set(e,t-1),e.pending.delete(h)}},l=()=>{for(let e of n.keys())jA(e);t.clear()};return{middleware:e=>n=>r=>{let c;if(!N2(r))return n(r);if(jP.match(r))return a(r.payload);if(jI.match(r))return void l();if(jL.match(r))return o(r.payload);let u=e.getState(),d=()=>{if(u===j_)throw Error(jF(23));return u};try{if(c=n(r),t.size>0){let n=e.getState();for(let a of Array.from(t.values())){let t=!1;try{t=a.predicate(r,n,u)}catch(e){t=!1,jD(i,e,{raisedBy:"predicate"})}t&&s(a,r,e,d)}}}finally{u=j_}return c},startListening:a,stopListening:o,clearListeners:l}};function jF(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");var jz=e.i(92068);function jV(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function jH(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.reduce((e,t,r)=>{var i=n[r-1];return"string"==typeof i?e+i+t:void 0!==i?e+jV(i)+t:e+t},"")}var jU=e=>0===e?0:e>0?1:-1,jW=e=>"number"==typeof e&&e!=+e,jY=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,jG=e=>("number"==typeof e||e instanceof Number)&&!jW(e),jX=e=>jG(e)||"string"==typeof e,j$=0,jq=e=>{var t=++j$;return"".concat(e||"").concat(t)},jK=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!jG(e)&&"string"!=typeof e)return r;if(jY(e)){if(null==t)return r;var a=e.indexOf("%");n=t*parseFloat(e.slice(0,a))/100}else n=+e;return jW(n)&&(n=r),i&&null!=t&&n>t&&(n=t),n},jZ=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(n[String(e[r])])return!0;else n[String(e[r])]=!0;return!1};function jQ(e,t,n){return jG(e)&&jG(t)?jV(e+n*(t-e)):t}function jJ(e,t,n){if(e&&e.length)return e.find(e=>e&&("function"==typeof t?t(e):(0,jz.default)(e,t))===n)}var j0=e=>null==e?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function j1(e){return null!=e}function j2(){}function j5(e,t){if(t){var n=Number.parseInt(t,10);if(!jW(n))return null==e?void 0:e[n]}}var j3=js({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:e=>{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),j4=j3.reducer,{createEventEmitter:j6}=j3.actions,j7=(e.i(13027),{notify(){},get:()=>[]}),j9="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,j8="u">typeof navigator&&"ReactNative"===navigator.product,ke=j9||j8?eh.useLayoutEffect:eh.useEffect;function kt(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}var kn=Symbol.for("react-redux-context"),kr="u">typeof globalThis?globalThis:{},ki=function(){if(!eh.createContext)return{};let e=kr[kn]??=new Map,t=e.get(eh.createContext);return t||(t=eh.createContext(null),e.set(eh.createContext,t)),t}(),ka=function(e){let{children:t,context:n,serverState:r,store:i}=e,a=eh.useMemo(()=>{let e=function(e){let t,n=j7,r=0,i=!1;function a(){l.onStateChange&&l.onStateChange()}function o(){if(r++,!t){let r,i;t=e.subscribe(a),r=null,i=null,n={clear(){r=null,i=null},notify(){let e=r;for(;e;)e.callback(),e=e.next},get(){let e=[],t=r;for(;t;)e.push(t),t=t.next;return e},subscribe(e){let t=!0,n=i={callback:e,next:null,prev:i};return n.prev?n.prev.next=n:r=n,function(){t&&null!==r&&(t=!1,n.next?n.next.prev=n.prev:i=n.prev,n.prev?n.prev.next=n.next:r=n.next)}}}}}function s(){r--,t&&0===r&&(t(),t=void 0,n.clear(),n=j7)}let l={addNestedSub:function(e){o();let t=n.subscribe(e),r=!1;return()=>{r||(r=!0,t(),s())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:a,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,o())},tryUnsubscribe:function(){i&&(i=!1,s())},getListeners:()=>n};return l}(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=eh.useMemo(()=>i.getState(),[i]);return ke(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]),eh.createElement((n||ki).Provider,{value:a},t)};function ko(e=ki){return function(){return eh.useContext(e)}}var ks=ko(),kl=Symbol.for("immer-nothing"),kc=Symbol.for("immer-draftable"),ku=Symbol.for("immer-state");function kd(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var kh=Object.getPrototypeOf;function kf(e){return!!e&&!!e[ku]}function kp(e){return!!e&&(kv(e)||Array.isArray(e)||!!e[kc]||!!e.constructor?.[kc]||kN(e)||kj(e))}var km=Object.prototype.constructor.toString(),kg=new WeakMap;function kv(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=kg.get(n);return void 0===r&&(r=Function.toString.call(n),kg.set(n,r)),r===km}function kx(e,t,n=!0){0===ky(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ky(e){let t=e[ku];return t?t.type_:Array.isArray(e)?1:kN(e)?2:3*!!kj(e)}function kb(e,t){return 2===ky(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function kw(e,t,n){let r=ky(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function kN(e){return e instanceof Map}function kj(e){return e instanceof Set}function kk(e){return e.copy_||e.base_}function kS(e,t){if(kN(e))return new Map(e);if(kj(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=kv(e);if(!0!==t&&("class_only"!==t||n)){let t=kh(e);return null!==t&&n?{...e}:Object.assign(Object.create(t),e)}{let t=Object.getOwnPropertyDescriptors(e);delete t[ku];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(kh(e),t)}}function kC(e,t=!1){return kE(e)||kf(e)||!kp(e)||(ky(e)>1&&Object.defineProperties(e,{set:k_,add:k_,clear:k_,delete:k_}),Object.freeze(e),t&&Object.values(e).forEach(e=>kC(e,!0))),e}var k_={value:function(){kd(2)}};function kE(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var kT={};function kM(e){let t=kT[e];return t||kd(0,e),t}function kO(e,t){t&&(kM("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function kA(e){kD(e),e.drafts_.forEach(kI),e.drafts_=null}function kD(e){e===P&&(P=e.parent_)}function kP(e){return P={drafts_:[],parent_:P,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function kI(e){let t=e[ku];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function kL(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return void 0!==e&&e!==n?(n[ku].modified_&&(kA(t),kd(4)),kp(e)&&(e=kR(t,e),t.parent_||kF(t,e)),t.patches_&&kM("Patches").generateReplacementPatches_(n[ku].base_,e,t.patches_,t.inversePatches_)):e=kR(t,n,[]),kA(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==kl?e:void 0}function kR(e,t,n){if(kE(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[ku];if(!i)return kx(t,(r,a)=>kB(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return kF(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;3===i.type_&&(a=new Set(t),t.clear(),o=!0),kx(a,(r,a)=>kB(e,i,t,r,a,n,o),r),kF(e,t,!1),n&&e.patches_&&kM("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function kB(e,t,n,r,i,a,o){if(null==i||"object"!=typeof i&&!o)return;let s=kE(i);if(!s||o){if(kf(i)){let o=kR(e,i,a&&t&&3!==t.type_&&!kb(t.assigned_,r)?a.concat(r):void 0);if(kw(n,r,o),!kf(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(kp(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;kR(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof r&&(kN(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&kF(e,i)}}}function kF(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&kC(t,n)}var kz={get(e,t){if(t===ku)return e;let n=kk(e);if(!kb(n,t)){var r;let i;return r=e,(i=kU(n,t))?"value"in i?i.value:i.get?.call(r.draft_):void 0}let i=n[t];return e.finalized_||!kp(i)?i:i===kH(e.base_,t)?(kY(e),e.copy_[t]=kX(i,e)):i},has:(e,t)=>t in kk(e),ownKeys:e=>Reflect.ownKeys(kk(e)),set(e,t,n){let r=kU(kk(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=kH(kk(e),t),i=r?.[ku];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||kb(e.base_,t)))return!0;kY(e),kW(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty:(e,t)=>(void 0!==kH(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,kY(e),kW(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=kk(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){kd(11)},getPrototypeOf:e=>kh(e.base_),setPrototypeOf(){kd(12)}},kV={};function kH(e,t){let n=e[ku];return(n?kk(n):e)[t]}function kU(e,t){if(!(t in e))return;let n=kh(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=kh(n)}}function kW(e){!e.modified_&&(e.modified_=!0,e.parent_&&kW(e.parent_))}function kY(e){e.copy_||(e.copy_=kS(e.base_,e.scope_.immer_.useStrictShallowCopy_))}kx(kz,(e,t)=>{kV[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),kV.deleteProperty=function(e,t){return kV.set.call(this,e,t,void 0)},kV.set=function(e,t,n){return kz.set.call(this,e[0],t,n,e[0])};var kG=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{let r;if("function"==typeof e&&"function"!=typeof t){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if("function"!=typeof t&&kd(6),void 0!==n&&"function"!=typeof n&&kd(7),kp(e)){let i=kP(this),a=kX(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?kA(i):kD(i)}return kO(i,n),kL(r,i)}if(e&&"object"==typeof e)kd(1,e);else{if(void 0===(r=t(e))&&(r=e),r===kl&&(r=void 0),this.autoFreeze_&&kC(r,!0),n){let t=[],i=[];kM("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return"function"==typeof e?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;kp(e)||kd(8),kf(e)&&(kf(t=e)||kd(10,t),e=function e(t){let n;if(!kp(t)||kE(t))return t;let r=t[ku],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=kS(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=kS(t,!0);return kx(n,(t,r)=>{kw(n,t,e(r))},i),r&&(r.finalized_=!1),n}(t));let n=kP(this),r=kX(e,void 0);return r[ku].isManual_=!0,kD(n),r}finishDraft(e,t){let n=e&&e[ku];n&&n.isManual_||kd(9);let{scope_:r}=n;return kO(r,t),kL(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=kM("Patches").applyPatches_;return kf(e)?r(e,t):this.produce(e,e=>r(e,t))}};function kX(e,t){let n=kN(e)?kM("MapSet").proxyMap_(e,t):kj(e)?kM("MapSet").proxySet_(e,t):function(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:P,modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=kz;n&&(i=[r],a=kV);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}(e,t);return(t?t.scope_:P).drafts_.push(n),n}new kG().produce;var k$={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},kq=js({name:"tooltip",initialState:{itemInteraction:{click:k$,hover:k$},axisInteraction:{click:k$,hover:k$},keyboardInteraction:k$,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:jt()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NE(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:jt()},removeTooltipEntrySettings:{reducer(e,t){var n=NE(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:jt()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:kK,replaceTooltipEntrySettings:kZ,removeTooltipEntrySettings:kQ,setTooltipSettingsState:kJ,setActiveMouseOverItemIndex:k0,mouseLeaveItem:k1,mouseLeaveChart:k2,setActiveClickItemIndex:k5,setMouseOverAxisIndex:k3,setMouseClickAxisIndex:k4,setSyncInteraction:k6,setKeyboardInteraction:k7}=kq.actions,k9=kq.reducer,k8=js({name:"chartData",initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=t.payload,null==t.payload){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;null!=n&&(e.dataStartIndex=n),null!=r&&(e.dataEndIndex=r)}}}),{setChartData:Se,setDataStartEndIndexes:St,setComputedData:Sn}=k8.actions,Sr=k8.reducer,Si=js({name:"chartLayout",initialState:{layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=null!=(n=t.payload.top)?n:0,e.margin.right=null!=(r=t.payload.right)?r:0,e.margin.bottom=null!=(i=t.payload.bottom)?i:0,e.margin.left=null!=(a=t.payload.left)?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Sa,setLayout:So,setChartSize:Ss,setScale:Sl}=Si.actions,Sc=Si.reducer,Su=e.i(30224),Sd=(0,eh.createContext)(null),Sh=e=>e,Sf=()=>{var e=(0,eh.useContext)(Sd);return e?e.store.dispatch:Sh},Sp=()=>{},Sm=()=>Sp,Sg=(e,t)=>e===t;function Sv(e){var t=(0,eh.useContext)(Sd);return(0,Su.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Sm,t?t.store.getState:Sp,t?t.store.getState:Sp,t?e:Sp,Sg)}var Sx=e.i(42342),Sy=e=>e.legend.settings;function Sb(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Sw(e){return function(){return e}}function SN(e,t){if((i=e.length)>1)for(var n,r,i,a=1,o=e[t[0]],s=o.length;a<i;++a)for(r=o,o=e[t[a]],n=0;n<s;++n)o[n][1]+=o[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function Sj(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function Sk(e,t){return e[t]}function SS(e){let t=[];return t.key=e,t}function SC(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function S_(e){return Number.isFinite(e)}function SE(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function ST(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function SM(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ST(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ST(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function SO(e,t,n){return null==e||null==t?n:jX(t)?(0,jz.default)(e,t,n):"function"==typeof t?t(e):n}NX([e=>e.legend.payload,Sy],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,Sx.default)(r,n):r}),Array.prototype.slice;var SA=(e,t)=>"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,SD=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},SP=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:c,tickCount:u,ticks:d,niceTicks:h,axisType:f}=e;if(!o)return null;var p="scaleBand"===s&&o.bandwidth?o.bandwidth()/2:2,g=(t||n)&&"category"===i&&o.bandwidth?o.bandwidth()/p:0;return(g="angleAxis"===f&&a&&a.length>=2?2*jU(a[0]-a[1])*g:g,t&&(d||h))?(d||h||[]).map((e,t)=>({coordinate:o(r?r.indexOf(e):e)+g,value:e,offset:g,index:t})).filter(e=>!jW(e.coordinate)):l&&c?c.map((e,t)=>({coordinate:o(e)+g,value:e,index:t,offset:g})):o.ticks&&!n&&null!=u?o.ticks(u).map((e,t)=>({coordinate:o(e)+g,value:e,offset:g,index:t})):o.domain().map((e,t)=>({coordinate:o(e)+g,value:r?r[e]:e,index:t,offset:g}))},SI={sign:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0,s=0;s<n;++s){var l=e[s],c=null==l?void 0:l[i];if(null!=c){var u=c[1],d=c[0],h=jW(u)?d:u;h>=0?(c[0]=a,c[1]=a+h,a=u):(c[0]=o,c[1]=o+h,o=u)}}}},expand:function(e,t){if((r=e.length)>0){for(var n,r,i,a=0,o=e[0].length;a<o;++a){for(i=n=0;n<r;++n)i+=e[n][a][1]||0;if(i)for(n=0;n<r;++n)e[n][a][1]/=i}SN(e,t)}},none:SN,silhouette:function(e,t){if((n=e.length)>0){for(var n,r=0,i=e[t[0]],a=i.length;r<a;++r){for(var o=0,s=0;o<n;++o)s+=e[o][r][1]||0;i[r][1]+=i[r][0]=-s/2}SN(e,t)}},wiggle:function(e,t){if((i=e.length)>0&&(r=(n=e[t[0]]).length)>0){for(var n,r,i,a=0,o=1;o<r;++o){for(var s=0,l=0,c=0;s<i;++s){for(var u=e[t[s]],d=u[o][1]||0,h=(d-(u[o-1][1]||0))/2,f=0;f<s;++f){var p=e[t[f]];h+=(p[o][1]||0)-(p[o-1][1]||0)}l+=d,c+=h*d}n[o-1][1]+=n[o-1][0]=a,l&&(a-=c/l)}n[o-1][1]+=n[o-1][0]=a,SN(e,t)}},positive:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0;o<n;++o){var s=e[o],l=null==s?void 0:s[i];if(null!=l){var c=jW(l[1])?l[0]:l[1];c>=0?(l[0]=a,l[1]=a+c,a=l[1]):(l[0]=0,l[1]=0)}}}}};function SL(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if("category"===t.type){if(!t.allowDuplicatedCategory&&t.dataKey&&null!=i[t.dataKey]){var s=jJ(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var l=SO(i,null==o?t.dataKey:o);return null==l?null:t.scale(l)}var SR=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,SB=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,SF=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,Sx.default)(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],c=i[o-1];a=Math.min(((null==l?void 0:l.coordinate)||0)-((null==c?void 0:c.coordinate)||0),a)}return a===1/0?0:a}return n?void 0:0};function Sz(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return SM(SM({},t),{},{dataKey:n,payload:r,value:i,name:a})}function SV(e,t){return e?String(e):"string"==typeof t?t:void 0}var SH=e=>e.layout.width,SU=e=>e.layout.height,SW=e=>e.layout.scale,SY=e=>e.layout.margin,SG=NX(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),SX=NX(e=>e.cartesianAxis.yAxis,e=>Object.values(e));function S$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Sq(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S$(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var SK=NX([SH,SU,SY,e=>e.brush.height,function(e){return SX(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return SX(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return SG(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return SG(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},Sy,e=>e.legend.size],(e,t,n,r,i,a,o,s,l,c)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=Sq(Sq({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),h=d.bottom;d.bottom+=r;var f=e-(d=((e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if(("vertical"===s||"horizontal"===s&&"middle"===o)&&"center"!==a&&jG(e[a]))return SM(SM({},e),{},{[a]:e[a]+(r||0)});if(("horizontal"===s||"vertical"===s&&"center"===a)&&"middle"!==o&&jG(e[o]))return SM(SM({},e),{},{[o]:e[o]+(i||0)})}return e})(d,l,c)).left-d.right,p=t-d.top-d.bottom;return Sq(Sq({brushBottom:h},d),{},{width:Math.max(f,0),height:Math.max(p,0)})}),SZ=NX(SK,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),SQ=NX(SH,SU,(e,t)=>({x:0,y:0,width:e,height:t})),SJ=(0,eh.createContext)(null),S0=()=>null!=(0,eh.useContext)(SJ),S1=e=>e.brush,S2=NX([S1,SK,SY],(e,t,n)=>({height:e.height,x:jG(e.x)?e.x:t.left,y:jG(e.y)?e.y:t.top+t.height+t.brushBottom-((null==n?void 0:n.bottom)||0),width:jG(e.width)?e.width:t.width})),S5=e.i(7670),S3=e.i(58723),S4=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if("u">typeof console&&console.warn&&(void 0===t&&console.warn("LogUtils requires an error message argument"),!e))if(void 0===t)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(t.replace(/%s/g,()=>r[a++]))}},S6=(e,t,n)=>{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,s=jY(r)?e:Number(r),l=jY(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&null!=l&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},S7={width:0,height:0,overflow:"visible"},S9={width:0,overflowX:"visible"},S8={height:0,overflowY:"visible"},Ce={};function Ct(){return(Ct=Object.assign.bind()).apply(null,arguments)}function Cn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Cr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cn(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ci=(0,eh.createContext)({width:-1,height:-1});function Ca(e){var{children:t,width:n,height:r}=e,i=(0,eh.useMemo)(()=>({width:n,height:r}),[n,r]);return SE(i.width)&&SE(i.height)?eh.createElement(Ci.Provider,{value:i},t):null}var Co=()=>(0,eh.useContext)(Ci),Cs=(0,eh.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:s,maxHeight:l,children:c,debounce:u=0,id:d,className:h,onResize:f,style:p={}}=e,g=(0,eh.useRef)(null),v=(0,eh.useRef)();v.current=f,(0,eh.useImperativeHandle)(t,()=>g.current);var[x,y]=(0,eh.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,eh.useCallback)((e,t)=>{y(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,eh.useEffect)(()=>{if(null==g.current||"u"<typeof ResizeObserver)return j2;var e=e=>{var t,{width:n,height:r}=e[0].contentRect;b(n,r),null==(t=v.current)||t.call(v,n,r)};u>0&&(e=(0,S3.default)(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=g.current.getBoundingClientRect();return b(n,r),t.observe(g.current),()=>{t.disconnect()}},[b,u]);var{containerWidth:w,containerHeight:N}=x;S4(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:j,calculatedHeight:k}=S6(w,N,{width:i,height:a,aspect:n,maxHeight:l});return S4(null!=j&&j>0||null!=k&&k>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",j,k,i,a,o,s,n),eh.createElement("div",{id:d?"".concat(d):void 0,className:(0,S5.clsx)("recharts-responsive-container",h),style:Cr(Cr({},p),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:g},eh.createElement("div",{style:(e=>{var{width:t,height:n}=e,r=jY(t),i=jY(n);return r&&i?S7:r?S9:i?S8:Ce})({width:i,height:a})},eh.createElement(Ca,{width:j,height:k},c)))}),Cl=(0,eh.forwardRef)((e,t)=>{var n=Co();if(SE(n.width)&&SE(n.height))return e.children;var{width:r,height:i}=function(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return void 0===i&&void 0===a?(i="100%",a="100%"):void 0===i?i=r&&r>0?void 0:"100%":void 0===a&&(a=r&&r>0?void 0:"100%"),{width:i,height:a}}({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=S6(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return jG(a)&&jG(o)?eh.createElement(Ca,{width:a,height:o},e.children):eh.createElement(Cs,Ct({},e,{width:r,height:i,ref:t}))});function Cc(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Cu=()=>{var e,t=S0(),n=Sv(SZ),r=Sv(S2),i=null==(e=Sv(S1))?void 0:e.padding;return t&&r&&i?{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}:n},Cd={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Ch=()=>{var e;return null!=(e=Sv(SK))?e:Cd},Cf=e=>e.layout.layoutType,Cp=e=>{var t=Sf(),n=S0(),{width:r,height:i}=e,a=Co(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,eh.useEffect)(()=>{!n&&SE(o)&&SE(s)&&t(Ss({width:o,height:s}))},[t,n,o,s]),null},Cm=e.i(66814);function Cg(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Cv(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}e.s([],25212),e.i(25212),e.s([],67155),e.i(67155);class Cx extends Map{constructor(e,t=Cb){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(Cy(this,e))}has(e){return super.has(Cy(this,e))}set(e,t){return super.set(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}(this,e),t)}delete(e){return super.delete(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}(this,e))}}function Cy({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Cb(e){return null!==e&&"object"==typeof e?e.valueOf():e}let Cw=Symbol("implicit");function CN(){var e=new Cx,t=[],n=[],r=Cw;function i(i){let a=e.get(i);if(void 0===a){if(r!==Cw)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();for(let r of(t=[],e=new Cx,n))e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return CN(t,n).unknown(r)},Cg.apply(i,arguments),i}function Cj(){var e,t,n=CN().unknown(void 0),r=n.domain,i=n.range,a=0,o=1,s=!1,l=0,c=0,u=.5;function d(){var n=r().length,d=o<a,h=d?o:a,f=d?a:o;e=(f-h)/Math.max(1,n-l+2*c),s&&(e=Math.floor(e)),h+=(f-h-e*(n-l))*u,t=e*(1-l),s&&(h=Math.round(h),t=Math.round(t));var p=(function(e,t,n){e*=1,t*=1,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);++r<i;)a[r]=e+r*n;return a})(n).map(function(t){return h+e*t});return i(d?p.reverse():p)}return delete n.unknown,n.domain=function(e){return arguments.length?(r(e),d()):r()},n.range=function(e){return arguments.length?([a,o]=e,a*=1,o*=1,d()):[a,o]},n.rangeRound=function(e){return[a,o]=e,a*=1,o*=1,s=!0,d()},n.bandwidth=function(){return t},n.step=function(){return e},n.round=function(e){return arguments.length?(s=!!e,d()):s},n.padding=function(e){return arguments.length?(l=Math.min(1,c=+e),d()):l},n.paddingInner=function(e){return arguments.length?(l=Math.min(1,e),d()):l},n.paddingOuter=function(e){return arguments.length?(c=+e,d()):c},n.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},n.copy=function(){return Cj(r(),[a,o]).round(s).paddingInner(l).paddingOuter(c).align(u)},Cg.apply(d(),arguments)}function Ck(){return function e(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return e(n())},t}(Cj.apply(null,arguments).paddingInner(1))}let CS=Math.sqrt(50),CC=Math.sqrt(10),C_=Math.sqrt(2);function CE(e,t,n){let r,i,a,o=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(o)),l=o/Math.pow(10,s),c=l>=CS?10:l>=CC?5:l>=C_?2:1;return(s<0?(r=Math.round(e*(a=Math.pow(10,-s)/c)),i=Math.round(t*a),r/a<e&&++r,i/a>t&&--i,a=-a):(r=Math.round(e/(a=Math.pow(10,s)*c)),i=Math.round(t/a),r*a<e&&++r,i*a>t&&--i),i<r&&.5<=n&&n<2)?CE(e,t,2*n):[r,i,a]}function CT(e,t,n){if(t*=1,e*=1,!((n*=1)>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?CE(t,e,n):CE(e,t,n);if(!(a>=i))return[];let s=a-i+1,l=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)l[e]=-((a-e)/o);else for(let e=0;e<s;++e)l[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)l[e]=-((i+e)/o);else for(let e=0;e<s;++e)l[e]=(i+e)*o;return l}function CM(e,t,n){return CE(e*=1,t*=1,n*=1)[2]}function CO(e,t,n){t*=1,e*=1,n*=1;let r=t<e,i=r?CM(t,e,n):CM(e,t,n);return(r?-1:1)*(i<0?-(1/i):i)}function CA(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function CD(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function CP(e){let t,n,r;function i(e,r,a=0,o=e.length){if(a<o){if(0!==t(r,r))return o;do{let t=a+o>>>1;0>n(e[t],r)?a=t+1:o=t}while(a<o)}return a}return 2!==e.length?(t=CA,n=(t,n)=>CA(e(t),n),r=(t,n)=>e(t)-n):(t=e===CA||e===CD?e:CI,n=e,r=e),{left:i,center:function(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o},right:function(e,r,i=0,a=e.length){if(i<a){if(0!==t(r,r))return a;do{let t=i+a>>>1;0>=n(e[t],r)?i=t+1:a=t}while(i<a)}return i}}}function CI(){return 0}function CL(e){return null===e?NaN:+e}let CR=CP(CA),CB=CR.right;function CF(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Cz(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function CV(){}CR.left,CP(CL).center;var CH="\\s*([+-]?\\d+)\\s*",CU="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",CW="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",CY=/^#([0-9a-f]{3,8})$/,CG=RegExp(`^rgb\\(${CH},${CH},${CH}\\)$`),CX=RegExp(`^rgb\\(${CW},${CW},${CW}\\)$`),C$=RegExp(`^rgba\\(${CH},${CH},${CH},${CU}\\)$`),Cq=RegExp(`^rgba\\(${CW},${CW},${CW},${CU}\\)$`),CK=RegExp(`^hsl\\(${CU},${CW},${CW}\\)$`),CZ=RegExp(`^hsla\\(${CU},${CW},${CW},${CU}\\)$`),CQ={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function CJ(){return this.rgb().formatHex()}function C0(){return this.rgb().formatRgb()}function C1(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=CY.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?C2(t):3===n?new C4(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?C5(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?C5(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=CG.exec(e))?new C4(t[1],t[2],t[3],1):(t=CX.exec(e))?new C4(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=C$.exec(e))?C5(t[1],t[2],t[3],t[4]):(t=Cq.exec(e))?C5(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=CK.exec(e))?_t(t[1],t[2]/100,t[3]/100,1):(t=CZ.exec(e))?_t(t[1],t[2]/100,t[3]/100,t[4]):CQ.hasOwnProperty(e)?C2(CQ[e]):"transparent"===e?new C4(NaN,NaN,NaN,0):null}function C2(e){return new C4(e>>16&255,e>>8&255,255&e,1)}function C5(e,t,n,r){return r<=0&&(e=t=n=NaN),new C4(e,t,n,r)}function C3(e,t,n,r){var i;return 1==arguments.length?((i=e)instanceof CV||(i=C1(i)),i)?new C4((i=i.rgb()).r,i.g,i.b,i.opacity):new C4:new C4(e,t,n,null==r?1:r)}function C4(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function C6(){return`#${_e(this.r)}${_e(this.g)}${_e(this.b)}`}function C7(){let e=C9(this.opacity);return`${1===e?"rgb(":"rgba("}${C8(this.r)}, ${C8(this.g)}, ${C8(this.b)}${1===e?")":`, ${e})`}`}function C9(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function C8(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _e(e){return((e=C8(e))<16?"0":"")+e.toString(16)}function _t(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new _r(e,t,n,r)}function _n(e){if(e instanceof _r)return new _r(e.h,e.s,e.l,e.opacity);if(e instanceof CV||(e=C1(e)),!e)return new _r;if(e instanceof _r)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new _r(o,s,l,e.opacity)}function _r(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function _i(e){return(e=(e||0)%360)<0?e+360:e}function _a(e){return Math.max(0,Math.min(1,e||0))}function _o(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}function _s(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}CF(CV,C1,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:CJ,formatHex:CJ,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return _n(this).formatHsl()},formatRgb:C0,toString:C0}),CF(C4,C3,Cz(CV,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new C4(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new C4(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new C4(C8(this.r),C8(this.g),C8(this.b),C9(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:C6,formatHex:C6,formatHex8:function(){return`#${_e(this.r)}${_e(this.g)}${_e(this.b)}${_e((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:C7,toString:C7})),CF(_r,function(e,t,n,r){return 1==arguments.length?_n(e):new _r(e,t,n,null==r?1:r)},Cz(CV,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new _r(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new _r(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new C4(_o(e>=240?e-240:e+120,i,r),_o(e,i,r),_o(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new _r(_i(this.h),_a(this.s),_a(this.l),C9(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=C9(this.opacity);return`${1===e?"hsl(":"hsla("}${_i(this.h)}, ${100*_a(this.s)}%, ${100*_a(this.l)}%${1===e?")":`, ${e})`}`}}));let _l=e=>()=>e;function _c(e,t){var n=t-e;return n?function(t){return e+t*n}:_l(isNaN(e)?t:e)}let _u=function e(t){var n,r=1==(n=+t)?_c:function(e,t){var r,i,a;return t-e?(r=e,i=t,r=Math.pow(r,a=n),i=Math.pow(i,a)-r,a=1/a,function(e){return Math.pow(r+e*i,a)}):_l(isNaN(e)?t:e)};function i(e,t){var n=r((e=C3(e)).r,(t=C3(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=_c(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return i.gamma=e,i}(1);function _d(e){return function(t){var n,r,i=t.length,a=Array(i),o=Array(i),s=Array(i);for(n=0;n<i;++n)r=C3(t[n]),a[n]=r.r||0,o[n]=r.g||0,s[n]=r.b||0;return a=e(a),o=e(o),s=e(s),r.opacity=1,function(e){return r.r=a(e),r.g=o(e),r.b=s(e),r+""}}}function _h(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}_d(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r<t-1?e[r+2]:2*a-i;return _s((n-r/t)*t,o,i,a,s)}}),_d(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return _s((n-r/t)*t,i,a,o,s)}});var _f=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_p=RegExp(_f.source,"g");function _m(e,t){var n,r,i=typeof t;return null==t||"boolean"===i?_l(t):("number"===i?_h:"string"===i?(r=C1(t))?(t=r,_u):function(e,t){var n,r,i,a,o,s=_f.lastIndex=_p.lastIndex=0,l=-1,c=[],u=[];for(e+="",t+="";(i=_f.exec(e))&&(a=_p.exec(t));)(o=a.index)>s&&(o=t.slice(s,o),c[l]?c[l]+=o:c[++l]=o),(i=i[0])===(a=a[0])?c[l]?c[l]+=a:c[++l]=a:(c[++l]=null,u.push({i:l,x:_h(i,a)})),s=_p.lastIndex;return s<t.length&&(o=t.slice(s),c[l]?c[l]+=o:c[++l]=o),c.length<2?u[0]?(n=u[0].x,function(e){return n(e)+""}):(r=t,function(){return r}):(t=u.length,function(e){for(var n,r=0;r<t;++r)c[(n=u[r]).i]=n.x(e);return c.join("")})}:t instanceof C1?_u:t instanceof Date?function(e,t){var n=new Date;return e*=1,t*=1,function(r){return n.setTime(e*(1-r)+t*r),n}}:!ArrayBuffer.isView(n=t)||n instanceof DataView?Array.isArray(t)?function(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,a=Array(i),o=Array(r);for(n=0;n<i;++n)a[n]=_m(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<i;++n)o[n]=a[n](e);return o}}:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?function(e,t){var n,r={},i={};for(n in(null===e||"object"!=typeof e)&&(e={}),(null===t||"object"!=typeof t)&&(t={}),t)n in e?r[n]=_m(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}:_h:function(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}})(e,t)}function _g(e,t){return e*=1,t*=1,function(n){return Math.round(e*(1-n)+t*n)}}function _v(e){return+e}var _x=[0,1];function _y(e){return e}function _b(e,t){var n;return(t-=e*=1)?function(n){return(n-e)/t}:(n=isNaN(t)?NaN:.5,function(){return n})}function _w(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=_b(i,r),a=n(o,a)):(r=_b(r,i),a=n(a,o)),function(e){return a(r(e))}}function _N(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=_b(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=CB(e,t,1,r)-1;return a[n](i[n](t))}}function _j(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function _k(){var e,t,n,r,i,a,o=_x,s=_x,l=_m,c=_y;function u(){var e,t,n,l=Math.min(o.length,s.length);return c!==_y&&(e=o[0],t=o[l-1],e>t&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?_N:_w,i=a=null,d}function d(t){return null==t||isNaN(t*=1)?n:(i||(i=r(o.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(s,o.map(e),_h)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,_v),u()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=_g,u()},d.clamp=function(e){return arguments.length?(c=!!e||_y,u()):c!==_y},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}function _S(){return _k()(_y,_y)}function _C(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function __(e){return(e=_C(Math.abs(e)))?e[1]:NaN}var _E=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function _T(e){var t;if(!(t=_E.exec(e)))throw Error("invalid format: "+e);return new _M({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function _M(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function _O(e,t){var n=_C(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+Array(i-r.length+2).join("0")}_T.prototype=_M.prototype,_M.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};let _A={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>_O(100*e,t),r:_O,s:function(e,t){var n=_C(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(I=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+Array(1-a).join("0")+_C(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function _D(e){return e}var _P=Array.prototype.map,_I=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function _L(e,t,n,r){var i,a,o=CO(e,t,n);switch((r=_T(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(a=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(__(s)/3)))-__(Math.abs(o))))||(r.precision=a),B(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(a=Math.max(0,__(Math.abs(Math.max(Math.abs(e),Math.abs(t)))-(i=Math.abs(i=o)))-__(i))+1)||(r.precision=a-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(a=Math.max(0,-__(Math.abs(o))))||(r.precision=a-("%"===r.type)*2)}return R(r)}function _R(e){var t=e.domain;return e.ticks=function(e){var n=t();return CT(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return _L(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i,a=t(),o=0,s=a.length-1,l=a[o],c=a[s],u=10;for(c<l&&(i=l,l=c,c=i,i=o,o=s,s=i);u-- >0;){if((i=CM(l,c,n))===r)return a[o]=l,a[s]=c,t(a);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else if(i<0)l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i;else break;r=i}return e},e}function _B(){var e=_S();return e.copy=function(){return _j(e,_B())},Cg.apply(e,arguments),_R(e)}function _F(e){var t;function n(e){return null==e||isNaN(e*=1)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,_v),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return _F(e).unknown(t)},e=arguments.length?Array.from(e,_v):[0,1],_R(n)}function _z(e,t){e=e.slice();var n,r=0,i=e.length-1,a=e[r],o=e[i];return o<a&&(n=r,r=i,i=n,n=a,a=o,o=n),e[r]=t.floor(a),e[i]=t.ceil(o),e}function _V(e){return Math.log(e)}function _H(e){return Math.exp(e)}function _U(e){return-Math.log(-e)}function _W(e){return-Math.exp(-e)}function _Y(e){return isFinite(e)?+("1e"+e):e<0?0:e}function _G(e){return(t,n)=>-e(-t,n)}function _X(e){let t,n,r=e(_V,_H),i=r.domain,a=10;function o(){var o,s;return t=(o=a)===Math.E?Math.log:10===o&&Math.log10||2===o&&Math.log2||(o=Math.log(o),e=>Math.log(e)/o),n=10===(s=a)?_Y:s===Math.E?Math.exp:e=>Math.pow(s,e),i()[0]<0?(t=_G(t),n=_G(n),e(_U,_W)):e(_V,_H),r}return r.base=function(e){return arguments.length?(a=+e,o()):a},r.domain=function(e){return arguments.length?(i(e),o()):i()},r.ticks=e=>{let r,o,s=i(),l=s[0],c=s[s.length-1],u=c<l;u&&([l,c]=[c,l]);let d=t(l),h=t(c),f=null==e?10:+e,p=[];if(!(a%1)&&h-d<f){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(r=1;r<a;++r)if(!((o=d<0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}}else for(;d<=h;++d)for(r=a-1;r>=1;--r)if(!((o=d>0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}2*p.length<f&&(p=CT(l,c,f))}else p=CT(d,h,Math.min(h-d,f)).map(n);return u?p.reverse():p},r.tickFormat=(e,i)=>{if(null==e&&(e=10),null==i&&(i=10===a?"s":","),"function"!=typeof i&&(a%1||null!=(i=_T(i)).precision||(i.trim=!0),i=R(i)),e===1/0)return i;let o=Math.max(1,a*e/r.ticks().length);return e=>{let r=e/n(Math.round(t(e)));return r*a<a-.5&&(r*=a),r<=o?i(e):""}},r.nice=()=>i(_z(i(),{floor:e=>n(Math.floor(t(e))),ceil:e=>n(Math.ceil(t(e)))})),r}function _$(){let e=_X(_k()).domain([1,10]);return e.copy=()=>_j(e,_$()).base(e.base()),Cg.apply(e,arguments),e}function _q(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function _K(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function _Z(e){var t=1,n=e(_q(1),_K(t));return n.constant=function(n){return arguments.length?e(_q(t=+n),_K(t)):t},_R(n)}function _Q(){var e=_Z(_k());return e.copy=function(){return _j(e,_Q()).constant(e.constant())},Cg.apply(e,arguments)}function _J(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function _0(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function _1(e){return e<0?-e*e:e*e}function _2(e){var t=e(_y,_y),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(_y,_y):.5===n?e(_0,_1):e(_J(n),_J(1/n)):n},_R(t)}function _5(){var e=_2(_k());return e.copy=function(){return _j(e,_5()).exponent(e.exponent())},Cg.apply(e,arguments),e}function _3(){return _5.apply(null,arguments).exponent(.5)}function _4(e){return Math.sign(e)*e*e}function _6(){var e,t=_S(),n=[0,1],r=!1;function i(n){var i,a=Math.sign(i=t(n))*Math.sqrt(Math.abs(i));return isNaN(a)?e:r?Math.round(a):a}return i.invert=function(e){return t.invert(_4(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain()},i.range=function(e){return arguments.length?(t.range((n=Array.from(e,_v)).map(_4)),i):n.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(r=!!e,i):r},i.clamp=function(e){return arguments.length?(t.clamp(e),i):t.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return _6(t.domain(),n).round(r).clamp(t.clamp()).unknown(e)},Cg.apply(i,arguments),_R(i)}function _7(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n<t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function _9(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function _8(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}function Ee(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Et(){var e,t=[],n=[],r=[];function i(){var e=0,i=Math.max(1,n.length);for(r=Array(i-1);++e<i;)r[e-1]=function(e,t,n=CL){if(!(!(r=e.length)||isNaN(t*=1))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(n(e[a+1],a+1,e)-o)*(i-a)}}(t,e/i);return a}function a(t){return null==t||isNaN(t*=1)?e:n[CB(r,t)]}return a.invertExtent=function(e){var i=n.indexOf(e);return i<0?[NaN,NaN]:[i>0?r[i-1]:t[0],i<r.length?r[i]:t[t.length-1]]},a.domain=function(e){if(!arguments.length)return t.slice();for(let n of(t=[],e))null==n||isNaN(n*=1)||t.push(n);return t.sort(CA),i()},a.range=function(e){return arguments.length?(n=Array.from(e),i()):n.slice()},a.unknown=function(t){return arguments.length?(e=t,a):e},a.quantiles=function(){return r.slice()},a.copy=function(){return Et().domain(t).range(n).unknown(e)},Cg.apply(a,arguments)}function En(){var e,t=0,n=1,r=1,i=[.5],a=[0,1];function o(t){return null!=t&&t<=t?a[CB(i,t,0,r)]:e}function s(){var e=-1;for(i=Array(r);++e<r;)i[e]=((e+1)*n-(e-r)*t)/(r+1);return o}return o.domain=function(e){return arguments.length?([t,n]=e,t*=1,n*=1,s()):[t,n]},o.range=function(e){return arguments.length?(r=(a=Array.from(e)).length-1,s()):a.slice()},o.invertExtent=function(e){var o=a.indexOf(e);return o<0?[NaN,NaN]:o<1?[t,i[0]]:o>=r?[i[r-1],n]:[i[o-1],i[o]]},o.unknown=function(t){return arguments.length&&(e=t),o},o.thresholds=function(){return i.slice()},o.copy=function(){return En().domain([t,n]).range(a).unknown(e)},Cg.apply(_R(o),arguments)}function Er(){var e,t=[.5],n=[0,1],r=1;function i(i){return null!=i&&i<=i?n[CB(t,i,0,r)]:e}return i.domain=function(e){return arguments.length?(r=Math.min((t=Array.from(e)).length,n.length-1),i):t.slice()},i.range=function(e){return arguments.length?(n=Array.from(e),r=Math.min(t.length,n.length-1),i):n.slice()},i.invertExtent=function(e){var r=n.indexOf(e);return[t[r-1],t[r]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Er().domain(t).range(n).unknown(e)},Cg.apply(i,arguments)}R=(L=function(e){var t,n,r,i=void 0===e.grouping||void 0===e.thousands?_D:(t=_P.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,a=[],o=0,s=t[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(i-=s,i+s)),!((l+=s+1)>r));)s=t[o=(o+1)%t.length];return a.reverse().join(n)}),a=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",s=void 0===e.decimal?".":e.decimal+"",l=void 0===e.numerals?_D:(r=_P.call(e.numerals,String),function(e){return e.replace(/[0-9]/g,function(e){return r[+e]})}),c=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",d=void 0===e.nan?"NaN":e.nan+"";function h(e){var t=(e=_T(e)).fill,n=e.align,r=e.sign,h=e.symbol,f=e.zero,p=e.width,g=e.comma,v=e.precision,x=e.trim,y=e.type;"n"===y?(g=!0,y="g"):_A[y]||(void 0===v&&(v=12),x=!0,y="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var b="$"===h?a:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o:/[%p]/.test(y)?c:"",N=_A[y],j=/[defgprs%]/.test(y);function k(e){var a,o,c,h=b,k=w;if("c"===y)k=N(e)+k,e="";else{var S=(e*=1)<0||1/e<0;if(e=isNaN(e)?d:N(Math.abs(e),v),x&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r<n;++r)switch(e[r]){case".":i=t=r;break;case"0":0===i&&(i=r),t=r;break;default:if(!+e[r])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),S&&0==+e&&"+"!==r&&(S=!1),h=(S?"("===r?r:u:"-"===r||"("===r?"":r)+h,k=("s"===y?_I[8+I/3]:"")+k+(S&&"("===r?")":""),j){for(a=-1,o=e.length;++a<o;)if(48>(c=e.charCodeAt(a))||c>57){k=(46===c?s+e.slice(a+1):e.slice(a))+k,e=e.slice(0,a);break}}}g&&!f&&(e=i(e,1/0));var C=h.length+e.length+k.length,_=C<p?Array(p-C+1).join(t):"";switch(g&&f&&(e=i(_+e,_.length?p-k.length:1/0),_=""),n){case"<":e=h+e+k+_;break;case"=":e=h+_+e+k;break;case"^":e=_.slice(0,C=_.length>>1)+h+e+k+_.slice(C);break;default:e=_+h+e+k}return l(e)}return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),k.toString=function(){return e+""},k}return{format:h,formatPrefix:function(e,t){var n=h(((e=_T(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(__(t)/3))),i=Math.pow(10,-r),a=_I[8+r/3];return function(e){return n(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,B=L.formatPrefix;let Ei=new Date,Ea=new Date;function Eo(e,t,n,r){function i(t){return e(t=0==arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o,s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r)||!(a>0))return s;do s.push(o=new Date(+n)),t(n,a),e(n);while(o<n&&n<r)return s},i.filter=n=>Eo(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(Ei.setTime(+t),Ea.setTime(+r),e(Ei),e(Ea),Math.floor(n(Ei,Ea))),i.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?i.filter(r?t=>r(t)%e==0:t=>i.count(0,t)%e==0):i:null),i}let Es=Eo(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Es.every=e=>isFinite(e=Math.floor(e))&&e>0?Eo(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,Es.range;let El=Eo(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());El.every=e=>isFinite(e=Math.floor(e))&&e>0?Eo(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,El.range;let Ec=Eo(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Ec.range;let Eu=Eo(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Eu.range;function Ed(e){return Eo(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}let Eh=Ed(0),Ef=Ed(1),Ep=Ed(2),Em=Ed(3),Eg=Ed(4),Ev=Ed(5),Ex=Ed(6);function Ey(e){return Eo(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/6048e5)}Eh.range,Ef.range,Ep.range,Em.range,Eg.range,Ev.range,Ex.range;let Eb=Ey(0),Ew=Ey(1),EN=Ey(2),Ej=Ey(3),Ek=Ey(4),ES=Ey(5),EC=Ey(6);Eb.range,Ew.range,EN.range,Ej.range,Ek.range,ES.range,EC.range;let E_=Eo(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1);E_.range;let EE=Eo(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1);EE.range;let ET=Eo(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5));ET.range;let EM=Eo(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getHours());EM.range;let EO=Eo(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours());EO.range;let EA=Eo(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getMinutes());EA.range;let ED=Eo(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes());ED.range;let EP=Eo(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+1e3*t)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds());EP.range;let EI=Eo(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);function EL(e,t,n,r,i,a){let o=[[EP,1,1e3],[EP,5,5e3],[EP,15,15e3],[EP,30,3e4],[a,1,6e4],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,36e5],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,864e5],[r,2,1728e5],[n,1,6048e5],[t,1,2592e6],[t,3,7776e6],[e,1,31536e6]];function s(t,n,r){let i=Math.abs(n-t)/r,a=CP(([,,e])=>e).right(o,i);if(a===o.length)return e.every(CO(t/31536e6,n/31536e6,r));if(0===a)return EI.every(Math.max(CO(t,n,r),1));let[s,l]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(l)}return[function(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&"function"==typeof n.range?n:s(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a},s]}EI.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?Eo(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):EI:null,EI.range;let[ER,EB]=EL(El,Eu,Eb,ET,EO,ED),[EF,Ez]=EL(Es,Ec,Eh,E_,EM,EA);function EV(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function EH(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function EU(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var EW={"-":"",_:" ",0:"0"},EY=/^\s*\d+/,EG=/^%/,EX=/[\\^$*+?|[\]().{}]/g;function E$(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function Eq(e){return e.replace(EX,"\\$&")}function EK(e){return RegExp("^(?:"+e.map(Eq).join("|")+")","i")}function EZ(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function EQ(e,t,n){var r=EY.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function EJ(e,t,n){var r=EY.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function E0(e,t,n){var r=EY.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function E1(e,t,n){var r=EY.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function E2(e,t,n){var r=EY.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function E5(e,t,n){var r=EY.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function E3(e,t,n){var r=EY.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function E4(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function E6(e,t,n){var r=EY.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function E7(e,t,n){var r=EY.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function E9(e,t,n){var r=EY.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function E8(e,t,n){var r=EY.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Te(e,t,n){var r=EY.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Tt(e,t,n){var r=EY.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Tn(e,t,n){var r=EY.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Tr(e,t,n){var r=EY.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Ti(e,t,n){var r=EY.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Ta(e,t,n){var r=EG.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function To(e,t,n){var r=EY.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Ts(e,t,n){var r=EY.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Tl(e,t){return E$(e.getDate(),t,2)}function Tc(e,t){return E$(e.getHours(),t,2)}function Tu(e,t){return E$(e.getHours()%12||12,t,2)}function Td(e,t){return E$(1+E_.count(Es(e),e),t,3)}function Th(e,t){return E$(e.getMilliseconds(),t,3)}function Tf(e,t){return Th(e,t)+"000"}function Tp(e,t){return E$(e.getMonth()+1,t,2)}function Tm(e,t){return E$(e.getMinutes(),t,2)}function Tg(e,t){return E$(e.getSeconds(),t,2)}function Tv(e){var t=e.getDay();return 0===t?7:t}function Tx(e,t){return E$(Eh.count(Es(e)-1,e),t,2)}function Ty(e){var t=e.getDay();return t>=4||0===t?Eg(e):Eg.ceil(e)}function Tb(e,t){return e=Ty(e),E$(Eg.count(Es(e),e)+(4===Es(e).getDay()),t,2)}function Tw(e){return e.getDay()}function TN(e,t){return E$(Ef.count(Es(e)-1,e),t,2)}function Tj(e,t){return E$(e.getFullYear()%100,t,2)}function Tk(e,t){return E$((e=Ty(e)).getFullYear()%100,t,2)}function TS(e,t){return E$(e.getFullYear()%1e4,t,4)}function TC(e,t){var n=e.getDay();return E$((e=n>=4||0===n?Eg(e):Eg.ceil(e)).getFullYear()%1e4,t,4)}function T_(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+E$(t/60|0,"0",2)+E$(t%60,"0",2)}function TE(e,t){return E$(e.getUTCDate(),t,2)}function TT(e,t){return E$(e.getUTCHours(),t,2)}function TM(e,t){return E$(e.getUTCHours()%12||12,t,2)}function TO(e,t){return E$(1+EE.count(El(e),e),t,3)}function TA(e,t){return E$(e.getUTCMilliseconds(),t,3)}function TD(e,t){return TA(e,t)+"000"}function TP(e,t){return E$(e.getUTCMonth()+1,t,2)}function TI(e,t){return E$(e.getUTCMinutes(),t,2)}function TL(e,t){return E$(e.getUTCSeconds(),t,2)}function TR(e){var t=e.getUTCDay();return 0===t?7:t}function TB(e,t){return E$(Eb.count(El(e)-1,e),t,2)}function TF(e){var t=e.getUTCDay();return t>=4||0===t?Ek(e):Ek.ceil(e)}function Tz(e,t){return e=TF(e),E$(Ek.count(El(e),e)+(4===El(e).getUTCDay()),t,2)}function TV(e){return e.getUTCDay()}function TH(e,t){return E$(Ew.count(El(e)-1,e),t,2)}function TU(e,t){return E$(e.getUTCFullYear()%100,t,2)}function TW(e,t){return E$((e=TF(e)).getUTCFullYear()%100,t,2)}function TY(e,t){return E$(e.getUTCFullYear()%1e4,t,4)}function TG(e,t){var n=e.getUTCDay();return E$((e=n>=4||0===n?Ek(e):Ek.ceil(e)).getUTCFullYear()%1e4,t,4)}function TX(){return"+0000"}function T$(){return"%"}function Tq(e){return+e}function TK(e){return Math.floor(e/1e3)}function TZ(e){return new Date(e)}function TQ(e){return e instanceof Date?+e:+new Date(+e)}function TJ(e,t,n,r,i,a,o,s,l,c){var u=_S(),d=u.invert,h=u.domain,f=c(".%L"),p=c(":%S"),g=c("%I:%M"),v=c("%I %p"),x=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function N(e){return(l(e)<e?f:s(e)<e?p:o(e)<e?g:a(e)<e?v:r(e)<e?i(e)<e?x:y:n(e)<e?b:w)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?h(Array.from(e,TQ)):h().map(TZ)},u.ticks=function(t){var n=h();return e(n[0],n[n.length-1],null==t?10:t)},u.tickFormat=function(e,t){return null==t?N:c(t)},u.nice=function(e){var n=h();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?h(_z(n,e)):u},u.copy=function(){return _j(u,TJ(e,t,n,r,i,a,o,s,l,c))},u}function T0(){return Cg.apply(TJ(EF,Ez,Es,Ec,Eh,E_,EM,EA,EP,z).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function T1(){return Cg.apply(TJ(ER,EB,El,Eu,Eb,EE,EO,ED,EP,V).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function T2(){var e,t,n,r,i,a=0,o=1,s=_y,l=!1;function c(t){return null==t||isNaN(t*=1)?i:s(0===n?.5:(t=(r(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,s=e(n,r),c):[s(0),s(1)]}}return c.domain=function(i){return arguments.length?([a,o]=i,e=r(a*=1),t=r(o*=1),n=e===t?0:1/(t-e),c):[a,o]},c.clamp=function(e){return arguments.length?(l=!!e,c):l},c.interpolator=function(e){return arguments.length?(s=e,c):s},c.range=u(_m),c.rangeRound=u(_g),c.unknown=function(e){return arguments.length?(i=e,c):i},function(i){return r=i,e=i(a),t=i(o),n=e===t?0:1/(t-e),c}}function T5(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function T3(){var e=_R(T2()(_y));return e.copy=function(){return T5(e,T3())},Cv.apply(e,arguments)}function T4(){var e=_X(T2()).domain([1,10]);return e.copy=function(){return T5(e,T4()).base(e.base())},Cv.apply(e,arguments)}function T6(){var e=_Z(T2());return e.copy=function(){return T5(e,T6()).constant(e.constant())},Cv.apply(e,arguments)}function T7(){var e=_2(T2());return e.copy=function(){return T5(e,T7()).exponent(e.exponent())},Cv.apply(e,arguments)}function T9(){return T7.apply(null,arguments).exponent(.5)}function T8(){var e=[],t=_y;function n(n){if(null!=n&&!isNaN(n*=1))return t((CB(e,n,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();for(let n of(e=[],t))null==n||isNaN(n*=1)||e.push(n);return e.sort(CA),n},n.interpolator=function(e){return arguments.length?(t=e,n):t},n.range=function(){return e.map((n,r)=>t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>(function(e,t){if(!(!(n=(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t*=1)>=t&&(yield t);else{let n=-1;for(let r of e)null!=(r=t(r,++n,e))&&(r*=1)>=r&&(yield r)}}(e,void 0))).length)||isNaN(t*=1))){if(t<=0||n<2)return _9(e);if(t>=1)return _7(e);var n,r=(n-1)*t,i=Math.floor(r),a=_7((function e(t,n,r=0,i=1/0,a){if(n=Math.floor(n),r=Math.floor(Math.max(0,r)),i=Math.floor(Math.min(t.length-1,i)),!(r<=n&&n<=i))return t;for(a=void 0===a?_8:function(e=CA){if(e===CA)return _8;if("function"!=typeof e)throw TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}(a);i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1),d=Math.max(r,Math.floor(n-s*c/o+u)),h=Math.min(i,Math.floor(n+(o-s)*c/o+u));e(t,n,d,h,a)}let o=t[n],s=r,l=i;for(Ee(t,r,n),a(t[i],o)>0&&Ee(t,r,i);s<l;){for(Ee(t,s,l),++s,--l;0>a(t[s],o);)++s;for(;a(t[l],o)>0;)--l}0===a(t[r],o)?Ee(t,r,l):Ee(t,++l,i),l<=n&&(r=l+1),n<=l&&(i=l-1)}return t})(e,i).subarray(0,i+1));return a+(_9(e.subarray(i+1))-a)*(r-i)}})(e,r/t))},n.copy=function(){return T8(t).domain(e)},Cv.apply(n,arguments)}function Me(){var e,t,n,r,i,a,o,s=0,l=.5,c=1,u=1,d=_y,h=!1;function f(e){return isNaN(e*=1)?o:(e=.5+((e=+a(e))-t)*(u*e<u*t?r:i),d(h?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var n,r,i;return arguments.length?([n,r,i]=t,d=function(e,t){void 0===t&&(t=e,e=_m);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}(e,[n,r,i]),f):[d(0),d(.5),d(1)]}}return f.domain=function(o){return arguments.length?([s,l,c]=o,e=a(s*=1),t=a(l*=1),n=a(c*=1),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f):[s,l,c]},f.clamp=function(e){return arguments.length?(h=!!e,f):h},f.interpolator=function(e){return arguments.length?(d=e,f):d},f.range=p(_m),f.rangeRound=p(_g),f.unknown=function(e){return arguments.length?(o=e,f):o},function(o){return a=o,e=o(s),t=o(l),n=o(c),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f}}function Mt(){var e=_R(Me()(_y));return e.copy=function(){return T5(e,Mt())},Cv.apply(e,arguments)}function Mn(){var e=_X(Me()).domain([.1,1,10]);return e.copy=function(){return T5(e,Mn()).base(e.base())},Cv.apply(e,arguments)}function Mr(){var e=_Z(Me());return e.copy=function(){return T5(e,Mr()).constant(e.constant())},Cv.apply(e,arguments)}function Mi(){var e=_2(Me());return e.copy=function(){return T5(e,Mi()).exponent(e.exponent())},Cv.apply(e,arguments)}function Ma(){return Mi.apply(null,arguments).exponent(.5)}z=(F=function(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,l=e.shortMonths,c=EK(i),u=EZ(i),d=EK(a),h=EZ(a),f=EK(o),p=EZ(o),g=EK(s),v=EZ(s),x=EK(l),y=EZ(l),b={a:function(e){return o[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:Tl,e:Tl,f:Tf,g:Tk,G:TC,H:Tc,I:Tu,j:Td,L:Th,m:Tp,M:Tm,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Tq,s:TK,S:Tg,u:Tv,U:Tx,V:Tb,w:Tw,W:TN,x:null,X:null,y:Tj,Y:TS,Z:T_,"%":T$},w={a:function(e){return o[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:TE,e:TE,f:TD,g:TW,G:TG,H:TT,I:TM,j:TO,L:TA,m:TP,M:TI,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Tq,s:TK,S:TL,u:TR,U:TB,V:Tz,w:TV,W:TH,x:null,X:null,y:TU,Y:TY,Z:TX,"%":T$},N={a:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=x.exec(t.slice(n));return r?(e.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return S(e,t,n,r)},d:E9,e:E9,f:Ti,g:E3,G:E5,H:Te,I:Te,j:E8,L:Tr,m:E7,M:Tt,p:function(e,t,n){var r=c.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:E6,Q:To,s:Ts,S:Tn,u:EJ,U:E0,V:E1,w:EQ,W:E2,x:function(e,t,r){return S(e,n,t,r)},X:function(e,t,n){return S(e,r,t,n)},y:E3,Y:E5,Z:E4,"%":Ta};function j(e,t){return function(n){var r,i,a,o=[],s=-1,l=0,c=e.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===e.charCodeAt(s)&&(o.push(e.slice(l,s)),null!=(i=EW[r=e.charAt(++s)])?r=e.charAt(++s):i="e"===r?" ":"0",(a=t[r])&&(r=a(n,i)),o.push(r),l=s+1);return o.push(e.slice(l,s)),o.join("")}}function k(e,t){return function(n){var r,i,a=EU(1900,void 0,1);if(S(a,e,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(!t||"Z"in a||(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(r=(i=(r=EH(EU(a.y,0,1))).getUTCDay())>4||0===i?Ew.ceil(r):Ew(r),r=EE.offset(r,(a.V-1)*7),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(r=(i=(r=EV(EU(a.y,0,1))).getDay())>4||0===i?Ef.ceil(r):Ef(r),r=E_.offset(r,(a.V-1)*7),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:+("W"in a)),i="Z"in a?EH(EU(a.y,0,1)).getUTCDay():EV(EU(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,EH(a)):EV(a)}}function S(e,t,n,r){for(var i,a,o=0,s=t.length,l=n.length;o<s;){if(r>=l)return -1;if(37===(i=t.charCodeAt(o++))){if(!(a=N[(i=t.charAt(o++))in EW?t.charAt(o++):i])||(r=a(e,n,r))<0)return -1}else if(i!=n.charCodeAt(r++))return -1}return r}return b.x=j(n,b),b.X=j(r,b),b.c=j(t,b),w.x=j(n,w),w.X=j(r,w),w.c=j(t,w),{format:function(e){var t=j(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=j(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,F.parse,V=F.utcFormat,F.utcParse,e.s(["scaleBand",0,Cj,"scaleDiverging",0,Mt,"scaleDivergingLog",0,Mn,"scaleDivergingPow",0,Mi,"scaleDivergingSqrt",0,Ma,"scaleDivergingSymlog",0,Mr,"scaleIdentity",0,_F,"scaleImplicit",0,Cw,"scaleLinear",0,_B,"scaleLog",0,_$,"scaleOrdinal",0,CN,"scalePoint",0,Ck,"scalePow",0,_5,"scaleQuantile",0,Et,"scaleQuantize",0,En,"scaleRadial",0,_6,"scaleSequential",0,T3,"scaleSequentialLog",0,T4,"scaleSequentialPow",0,T7,"scaleSequentialQuantile",0,T8,"scaleSequentialSqrt",0,T9,"scaleSequentialSymlog",0,T6,"scaleSqrt",0,_3,"scaleSymlog",0,_Q,"scaleThreshold",0,Er,"scaleTime",0,T0,"scaleUtc",0,T1,"tickFormat",0,_L],29061),e.i(29061),e.s(["scaleBand",0,Cj,"scaleDiverging",0,Mt,"scaleDivergingLog",0,Mn,"scaleDivergingPow",0,Mi,"scaleDivergingSqrt",0,Ma,"scaleDivergingSymlog",0,Mr,"scaleIdentity",0,_F,"scaleImplicit",0,Cw,"scaleLinear",0,_B,"scaleLog",0,_$,"scaleOrdinal",0,CN,"scalePoint",0,Ck,"scalePow",0,_5,"scaleQuantile",0,Et,"scaleQuantize",0,En,"scaleRadial",0,_6,"scaleSequential",0,T3,"scaleSequentialLog",0,T4,"scaleSequentialPow",0,T7,"scaleSequentialQuantile",0,T8,"scaleSequentialSqrt",0,T9,"scaleSequentialSymlog",0,T6,"scaleSqrt",0,_3,"scaleSymlog",0,_Q,"scaleThreshold",0,Er,"scaleTime",0,T0,"scaleUtc",0,T1,"tickFormat",0,_L],79357);var Mo=e.i(79357),Ms=e=>e.chartData,Ml=NX([Ms],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Mc=(e,t,n,r)=>r?Ml(e):Ms(e);function Mu(e){if(Array.isArray(e)&&2===e.length){var[t,n]=e;if(S_(t)&&S_(n))return!0}return!1}function Md(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Mh(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var n,r,[i,a]=e;if(S_(i))n=i;else if("function"==typeof i)return;if(S_(a))r=a;else if("function"==typeof a)return;var o=[n,r];if(Mu(o))return o}}var Mf=e.i(51655),Mp=e=>e,Mm={},Mg=e=>function t(){let n;return 0==arguments.length||1==arguments.length&&(n=arguments.length<=0?void 0:arguments[0],n===Mm)?t:e(...arguments)},Mv=(e,t)=>1===e?t:Mg(function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=r.filter(e=>e!==Mm).length;return a>=e?t(...r):Mv(e-a,Mg(function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t(...r.map(e=>e===Mm?n.shift():e),...n)}))}),Mx=(e,t)=>{for(var n=[],r=e;r<t;++r)n[r-e]=r;return n},My=Mv((r=(e,t)=>Array.isArray(t)?t.map(e):Object.keys(t).map(e=>t[e]).map(e)).length,r),Mb=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.length)return Mp;var r=t.reverse(),i=r[0],a=r.slice(1);return function(){return a.reduce((e,t)=>t(e),i(...arguments))}};function Mw(e){return 0===e?1:Math.floor(new Mf.default(e).abs().log(10).toNumber())+1}function MN(e,t,n){for(var r=new Mf.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var Mj=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},Mk=(e,t,n)=>{if(e.lte(0))return new Mf.default(0);var r=Mw(e.toNumber()),i=new Mf.default(10).pow(r),a=e.div(i),o=1!==r?.05:.1,s=new Mf.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return new Mf.default(t?s.toNumber():Math.ceil(s.toNumber()))},MS=function(e,t,n,r){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Mf.default(0),tickMin:new Mf.default(0),tickMax:new Mf.default(0)};var o=Mk(new Mf.default(t).sub(e).div(n-1),r,a),s=Math.ceil((i=e<=0&&t>=0?new Mf.default(0):(i=new Mf.default(e).add(t).div(2)).sub(new Mf.default(i).mod(o))).sub(e).div(o).toNumber()),l=Math.ceil(new Mf.default(t).sub(i).div(o).toNumber()),c=s+l+1;return c>n?MS(e,t,n,r,a+1):(c<n&&(l=t>0?l+(n-c):l,s=t>0?s:s+(n-c)),{step:o,tickMin:i.sub(new Mf.default(s).mul(o)),tickMax:i.add(new Mf.default(l).mul(o))})},MC=function(e){var[t,n]=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(r,2),[o,s]=Mj([t,n]);if(o===-1/0||s===1/0){var l=s===1/0?[o,...Mx(0,r-1).map(()=>1/0)]:[...Mx(0,r-1).map(()=>-1/0),s];return t>n?l.reverse():l}if(o===s){var c=new Mf.default(1),u=new Mf.default(o);if(!u.isint()&&i){var d=Math.abs(o);d<1?(c=new Mf.default(10).pow(Mw(o)-1),u=new Mf.default(Math.floor(u.div(c).toNumber())).mul(c)):d>1&&(u=new Mf.default(Math.floor(o)))}else 0===o?u=new Mf.default(Math.floor((r-1)/2)):i||(u=new Mf.default(Math.floor(o)));var h=Math.floor((r-1)/2);return Mb(My(e=>u.add(new Mf.default(e-h).mul(c)).toNumber()),Mx)(0,r)}var{step:f,tickMin:p,tickMax:g}=MS(o,s,a,i,0),v=MN(p,g.add(new Mf.default(.1).mul(f)),f);return t>n?v.reverse():v},M_=function(e,t){var[n,r]=e,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[a,o]=Mj([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var s=Math.max(t,2),l=Mk(new Mf.default(o).sub(a).div(s-1),i,0),c=[...MN(new Mf.default(a),new Mf.default(o),l),o];return!1===i&&(c=c.map(e=>Math.round(e))),n>r?c.reverse():c},ME=e=>e.rootProps.stackOffset,MT=e=>e.rootProps.reverseStackOrder,MM=e=>e.options.chartName,MO=e=>e.rootProps.syncId,MA=e=>e.rootProps.syncMethod,MD=e=>e.options.eventEmitter;function MP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function MI(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?MP(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ML=Math.PI/180,MR=(e,t,n,r)=>({x:e+Math.cos(-ML*r)*n,y:t+Math.sin(-ML*r)*n}),MB={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},MF={allowDecimals:!1,allowDuplicatedCategory:!0,angleAxisId:0,axisLine:!0,axisLineType:"polygon",cx:0,cy:0,orientation:"outer",reversed:!1,scale:"auto",tick:!0,tickLine:!0,tickSize:8,type:"category",zIndex:MB.axis},Mz={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,label:!1,orientation:"right",radiusAxisId:0,reversed:!1,scale:"auto",stroke:"#ccc",tick:!0,tickCount:5,type:"number",zIndex:MB.axis},MV=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t},MH={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:MF.angleAxisId,includeHidden:!1,name:void 0,reversed:MF.reversed,scale:MF.scale,tick:MF.tick,tickCount:void 0,ticks:void 0,type:MF.type,unit:void 0},MU={allowDataOverflow:Mz.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Mz.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Mz.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Mz.scale,tick:Mz.tick,tickCount:Mz.tickCount,ticks:void 0,type:Mz.type,unit:void 0},MW={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:MF.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:MF.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:MF.scale,tick:MF.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},MY={allowDataOverflow:Mz.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Mz.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Mz.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Mz.scale,tick:Mz.tick,tickCount:Mz.tickCount,ticks:void 0,type:"category",unit:void 0},MG=(e,t)=>null!=e.polarAxis.angleAxis[t]?e.polarAxis.angleAxis[t]:"radial"===e.layout.layoutType?MW:MH,MX=(e,t)=>null!=e.polarAxis.radiusAxis[t]?e.polarAxis.radiusAxis[t]:"radial"===e.layout.layoutType?MY:MU,M$=e=>e.polarOptions,Mq=NX([SH,SU,SK],function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2}),MK=NX([M$,Mq],(e,t)=>{if(null!=e)return jK(e.innerRadius,t,0)}),MZ=NX([M$,Mq],(e,t)=>{if(null!=e)return jK(e.outerRadius,t,.8*t)}),MQ=NX([M$],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});NX([MG,MQ],MV);var MJ=NX([Mq,MK,MZ],(e,t,n)=>{if(null!=e&&null!=t&&null!=n)return[t,n]});NX([MX,MJ],MV);var M0=NX([Cf,M$,MK,MZ,SH,SU],(e,t,n,r,i,a)=>{if(("centric"===e||"radial"===e)&&null!=t&&null!=n&&null!=r){var{cx:o,cy:s,startAngle:l,endAngle:c}=t;return{cx:jK(o,i,i/2),cy:jK(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),M1=(e,t)=>t,M2=(e,t,n)=>n;function M5(e){return null==e?void 0:e.id}function M3(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t,n=null!=(t=e.data)?t:r;if(null!=n&&0!==n.length){var s=M5(e);n.forEach((t,n)=>{var r,l=null==a||i?n:String(SO(t,a,null)),c=SO(t,e.dataKey,0);Object.assign(r=o.has(l)?o.get(l):{},{[s]:c}),o.set(l,r)})}}),Array.from(o.values())}function M4(e){return"stackId"in e&&null!=e.stackId&&null!=e.dataKey}var M6=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function M7(e,t){return!!(Array.isArray(e)&&Array.isArray(t))&&0===e.length&&0===t.length||e===t}var M9=e=>{var t=Cf(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},M8=e=>e.tooltip.settings.axisId;function Oe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Oe(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var On=[0,"auto"],Or={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},Oi=(e,t)=>e.cartesianAxis.xAxis[t],Oa=(e,t)=>{var n=Oi(e,t);return null==n?Or:n},Oo={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:On,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:60},Os=(e,t)=>e.cartesianAxis.yAxis[t],Ol=(e,t)=>{var n=Os(e,t);return null==n?Oo:n},Oc={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},Ou=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return null==n?Oc:n},Od=(e,t,n)=>{switch(t){case"xAxis":return Oa(e,n);case"yAxis":return Ol(e,n);case"zAxis":return Ou(e,n);case"angleAxis":return MG(e,n);case"radiusAxis":return MX(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Oh=(e,t,n)=>{switch(t){case"xAxis":return Oa(e,n);case"yAxis":return Ol(e,n);case"angleAxis":return MG(e,n);case"radiusAxis":return MX(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Of=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function Op(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var Om=e=>e.graphicalItems.cartesianItems,Og=NX([M1,M2],Op),Ov=(e,t,n)=>e.filter(n).filter(e=>(null==t?void 0:t.includeHidden)===!0||!e.hide),Ox=NX([Om,Od,Og],Ov,{memoizeOptions:{resultEqualityCheck:M7}}),Oy=NX([Ox],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(M4)),Ob=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),Ow=NX([Ox],Ob),ON=e=>e.map(e=>e.data).filter(Boolean).flat(1),Oj=NX([Ox],ON,{memoizeOptions:{resultEqualityCheck:M7}}),Ok=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},OS=NX([Oj,Mc],Ok),OC=(e,t,n)=>(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:SO(e,t.dataKey)})):n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:SO(e,t)}))):e.map(e=>({value:e})),O_=NX([OS,Od,Ox],OC);function OE(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function OT(e){if(jX(e)||e instanceof Date){var t=Number(e);if(S_(t))return t}}function OM(e){if(Array.isArray(e)){var t=[OT(e[0]),OT(e[1])];return Mu(t)?t:void 0}var n=OT(e);if(null!=n)return[n,n]}function OO(e){return e.map(OT).filter(j1)}var OA=e=>{var t=M9(e),n=M8(e);return Oh(e,t,n)},OD=NX([OA],e=>null==e?void 0:e.dataKey),OP=NX([Oy,Mc,OA],M3),OI=(e,t,n,r)=>Object.fromEntries(Object.entries(t.reduce((e,t)=>{if(null==t.stackId)return e;var n=e[t.stackId];return null==n&&(n=[]),n.push(t),e[t.stackId]=n,e},{})).map(t=>{var i,a,o,[s,l]=t,c=r?[...l].reverse():l,u=c.map(M5);return[s,{stackedData:(a=null!=(i=SI[n])?i:SN,(o=(function(){var e=Sw([]),t=Sj,n=SN,r=Sk;function i(i){var a,o,s=Array.from(e.apply(this,arguments),SS),l=s.length,c=-1;for(let e of i)for(a=0,++c;a<l;++a)(s[a][c]=[0,+r(e,s[a].key,c,i)]).data=e;for(a=0,o=Sb(t(s));a<l;++a)s[o[a]].index=a;return n(s,o),s}return i.keys=function(t){return arguments.length?(e="function"==typeof t?t:Sw(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r="function"==typeof e?e:Sw(+e),i):r},i.order=function(e){return arguments.length?(t=null==e?Sj:"function"==typeof e?e:Sw(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=null==e?SN:e,i):n},i})().keys(u).value((e,t)=>Number(SO(e,t,0))).order(Sj).offset(a)(e)).forEach((t,n)=>{t.forEach((t,r)=>{var i=SO(e[r],u[n],0);Array.isArray(i)&&2===i.length&&jG(i[0])&&jG(i[1])&&(t[0]=i[0],t[1]=i[1])})}),o),graphicalItems:c}]})),OL=NX([OP,Oy,ME,MT],OI),OR=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(null==r&&"zAxis"!==n){var o=((e,t,n)=>{if(null!=e){let r;return[(r=Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i,a=[Math.min(...i=SC(r,t,n).flat(2).filter(jG)),Math.max(...i)];return S_(a[0])&&S_(a[1])?[Math.min(e[0],a[0]),Math.max(e[1],a[1])]:e},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))[0]===1/0?0:r[0],r[1]===-1/0?0:r[1]]}})(e,i,a);if(null==o||0!==o[0]||0!==o[1])return o}},OB=NX([Od],e=>e.allowDataOverflow),OF=e=>{var t;if(null==e||!("domain"in e))return On;if(null!=e.domain)return e.domain;if("ticks"in e&&null!=e.ticks){if("number"===e.type){var n=OO(e.ticks);return[Math.min(...n),Math.max(...n)]}if("category"===e.type)return e.ticks.map(String)}return null!=(t=null==e?void 0:e.domain)?t:On},Oz=NX([Od],OF),OV=NX([Oz,OB],Mh),OH=NX([OL,Ms,M1,OV],OR,{memoizeOptions:{resultEqualityCheck:M6}}),OU=e=>e.errorBars,OW=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.filter(Boolean);if(0!==r.length){var i=r.flat();return[Math.min(...i),Math.max(...i)]}},OY=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s,l,c=null==(s=r[n.id])?void 0:s.filter(e=>OE(i,e)),u=SO(e,null!=(l=t.dataKey)?l:n.dataKey),d=!(!c||"number"!=typeof u||jW(u))&&c.length?OO(c.flatMap(t=>{var n,r,i=SO(e,t.dataKey);if(Array.isArray(i)?[n,r]=i:n=r=i,S_(n)&&S_(r))return[u-n,u+r]})):[];if(d.length>=2){var h=Math.min(...d),f=Math.max(...d);(null==a||h<a)&&(a=h),(null==o||f>o)&&(o=f)}var p=OM(u);null!=p&&(a=null==a?p[0]:Math.min(a,p[0]),o=null==o?p[1]:Math.max(o,p[1]))})}),(null==t?void 0:t.dataKey)!=null&&e.forEach(e=>{var n=OM(SO(e,t.dataKey));null!=n&&(a=null==a?n[0]:Math.min(a,n[0]),o=null==o?n[1]:Math.max(o,n[1]))}),S_(a)&&S_(o))return[a,o]},OG=NX([OS,Od,Ow,OU,M1],OY,{memoizeOptions:{resultEqualityCheck:M6}});function OX(e){var{value:t}=e;if(jX(t)||t instanceof Date)return t}var O$=e=>e.referenceElements.dots,Oq=(e,t,n)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===n:e.yAxisId===n),OK=NX([O$,M1,M2],Oq),OZ=e=>e.referenceElements.areas,OQ=NX([OZ,M1,M2],Oq),OJ=e=>e.referenceElements.lines,O0=NX([OJ,M1,M2],Oq),O1=(e,t)=>{if(null!=e){var n=OO(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},O2=NX(OK,M1,O1),O5=(e,t)=>{if(null!=e){var n=OO(e.flatMap(e=>["xAxis"===t?e.x1:e.y1,"xAxis"===t?e.x2:e.y2]));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},O3=NX([OQ,M1],O5),O4=(e,t)=>{if(null!=e){var n=e.flatMap(e=>"xAxis"===t?function(e){if(null!=e.x)return OO([e.x]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.x);return null==n||0===n.length?[]:OO(n)}(e):function(e){if(null!=e.y)return OO([e.y]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.y);return null==n||0===n.length?[]:OO(n)}(e));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},O6=NX([O0,M1],O4),O7=NX(O2,O6,O3,(e,t,n)=>OW(e,n,t)),O9=(e,t,n,r,i,a,o,s)=>null!=n?n:function(e,t,n){if(n||null!=t){if("function"==typeof e&&null!=t)try{var r=e(t,n);if(Mu(r))return Md(r,t,n)}catch(e){}if(Array.isArray(e)&&2===e.length){var i,a,[o,s]=e;if("auto"===o)null!=t&&(i=Math.min(...t));else if(jG(o))i=o;else if("function"==typeof o)try{null!=t&&(i=o(null==t?void 0:t[0]))}catch(e){}else if("string"==typeof o&&SR.test(o)){var l=SR.exec(o);if(null==l||null==l[1]||null==t)i=void 0;else{var c=+l[1];i=t[0]-c}}else i=null==t?void 0:t[0];if("auto"===s)null!=t&&(a=Math.max(...t));else if(jG(s))a=s;else if("function"==typeof s)try{null!=t&&(a=s(null==t?void 0:t[1]))}catch(e){}else if("string"==typeof s&&SB.test(s)){var u=SB.exec(s);if(null==u||null==u[1]||null==t)a=void 0;else{var d=+u[1];a=t[1]+d}}else a=null==t?void 0:t[1];var h=[i,a];if(Mu(h))return null==t?h:Md(h,t,n)}}}(t,"vertical"===o&&"xAxis"===s||"horizontal"===o&&"yAxis"===s?OW(r,a,i):OW(a,i),e.allowDataOverflow),O8=NX([Od,Oz,OV,OH,OG,O7,Cf,M1],O9,{memoizeOptions:{resultEqualityCheck:M6}}),Ae=[0,1],At=(e,t,n,r,i,a,o)=>{if(null!=e&&null!=n&&0!==n.length||void 0!==o){var s,l,{dataKey:c,type:u}=e,d=SA(t,a);return d&&null==c?(0,Cm.default)(0,null!=(l=null==n?void 0:n.length)?l:0):"category"===u?(s=r.map(OX).filter(e=>null!=e),d&&(null==e.dataKey||e.allowDuplicatedCategory&&jZ(s))?(0,Cm.default)(0,r.length):e.allowDuplicatedCategory?s:Array.from(new Set(s))):"expand"===i?Ae:o}},An=NX([Od,Cf,OS,O_,ME,M1,O8],At),Ar=(e,t,n,r,i)=>{if(null!=e){var{scale:a,type:o}=e;if("auto"===a)return"radial"===t&&"radiusAxis"===i?"band":"radial"===t&&"angleAxis"===i?"linear":"category"===o&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?"point":"category"===o?"band":"linear";if("string"==typeof a){var s="scale".concat(j0(a));return s in Mo?s:"point"}}},Ai=NX([Od,Cf,Of,MM,M1],Ar);function Aa(e,t,n,r){if(null!=n&&null!=r){if("function"==typeof e.scale)return e.scale.copy().domain(n).range(r);var i=function(e){if(null!=e){if(e in Mo)return Mo[e]();var t="scale".concat(j0(e));if(t in Mo)return Mo[t]()}}(t);if(null!=i){var a=i.domain(n).range(r);return(e=>{var t=e.domain();if(t&&!(t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-1e-4,a=Math.max(r[0],r[1])+1e-4,o=e(t[0]),s=e(t[n-1]);(o<i||o>a||s<i||s>a)&&e.domain([t[0],t[n-1]])}})(a),a}}}var Ao=(e,t,n)=>{var r=OF(t);if("auto"===n||"linear"===n){if(null!=t&&t.tickCount&&Array.isArray(r)&&("auto"===r[0]||"auto"===r[1])&&Mu(e))return MC(e,t.tickCount,t.allowDecimals);if(null!=t&&t.tickCount&&"number"===t.type&&Mu(e))return M_(e,t.tickCount,t.allowDecimals)}},As=NX([An,Oh,Ai],Ao),Al=(e,t,n,r)=>"angleAxis"!==r&&(null==e?void 0:e.type)==="number"&&Mu(t)&&Array.isArray(n)&&n.length>0?[Math.min(t[0],n[0]),Math.max(t[1],n[n.length-1])]:t,Ac=NX([Od,An,As,M1],Al),Au=NX(O_,Od,(e,t)=>{if(t&&"number"===t.type){var n=1/0,r=Array.from(OO(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(null==i||null==a)return 1/0;var o=a-i;if(0===o)return 1/0;for(var s=0;s<r.length-1;s++){var l=r[s],c=r[s+1];null!=l&&null!=c&&(n=Math.min(n,c-l))}return n/o}}),Ad=NX(Au,Cf,e=>e.rootProps.barCategoryGap,SK,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!S_(e))return 0;var a="vertical"===t?r.height:r.width;if("gap"===i)return e*a/2;if("no-gap"===i){var o=jK(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),Ah=NX(Oa,(e,t,n)=>{var r=Oa(e,t);return null==r||"string"!=typeof r.padding?0:Ad(e,"xAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{left:0,right:0};var n,r,{padding:i}=e;return"string"==typeof i?{left:t,right:t}:{left:(null!=(n=i.left)?n:0)+t,right:(null!=(r=i.right)?r:0)+t}}),Af=NX(Ol,(e,t,n)=>{var r=Ol(e,t);return null==r||"string"!=typeof r.padding?0:Ad(e,"yAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{top:0,bottom:0};var n,r,{padding:i}=e;return"string"==typeof i?{top:t,bottom:t}:{top:(null!=(n=i.top)?n:0)+t,bottom:(null!=(r=i.bottom)?r:0)+t}}),Ap=NX([SK,Ah,S2,S1,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),Am=NX([SK,Cf,Af,S2,S1,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:"horizontal"===t?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),Ag=(e,t,n,r)=>{var i;switch(t){case"xAxis":return Ap(e,n,r);case"yAxis":return Am(e,n,r);case"zAxis":return null==(i=Ou(e,n))?void 0:i.range;case"angleAxis":return MQ(e);case"radiusAxis":return MJ(e,n);default:return}},Av=NX([Od,Ag],MV),Ax=NX([Od,Ai,Ac,Av],Aa);function Ay(e,t){return e.id<t.id?-1:+(e.id>t.id)}NX([Ox,OU,M1],(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>OE(n,e)));var Ab=(e,t)=>t,Aw=(e,t,n)=>n,AN=NX(SG,Ab,Aw,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Ay)),Aj=NX(SX,Ab,Aw,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Ay)),Ak=(e,t)=>({width:e.width,height:t.height}),AS=NX(SK,Oa,Ak),AC=NX(SU,SK,AN,Ab,Aw,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s=Ak(t,n);null==a&&(a=((e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}})(t,r,e));var l="top"===r&&!i||"bottom"===r&&i;o[n.id]=a-Number(l)*s.height,a+=(l?-1:1)*s.height}),o}),A_=NX(SH,SK,Aj,Ab,Aw,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s={width:"number"==typeof n.width?n.width:60,height:t.height};null==a&&(a=((e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}})(t,r,e));var l="left"===r&&!i||"right"===r&&i;o[n.id]=a-Number(l)*s.width,a+=(l?-1:1)*s.width}),o}),AE=NX([SK,Oa,(e,t)=>{var n=Oa(e,t);if(null!=n)return AC(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:e.left,y:0}:{x:e.left,y:i}}}),AT=NX([SK,Ol,(e,t)=>{var n=Ol(e,t);if(null!=n)return A_(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:0,y:e.top}:{x:i,y:e.top}}}),AM=NX(SK,Ol,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height})),AO=(e,t,n,r)=>{if(null!=n){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=SA(e,r),l=t.map(e=>e.value);if(o&&s&&"category"===a&&i&&jZ(l))return l}},AA=NX([Cf,O_,Od,M1],AO),AD=(e,t,n,r)=>{if(null!=n&&null!=n.dataKey){var{type:i,scale:a}=n;if(SA(e,r)&&("number"===i||"auto"!==a))return t.map(e=>e.value)}},AP=NX([Cf,O_,Oh,M1],AD),AI=NX([Cf,(e,t,n)=>{switch(t){case"xAxis":return Oa(e,n);case"yAxis":return Ol(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Ai,Ax,AA,AP,Ag,As,M1],(e,t,n,r,i,a,o,s,l)=>{if(null!=t){var c=SA(e,l);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:l,categoricalDomain:a,duplicateDomain:i,isCategorical:c,niceTicks:s,range:o,realScaleType:n,scale:r}}}),AL=NX([Cf,Oh,Ai,Ax,As,Ag,AA,AP,M1],(e,t,n,r,i,a,o,s,l)=>{if(null!=t&&null!=r){var c=SA(e,l),{type:u,ticks:d,tickCount:h}=t,f="scaleBand"===n&&"function"==typeof r.bandwidth?r.bandwidth()/2:2,p="category"===u&&r.bandwidth?r.bandwidth()/f:0;p="angleAxis"===l&&null!=a&&a.length>=2?2*jU(a[0]-a[1])*p:p;var g=d||i;return g?g.map((e,t)=>({index:t,coordinate:r(o?o.indexOf(e):e)+p,value:e,offset:p})).filter(e=>S_(e.coordinate)):c&&s?s.map((e,t)=>({coordinate:r(e)+p,value:e,index:t,offset:p})).filter(e=>S_(e.coordinate)):r.ticks?r.ticks(h).map(e=>({coordinate:r(e)+p,value:e,offset:p})):r.domain().map((e,t)=>({coordinate:r(e)+p,value:o?o[e]:e,index:t,offset:p}))}}),AR=NX([Cf,Oh,Ax,Ag,AA,AP,M1],(e,t,n,r,i,a,o)=>{if(null!=t&&null!=n&&null!=r&&r[0]!==r[1]){var s=SA(e,o),{tickCount:l}=t,c=0;return(c="angleAxis"===o&&(null==r?void 0:r.length)>=2?2*jU(r[0]-r[1])*c:c,s&&a)?a.map((e,t)=>({coordinate:n(e)+c,value:e,index:t,offset:c})):n.ticks?n.ticks(l).map(e=>({coordinate:n(e)+c,value:e,offset:c})):n.domain().map((e,t)=>({coordinate:n(e)+c,value:i?i[e]:e,index:t,offset:c}))}}),AB=NX(Od,Ax,(e,t)=>{if(null!=e&&null!=t)return Ot(Ot({},e),{},{scale:t})}),AF=NX([Od,Ai,An,Av],Aa);NX((e,t,n)=>Ou(e,n),AF,(e,t)=>{if(null!=e&&null!=t)return Ot(Ot({},e),{},{scale:t})});var Az=NX([Cf,SG,SX],(e,t,n)=>{switch(e){case"horizontal":return t.some(e=>e.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(e=>e.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),AV=e=>e.options.defaultTooltipEventType,AH=e=>e.options.validateTooltipEventTypes;function AU(e,t,n){if(null==e)return t;var r=e?"axis":"item";return null==n?t:n.includes(r)?r:t}function AW(e,t){return AU(t,AV(e),AH(e))}var AY=(e,t)=>{var n,r=Number(t);if(!jW(r)&&null!=t)return r>=0?null==e||null==(n=e[r])?void 0:n.value:void 0};function AG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function AX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?AG(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var A$=(e,t,n,r)=>{if(null==t)return k$;var i,a,o,s=(i=e,a=t,o=n,"axis"===a?"click"===o?i.axisInteraction.click:i.axisInteraction.hover:"click"===o?i.itemInteraction.click:i.itemInteraction.hover);if(null==s)return k$;if(s.active)return s;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&null!=e.syncInteraction.index)return e.syncInteraction;var l=!0===e.settings.active;if(null!=s.index){if(l)return AX(AX({},s),{},{active:!0})}else if(null!=r)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return AX(AX({},k$),{},{coordinate:s.coordinate})},Aq=(e,t,n,r)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!S_(a))return i;var o=Infinity;t.length>0&&(o=t.length-1);var s=Math.max(0,Math.min(a,o)),l=t[s];return null==l?String(s):!function(e,t,n){if(null==n||null==t)return!0;var r=SO(e,t);return!(null!=r&&Mu(n))||function(e,t){var n=function(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}(e),r=t[0],i=t[1];if(void 0===n)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}(r,n)}(l,n,r)?null:String(s)},AK=(e,t,n,r,i,a,o,s)=>{if(null!=a&&null!=s){var l=o[0],c=null==l?void 0:s(l.positions,a);if(null!=c)return c;var u=null==i?void 0:i[Number(a)];if(u)if("horizontal"===n)return{x:u.coordinate,y:(r.top+t)/2};else return{x:(r.left+e)/2,y:u.coordinate}}},AZ=(e,t,n,r)=>{if("axis"===t)return e.tooltipItemPayloads;if(0===e.tooltipItemPayloads.length)return[];if(null==(i="hover"===n?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId)&&null!=r){var i,a=e.tooltipItemPayloads[0];return null!=a?[a]:[]}return e.tooltipItemPayloads.filter(e=>{var t;return(null==(t=e.settings)?void 0:t.graphicalItemId)===i})},AQ=e=>e.options.tooltipPayloadSearcher,AJ=e=>e.tooltip;function A0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A1(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A0(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var A2=(e,t,n,r,i,a,o)=>{if(null!=t&&null!=a){var{chartData:s,computedData:l,dataStartIndex:c,dataEndIndex:u}=n;return e.reduce((e,n)=>{var d,h,f,{dataDefinedOnItem:p,settings:g}=n,v=null!=p?p:s,x=Array.isArray(v)?SC(v,c,u):v,y=null!=(d=null==g?void 0:g.dataKey)?d:r,b=null==g?void 0:g.nameKey;return Array.isArray(h=r&&Array.isArray(x)&&!Array.isArray(x[0])&&"axis"===o?jJ(x,r,i):a(x,t,l,b))?h.forEach(t=>{var n=A1(A1({},g),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(Sz({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:SO(t.payload,t.dataKey),name:t.name}))}):e.push(Sz({tooltipEntrySettings:g,dataKey:y,payload:h,value:SO(h,y),name:null!=(f=SO(h,b))?f:null==g?void 0:g.name})),e},[])}},A5=NX([OA,Cf,Of,MM,M9],Ar),A3=NX([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),A4=NX([M9,M8],Op),A6=NX([A3,OA,A4],Ov,{memoizeOptions:{resultEqualityCheck:M7}}),A7=NX([A6],e=>e.filter(M4)),A9=NX([A6],ON,{memoizeOptions:{resultEqualityCheck:M7}}),A8=NX([A9,Ms],Ok),De=NX([A7,Ms,OA],M3),Dt=NX([A8,OA,A6],OC),Dn=NX([OA],OF),Dr=NX([OA],e=>e.allowDataOverflow),Di=NX([Dn,Dr],Mh),Da=NX([A6],e=>e.filter(M4)),Do=NX([De,Da,ME,MT],OI),Ds=NX([Do,Ms,M9,Di],OR),Dl=NX([A6],Ob),Dc=NX([A8,OA,Dl,OU,M9],OY,{memoizeOptions:{resultEqualityCheck:M6}}),Du=NX([O$,M9,M8],Oq),Dd=NX([Du,M9],O1),Dh=NX([OZ,M9,M8],Oq),Df=NX([Dh,M9],O5),Dp=NX([OJ,M9,M8],Oq),Dm=NX([Dp,M9],O4),Dg=NX([Dd,Dm,Df],OW),Dv=NX([OA,Dn,Di,Ds,Dc,Dg,Cf,M9],O9),Dx=NX([OA,Cf,A8,Dt,ME,M9,Dv],At),Dy=NX([Dx,OA,A5],Ao),Db=NX([OA,Dx,Dy,M9],Al),Dw=e=>{var t=M9(e),n=M8(e);return Ag(e,t,n,!1)},DN=NX([OA,Dw],MV),Dj=NX([OA,A5,Db,DN],Aa),Dk=NX([Cf,Dt,OA,M9],AO),DS=NX([Cf,Dt,OA,M9],AD),DC=NX([Cf,OA,A5,Dj,Dw,Dk,DS,M9],(e,t,n,r,i,a,o,s)=>{if(t){var{type:l}=t,c=SA(e,s);if(r){var u="scaleBand"===n&&r.bandwidth?r.bandwidth()/2:2,d="category"===l&&r.bandwidth?r.bandwidth()/u:0;return(d="angleAxis"===s&&null!=i&&(null==i?void 0:i.length)>=2?2*jU(i[0]-i[1])*d:d,c&&o)?o.map((e,t)=>({coordinate:r(e)+d,value:e,index:t,offset:d})):r.domain().map((e,t)=>({coordinate:r(e)+d,value:a?a[e]:e,index:t,offset:d}))}}}),D_=NX([AV,AH,e=>e.tooltip.settings],(e,t,n)=>AU(n.shared,e,t)),DE=e=>e.tooltip.settings.trigger,DT=e=>e.tooltip.settings.defaultIndex,DM=NX([AJ,D_,DE,DT],A$),DO=NX([DM,A8,OD,Dx],Aq),DA=NX([DC,DO],AY),DD=NX([DM],e=>{if(e)return e.dataKey});NX([DM],e=>{if(e)return e.graphicalItemId});var DP=NX([AJ,D_,DE,DT],AZ),DI=NX([SH,SU,Cf,SK,DC,DT,DP,AQ],AK),DL=NX([DM,DI],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),DR=NX([DM],e=>{var t;return null!=(t=null==e?void 0:e.active)&&t}),DB=NX([DP,DO,Ms,OD,DA,AQ,D_],A2),DF=NX([DB],e=>{if(null!=e)return Array.from(new Set(e.map(e=>e.payload).filter(e=>null!=e)))});function Dz(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function DV(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dz(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dz(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var DH=(e,t,n,r,i)=>{var a=null!=(d=null==t?void 0:t.length)?d:0;if(a<=1||null==e)return 0;if("angleAxis"===r&&null!=i&&1e-6>=Math.abs(Math.abs(i[1]-i[0])-360))for(var o=0;o<a;o++){var s=o>0?null==(h=n[o-1])?void 0:h.coordinate:null==(f=n[a-1])?void 0:f.coordinate,l=null==(p=n[o])?void 0:p.coordinate,c=o>=a-1?null==(g=n[0])?void 0:g.coordinate:null==(v=n[o+1])?void 0:v.coordinate,u=void 0;if(null!=s&&null!=l&&null!=c)if(jU(l-s)!==jU(c-l)){var d,h,f,p,g,v,x,y=[];if(jU(c-l)===jU(i[1]-i[0])){u=c;var b=l+i[1]-i[0];y[0]=Math.min(b,(b+s)/2),y[1]=Math.max(b,(b+s)/2)}else{u=s;var w=c+i[1]-i[0];y[0]=Math.min(l,(w+l)/2),y[1]=Math.max(l,(w+l)/2)}var N=[Math.min(l,(u+l)/2),Math.max(l,(u+l)/2)];if(e>N[0]&&e<=N[1]||e>=y[0]&&e<=y[1])return null==(x=n[o])?void 0:x.index}else{var j,k=Math.min(s,c),S=Math.max(s,c);if(e>(k+l)/2&&e<=(S+l)/2)return null==(j=n[o])?void 0:j.index}}else if(t)for(var C=0;C<a;C++){var _=t[C];if(null!=_){var E=t[C+1],T=t[C-1];if(0===C&&null!=E&&e<=(_.coordinate+E.coordinate)/2||C===a-1&&null!=T&&e>(_.coordinate+T.coordinate)/2||C>0&&C<a-1&&null!=T&&null!=E&&e>(_.coordinate+T.coordinate)/2&&e<=(_.coordinate+E.coordinate)/2)return _.index}}return -1},DU=(e,t)=>t,DW=(e,t,n)=>n,DY=(e,t,n,r)=>r,DG=NX(DC,e=>(0,Sx.default)(e,e=>e.coordinate)),DX=NX([AJ,DU,DW,DY],A$),D$=NX([DX,A8,OD,Dx],Aq),Dq=NX([AJ,DU,DW,DY],AZ),DK=NX([SH,SU,Cf,SK,DC,DY,Dq,AQ],AK),DZ=NX([DX,DK],(e,t)=>{var n;return null!=(n=e.coordinate)?n:t}),DQ=NX([DC,D$],AY),DJ=NX([Dq,D$,Ms,OD,DQ,AQ,DU],A2),D0=NX([DX,D$],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),D1=NX([(e,t)=>t,Cf,M0,M9,DN,DC,DG,SK],(e,t,n,r,i,a,o,s)=>{if(e&&t&&r&&i&&a){if("horizontal"===t||"vertical"===t){if(!e||!r||!i||!a)return;if(function(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}(e,s)){var l=DH("horizontal"===t?e.chartX:"vertical"===t?e.chartY:void 0,o,a,r,i),c=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("horizontal"===e)return{x:i.coordinate,y:r.chartY};if("vertical"===e)return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}})(t,a,l,e);return{activeIndex:String(l),activeCoordinate:c}}return}if(e&&r&&i&&a&&n){var u=((e,t)=>{var n,{chartX:r,chartY:i}=e,{radius:a,angle:o}=((e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=((e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)})({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=Math.acos((n-i)/o);return r>a&&(s=2*Math.PI-s),{radius:o,angle:180*s/Math.PI,angleInRadian:s}})({x:r,y:i},t),{innerRadius:s,outerRadius:l}=t;if(a<s||a>l||0===a)return null;var{startAngle:c,endAngle:u}=(e=>{var{startAngle:t,endAngle:n}=e,r=Math.min(Math.floor(t/360),Math.floor(n/360));return{startAngle:t-360*r,endAngle:n-360*r}})(t),d=o;if(c<=u){for(;d>u;)d-=360;for(;d<c;)d+=360;n=d>=c&&d<=u}else{for(;d>c;)d-=360;for(;d<u;)d+=360;n=d>=u&&d<=c}return n?MI(MI({},t),{},{radius:a,angle:((e,t)=>{var{startAngle:n,endAngle:r}=t;return e+360*Math.min(Math.floor(n/360),Math.floor(r/360))})(d,t)}):null})(e,n);if(u){var d=DH("centric"===t?u.angle:u.radius,o,a,r,i),h=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("centric"===e){var a=i.coordinate,{radius:o}=r;return DV(DV(DV({},r),MR(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:l}=r;return DV(DV(DV({},r),MR(r.cx,r.cy,s,l)),{},{angle:l,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}})(t,a,d,u);return{activeIndex:String(d),activeCoordinate:h}}return}}}),D2=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},D5=N6("mouseClick"),D3=jB();D3.startListening({actionCreator:D5,effect:(e,t)=>{var n=e.payload,r=D1(t.getState(),D2(n));(null==r?void 0:r.activeIndex)!=null&&t.dispatch(k4({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var D4=N6("mouseMove"),D6=jB(),D7=null;function D9(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":"children"===e&&"object"==typeof t&&null!==t?"<<CHILDREN>>":t}function D8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D8(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D8(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}D6.startListening({actionCreator:D4,effect:(e,t)=>{var n=e.payload;null!==D7&&cancelAnimationFrame(D7);var r=D2(n);D7=requestAnimationFrame(()=>{var e=t.getState();if("axis"===AW(e,e.tooltip.settings.shared)){var n=D1(e,r);(null==n?void 0:n.activeIndex)!=null?t.dispatch(k3({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):t.dispatch(k2())}D7=null})}});var Pt=js({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:jt()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.xAxis[n.id]&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=r)},prepare:jt()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:jt()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:jt()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.yAxis[n.id]&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=r)},prepare:jt()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:jt()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:jt()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.zAxis[n.id]&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=r)},prepare:jt()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:jt()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var a=i.widthHistory||[];if(3===a.length&&a[0]===a[2]&&r===a[1]&&r!==i.width&&1>=Math.abs(r-a[0]))return;var o=[...a,r].slice(-3);e.yAxis[n]=Pe(Pe({},e.yAxis[n]),{},{width:r,widthHistory:o})}}}}),{addXAxis:Pn,replaceXAxis:Pr,removeXAxis:Pi,addYAxis:Pa,replaceYAxis:Po,removeYAxis:Ps,addZAxis:Pl,replaceZAxis:Pc,removeZAxis:Pu,updateYAxisWidth:Pd}=Pt.actions,Ph=Pt.reducer,Pf=js({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:jt()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NE(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:jt()},removeCartesianGraphicalItem:{reducer(e,t){var n=NE(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:jt()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:jt()},removePolarGraphicalItem:{reducer(e,t){var n=NE(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:jt()}}}),{addCartesianGraphicalItem:Pp,replaceCartesianGraphicalItem:Pm,removeCartesianGraphicalItem:Pg,addPolarGraphicalItem:Pv,removePolarGraphicalItem:Px}=Pf.actions,Py=Pf.reducer,Pb=js({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=NE(e).dots.findIndex(e=>e===t.payload);-1!==n&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=NE(e).areas.findIndex(e=>e===t.payload);-1!==n&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=NE(e).lines.findIndex(e=>e===t.payload);-1!==n&&e.lines.splice(n,1)}}}),{addDot:Pw,removeDot:PN,addArea:Pj,removeArea:Pk,addLine:PS,removeLine:PC}=Pb.actions,P_=Pb.reducer,PE={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},PT=js({name:"brush",initialState:PE,reducers:{setBrushSettings:(e,t)=>null==t.payload?PE:t.payload}}),{setBrushSettings:PM}=PT.actions,PO=PT.reducer,PA=js({name:"legend",initialState:{settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:jt()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NE(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:jt()},removeLegendPayload:{reducer(e,t){var n=NE(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:jt()}}}),{setLegendSize:PD,setLegendSettings:PP,addLegendPayload:PI,replaceLegendPayload:PL,removeLegendPayload:PR}=PA.actions,PB=PA.reducer,PF={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},Pz=js({name:"rootProps",initialState:PF,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!=(n=t.payload.barGap)?n:PF.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),PV=Pz.reducer,{updateOptions:PH}=Pz.actions,PU=js({name:"polarAxis",initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:PW,removeRadiusAxis:PY,addAngleAxis:PG,removeAngleAxis:PX}=PU.actions,P$=PU.reducer,Pq=js({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:PK}=Pq.actions,PZ=Pq.reducer,PQ=N6("keyDown"),PJ=N6("focus"),P0=jB();P0.startListening({actionCreator:PQ,effect:(e,t)=>{var n=t.getState();if(!1===n.rootProps.accessibilityLayer)return;var{keyboardInteraction:r}=n.tooltip,i=e.payload;if("ArrowRight"===i||"ArrowLeft"===i||"Enter"===i){var a=Aq(r,A8(n),OD(n),Dx(n)),o=null==a?-1:Number(a);if(Number.isFinite(o)&&!(o<0)){var s=DC(n);if("Enter"===i){var l=DK(n,"axis","hover",String(r.index));t.dispatch(k7({active:!r.active,activeIndex:r.index,activeCoordinate:l}));return}var c=o+("ArrowRight"===i?1:-1)*("left-to-right"===Az(n)?1:-1);if(null!=s&&!(c>=s.length)&&!(c<0)){var u=DK(n,"axis","hover",String(c));t.dispatch(k7({active:!0,activeIndex:c.toString(),activeCoordinate:u}))}}}}}),P0.startListening({actionCreator:PJ,effect:(e,t)=>{var n=t.getState();if(!1!==n.rootProps.accessibilityLayer){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&null==r.index){var i=DK(n,"axis","hover",String("0"));t.dispatch(k7({active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var P1=N6("externalEvent"),P2=jB(),P5=new Map;P2.startListening({actionCreator:P1,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(null!=n){r.persist();var i=r.type,a=P5.get(i);void 0!==a&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:DL(e),activeDataKey:DD(e),activeIndex:DO(e),activeLabel:DA(e),activeTooltipIndex:DO(e),isTooltipActive:DR(e)};n(a,r)}finally{P5.delete(i)}});P5.set(i,o)}}});var P3=NX([AJ],e=>e.tooltipItemPayloads),P4=NX([P3,AQ,(e,t)=>t,(e,t,n)=>n],(e,t,n,r)=>{var i=e.find(e=>e.settings.graphicalItemId===r);if(null!=i){var{positions:a}=i;if(null!=a)return t(a,n)}}),P6=N6("touchMove"),P7=jB();P7.startListening({actionCreator:P6,effect:(e,t)=>{var n=e.payload;if(null!=n.touches&&0!==n.touches.length){var r=t.getState(),i=AW(r,r.tooltip.settings.shared);if("axis"===i){var a=n.touches[0];if(null==a)return;var o=D1(r,D2({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(null==o?void 0:o.activeIndex)!=null&&t.dispatch(k3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if("item"===i){var s,l=n.touches[0];if(null==document.elementFromPoint||null==l)return;var c=document.elementFromPoint(l.clientX,l.clientY);if(!c||!c.getAttribute)return;var u=c.getAttribute("data-recharts-item-index"),d=null!=(s=c.getAttribute("data-recharts-item-id"))?s:void 0,h=A6(r).find(e=>e.id===d);if(null==u||null==h||null==d)return;var{dataKey:f}=h,p=P4(r,u,d);t.dispatch(k0({activeDataKey:f,activeIndex:u,activeCoordinate:p,activeGraphicalItemId:d}))}}}});var P9=js({name:"errorBars",initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:P8,replaceErrorBar:Ie,removeErrorBar:It}=P9.actions,In=P9.reducer,Ir={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function Ii(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ia(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ii(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ii(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Io={zIndexMap:Object.values(MB).reduce((e,t)=>Ia(Ia({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},Is=new Set(Object.values(MB)),Il=js({name:"zIndex",initialState:Io,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:jt()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!Is.has(n)&&delete e.zIndexMap[n])},prepare:jt()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:jt()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:jt()}}}),{registerZIndexPortal:Ic,unregisterZIndexPortal:Iu,registerZIndexPortalElement:Id,unregisterZIndexPortalElement:Ih}=Il.actions,If=N0({brush:PO,cartesianAxis:Ph,chartData:Sr,errorBars:In,graphicalItems:Py,layout:Sc,legend:PB,options:j4,polarAxis:P$,polarOptions:PZ,referenceElements:P_,rootProps:PV,tooltip:k9,zIndex:Il.reducer}),Ip=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Chart";return function(e){let t,n,r,i=function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new N7;return t&&("boolean"==typeof t?a.push(N3):a.push(N5(t.extraArgument))),a},{reducer:a,middleware:o,devTools:s=!0,duplicateMiddlewareCheck:l=!0,preloadedState:c,enhancers:u}=e||{};if("function"==typeof a)t=a;else if(NJ(a))t=N0(a);else throw Error(jF(1));n="function"==typeof o?o(i):i();let d=N1;s&&(d=N4({trace:!1,..."object"==typeof s&&s}));let h=(r=function(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(Nq(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=N1(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}(...n),function(e){let{autoBatch:t=!0}=e??{},n=new N7(r);return t&&n.push(jr("object"==typeof t?t:void 0)),n});return function e(t,n,r){if("function"!=typeof t)throw Error(Nq(2));if("function"==typeof n&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error(Nq(0));if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error(Nq(1));return r(e)(t,n)}let i=t,a=n,o=new Map,s=o,l=0,c=!1;function u(){s===o&&(s=new Map,o.forEach((e,t)=>{s.set(t,e)}))}function d(){if(c)throw Error(Nq(3));return a}function h(e){if("function"!=typeof e)throw Error(Nq(4));if(c)throw Error(Nq(5));let t=!0;u();let n=l++;return s.set(n,e),function(){if(t){if(c)throw Error(Nq(6));t=!1,u(),s.delete(n),o=null}}}function f(e){if(!NJ(e))throw Error(Nq(7));if(void 0===e.type)throw Error(Nq(8));if("string"!=typeof e.type)throw Error(Nq(17));if(c)throw Error(Nq(9));try{c=!0,a=i(a,e)}finally{c=!1}return(o=s).forEach(e=>{e()}),e}return f({type:NQ.INIT}),{dispatch:f,subscribe:h,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw Error(Nq(10));i=e,f({type:NQ.REPLACE})},[NK]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(Nq(11));function t(){e.next&&e.next(d())}return t(),{unsubscribe:h(t)}},[NK](){return this}}}}}(t,c,d(..."function"==typeof u?u(h):h()))}({reducer:If,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([D3.middleware,D6.middleware,P0.middleware,P2.middleware,P7.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(jr({type:"raf"}))},devTools:Ir.devToolsEnabled&&{serialize:{replacer:D9},name:"recharts-".concat(t)}})};function Im(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=S0(),a=(0,eh.useRef)(null);return i?n:(null==a.current&&(a.current=Ip(t,r)),eh.createElement(ka,{context:Sd,store:a.current},n))}var Ig=e=>{var{chartData:t}=e,n=Sf(),r=S0();return(0,eh.useEffect)(()=>r?()=>{}:(n(Se(t)),()=>{n(Se(void 0))}),[t,n,r]),null},Iv=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function Ix(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(Iv.has(n)){if(null==e[n]&&null==t[n])continue;if(!function(e,t){if(kt(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!kt(e[n[r]],t[n[r]]))return!1;return!0}(e[n],t[n]))return!1}else{var r,i;if(r=e[n],i=t[n],(null!=r||null!=i)&&("number"==typeof r&&"number"==typeof i?r!==i&&(r==r||i==i):r!==i))return!1}return!0}var Iy=(0,eh.memo)(function(e){var{layout:t,margin:n}=e,r=Sf(),i=S0();return(0,eh.useEffect)(()=>{i||(r(So(t)),r(Sa(n)))},[r,i,t,n]),null},Ix);function Ib(e){var t=Sf();return(0,eh.useEffect)(()=>{t(PH(e))},[t,e]),null}var Iw=()=>{var e;return null==(e=Sv(e=>e.rootProps.accessibilityLayer))||e},IN=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function Ij(e){return"string"==typeof e&&IN.includes(e)}var Ik=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"]);function IS(e){return"string"==typeof e&&Ik.has(e)}function IC(e){return"string"==typeof e&&e.startsWith("data-")}function I_(e){if("object"!=typeof e||null===e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IS(n)||IC(n))&&(t[n]=e[n]);return t}function IE(e){return null==e?null:(0,eh.isValidElement)(e)&&"object"==typeof e.props&&null!==e.props?I_(e.props):"object"!=typeof e||Array.isArray(e)?null:I_(e)}function IT(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IS(n)||IC(n)||Ij(n))&&(t[n]=e[n]);return t}var IM=["children","width","height","viewBox","className","style","title","desc"];function IO(){return(IO=Object.assign.bind()).apply(null,arguments)}var IA=(0,eh.forwardRef)((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:c}=e,u=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,IM),d=a||{width:r,height:i,x:0,y:0},h=(0,S5.clsx)("recharts-surface",o);return eh.createElement("svg",IO({},IT(u),{className:h,width:r,height:i,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height),ref:t}),eh.createElement("title",null,l),eh.createElement("desc",null,c),n)}),ID=NX(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(null!=t){var r=e[t];if(null!=r)return n?r.panoramaElement:r.element}}),IP=NX(e=>e.zIndex.zIndexMap,e=>Array.from(new Set(Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(MB)))).sort((e,t)=>e-t),{memoizeOptions:{resultEqualityCheck:function(e,t){if(e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}}});function II(e){var{zIndex:t,isPanorama:n}=e,r=(0,eh.useRef)(null),i=Sf();return(0,eh.useLayoutEffect)(()=>(r.current&&i(Id({zIndex:t,element:r.current,isPanorama:n})),()=>{i(Ih({zIndex:t,isPanorama:n}))}),[i,t,n]),eh.createElement("g",{tabIndex:-1,ref:r})}function IL(e){var{children:t,isPanorama:n}=e,r=Sv(IP);if(!r||0===r.length)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return eh.createElement(eh.Fragment,null,i.map(e=>eh.createElement(II,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>eh.createElement(II,{key:e,zIndex:e,isPanorama:n})))}var IR=["children"];function IB(){return(IB=Object.assign.bind()).apply(null,arguments)}var IF={width:"100%",height:"100%",display:"block"},Iz=(0,eh.forwardRef)((e,t)=>{var n,r,i=Sv(SH),a=Sv(SU),o=Iw();if(!SE(i)||!SE(a))return null;var{children:s,otherAttributes:l,title:c,desc:u}=e;return null!=l&&(n="number"==typeof l.tabIndex?l.tabIndex:o?0:void 0,r="string"==typeof l.role?l.role:o?"application":void 0),eh.createElement(IA,IB({},l,{title:c,desc:u,role:r,tabIndex:n,width:i,height:a,style:IF,ref:t}),s)}),IV=e=>{var{children:t}=e,n=Sv(S2);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return eh.createElement(IA,{width:r,height:i,x:o,y:a},t)},IH=(0,eh.forwardRef)((e,t)=>{var{children:n}=e,r=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,IR);return S0()?eh.createElement(IV,null,eh.createElement(IL,{isPanorama:!0},n)):eh.createElement(Iz,IB({ref:t},r),eh.createElement(IL,{isPanorama:!1},n))}),IU=new(e.i(29942)).default,IW="recharts.syncEvent.tooltip",IY="recharts.syncEvent.brush";function IG(e){return e.tooltip.syncInteraction}var IX=["x","y"];function I$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Iq(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I$(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var IK=(0,eh.createContext)(null),IZ=(0,eh.createContext)(null);function IQ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function IJ(){return(IJ=Object.assign.bind()).apply(null,arguments)}var I0=()=>{var e,t,n,r,i,a,o,s,l,c,u,d;return e=Sf(),(0,eh.useEffect)(()=>{e(j6())},[e]),t=Sv(MO),n=Sv(MD),r=Sf(),i=Sv(MA),a=Sv(DC),o=Sv(Cf),s=Cu(),l=Sv(e=>e.rootProps.className),(0,eh.useEffect)(()=>{if(null==t)return j2;var e=(e,l,c)=>{if(n!==c&&t===e){if("index"===i){if(s&&null!=l&&null!=(u=l.payload)&&u.coordinate&&l.payload.sourceViewBox){var u,d,h=l.payload.coordinate,{x:f,y:p}=h,g=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(h,IX),{x:v,y:x,width:y,height:b}=l.payload.sourceViewBox,w=Iq(Iq({},g),{},{x:s.x+(y?(f-v)/y:0)*s.width,y:s.y+(b?(p-x)/b:0)*s.height});r(Iq(Iq({},l),{},{payload:Iq(Iq({},l.payload),{},{coordinate:w})}))}else r(l);return}if(null!=a){if("function"==typeof i){var N=i(a,{activeTooltipIndex:null==l.payload.index?void 0:Number(l.payload.index),isTooltipActive:l.payload.active,activeIndex:null==l.payload.index?void 0:Number(l.payload.index),activeLabel:l.payload.label,activeDataKey:l.payload.dataKey,activeCoordinate:l.payload.coordinate});d=a[N]}else"value"===i&&(d=a.find(e=>String(e.value)===l.payload.label));var{coordinate:j}=l.payload;if(null==d||!1===l.payload.active||null==j||null==s)return void r(k6({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));var{x:k,y:S}=j,C=Math.min(k,s.x+s.width),_=Math.min(S,s.y+s.height),E={x:"horizontal"===o?d.coordinate:C,y:"horizontal"===o?_:d.coordinate};r(k6({active:l.payload.active,coordinate:E,dataKey:l.payload.dataKey,index:String(d.index),label:l.payload.label,sourceViewBox:l.payload.sourceViewBox,graphicalItemId:l.payload.graphicalItemId}))}}};return IU.on(IW,e),()=>{IU.off(IW,e)}},[l,r,n,t,i,a,o,s]),c=Sv(MO),u=Sv(MD),d=Sf(),(0,eh.useEffect)(()=>{if(null==c)return j2;var e=(e,t,n)=>{u!==n&&c===e&&d(St(t))};return IU.on(IY,e),()=>{IU.off(IY,e)}},[d,u,c]),null};function I1(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var I2=(0,eh.forwardRef)((e,t)=>{var n,r,i=(0,eh.useRef)(null),[a,o]=(0,eh.useState)({containerWidth:I1(null==(n=e.style)?void 0:n.width),containerHeight:I1(null==(r=e.style)?void 0:r.height)}),s=(0,eh.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),l=(0,eh.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e&&"u">typeof ResizeObserver){var{width:n,height:r}=e.getBoundingClientRect();s(n,r);var a=new ResizeObserver(e=>{var{width:t,height:n}=e[0].contentRect;s(t,n)});a.observe(e),i.current=a}},[t,s]);return(0,eh.useEffect)(()=>()=>{var e=i.current;null!=e&&e.disconnect()},[s]),eh.createElement(eh.Fragment,null,eh.createElement(Cp,{width:a.containerWidth,height:a.containerHeight}),eh.createElement("div",IJ({ref:l},e)))}),I5=(0,eh.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,eh.useState)({containerWidth:I1(n),containerHeight:I1(r)}),o=(0,eh.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,eh.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return eh.createElement(eh.Fragment,null,eh.createElement(Cp,{width:i.containerWidth,height:i.containerHeight}),eh.createElement("div",IJ({ref:s},e)))}),I3=(0,eh.forwardRef)((e,t)=>{var{width:n,height:r}=e;return eh.createElement(eh.Fragment,null,eh.createElement(Cp,{width:n,height:r}),eh.createElement("div",IJ({ref:t},e)))}),I4=(0,eh.forwardRef)((e,t)=>{var{width:n,height:r}=e;return jY(n)||jY(r)?eh.createElement(I5,IJ({},e,{ref:t})):eh.createElement(I3,IJ({},e,{ref:t}))}),I6=(0,eh.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:l,onMouseEnter:c,onMouseLeave:u,onMouseMove:d,onMouseUp:h,onTouchEnd:f,onTouchMove:p,onTouchStart:g,style:v,width:x,responsive:y,dispatchTouchEvents:b=!0}=e,w=(0,eh.useRef)(null),N=Sf(),[j,k]=(0,eh.useState)(null),[S,C]=(0,eh.useState)(null),_=function(){var e=Sf(),[t,n]=(0,eh.useState)(null),r=Sv(SW);return(0,eh.useEffect)(()=>{if(null!=t){var n=t.getBoundingClientRect().width/t.offsetWidth;S_(n)&&n!==r&&e(Sl(n))}},[t,e,r]),n}(),E=Co(),T=(null==E?void 0:E.width)>0?E.width:x,M=(null==E?void 0:E.height)>0?E.height:i,O=(0,eh.useCallback)(e=>{_(e),"function"==typeof t&&t(e),k(e),C(e),null!=e&&(w.current=e)},[_,t,k,C]),A=(0,eh.useCallback)(e=>{N(D5(e)),N(P1({handler:a,reactEvent:e}))},[N,a]),D=(0,eh.useCallback)(e=>{N(D4(e)),N(P1({handler:c,reactEvent:e}))},[N,c]),P=(0,eh.useCallback)(e=>{N(k2()),N(P1({handler:u,reactEvent:e}))},[N,u]),I=(0,eh.useCallback)(e=>{N(D4(e)),N(P1({handler:d,reactEvent:e}))},[N,d]),L=(0,eh.useCallback)(()=>{N(PJ())},[N]),R=(0,eh.useCallback)(e=>{N(PQ(e.key))},[N]),B=(0,eh.useCallback)(e=>{N(P1({handler:o,reactEvent:e}))},[N,o]),F=(0,eh.useCallback)(e=>{N(P1({handler:s,reactEvent:e}))},[N,s]),z=(0,eh.useCallback)(e=>{N(P1({handler:l,reactEvent:e}))},[N,l]),V=(0,eh.useCallback)(e=>{N(P1({handler:h,reactEvent:e}))},[N,h]),H=(0,eh.useCallback)(e=>{N(P1({handler:g,reactEvent:e}))},[N,g]),U=(0,eh.useCallback)(e=>{b&&N(P6(e)),N(P1({handler:p,reactEvent:e}))},[N,b,p]),W=(0,eh.useCallback)(e=>{N(P1({handler:f,reactEvent:e}))},[N,f]);return eh.createElement(IK.Provider,{value:j},eh.createElement(IZ.Provider,{value:S},eh.createElement(!0===y?I2:I4,{width:null!=T?T:null==v?void 0:v.width,height:null!=M?M:null==v?void 0:v.height,className:(0,S5.clsx)("recharts-wrapper",r),style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?IQ(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IQ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({position:"relative",cursor:"default",width:T,height:M},v),onClick:A,onContextMenu:B,onDoubleClick:F,onFocus:L,onKeyDown:R,onMouseDown:z,onMouseEnter:D,onMouseLeave:P,onMouseMove:I,onMouseUp:V,onTouchEnd:W,onTouchMove:U,onTouchStart:H,ref:O},eh.createElement(I0,null),n)))}),I7=NX([SK],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),I9=NX([I7,SH,SU],(e,t,n)=>{if(e&&null!=t&&null!=n)return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),I8=(0,eh.createContext)(void 0),Le=e=>{var{children:t}=e,[n]=(0,eh.useState)("".concat(jq("recharts"),"-clip")),r=Sv(I9);if(null==r)return null;var{x:i,y:a,width:o,height:s}=r;return eh.createElement(I8.Provider,{value:n},eh.createElement("defs",null,eh.createElement("clipPath",{id:n},eh.createElement("rect",{x:i,y:a,height:s,width:o}))),t)},Lt=["width","height","responsive","children","className","style","compact","title","desc"],Ln=(0,eh.forwardRef)((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:l,title:c,desc:u}=e,d=I_(function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Lt));return l?eh.createElement(eh.Fragment,null,eh.createElement(Cp,{width:n,height:r}),eh.createElement(IH,{otherAttributes:d,title:c,desc:u},a)):eh.createElement(I6,{className:o,style:s,width:n,height:r,responsive:null!=i&&i,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},eh.createElement(IH,{otherAttributes:d,title:c,desc:u,ref:t},eh.createElement(Le,null,a)))});function Lr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Li(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lr(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);return Object.keys(t).reduce((e,n)=>(void 0===e[n]&&void 0!==t[n]&&(e[n]=t[n]),e),n)}function La(){return(La=Object.assign.bind()).apply(null,arguments)}var Lo={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Ls=(0,eh.forwardRef)(function(e,t){var n,r=Li(e.categoricalChartProps,Lo),{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,categoricalChartProps:l}=e;return eh.createElement(Im,{preloadedState:{options:{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,eventEmitter:void 0}},reduxStoreName:null!=(n=l.id)?n:i},eh.createElement(Ig,{chartData:l.data}),eh.createElement(Iy,{layout:r.layout,margin:r.margin}),eh.createElement(Ib,{baseValue:r.baseValue,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),eh.createElement(Ln,La({},r,{ref:t})))}),Ll=["axis"],Lc=(0,eh.forwardRef)((e,t)=>eh.createElement(Ls,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Ll,tooltipPayloadSearcher:j5,categoricalChartProps:e,ref:t})),Lu=eh;function Ld(e){this._context=e}function Lh(e){return new Ld(e)}Ld.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};let Lf=Math.PI,Lp=2*Lf,Lm=Lp-1e-6;function Lg(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class Lv{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?Lg:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return Lg;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e*=1,t*=1,n*=1,r*=1,(i*=1)<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,l=r-t,c=a-e,u=o-t,d=c*c+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>1e-6)if(Math.abs(u*s-l*c)>1e-6&&i){let h=n-a,f=r-o,p=s*s+l*l,g=Math.sqrt(p),v=Math.sqrt(d),x=i*Math.tan((Lf-Math.acos((p+d-(h*h+f*f))/(2*g*v)))/2),y=x/v,b=x/g;Math.abs(y-1)>1e-6&&this._append`L${e+y*c},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*h>c*f)},${this._x1=e+b*s},${this._y1=t+b*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,r,i,a){if(e*=1,t*=1,n*=1,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=e+o,c=t+s,u=1^a,d=a?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-c)>1e-6)&&this._append`L${l},${c}`,n&&(d<0&&(d=d%Lp+Lp),d>Lm?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:d>1e-6&&this._append`A${n},${n},0,${+(d>=Lf)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n*=1}v${+r}h${-n}Z`}toString(){return this._}}function Lx(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Lv(t)}function Ly(e){return e[0]}function Lb(e){return e[1]}function Lw(e,t){var n=Sw(!0),r=null,i=Lh,a=null,o=Lx(s);function s(s){var l,c,u,d=(s=Sb(s)).length,h=!1;for(null==r&&(a=i(u=o())),l=0;l<=d;++l)!(l<d&&n(c=s[l],l,s))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(c,l,s),+t(c,l,s));if(u)return a=null,u+""||null}return e="function"==typeof e?e:void 0===e?Ly:Sw(e),t="function"==typeof t?t:void 0===t?Lb:Sw(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:Sw(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:Sw(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:Sw(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,null!=r&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(null==e?r=a=null:a=i(r=e),s):r},s}function LN(e,t,n){var r=null,i=Sw(!0),a=null,o=Lh,s=null,l=Lx(c);function c(c){var u,d,h,f,p,g=(c=Sb(c)).length,v=!1,x=Array(g),y=Array(g);for(null==a&&(s=o(p=l())),u=0;u<=g;++u){if(!(u<g&&i(f=c[u],u,c))===v)if(v=!v)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),h=u-1;h>=d;--h)s.point(x[h],y[h]);s.lineEnd(),s.areaEnd()}v&&(x[u]=+e(f,u,c),y[u]=+t(f,u,c),s.point(r?+r(f,u,c):x[u],n?+n(f,u,c):y[u]))}if(p)return s=null,p+""||null}function u(){return Lw().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?Ly:Sw(+e),t="function"==typeof t?t:void 0===t?Sw(0):Sw(+t),n="function"==typeof n?n:void 0===n?Lb:Sw(+n),c.x=function(t){return arguments.length?(e="function"==typeof t?t:Sw(+t),r=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:Sw(+t),c):e},c.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:Sw(+e),c):r},c.y=function(e){return arguments.length?(t="function"==typeof e?e:Sw(+e),n=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:Sw(+e),c):t},c.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:Sw(+e),c):n},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(n)},c.lineX1=function(){return u().x(r).y(t)},c.defined=function(e){return arguments.length?(i="function"==typeof e?e:Sw(!!e),c):i},c.curve=function(e){return arguments.length?(o=e,null!=a&&(s=o(a)),c):o},c.context=function(e){return arguments.length?(null==e?a=s=null:s=o(a=e),c):a},c}function Lj(){}function Lk(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function LS(e){this._context=e}function LC(e){this._context=e}function L_(e){this._context=e}Lv.prototype,LS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Lk(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Lk(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},LC.prototype={areaStart:Lj,areaEnd:Lj,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Lk(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},L_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Lk(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};class LE{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}function LT(e){this._context=e}LT.prototype={areaStart:Lj,areaEnd:Lj,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e*=1,t*=1,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function LM(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0);return((a<0?-1:1)+(o<0?-1:1))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs((a*i+o*r)/(r+i)))||0}function LO(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function LA(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function LD(e){this._context=e}function LP(e){this._context=new LI(e)}function LI(e){this._context=e}function LL(e){this._context=e}function LR(e){var t,n,r=e.length-1,i=Array(r),a=Array(r),o=Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/a[t-1],a[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/a[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(t=0,a[r-1]=(e[r]+i[r-1])/2;t<r-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function LB(e,t){this._context=e,this._t=t}LD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:LA(this,this._t0,LO(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t*=1,(e*=1)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,LA(this,LO(this,n=LM(this,e,t)),n);break;default:LA(this,this._t0,n=LM(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(LP.prototype=Object.create(LD.prototype)).point=function(e,t){LD.prototype.point.call(this,t,e)},LI.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}},LL.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var r=LR(e),i=LR(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},LB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var LF=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Lz=(e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var n=e;if((0,eh.isValidElement)(e)&&(n=e.props),"object"!=typeof n&&"function"!=typeof n)return null;var r={};return Object.keys(n).forEach(e=>{Ij(e)&&(r[e]=t||(t=>n[e](n,t)))}),r};function LV(){return(LV=Object.assign.bind()).apply(null,arguments)}function LH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function LU(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?LH(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var LW={curveBasisClosed:function(e){return new LC(e)},curveBasisOpen:function(e){return new L_(e)},curveBasis:function(e){return new LS(e)},curveBumpX:function(e){return new LE(e,!0)},curveBumpY:function(e){return new LE(e,!1)},curveLinearClosed:function(e){return new LT(e)},curveLinear:Lh,curveMonotoneX:function(e){return new LD(e)},curveMonotoneY:function(e){return new LP(e)},curveNatural:function(e){return new LL(e)},curveStep:function(e){return new LB(e,.5)},curveStepAfter:function(e){return new LB(e,1)},curveStepBefore:function(e){return new LB(e,0)}},LY=e=>S_(e.x)&&S_(e.y),LG=e=>null!=e.base&&LY(e.base)&&LY(e),LX=e=>e.x,L$=e=>e.y,Lq=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=Sv(Cf);if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?(e=>{var{type:t="linear",points:n=[],baseLine:r,layout:i,connectNulls:a=!1}=e,o=((e,t)=>{if("function"==typeof e)return e;var n="curve".concat(j0(e));return("curveMonotone"===n||"curveBump"===n)&&t?LW["".concat(n).concat("vertical"===t?"Y":"X")]:LW[n]||Lh})(t,i),s=a?n.filter(LY):n;if(Array.isArray(r)){var l=n.map((e,t)=>LU(LU({},e),{},{base:r[t]}));return("vertical"===i?LN().y(L$).x1(LX).x0(e=>e.base.x):LN().x(LX).y1(L$).y0(e=>e.base.y)).defined(LG).curve(o)(a?l.filter(LG):l)}return("vertical"===i&&jG(r)?LN().y(L$).x1(LX).x0(r):jG(r)?LN().x(LX).y1(L$).y0(r):Lw().x(LX).y(L$)).defined(LY).curve(o)(s)})(o):r;return eh.createElement("path",LV({},I_(e),Lz(e),{className:(0,S5.clsx)("recharts-curve",t),d:null===s?void 0:s,ref:i}))},LK=["children","className"];function LZ(){return(LZ=Object.assign.bind()).apply(null,arguments)}var LQ=eh.forwardRef((e,t)=>{var{children:n,className:r}=e,i=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,LK),a=(0,S5.clsx)("recharts-layer",r);return eh.createElement("g",LZ({className:a},IT(i),{ref:t}),n)}),LJ=e.i(4178);function L0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var L1=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L0(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},{cacheSize:2e3,enableCache:!0}),L2=new class{constructor(e){!function(e,t,n){var r;(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"cache",new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return void 0!==t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;null!=n&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}}(L1.cacheSize),L5={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},L3="recharts_measurement_span",L4=(e,t)=>{try{var n=document.getElementById(L3);n||((n=document.createElement("span")).setAttribute("id",L3),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,L5,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch(e){return{width:0,height:0}}},L6=function(e){var t,n,r,i,a,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||Ir.isSsr)return{width:0,height:0};if(!L1.enableCache)return L4(e,s);var l=(t=s.fontSize||"",n=s.fontFamily||"",r=s.fontWeight||"",i=s.fontStyle||"",a=s.letterSpacing||"",o=s.textTransform||"","".concat(e,"|").concat(t,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(a,"|").concat(o)),c=L2.get(l);if(c)return c;var u=L4(e,s);return L2.set(l,u),u},L7=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,L9=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,L8=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Re=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Rt={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},Rn=["cm","mm","pt","pc","in","Q","px"];class Rr{static parse(e){var t,[,n,r]=null!=(t=Re.exec(e))?t:[];return null==n?Rr.NaN:new Rr(parseFloat(n),null!=r?r:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,jW(e)&&(this.unit=""),""===t||L8.test(t)||(this.num=NaN,this.unit=""),function(e){return Rn.includes(e)}(t)&&(this.num=function(e,t){return e*Rt[t]}(e,t),this.unit="px")}add(e){return this.unit!==e.unit?new Rr(NaN,""):new Rr(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Rr(NaN,""):new Rr(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Rr(NaN,""):new Rr(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Rr(NaN,""):new Rr(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return jW(this.num)}}function Ri(e){if(null==e||e.includes("NaN"))return"NaN";for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=null!=(n=L7.exec(t))?n:[],o=Rr.parse(null!=r?r:""),s=Rr.parse(null!=a?a:""),l="*"===i?o.multiply(s):o.divide(s);if(l.isNaN())return"NaN";t=t.replace(L7,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var c,[,u,d,h]=null!=(c=L9.exec(t))?c:[],f=Rr.parse(null!=u?u:""),p=Rr.parse(null!=h?h:""),g="+"===d?f.add(p):f.subtract(p);if(g.isNaN())return"NaN";t=t.replace(L9,g.toString())}return t}s="NaN",l=new Rr(NaN,""),(s="symbol"==typeof(i=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(s,"string"))?i:i+"")in Rr?Object.defineProperty(Rr,s,{value:l,enumerable:!0,configurable:!0,writable:!0}):Rr[s]=l;var Ra=/\(([^()]*)\)/;function Ro(e){var t=function(e){try{var t;return t=e.replace(/\s+/g,""),t=function(e){for(var t,n=e;null!=(t=Ra.exec(n));){var[,r]=t;n=n.replace(Ra,Ri(r))}return n}(t),t=Ri(t)}catch(e){return"NaN"}}(e.slice(5,-1));return"NaN"===t?"":t}var Rs=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],Rl=["dx","dy","angle","className","breakAll"];function Rc(){return(Rc=Object.assign.bind()).apply(null,arguments)}function Ru(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Rd=/[ \f\n\r\t\v\u2028\u2029]+/,Rh=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];null!=t&&(i=n?t.toString().split(""):t.toString().split(Rd));var a=i.map(e=>({word:e,width:L6(e,r).width})),o=n?0:L6(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch(e){return null}},Rf=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];return s&&null!=o&&(null==t||r||s.width+o+n<Number(t))?(s.words.push(a),s.width+=o+n):e.push({words:[a],width:o}),e},[]),Rp=e=>e.reduce((e,t)=>e.width>t.width?e:t),Rm=(e,t,n,r,i,a,o,s)=>{var l=Rh({breakAll:n,style:r,children:e.slice(0,t)+"…"});if(!l)return[!1,[]];var c=Rf(l.wordsWithComputedWidth,a,o,s);return[c.length>i||Rp(c).width>Number(a),c]},Rg=e=>[{words:null==e?[]:e.toString().split(Rd),width:void 0}],Rv="#808080",Rx={angle:0,breakAll:!1,capHeight:"0.71em",fill:Rv,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Ry=(0,eh.forwardRef)((e,t)=>{var n,r=Li(e,Rx),{x:i,y:a,lineHeight:o,capHeight:s,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=r,h=Ru(r,Rs),f=(0,eh.useMemo)(()=>(e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Ir.isSsr){var s=Rh({breakAll:a,children:r,style:i});if(!s)return Rg(r);var{wordsWithComputedWidth:l,spaceWidth:c}=s;return((e,t,n,r,i)=>{var a,{maxLines:o,children:s,style:l,breakAll:c}=e,u=jG(o),d=String(s),h=Rf(t,r,n,i);if(!u||i||!(h.length>o||Rp(h).width>Number(r)))return h;for(var f=0,p=d.length-1,g=0;f<=p&&g<=d.length-1;){var v=Math.floor((f+p)/2),[x,y]=Rm(d,v-1,c,l,o,r,n,i),[b]=Rm(d,v,c,l,o,r,n,i);if(x||b||(f=v+1),x&&b&&(p=v-1),!x&&b){a=y;break}g++}return a||h})({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return Rg(r)})({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:c,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,c,h.style,h.width]),{dx:p,dy:g,angle:v,className:x,breakAll:y}=h,b=Ru(h,Rl);if(!jX(i)||!jX(a)||0===f.length)return null;var w=Number(i)+(jG(p)?p:0),N=Number(a)+(jG(g)?g:0);if(!S_(w)||!S_(N))return null;switch(d){case"start":n=Ro("calc(".concat(s,")"));break;case"middle":n=Ro("calc(".concat((f.length-1)/2," * -").concat(o," + (").concat(s," / 2))"));break;default:n=Ro("calc(".concat(f.length-1," * -").concat(o,")"))}var j=[];if(c){var k=f[0].width,{width:S}=h;j.push("scale(".concat(jG(S)&&jG(k)?S/k:1,")"))}return v&&j.push("rotate(".concat(v,", ").concat(w,", ").concat(N,")")),j.length&&(b.transform=j.join(" ")),eh.createElement("text",Rc({},IT(b),{ref:t,x:w,y:N,className:(0,S5.clsx)("recharts-text",x),textAnchor:u,fill:l.includes("url")?Rv:l}),f.map((e,t)=>{var r=e.words.join(y?"":" ");return eh.createElement("tspan",{x:w,dy:0===t?n:o,key:"".concat(r,"-").concat(t)},r)}))});function Rb(e){var{zIndex:t,children:n}=e,r=void 0!==Sv(Cf)&&void 0!==t&&0!==t,i=S0(),a=Sf();(0,eh.useLayoutEffect)(()=>r?(a(Ic({zIndex:t})),()=>{a(Iu({zIndex:t}))}):j2,[a,t,r]);var o=Sv(e=>ID(e,t,i));return r?o?(0,eQ.createPortal)(n,o):null:n}Ry.displayName="Text";var Rw=["labelRef"],RN=["content"];function Rj(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Rk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function RS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rk(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rk(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function RC(){return(RC=Object.assign.bind()).apply(null,arguments)}var R_=(0,eh.createContext)(null),RE=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,l=(0,eh.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return eh.createElement(R_.Provider,{value:l},s)},RT=()=>{var e=(0,eh.useContext)(R_),t=Cu();return e||Cc(t)},RM=(0,eh.createContext)(null),RO=e=>null!=e&&"function"==typeof e,RA=e=>"cx"in e&&jG(e.cx),RD={angle:0,offset:5,zIndex:MB.label,position:"middle",textBreakAll:!1};function RP(e){var t,n,r,i,a,o,s=Li(e,RD),{viewBox:l,position:c,value:u,children:d,content:h,className:f="",textBreakAll:p,labelRef:g}=s,v=(t=(0,eh.useContext)(RM),n=Sv(M0),t||n),x=RT();if(!(i=null==l?"center"===c?x:null!=v?v:x:RA(l)?l:Cc(l))||null==u&&null==d&&!(0,eh.isValidElement)(h)&&"function"!=typeof h)return null;var y=RS(RS({},s),{},{viewBox:i});if((0,eh.isValidElement)(h)){var{labelRef:b}=y,w=Rj(y,Rw);return(0,eh.cloneElement)(h,w)}if("function"==typeof h){var{content:N}=y,j=Rj(y,RN);if(a=(0,eh.createElement)(h,j),(0,eh.isValidElement)(a))return a}else a=(e=>{var{value:t,formatter:n}=e,r=null==e.children?t:e.children;return"function"==typeof n?n(r):r})(s);var k=IT(s);if(RA(i)){if("insideStart"===c||"insideEnd"===c||"end"===c)return((e,t,n,r,i)=>{var a,o,{offset:s,className:l}=e,{cx:c,cy:u,innerRadius:d,outerRadius:h,startAngle:f,endAngle:p,clockWise:g}=i,v=(d+h)/2,x=jU(p-f)*Math.min(Math.abs(p-f),360),y=x>=0?1:-1;switch(t){case"insideStart":a=f+y*s,o=g;break;case"insideEnd":a=p-y*s,o=!g;break;case"end":a=p+y*s,o=g;break;default:throw Error("Unsupported position ".concat(t))}o=x<=0?o:!o;var b=MR(c,u,v,a),w=MR(c,u,v,a+(o?1:-1)*359),N="M".concat(b.x,",").concat(b.y,"\n A").concat(v,",").concat(v,",0,1,").concat(+!o,",\n ").concat(w.x,",").concat(w.y),j=null==e.id?jq("recharts-radial-line-"):e.id;return eh.createElement("text",RC({},r,{dominantBaseline:"central",className:(0,S5.clsx)("recharts-radial-bar-label",l)}),eh.createElement("defs",null,eh.createElement("path",{id:j,d:N})),eh.createElement("textPath",{xlinkHref:"#".concat(j)},n))})(s,c,a,k,i);o=((e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:l}=e,c=(s+l)/2;if("outside"===n){var{x:u,y:d}=MR(r,i,o+t,c);return{x:u,y:d,textAnchor:u>=r?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var{x:h,y:f}=MR(r,i,(a+o)/2,c);return{x:h,y:f,textAnchor:"middle",verticalAnchor:"middle"}})(i,s.offset,s.position)}else o=((e,t)=>{var n,{parentViewBox:r,offset:i,position:a}=e;null==r||RA(r)||(n=r);var{x:o,y:s,upperWidth:l,lowerWidth:c,height:u}=t,d=o+(l-c)/2,h=(o+d)/2,f=(l+c)/2,p=u>=0?1:-1,g=p*i,v=p>0?"end":"start",x=p>0?"start":"end",y=l>=0?1:-1,b=y*i,w=y>0?"end":"start",N=y>0?"start":"end";if("top"===a)return RS(RS({},{x:o+l/2,y:s-g,textAnchor:"middle",verticalAnchor:v}),n?{height:Math.max(s-n.y,0),width:l}:{});if("bottom"===a)return RS(RS({},{x:d+c/2,y:s+u+g,textAnchor:"middle",verticalAnchor:x}),n?{height:Math.max(n.y+n.height-(s+u),0),width:c}:{});if("left"===a){var j={x:h-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"};return RS(RS({},j),n?{width:Math.max(j.x-n.x,0),height:u}:{})}if("right"===a){var k={x:h+f+b,y:s+u/2,textAnchor:N,verticalAnchor:"middle"};return RS(RS({},k),n?{width:Math.max(n.x+n.width-k.x,0),height:u}:{})}var S=n?{width:f,height:u}:{};return"insideLeft"===a?RS({x:h+b,y:s+u/2,textAnchor:N,verticalAnchor:"middle"},S):"insideRight"===a?RS({x:h+f-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"},S):"insideTop"===a?RS({x:o+l/2,y:s+g,textAnchor:"middle",verticalAnchor:x},S):"insideBottom"===a?RS({x:d+c/2,y:s+u-g,textAnchor:"middle",verticalAnchor:v},S):"insideTopLeft"===a?RS({x:o+b,y:s+g,textAnchor:N,verticalAnchor:x},S):"insideTopRight"===a?RS({x:o+l-b,y:s+g,textAnchor:w,verticalAnchor:x},S):"insideBottomLeft"===a?RS({x:d+b,y:s+u-g,textAnchor:N,verticalAnchor:v},S):"insideBottomRight"===a?RS({x:d+c-b,y:s+u-g,textAnchor:w,verticalAnchor:v},S):a&&"object"==typeof a&&(jG(a.x)||jY(a.x))&&(jG(a.y)||jY(a.y))?RS({x:o+jK(a.x,f),y:s+jK(a.y,u),textAnchor:"end",verticalAnchor:"end"},S):RS({x:o+l/2,y:s+u/2,textAnchor:"middle",verticalAnchor:"middle"},S)})(s,i);return eh.createElement(Rb,{zIndex:s.zIndex},eh.createElement(Ry,RC({ref:g,className:(0,S5.clsx)("recharts-label",f)},k,o,{textAnchor:"start"===(r=k.textAnchor)||"middle"===r||"end"===r||"inherit"===r?k.textAnchor:o.textAnchor,breakAll:p}),a))}function RI(e){var{label:t,labelRef:n}=e;return((e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return!0===e?eh.createElement(RP,RC({key:"label-implicit"},r)):jX(e)?eh.createElement(RP,RC({key:"label-implicit",value:e},r)):(0,eh.isValidElement)(e)?e.type===RP?(0,eh.cloneElement)(e,RS({key:"label-implicit"},r)):eh.createElement(RP,RC({key:"label-implicit",content:e},r)):RO(e)?eh.createElement(RP,RC({key:"label-implicit",content:e},r)):e&&"object"==typeof e?eh.createElement(RP,RC({},e,{key:"label-implicit"},r)):null})(t,RT(),n)||null}RP.displayName="Label";var RL=["valueAccessor"],RR=["dataKey","clockWise","id","textBreakAll","zIndex"];function RB(){return(RB=Object.assign.bind()).apply(null,arguments)}function RF(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Rz=e=>Array.isArray(e.value)?(0,LJ.default)(e.value):e.value,RV=(0,eh.createContext)(void 0),RH=RV.Provider,RU=(0,eh.createContext)(void 0);function RW(e){var{valueAccessor:t=Rz}=e,n=RF(e,RL),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,l=RF(n,RR),c=(0,eh.useContext)(RV),u=(0,eh.useContext)(RU),d=c||u;return d&&d.length?eh.createElement(Rb,{zIndex:null!=s?s:MB.label},eh.createElement(LQ,{className:"recharts-label-list"},d.map((e,i)=>{var s,c=null==r?t(e,i):SO(e&&e.payload,r),u=null==a?{}:{id:"".concat(a,"-").concat(i)};return eh.createElement(RP,RB({key:"label-".concat(i)},IT(e),l,u,{fill:null!=(s=n.fill)?s:e.fill,parentViewBox:e.parentViewBox,value:c,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))}))):null}function RY(e){var{label:t}=e;return t?!0===t?eh.createElement(RW,{key:"labelList-implicit"}):eh.isValidElement(t)||RO(t)?eh.createElement(RW,{key:"labelList-implicit",content:t}):"object"==typeof t?eh.createElement(RW,RB({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function RG(){return(RG=Object.assign.bind()).apply(null,arguments)}RU.Provider,RW.displayName="LabelList";var RX=e=>{var{cx:t,cy:n,r,className:i}=e,a=(0,S5.clsx)("recharts-dot",i);return jG(t)&&jG(n)&&jG(r)?eh.createElement("circle",RG({},I_(e),Lz(e),{className:a,cx:t,cy:n,r:r})):null},R$=(e.i(79684),e=>!e||"object"!=typeof e||!("clipDot"in e)||!!e.clipDot),Rq=["points"];function RK(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function RZ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?RK(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RK(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function RQ(){return(RQ=Object.assign.bind()).apply(null,arguments)}function RJ(e){var{option:t,dotProps:n,className:r}=e;if((0,eh.isValidElement)(t))return(0,eh.cloneElement)(t,n);if("function"==typeof t)return t(n);var i=(0,S5.clsx)(r,"boolean"!=typeof t?t.className:""),a=null!=n?n:{},{points:o}=a,s=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(a,Rq);return eh.createElement(RX,RQ({},s,{className:i}))}function R0(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:o,needClip:s,clipPathId:l,zIndex:c=MB.scatter}=e;if(null==t||!n&&1!==t.length)return null;var u=R$(n),d=null==n?null:(0,eh.isValidElement)(n)?IT(n.props):"object"!=typeof n||Array.isArray(n)?null:IT(n),h=t.map((e,r)=>{var s,l,c=RZ(RZ(RZ({r:3},o),d),{},{index:r,cx:null!=(s=e.x)?s:void 0,cy:null!=(l=e.y)?l:void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return eh.createElement(RJ,{key:"dot-".concat(r),option:n,dotProps:c,className:i})}),f={};return s&&null!=l&&(f.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),eh.createElement(Rb,{zIndex:c},eh.createElement(LQ,RQ({className:r},f),h))}function R1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R1(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var R5=e=>{var t,{point:n,childIndex:r,mainColor:i,activeDot:a,dataKey:o,clipPath:s}=e;if(!1===a||null==n.x||null==n.y)return null;var l=R2(R2(R2({},{index:r,dataKey:o,cx:n.x,cy:n.y,r:4,fill:null!=i?i:"none",strokeWidth:2,stroke:"#fff",payload:n.payload,value:n.value}),IE(a)),Lz(a));return t=(0,eh.isValidElement)(a)?(0,eh.cloneElement)(a,l):"function"==typeof a?a(l):eh.createElement(RX,l),eh.createElement(LQ,{className:"recharts-active-dot",clipPath:s},t)};function R3(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=MB.activeDot}=e,s=Sv(DO),l=Sv(DF);if(null==t||null==l)return null;var c=t.find(e=>l.includes(e.payload));return null==c?null:eh.createElement(Rb,{zIndex:o},eh.createElement(R5,{point:c,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}function R4(e){var{tooltipEntrySettings:t}=e,n=Sf(),r=S0(),i=(0,eh.useRef)(null);return(0,eh.useLayoutEffect)(()=>{r||(null===i.current?n(kK(t)):i.current!==t&&n(kZ({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,eh.useLayoutEffect)(()=>()=>{i.current&&(n(kQ(i.current)),i.current=null)},[n]),null}function R6(e,t){var n,r,i=Sv(t=>Oa(t,e)),a=Sv(e=>Ol(e,t)),o=null!=(n=null==i?void 0:i.allowDataOverflow)?n:Or.allowDataOverflow,s=null!=(r=null==a?void 0:a.allowDataOverflow)?r:Oo.allowDataOverflow;return{needClip:o||s,needClipX:o,needClipY:s}}function R7(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=Sv(I9),{needClipX:a,needClipY:o,needClip:s}=R6(t,n);if(!s||!i)return null;var{x:l,y:c,width:u,height:d}=i;return eh.createElement("clipPath",{id:"clipPath-".concat(r)},eh.createElement("rect",{x:a?l:l-u/2,y:o?c:c-d/2,width:a?u:2*u,height:o?d:2*d}))}function R9(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.xAxisId)?n:0}function R8(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.yAxisId)?n:0}var Be=(e,t,n)=>AB(e,"xAxis",R9(e,t),n),Bt=(e,t,n)=>AR(e,"xAxis",R9(e,t),n),Bn=(e,t,n)=>AB(e,"yAxis",R8(e,t),n),Br=(e,t,n)=>AR(e,"yAxis",R8(e,t),n),Bi=NX([Cf,Be,Bn,Bt,Br],(e,t,n,r,i)=>SA(e,"xAxis")?SF(t,r,!1):SF(n,i,!1)),Ba=NX([Om,(e,t)=>t],(e,t)=>e.filter(e=>"area"===e.type).find(e=>e.id===t)),Bo=e=>SA(Cf(e),"xAxis")?"yAxis":"xAxis",Bs=NX([Ba,(e,t,n)=>OL(e,Bo(e),"yAxis"===Bo(e)?R8(e,t):R9(e,t),n)],(e,t)=>{if(null!=e&&null!=t){var n,{stackId:r}=e,i=M5(e);if(null!=r&&null!=i){var a=null==(n=t[r])?void 0:n.stackedData,o=null==a?void 0:a.find(e=>e.key===i);if(null!=o)return o.map(e=>[e[0],e[1]])}}}),Bl=NX([Cf,Be,Bn,Bt,Br,Bs,(e,t,n)=>n?Ml(e):Ms(e),Bi,Ba,e=>e.rootProps.baseValue],(e,t,n,r,i,a,o,s,l,c)=>{var u,{chartData:d,dataStartIndex:h,dataEndIndex:f}=o;if(null!=l&&("horizontal"===e||"vertical"===e)&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=s){var{data:p}=l;if(null!=(u=p&&p.length>0?p:null==d?void 0:d.slice(h,f+1)))return function(e){var t,{areaSettings:{connectNulls:n,baseValue:r,dataKey:i},stackedData:a,layout:o,chartBaseValue:s,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:h,yAxisTicks:f,bandSize:p}=e,g=a&&a.length,v=((e,t,n,r,i)=>{var a=null!=n?n:t;if(jG(a))return a;var o="horizontal"===e?i:r,s=o.scale.domain();if("number"===o.type){var l=Math.max(s[0],s[1]),c=Math.min(s[0],s[1]);return"dataMin"===a?c:"dataMax"===a||l<0?l:Math.max(Math.min(s[0],s[1]),0)}return"dataMin"===a?s[0]:"dataMax"===a?s[1]:s[0]})(o,s,r,l,c),x="horizontal"===o,y=!1,b=u.map((e,t)=>{if(g)s=a[d+t];else{var r,o,s,u=SO(e,i);Array.isArray(u)?(s=u,y=!0):s=[v,u]}var b=null!=(r=null==(o=s)?void 0:o[1])?r:null,w=null==b||g&&!n&&null==SO(e,i);return x?{x:SL({axis:l,ticks:h,bandSize:p,entry:e,index:t}),y:w?null:c.scale(b),value:s,payload:e}:{x:w?null:l.scale(b),y:SL({axis:c,ticks:f,bandSize:p,entry:e,index:t}),value:s,payload:e}});return t=g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return x?{x:e.x,y:null!=t&&null!=e.y?c.scale(t):null,payload:e.payload}:{x:null!=t?l.scale(t):null,y:e.y,payload:e.payload}}):x?c.scale(v):l.scale(v),{points:b,baseLine:t,isRange:y}}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:h,areaSettings:l,stackedData:a,displayedData:u,chartBaseValue:c,bandSize:s})}});function Bc(e){var{legendPayload:t}=e,n=Sf(),r=S0(),i=(0,eh.useRef)(null);return(0,eh.useLayoutEffect)(()=>{r||(null===i.current?n(PI(t)):i.current!==t&&n(PL({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,eh.useLayoutEffect)(()=>()=>{i.current&&(n(PR(i.current)),i.current=null)},[n]),null}function Bu(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",n=(0,eh.useRef)(jq(t)),r=(0,eh.useRef)(e);return r.current!==e&&(n.current=jq(t),r.current=e),n.current}var Bd=null!=(H=eh["useId".toString()])?H:()=>{var[e]=eh.useState(()=>jq("uid-"));return e},Bh=(0,eh.createContext)(void 0),Bf=e=>{var t,n,{id:r,type:i,children:a}=e,o=(t="recharts-".concat(i),n=Bd(),r||(t?"".concat(t,"-").concat(n):n));return eh.createElement(Bh.Provider,{value:o},a(o))},Bp=(0,eh.memo)(e=>{var t=Sf(),n=(0,eh.useRef)(null);return(0,eh.useLayoutEffect)(()=>{null===n.current?t(Pp(e)):n.current!==e&&t(Pm({prev:n.current,next:e})),n.current=e},[t,e]),(0,eh.useLayoutEffect)(()=>()=>{n.current&&(t(Pg(n.current)),n.current=null)},[t]),null});function Bm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Bg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bm(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bm(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Bv=(e,t,n)=>e.map(e=>"".concat(e.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase()))," ").concat(t,"ms ").concat(n)).join(","),Bx=(e,t)=>Object.keys(t).reduce((n,r)=>Bg(Bg({},n),{},{[r]:e(r,t[r])}),{});function By(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Bb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?By(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):By(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Bw=(e,t,n)=>e+(t-e)*n,BN=e=>{var{from:t,to:n}=e;return t!==n},Bj=(e,t,n)=>{var r=Bx((t,n)=>{if(BN(n)){var[r,i]=e(n.from,n.to,n.velocity);return Bb(Bb({},n),{},{from:r,velocity:i})}return n},t);return n<1?Bx((e,t)=>BN(t)&&null!=r[e]?Bb(Bb({},t),{},{velocity:Bw(t.velocity,r[e].velocity,n),from:Bw(t.from,r[e].from,n)}):t,t):Bj(e,r,n-1)},Bk=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],BS=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),BC=(e,t)=>n=>BS(Bk(e,t),n),B_=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(1===t.length)switch(t[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:var r=(e=>{var t,n=e.split("(");if(2!==n.length||"cubic-bezier"!==n[0])return null;var r=null==(t=n[1])||null==(t=t.split(")")[0])?void 0:t.split(",");if(null==r||4!==r.length)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]})(t[0]);if(r)return r}return 4===t.length?t:[0,0,1,1]},BE=function(){return((e,t,n,r)=>{var i=BC(e,n),a=BC(t,r),o=t=>BS([...Bk(e,n).map((e,t)=>e*t).slice(1),0],t),s=e=>e>1?1:e<0?0:e,l=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var l=i(n)-t,c=o(n);if(1e-4>Math.abs(l-t)||c<1e-4)break;n=s(n-l/c)}return a(n)};return l.isStepper=!1,l})(...B_(...arguments))},BT=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{stiff:t=100,damping:n=8,dt:r=17}=e,i=(e,i,a)=>{var o=a+(-(e-i)*t-a*n)*r/1e3,s=a*r/1e3+e;return 1e-4>Math.abs(s-i)&&1e-4>Math.abs(o)?[i,0]:[s,o]};return i.isStepper=!0,i.dt=r,i};class BM{setTimeout(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):"function"==typeof requestAnimationFrame&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{null!=r&&cancelAnimationFrame(r)}}}var BO=(0,eh.createContext)(function(){var e,t,n,r,i;return e=new BM,t=()=>null,n=!1,r=null,i=a=>{if(!n){if(Array.isArray(a)){if(!a.length)return;var[o,...s]=a;if("number"==typeof o){r=e.setTimeout(i.bind(null,s),o);return}i(o),r=e.setTimeout(i.bind(null,s));return}"string"==typeof a&&t(a),"object"==typeof a&&t(a),"function"==typeof a&&a()}},{stop:()=>{n=!0},start:e=>{n=!1,r&&(r(),r=null),i(e)},subscribe:e=>(t=e,()=>{t=()=>null}),getTimeoutController:()=>e}}),BA={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},BD={t:0},BP={t:1};function BI(e){var t,n,r,i=Li(e,BA),{isActive:a,canBegin:o,duration:s,easing:l,begin:c,onAnimationEnd:u,onAnimationStart:d,children:h}=i,f="auto"===a?!Ir.isSsr:a,p=(t=i.animationId,n=i.animationManager,r=(0,eh.useContext)(BO),(0,eh.useMemo)(()=>null!=n?n:r(t),[t,n,r])),[g,v]=(0,eh.useState)(f?BD:BP),x=(0,eh.useRef)(null);return(0,eh.useEffect)(()=>{f||v(BP)},[f]),(0,eh.useEffect)(()=>{if(!f||!o)return j2;var e=((e,t,n,r,i,a)=>{var o,s,l,c,u,d,h,f,p=[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e)));return null==n?()=>(i(Bb(Bb({},e),t)),()=>{}):!0===n.isStepper?(s=p.reduce((n,r)=>Bb(Bb({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),l=null,c=r=>{o||(o=r);var u=(r-o)/n.dt;s=Bj(n,s,u),i(Bb(Bb(Bb({},e),t),Bx((e,t)=>t.from,s))),o=r,Object.values(s).filter(BN).length&&(l=a.setTimeout(c))},()=>(l=a.setTimeout(c),()=>{var e;null==(e=l)||e()})):(d=null,h=p.reduce((n,r)=>{var i=e[r],a=t[r];return null==i||null==a?n:Bb(Bb({},n),{},{[r]:[i,a]})},{}),f=o=>{u||(u=o);var s=(o-u)/r,l=Bx((e,t)=>Bw(...t,n(s)),h);if(i(Bb(Bb(Bb({},e),t),l)),s<1)d=a.setTimeout(f);else{var c=Bx((e,t)=>Bw(...t,n(1)),h);i(Bb(Bb(Bb({},e),t),c))}},()=>(d=a.setTimeout(f),()=>{var e;null==(e=d)||e()}))})(BD,BP,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return BE(e);case"spring":return BT();default:if("cubic-bezier"===e.split("(")[0])return BE(e)}return"function"==typeof e?e:null})(l),s,v,p.getTimeoutController());return p.start([d,c,()=>{x.current=e()},s,u]),()=>{p.stop(),x.current&&x.current(),u()}},[f,o,s,l,c,d,u,p]),h(g.t)}function BL(e){var t=IE(e);if(null!=t){var{r:n,strokeWidth:r}=t,i=Number(n),a=Number(r);return(Number.isNaN(i)||i<0)&&(i=3),(Number.isNaN(a)||a<0)&&(a=2),{r:i,strokeWidth:a}}return{r:3,strokeWidth:2}}var BR=["id"],BB=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function BF(){return(BF=Object.assign.bind()).apply(null,arguments)}function Bz(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function BV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?BV(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BV(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function BU(e,t){return e&&"none"!==e?e:t}var BW=Lu.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:SV(o,t),hide:s,type:c,color:BU(r,a),unit:l,graphicalItemId:u}};return Lu.createElement(R4,{tooltipEntrySettings:d})});function BY(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,s=I_(r);return Lu.createElement(R0,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function BG(e){var{showLabels:t,children:n,points:r}=e,i=r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return BH(BH({},r),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:r,fill:void 0})});return Lu.createElement(RH,{value:t?i:void 0},n)}function BX(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:s,stroke:l,connectNulls:c,isRange:u}=a,{id:d}=a,h=Bz(a,BR),f=I_(h),p=IT(h);return Lu.createElement(Lu.Fragment,null,(null==t?void 0:t.length)>1&&Lu.createElement(LQ,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},Lu.createElement(Lq,BF({},p,{id:d,points:t,connectNulls:c,type:s,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),"none"!==l&&Lu.createElement(Lq,BF({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:t})),"none"!==l&&u&&Lu.createElement(Lq,BF({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:n}))),Lu.createElement(BY,{points:t,props:h,clipPathId:i}))}function B$(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.y,l=null==(n=a[a.length-1])?void 0:n.y;if(!S_(s)||!S_(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.x||0));return(jG(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.x||0),u)),jG(u))?Lu.createElement("rect",{x:0,y:s<l?s:s-c,width:u+(o?parseInt("".concat(o),10):1),height:Math.floor(c)}):null}function Bq(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.x,l=null==(n=a[a.length-1])?void 0:n.x;if(!S_(s)||!S_(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.y||0));return(jG(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.y||0),u)),jG(u))?Lu.createElement("rect",{x:s<l?s:s-c,y:0,width:c,height:Math.floor(u+(o?parseInt("".concat(o),10):1))}):null}function BK(e){var{alpha:t,layout:n,points:r,baseLine:i,strokeWidth:a}=e;return"vertical"===n?Lu.createElement(B$,{alpha:t,points:r,baseLine:i,strokeWidth:a}):Lu.createElement(Bq,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function BZ(e){var{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a}=e,{points:o,baseLine:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,onAnimationStart:h,onAnimationEnd:f}=r,p=Bu((0,Lu.useMemo)(()=>({points:o,baseLine:s}),[o,s]),"recharts-area-"),g=(()=>{var e=Sv(Cf);if("horizontal"===e||"vertical"===e)return e})(),[v,x]=(0,Lu.useState)(!1),y=(0,Lu.useCallback)(()=>{"function"==typeof f&&f(),x(!1)},[f]),b=(0,Lu.useCallback)(()=>{"function"==typeof h&&h(),x(!0)},[h]);if(null==g)return null;var w=i.current,N=a.current;return Lu.createElement(BG,{showLabels:!v,points:o},r.children,Lu.createElement(BI,{animationId:p,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:y,onAnimationStart:b,key:p},e=>{if(w){var c,u=w.length/o.length,d=1===e?o:o.map((t,n)=>{var r=Math.floor(n*u);if(w[r]){var i=w[r];return BH(BH({},t),{},{x:jQ(i.x,t.x,e),y:jQ(i.y,t.y,e)})}return t});if(jG(s))c=jQ(N,s,e);else c=null==s||jW(s)?jQ(N,0,e):s.map((t,n)=>{var r=Math.floor(n*u);if(Array.isArray(N)&&N[r]){var i=N[r];return BH(BH({},t),{},{x:jQ(i.x,t.x,e),y:jQ(i.y,t.y,e)})}return t});return e>0&&(i.current=d,a.current=c),Lu.createElement(BX,{points:d,baseLine:c,needClip:t,clipPathId:n,props:r})}return e>0&&(i.current=o,a.current=s),Lu.createElement(LQ,null,l&&Lu.createElement("defs",null,Lu.createElement("clipPath",{id:"animationClipPath-".concat(n)},Lu.createElement(BK,{alpha:e,points:o,baseLine:s,layout:g,strokeWidth:r.strokeWidth}))),Lu.createElement(LQ,{clipPath:"url(#animationClipPath-".concat(n,")")},Lu.createElement(BX,{points:o,baseLine:s,needClip:t,clipPathId:n,props:r})))}),Lu.createElement(RY,{label:r.label}))}function BQ(e){var{needClip:t,clipPathId:n,props:r}=e,i=(0,Lu.useRef)(null),a=(0,Lu.useRef)();return Lu.createElement(BZ,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class BJ extends Lu.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:i,left:a,needClip:o,xAxisId:s,yAxisId:l,width:c,height:u,id:d,baseLine:h,zIndex:f}=this.props;if(e)return null;var p=(0,S5.clsx)("recharts-area",r),{r:g,strokeWidth:v}=BL(t),x=R$(t),y=2*g+v,b=o?"url(#clipPath-".concat(x?"":"dots-").concat(d,")"):void 0;return Lu.createElement(Rb,{zIndex:f},Lu.createElement(LQ,{className:p},o&&Lu.createElement("defs",null,Lu.createElement(R7,{clipPathId:d,xAxisId:s,yAxisId:l}),!x&&Lu.createElement("clipPath",{id:"clipPath-dots-".concat(d)},Lu.createElement("rect",{x:a-y/2,y:i-y/2,width:c+y,height:u+y}))),Lu.createElement(BQ,{needClip:o,clipPathId:d,props:this.props})),Lu.createElement(R3,{points:n,mainColor:BU(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}),this.props.isRange&&Array.isArray(h)&&Lu.createElement(R3,{points:h,mainColor:BU(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}))}}var B0={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:MB.area};function B1(e){var t,n=Li(e,B0),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,fill:c,fillOpacity:u,hide:d,isAnimationActive:h,legendType:f,stroke:p,xAxisId:g,yAxisId:v}=n,x=Bz(n,BB),y=Sv(Cf),b=Sv(MM),{needClip:w}=R6(g,v),N=S0(),{points:j,isRange:k,baseLine:S}=null!=(t=Sv(t=>Bl(t,e.id,N)))?t:{},C=Sv(I9);if("horizontal"!==y&&"vertical"!==y||null==C||"AreaChart"!==b&&"ComposedChart"!==b)return null;var{height:_,width:E,x:T,y:M}=C;return j&&j.length?Lu.createElement(BJ,BF({},x,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:S,connectNulls:s,dot:l,fill:c,fillOpacity:u,height:_,hide:d,layout:y,isAnimationActive:"auto"===h?!Ir.isSsr:h,isRange:k,legendType:f,needClip:w,points:j,stroke:p,width:E,left:T,top:M,xAxisId:g,yAxisId:v})):null}var B2=Lu.memo(function(e){var t=Li(e,B0),n=S0();return Lu.createElement(Bf,{id:t.id,type:"area"},e=>{var r;return Lu.createElement(Lu.Fragment,null,Lu.createElement(Bc,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:BU(r,i),value:SV(n,t),payload:e}]})(t)}),Lu.createElement(BW,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),Lu.createElement(Bp,{type:"area",id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:null==(r=t.stackId)?void 0:String(r),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),Lu.createElement(B1,BF({},t,{id:e})))})},Ix);B2.displayName="Area";class B5{static create(e){return new B5(e)}constructor(e){this.scale=e}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(e){var{bandAware:t,position:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==e){if(n)switch(n){case"start":default:return this.scale(e);case"middle":var r=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+r;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(e)+i}if(t){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+a}return this.scale(e)}}isInRange(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}(c="symbol"==typeof(a=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(c="EPS","string"))?a:a+"")in B5?Object.defineProperty(B5,c,{value:1e-4,enumerable:!0,configurable:!0,writable:!0}):B5[c]=1e-4;var B3=function(e){var{width:t,height:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(r%180+180)%180*Math.PI/180,a=Math.atan(n/t);return Math.abs(i>a&&i<Math.PI-a?n/Math.sin(i):t/Math.cos(i))};function B4(e,t){if(t<1)return[];if(1===t)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];void 0!==i&&n.push(i)}return n}function B6(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function B7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function B9(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B7(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B7(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function B8(e,t,n){var r,{tick:i,ticks:a,viewBox:o,minTickGap:s,orientation:l,interval:c,tickFormatter:u,unit:d,angle:h}=e;if(!a||!a.length||!i)return[];if(jG(c)||Ir.isSsr)return null!=(r=B4(a,(jG(c)?c:0)+1))?r:[];var f="top"===l||"bottom"===l?"width":"height",p=d&&"width"===f?L6(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},g=(e,r)=>{var i,a="function"==typeof u?u(e.value,r):e.value;return"width"===f?(i=L6(a,{fontSize:t,letterSpacing:n}),B3({width:i.width+p.width,height:i.height+p.height},h)):L6(a,{fontSize:t,letterSpacing:n})[f]},v=a.length>=2?jU(a[1].coordinate-a[0].coordinate):1,x=function(e,t,n){var r="width"===n,{x:i,y:a,width:o,height:s}=e;return 1===t?{start:r?i:a,end:r?i+o:a+s}:{start:r?i+o:a+s,end:r?i:a}}(o,v,f);return"equidistantPreserveStart"===c?function(e,t,n,r,i){for(var a,o=(r||[]).slice(),{start:s,end:l}=t,c=0,u=1,d=s;u<=o.length;)if(a=function(){var t,a=null==r?void 0:r[c];if(void 0===a)return{v:B4(r,u)};var o=c,h=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=0===c||B6(e,f,h,d,l);p||(c=0,d=s,u+=1),p&&(d=f+e*(h()/2+i),c+=u)}())return a.v;return[]}(v,x,g,a,s):"equidistantPreserveEnd"===c?function(e,t,n,r,i){var a=(r||[]).slice().length;if(0===a)return[];for(var{start:o,end:s}=t,l=1;l<=a;l++){for(var c=(a-1)%l,u=o,d=!0,h=c;h<a&&!function(){var t,a=r[h],o=h,l=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=h===c||B6(e,f,l,u,s);if(!p)return d=!1,1;p&&(u=f+e*(l()/2+i))}();h+=l);if(d){for(var f=[],p=c;p<a;p+=l)f.push(r[p]);return f}}return[]}(v,x,g,a,s):("preserveStart"===c||"preserveStartEnd"===c?function(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:l,end:c}=t;if(a){var u=r[s-1],d=n(u,s-1),h=e*(u.coordinate+e*d/2-c);o[s-1]=u=B9(B9({},u),{},{tickCoord:h>0?u.coordinate-h*e:u.coordinate}),null!=u.tickCoord&&B6(e,u.tickCoord,()=>d,l,c)&&(c=u.tickCoord-e*(d/2+i),o[s-1]=B9(B9({},u),{},{isShow:!0}))}for(var f=a?s-1:s,p=function(t){var r,a=o[t],s=()=>(void 0===r&&(r=n(a,t)),r);if(0===t){var u=e*(a.coordinate-e*s()/2-l);o[t]=a=B9(B9({},a),{},{tickCoord:u<0?a.coordinate-u*e:a.coordinate})}else o[t]=a=B9(B9({},a),{},{tickCoord:a.coordinate});null!=a.tickCoord&&B6(e,a.tickCoord,s,l,c)&&(l=a.tickCoord+e*(s()/2+i),o[t]=B9(B9({},a),{},{isShow:!0}))},g=0;g<f;g++)p(g);return o}(v,x,g,a,s,"preserveStartEnd"===c):function(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,{start:s}=t,{end:l}=t,c=function(t){var r,c=a[t],u=()=>(void 0===r&&(r=n(c,t)),r);if(t===o-1){var d=e*(c.coordinate+e*u()/2-l);a[t]=c=B9(B9({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate})}else a[t]=c=B9(B9({},c),{},{tickCoord:c.coordinate});null!=c.tickCoord&&B6(e,c.tickCoord,u,s,l)&&(l=c.tickCoord-e*(u()/2+i),a[t]=B9(B9({},c),{},{isShow:!0}))},u=o-1;u>=0;u--)c(u);return a}(v,x,g,a,s)).filter(e=>e.isShow)}var Fe=["axisLine","width","height","className","hide","ticks","axisType"];function Ft(){return(Ft=Object.assign.bind()).apply(null,arguments)}function Fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fn(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Fi={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:MB.axis};function Fa(e){var{x:t,y:n,width:r,height:i,orientation:a,mirror:o,axisLine:s,otherSvgProps:l}=e;if(!s)return null;var c=Fr(Fr(Fr({},l),I_(s)),{},{fill:"none"});if("top"===a||"bottom"===a){var u=+("top"===a&&!o||"bottom"===a&&o);c=Fr(Fr({},c),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+("left"===a&&!o||"right"===a&&o);c=Fr(Fr({},c),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return eh.createElement("line",Ft({},c,{className:(0,S5.clsx)("recharts-cartesian-axis-line",(0,jz.default)(s,"className"))}))}function Fo(e){var t,{option:n,tickProps:r,value:i}=e,a=(0,S5.clsx)(r.className,"recharts-cartesian-axis-tick-value");if(eh.isValidElement(n))t=eh.cloneElement(n,Fr(Fr({},r),{},{className:a}));else if("function"==typeof n)t=n(Fr(Fr({},r),{},{className:a}));else{var o="recharts-cartesian-axis-tick-value";"boolean"!=typeof n&&(o=(0,S5.clsx)(o,null==n?void 0:n.className)),t=eh.createElement(Ry,Ft({},r,{className:o}),i)}return t}var Fs=(0,eh.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:s,padding:l,tickTextProps:c,orientation:u,mirror:d,x:h,y:f,width:p,height:g,tickSize:v,tickMargin:x,fontSize:y,letterSpacing:b,getTicksConfig:w,events:N,axisType:j}=e,k=B8(Fr(Fr({},w),{},{ticks:n}),y,b),S=function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(u,d),C=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(u,d),_=I_(w),E=IE(r),T={};"object"==typeof i&&(T=i);var M=Fr(Fr({},_),{},{fill:"none"},T),O=k.map(e=>Fr({entry:e},function(e,t,n,r,i,a,o,s,l){var c,u,d,h,f,p,g=s?-1:1,v=e.tickSize||o,x=jG(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":c=u=e.coordinate,p=(d=(h=n+!s*i)-g*v)-g*l,f=x;break;case"left":d=h=e.coordinate,f=(c=(u=t+!s*r)-g*v)-g*l,p=x;break;case"right":d=h=e.coordinate,f=(c=(u=t+s*r)+g*v)+g*l,p=x;break;default:c=u=e.coordinate,p=(d=(h=n+s*i)+g*v)+g*l,f=x}return{line:{x1:c,y1:d,x2:u,y2:h},tick:{x:f,y:p}}}(e,h,f,p,g,u,v,d,x))),A=O.map(e=>{var{entry:t,line:n}=e;return eh.createElement(LQ,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},i&&eh.createElement("line",Ft({},M,n,{className:(0,S5.clsx)("recharts-cartesian-axis-tick-line",(0,jz.default)(i,"className"))})))}),D=O.map((e,t)=>{var{entry:n,tick:i}=e,u=Fr(Fr(Fr(Fr({textAnchor:S,verticalAnchor:C},_),{},{stroke:"none",fill:a},E),i),{},{index:t,payload:n,visibleTicksCount:k.length,tickFormatter:o,padding:l},c);return eh.createElement(LQ,Ft({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(n.value,"-").concat(n.coordinate,"-").concat(n.tickCoord)},((e,t,n)=>{if(null===e||"object"!=typeof e&&"function"!=typeof e)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Ij(i)&&"function"==typeof a&&(r||(r={}),r[i]=e=>(a(t,n,e),null))}),r})(N,n,t)),r&&eh.createElement(Fo,{option:r,tickProps:u,value:"".concat("function"==typeof o?o(n.value,t):n.value).concat(s||"")}))});return eh.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(j,"-ticks")},D.length>0&&eh.createElement(Rb,{zIndex:MB.label},eh.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(j,"-tick-labels"),ref:t},D)),A.length>0&&eh.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(j,"-tick-lines")},A))}),Fl=(0,eh.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s,axisType:l}=e,c=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Fe),[u,d]=(0,eh.useState)(""),[h,f]=(0,eh.useState)(""),p=(0,eh.useRef)(null);(0,eh.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0;return Math.round(o+(i+a)+s+(n?r:0))}return 0})({ticks:p.current,label:null==(t=e.labelRef)?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=(0,eh.useCallback)(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");p.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==u||a!==h)&&(d(i),f(a))}}},[u,h]);return o||null!=r&&r<=0||null!=i&&i<=0?null:eh.createElement(Rb,{zIndex:e.zIndex},eh.createElement(LQ,{className:(0,S5.clsx)("recharts-cartesian-axis",a)},eh.createElement(Fa,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:I_(e)}),eh.createElement(Fs,{ref:g,axisType:l,events:c,fontSize:u,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y}),eh.createElement(RE,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},eh.createElement(RI,{label:e.label,labelRef:e.labelRef}),e.children)))}),Fc=eh.forwardRef((e,t)=>{var n=Li(e,Fi);return eh.createElement(Fl,Ft({},n,{ref:t}))});Fc.displayName="CartesianAxis";var Fu=["domain","range"],Fd=["domain","range"];function Fh(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Ff(e,t){return e===t||!!(Array.isArray(e)&&2===e.length&&Array.isArray(t))&&2===t.length&&e[0]===t[0]&&e[1]===t[1]}function Fp(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=Fh(e,Fu),{domain:a,range:o}=t,s=Fh(t,Fd);return!!Ff(n,a)&&!!Ff(r,o)&&Ix(i,s)}var Fm=["dangerouslySetInnerHTML","ticks","scale"],Fg=["id","scale"];function Fv(){return(Fv=Object.assign.bind()).apply(null,arguments)}function Fx(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Fy(e){var t=Sf(),n=(0,eh.useRef)(null);return(0,eh.useLayoutEffect)(()=>{null===n.current?t(Pn(e)):n.current!==e&&t(Pr({prev:n.current,next:e})),n.current=e},[e,t]),(0,eh.useLayoutEffect)(()=>()=>{n.current&&(t(Pi(n.current)),n.current=null)},[t]),null}var Fb=e=>{var{xAxisId:t,className:n}=e,r=Sv(SQ),i=S0(),a="xAxis",o=Sv(e=>AL(e,a,t,i)),s=Sv(e=>AS(e,t)),l=Sv(e=>AE(e,t)),c=Sv(e=>Oi(e,t));if(null==s||null==l||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:h}=e,f=Fx(e,Fm),{id:p,scale:g}=c,v=Fx(c,Fg);return eh.createElement(Fc,Fv({},f,v,{x:l.x,y:l.y,width:s.width,height:s.height,className:(0,S5.clsx)("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:o,axisType:a}))},Fw={allowDataOverflow:Or.allowDataOverflow,allowDecimals:Or.allowDecimals,allowDuplicatedCategory:Or.allowDuplicatedCategory,angle:Or.angle,axisLine:Fi.axisLine,height:Or.height,hide:!1,includeHidden:Or.includeHidden,interval:Or.interval,minTickGap:Or.minTickGap,mirror:Or.mirror,orientation:Or.orientation,padding:Or.padding,reversed:Or.reversed,scale:Or.scale,tick:Or.tick,tickCount:Or.tickCount,tickLine:Fi.tickLine,tickSize:Fi.tickSize,type:Or.type,xAxisId:0},FN=eh.memo(e=>{var t=Li(e,Fw);return eh.createElement(eh.Fragment,null,eh.createElement(Fy,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),eh.createElement(Fb,t))},Fp);FN.displayName="XAxis";var Fj=["dangerouslySetInnerHTML","ticks","scale"],Fk=["id","scale"];function FS(){return(FS=Object.assign.bind()).apply(null,arguments)}function FC(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function F_(e){var t=Sf(),n=(0,eh.useRef)(null);return(0,eh.useLayoutEffect)(()=>{null===n.current?t(Pa(e)):n.current!==e&&t(Po({prev:n.current,next:e})),n.current=e},[e,t]),(0,eh.useLayoutEffect)(()=>()=>{n.current&&(t(Ps(n.current)),n.current=null)},[t]),null}var FE=e=>{var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,eh.useRef)(null),o=(0,eh.useRef)(null),s=Sv(SQ),l=S0(),c=Sf(),u="yAxis",d=Sv(e=>AM(e,t)),h=Sv(e=>AT(e,t)),f=Sv(e=>AL(e,u,t,l)),p=Sv(e=>Os(e,t));if((0,eh.useLayoutEffect)(()=>{if(!("auto"!==r||!d||RO(i)||(0,eh.isValidElement)(i))&&null!=p){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&c(Pd({id:t,width:n}))}}},[f,d,c,i,t,r,p]),null==d||null==h||null==p)return null;var{dangerouslySetInnerHTML:g,ticks:v,scale:x}=e,y=FC(e,Fj),{id:b,scale:w}=p,N=FC(p,Fk);return eh.createElement(Fc,FS({},y,N,{ref:a,labelRef:o,x:h.x,y:h.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:d.width,height:d.height,className:(0,S5.clsx)("recharts-".concat(u," ").concat(u),n),viewBox:s,ticks:f,axisType:u}))},FT={allowDataOverflow:Oo.allowDataOverflow,allowDecimals:Oo.allowDecimals,allowDuplicatedCategory:Oo.allowDuplicatedCategory,angle:Oo.angle,axisLine:Fi.axisLine,hide:!1,includeHidden:Oo.includeHidden,interval:Oo.interval,minTickGap:Oo.minTickGap,mirror:Oo.mirror,orientation:Oo.orientation,padding:Oo.padding,reversed:Oo.reversed,scale:Oo.scale,tick:Oo.tick,tickCount:Oo.tickCount,tickLine:Fi.tickLine,tickSize:Fi.tickSize,type:Oo.type,width:Oo.width,yAxisId:0},FM=eh.memo(e=>{var t=Li(e,FT);return eh.createElement(eh.Fragment,null,eh.createElement(F_,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),eh.createElement(FE,t))},Fp);function FO(){return(FO=Object.assign.bind()).apply(null,arguments)}function FA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function FD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FA(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FP(e){return Array.isArray(e)&&jX(e[0])&&jX(e[1])?e.join(" ~ "):e}FM.displayName="YAxis";var FI=e=>{var{separator:t=" : ",contentStyle:n={},itemStyle:r={},labelStyle:i={},payload:a,formatter:o,itemSorter:s,wrapperClassName:l,labelClassName:c,label:u,labelFormatter:d,accessibilityLayer:h=!1}=e,f=FD({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),p=FD({margin:0},i),g=null!=u,v=g?u:"",x=(0,S5.clsx)("recharts-default-tooltip",l),y=(0,S5.clsx)("recharts-tooltip-label",c);return g&&d&&null!=a&&(v=d(u,a)),eh.createElement("div",FO({className:x,style:f},h?{role:"status","aria-live":"assertive"}:{}),eh.createElement("p",{className:y,style:p},eh.isValidElement(v)?v:"".concat(v)),(()=>{if(a&&a.length){var e=(s?(0,Sx.default)(a,s):a).map((e,n)=>{if("none"===e.type)return null;var i=e.formatter||o||FP,{value:s,name:l}=e,c=s,u=l,d=i(s,l,e,n,a);if(Array.isArray(d))[c,u]=d;else{if(null==d)return null;c=d}var h=FD({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},r);return eh.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(n),style:h},jX(u)?eh.createElement("span",{className:"recharts-tooltip-item-name"},u):null,jX(u)?eh.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,eh.createElement("span",{className:"recharts-tooltip-item-value"},c),eh.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return eh.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},FL=eh,FR="recharts-tooltip-wrapper",FB={visibility:"hidden"};function FF(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offsetTopLeft:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=e;if(a&&jG(a[r]))return a[r];var u=n[r]-s-(i>0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var h=l[r];return null==h?0:o[r]?u<h?Math.max(d,h):Math.max(u,h):null==c?0:d+s>h+c?Math.max(u,h):Math.max(d,h)}function Fz(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function FV(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fz(Object(n),!0).forEach(function(t){FH(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fz(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FH(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class FU extends FL.PureComponent{constructor(){super(...arguments),FH(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),FH(this,"handleKeyDown",e=>{if("Escape"===e.key){var t,n,r,i;this.setState({dismissed:!0,dismissedAtCoordinate:{x:null!=(t=null==(n=this.props.coordinate)?void 0:n.x)?t:0,y:null!=(r=null==(i=this.props.coordinate)?void 0:i.y)?r:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,t;this.state.dismissed&&((null==(e=this.props.coordinate)?void 0:e.x)!==this.state.dismissedAtCoordinate.x||(null==(t=this.props.coordinate)?void 0:t.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:t,animationDuration:n,animationEasing:r,children:i,coordinate:a,hasPayload:o,isAnimationActive:s,offset:l,position:c,reverseDirection:u,useTranslate3d:d,viewBox:h,wrapperStyle:f,lastBoundingBox:p,innerRef:g,hasPortalFromProps:v}=this.props,{cssClasses:x,cssProperties:y}=function(e){var t,n,r,{allowEscapeViewBox:i,coordinate:a,offsetTopLeft:o,position:s,reverseDirection:l,tooltipBox:c,useTranslate3d:u,viewBox:d}=e;return{cssProperties:t=c.height>0&&c.width>0&&a?function(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}({translateX:n=FF({allowEscapeViewBox:i,coordinate:a,key:"x",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.width,viewBox:d,viewBoxDimension:d.width}),translateY:r=FF({allowEscapeViewBox:i,coordinate:a,key:"y",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.height,viewBox:d,viewBoxDimension:d.height}),useTranslate3d:u}):FB,cssClasses:function(e){var{coordinate:t,translateX:n,translateY:r}=e;return(0,S5.clsx)(FR,{["".concat(FR,"-right")]:jG(n)&&t&&jG(t.x)&&n>=t.x,["".concat(FR,"-left")]:jG(n)&&t&&jG(t.x)&&n<t.x,["".concat(FR,"-bottom")]:jG(r)&&t&&jG(t.y)&&r>=t.y,["".concat(FR,"-top")]:jG(r)&&t&&jG(t.y)&&r<t.y})}({translateX:n,translateY:r,coordinate:a})}}({allowEscapeViewBox:t,coordinate:a,offsetTopLeft:l,position:c,reverseDirection:u,tooltipBox:{height:p.height,width:p.width},useTranslate3d:d,viewBox:h}),b=v?{}:FV(FV({transition:s&&e?"transform ".concat(n,"ms ").concat(r):void 0},y),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&o?"visible":"hidden",position:"absolute",top:0,left:0}),w=FV(FV({},b),{},{visibility:!this.state.dismissed&&e&&o?"visible":"hidden"},f);return FL.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:w,ref:g},i)}}var FW=e.i(92809),FY=["x","y","top","left","width","height","className"];function FG(){return(FG=Object.assign.bind()).apply(null,arguments)}function FX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var F$=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FX(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({x:t,y:n,top:r,left:i,width:a,height:o},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,FY));return jG(t)&&jG(n)&&jG(a)&&jG(o)&&jG(r)&&jG(i)?eh.createElement("path",FG({},IT(l),{className:(0,S5.clsx)("recharts-cross",s),d:"M".concat(t,",").concat(r,"v").concat(o,"M").concat(i,",").concat(n,"h").concat(a)})):null},Fq=["radius"],FK=["radius"];function FZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function FQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FZ(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FJ(){return(FJ=Object.assign.bind()).apply(null,arguments)}function F0(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function F1(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var F2=(e,t,n,r,i)=>{var a,o=jV(n),s=jV(r),l=Math.min(Math.abs(o)/2,Math.abs(s)/2),c=s>=0?1:-1,u=o>=0?1:-1,d=+(s>=0&&o>=0||s<0&&o<0);if(l>0&&i instanceof Array){for(var h=[0,0,0,0],f=0;f<4;f++)h[f]=i[f]>l?l:i[f];a=jH(U||(U=F1(["M",",",""])),e,t+c*h[0]),h[0]>0&&(a+=jH(W||(W=F1(["A ",",",",0,0,",",",",",""])),h[0],h[0],d,e+u*h[0],t)),a+=jH(Y||(Y=F1(["L ",",",""])),e+n-u*h[1],t),h[1]>0&&(a+=jH(G||(G=F1(["A ",",",",0,0,",",\n ",",",""])),h[1],h[1],d,e+n,t+c*h[1])),a+=jH(X||(X=F1(["L ",",",""])),e+n,t+r-c*h[2]),h[2]>0&&(a+=jH($||($=F1(["A ",",",",0,0,",",\n ",",",""])),h[2],h[2],d,e+n-u*h[2],t+r)),a+=jH(q||(q=F1(["L ",",",""])),e+u*h[3],t+r),h[3]>0&&(a+=jH(K||(K=F1(["A ",",",",0,0,",",\n ",",",""])),h[3],h[3],d,e,t+r-c*h[3])),a+="Z"}else if(l>0&&i===+i&&i>0){var p=Math.min(l,i);a=jH(Z||(Z=F1(["M ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",","," Z"])),e,t+c*p,p,p,d,e+u*p,t,e+n-u*p,t,p,p,d,e+n,t+c*p,e+n,t+r-c*p,p,p,d,e+n-u*p,t+r,e+u*p,t+r,p,p,d,e,t+r-c*p)}else a=jH(Q||(Q=F1(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return a},F5={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},F3=e=>{var t=Li(e,F5),n=(0,eh.useRef)(null),[r,i]=(0,eh.useState)(-1);(0,eh.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&i(e)}catch(e){}},[]);var{x:a,y:o,width:s,height:l,radius:c,className:u}=t,{animationEasing:d,animationDuration:h,animationBegin:f,isAnimationActive:p,isUpdateAnimationActive:g}=t,v=(0,eh.useRef)(s),x=(0,eh.useRef)(l),y=(0,eh.useRef)(a),b=(0,eh.useRef)(o),w=Bu((0,eh.useMemo)(()=>({x:a,y:o,width:s,height:l,radius:c}),[a,o,s,l,c]),"rectangle-");if(a!==+a||o!==+o||s!==+s||l!==+l||0===s||0===l)return null;var N=(0,S5.clsx)("recharts-rectangle",u);if(!g){var j=IT(t),{radius:k}=j,S=F0(j,Fq);return eh.createElement("path",FJ({},S,{x:jV(a),y:jV(o),width:jV(s),height:jV(l),radius:"number"==typeof c?c:void 0,className:N,d:F2(a,o,s,l,c)}))}var C=v.current,_=x.current,E=y.current,T=b.current,M="0px ".concat(-1===r?1:r,"px"),O="".concat(r,"px 0px"),A=Bv(["strokeDasharray"],h,"string"==typeof d?d:F5.animationEasing);return eh.createElement(BI,{animationId:w,key:w,canBegin:r>0,duration:h,easing:d,isActive:g,begin:f},e=>{var r,i=jQ(C,s,e),u=jQ(_,l,e),d=jQ(E,a,e),h=jQ(T,o,e);n.current&&(v.current=i,x.current=u,y.current=d,b.current=h),r=p?e>0?{transition:A,strokeDasharray:O}:{strokeDasharray:M}:{strokeDasharray:O};var f=IT(t),{radius:g}=f,w=F0(f,FK);return eh.createElement("path",FJ({},w,{radius:"number"==typeof c?c:void 0,className:N,d:F2(d,h,i,u,c),ref:n,style:FQ(FQ({},r),t.style)}))})};function F4(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[MR(t,n,r,i),MR(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function F6(){return(F6=Object.assign.bind()).apply(null,arguments)}function F7(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var F9=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:s,cornerIsExternal:l}=e,c=s*(o?1:-1)+r,u=Math.asin(s/c)/ML,d=l?i:i+a*u,h=MR(t,n,c,d);return{center:h,circleTangency:MR(t,n,r,d),lineTangency:MR(t,n,c*Math.cos(u*ML),l?i-a*u:i),theta:u}},F8=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=jU(o-a)*Math.min(Math.abs(o-a),359.999),l=a+s,c=MR(t,n,i,a),u=MR(t,n,i,l),d=jH(J||(J=F7(["M ",",","\n A ",",",",0,\n ",",",",\n ",",","\n "])),c.x,c.y,i,i,+(Math.abs(s)>180),+(a>l),u.x,u.y);if(r>0){var h=MR(t,n,r,a),f=MR(t,n,r,l);d+=jH(ee||(ee=F7(["L ",",","\n A ",",",",0,\n ",",",",\n ",","," Z"])),f.x,f.y,r,r,+(Math.abs(s)>180),+(a<=l),h.x,h.y)}else d+=jH(et||(et=F7(["L ",","," Z"])),t,n);return d},ze={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},zt=e=>{var t,n=Li(e,ze),{cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:s,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:h}=n;if(o<a||u===d)return null;var f=(0,S5.clsx)("recharts-sector",h),p=o-a,g=jK(s,p,0,!0);return t=g>0&&360>Math.abs(u-d)?(e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:s,startAngle:l,endAngle:c}=e,u=jU(c-l),{circleTangency:d,lineTangency:h,theta:f}=F9({cx:t,cy:n,radius:i,angle:l,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:p,lineTangency:g,theta:v}=F9({cx:t,cy:n,radius:i,angle:c,sign:-u,cornerRadius:a,cornerIsExternal:s}),x=s?Math.abs(l-c):Math.abs(l-c)-f-v;if(x<0)return o?jH(en||(en=F7(["M ",",","\n a",",",",0,0,1,",",0\n a",",",",0,0,1,",",0\n "])),h.x,h.y,a,a,2*a,a,a,-(2*a)):F8({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var y=jH(er||(er=F7(["M ",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","\n "])),h.x,h.y,a,a,+(u<0),d.x,d.y,i,i,+(x>180),+(u<0),p.x,p.y,a,a,+(u<0),g.x,g.y);if(r>0){var{circleTangency:b,lineTangency:w,theta:N}=F9({cx:t,cy:n,radius:r,angle:l,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:j,lineTangency:k,theta:S}=F9({cx:t,cy:n,radius:r,angle:c,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),C=s?Math.abs(l-c):Math.abs(l-c)-N-S;if(C<0&&0===a)return"".concat(y,"L").concat(t,",").concat(n,"Z");y+=jH(ei||(ei=F7(["L",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","Z"])),k.x,k.y,a,a,+(u<0),j.x,j.y,r,r,+(C>180),+(u>0),b.x,b.y,a,a,+(u<0),w.x,w.y)}else y+=jH(ea||(ea=F7(["L",",","Z"])),t,n);return y})({cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(g,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):F8({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d}),eh.createElement("path",F6({},IT(n),{className:f,d:t}))};function zn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zn(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zi(){return(zi=Object.assign.bind()).apply(null,arguments)}function za(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?za(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):za(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zs(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return(0,eh.isValidElement)(t)?(0,eh.cloneElement)(t,r):(0,eh.createElement)(n,r)}function zl(e){var t,n,r,i,a,{coordinate:o,payload:s,index:l,offset:c,tooltipAxisBandSize:u,layout:d,cursor:h,tooltipEventType:f,chartName:p}=e;if(!h||!o||"ScatterChart"!==p&&"axis"!==f)return null;if("ScatterChart"===p)r=o,i=F$,a=MB.cursorLine;else if("BarChart"===p)t=u/2,r={stroke:"none",fill:"#ccc",x:"horizontal"===d?o.x-t:c.left+.5,y:"horizontal"===d?c.top+.5:o.y-t,width:"horizontal"===d?u:c.width-1,height:"horizontal"===d?c.height-1:u},i=F3,a=MB.cursorRectangle;else if("radial"===d&&LF(o)){var{cx:g,cy:v,radius:x,startAngle:y,endAngle:b}=F4(o);r={cx:g,cy:v,startAngle:y,endAngle:b,innerRadius:x,outerRadius:x},i=zt,a=MB.cursorLine}else r={points:function(e,t,n){if("horizontal"===e)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if("vertical"===e)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(LF(t)){if("centric"===e){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,l=MR(r,i,a,s),c=MR(r,i,o,s);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return F4(t)}}(d,o,c)},i=Lq,a=MB.cursorLine;var w="object"==typeof h&&"className"in h?h.className:void 0,N=zo(zo(zo(zo({stroke:"#ccc",pointerEvents:"none"},c),r),IE(h)),{},{payload:s,payloadIndex:l,className:(0,S5.clsx)("recharts-tooltip-cursor",w)});return eh.createElement(Rb,{zIndex:null!=(n=e.zIndex)?n:a},eh.createElement(zs,{cursor:h,cursorComp:i,cursorProps:N}))}function zc(e){var t,n,r,i=(t=Sv(OA),n=Sv(DC),r=Sv(Dj),t&&r?SF(zr(zr({},t),{},{scale:r}),n):SF(void 0,n)),a=Ch(),o=Sv(Cf),s=Sv(MM);return null==i||null==a||null==o||null==s?null:eh.createElement(zl,zi({},e,{offset:a,layout:o,tooltipAxisBandSize:i,chartName:s}))}function zu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zu(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zh(e){return e.dataKey}var zf=[],zp={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function zm(e){var t,n,r,i,a,o,s,l,c,u,d,h=Li(e,zp),{active:f,allowEscapeViewBox:p,animationDuration:g,animationEasing:v,content:x,filterNull:y,isAnimationActive:b,offset:w,payloadUniqBy:N,position:j,reverseDirection:k,useTranslate3d:S,wrapperStyle:C,cursor:_,shared:E,trigger:T,defaultIndex:M,portal:O,axisId:A}=h,D=Sf(),P="number"==typeof M?String(M):M;(0,eh.useEffect)(()=>{D(kJ({shared:E,trigger:T,axisId:A,active:f,defaultIndex:P}))},[D,E,T,A,f,P]);var I=Cu(),L=Iw(),R=Sv(e=>AW(e,E)),{activeIndex:B,isActive:F}=null!=(u=Sv(e=>D0(e,R,T,P)))?u:{},z=Sv(e=>DJ(e,R,T,P)),V=Sv(e=>DQ(e,R,T,P)),H=Sv(e=>DZ(e,R,T,P)),U=(0,eh.useContext)(IK),W=null!=(d=null!=f?f:F)&&d,[Y,G]=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],[t,n]=(0,eh.useState)({height:0,left:0,top:0,width:0}),r=(0,eh.useCallback)(e=>{if(null!=e){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>1||Math.abs(i.left-t.left)>1||Math.abs(i.top-t.top)>1||Math.abs(i.width-t.width)>1)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}([z,W]),X="axis"===R?V:void 0;t=Sv(e=>((e,t,n)=>{if(null!=t){var r=AJ(e);return"axis"===t?"hover"===n?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:"hover"===n?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}})(e,R,T)),n=Sv(MD),r=Sv(MO),i=Sv(MA),o=null==(a=Sv(IG))?void 0:a.active,s=Cu(),(0,eh.useEffect)(()=>{if(!o&&null!=r&&null!=n){var e=k6({active:W,coordinate:H,dataKey:t,index:B,label:"number"==typeof X?String(X):X,sourceViewBox:s,graphicalItemId:void 0});IU.emit(IW,r,e,n)}},[o,H,t,B,X,n,r,i,W,s]);var $=null!=O?O:U;if(null==$||null==I||null==R)return null;var q=null!=z?z:zf;W||(q=zf),y&&q.length&&(l=q.filter(e=>null!=e.value&&(!0!==e.hide||h.includeHidden)),q=!0===N?(0,FW.default)(l,zh):"function"==typeof N?(0,FW.default)(l,N):l);var K=q.length>0,Z=eh.createElement(FU,{allowEscapeViewBox:p,animationDuration:g,animationEasing:v,isAnimationActive:b,active:W,coordinate:H,hasPayload:K,offset:w,position:j,reverseDirection:k,useTranslate3d:S,viewBox:I,wrapperStyle:C,lastBoundingBox:Y,innerRef:G,hasPortalFromProps:!!O},(c=zd(zd({},h),{},{payload:q,label:X,active:W,activeIndex:B,coordinate:H,accessibilityLayer:L}),eh.isValidElement(x)?eh.cloneElement(x,c):"function"==typeof x?eh.createElement(x,c):eh.createElement(FI,c)));return eh.createElement(eh.Fragment,null,(0,eQ.createPortal)(Z,$),W&&eh.createElement(zc,{cursor:_,tooltipEventType:R,coordinate:H,payload:q,index:B}))}var zg=["x1","y1","x2","y2","key"],zv=["offset"],zx=["xAxisId","yAxisId"],zy=["xAxisId","yAxisId"];function zb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zb(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zN(){return(zN=Object.assign.bind()).apply(null,arguments)}function zj(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var zk=e=>{var{fill:t}=e;if(!t||"none"===t)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return eh.createElement("rect",{x:r,y:i,ry:s,width:a,height:o,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function zS(e){var{option:t,lineItemProps:n}=e;if(eh.isValidElement(t))r=eh.cloneElement(t,n);else if("function"==typeof t)r=t(n);else{var r,i,{x1:a,y1:o,x2:s,y2:l,key:c}=n,u=null!=(i=I_(zj(n,zg)))?i:{},{offset:d}=u,h=zj(u,zv);r=eh.createElement("line",zN({},h,{x1:a,y1:o,x2:s,y2:l,fill:"none",key:c}))}return r}function zC(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=zj(e,zx),l=i.map((e,i)=>{var a=zw(zw({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:"line-".concat(i),index:i});return eh.createElement(zS,{key:"line-".concat(i),option:r,lineItemProps:a})});return eh.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function z_(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=zj(e,zy),l=i.map((e,i)=>{var a=zw(zw({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:"line-".concat(i),index:i});return eh.createElement(zS,{option:r,lineItemProps:a,key:"line-".concat(i)})});return eh.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function zE(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:l=!0}=e;if(!l||!t||!t.length||null==s)return null;var c=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,s)=>{var l=c[s+1]?c[s+1]-e:i+o-e;if(l<=0)return null;var u=s%t.length;return eh.createElement("rect",{key:"react-".concat(s),y:e,x:r,height:l,width:a,stroke:"none",fill:t[u],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return eh.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function zT(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:l}=e;if(!t||!n||!n.length)return null;var c=l.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,t)=>{var l=c[t+1]?c[t+1]-e:i+o-e;if(l<=0)return null;var u=t%n.length;return eh.createElement("rect",{key:"react-".concat(t),x:e,y:a,width:l,height:s,stroke:"none",fill:n[u],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return eh.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var zM=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return SD(B8(zw(zw(zw({},Fi),n),{},{ticks:SP(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},zO=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return SD(B8(zw(zw(zw({},Fi),n),{},{ticks:SP(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},zA={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:MB.grid};function zD(e){var t=Sv(SH),n=Sv(SU),r=Ch(),i=zw(zw({},Li(e,zA)),{},{x:jG(e.x)?e.x:r.left,y:jG(e.y)?e.y:r.top,width:jG(e.width)?e.width:r.width,height:jG(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:l,width:c,height:u,syncWithTicks:d,horizontalValues:h,verticalValues:f}=i,p=S0(),g=Sv(e=>AI(e,"xAxis",a,p)),v=Sv(e=>AI(e,"yAxis",o,p));if(!SE(c)||!SE(u)||!jG(s)||!jG(l))return null;var x=i.verticalCoordinatesGenerator||zM,y=i.horizontalCoordinatesGenerator||zO,{horizontalPoints:b,verticalPoints:w}=i;if((!b||!b.length)&&"function"==typeof y){var N=h&&h.length,j=y({yAxis:v?zw(zw({},v),{},{ticks:N?h:v.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!N||d);S4(Array.isArray(j),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof j,"]")),Array.isArray(j)&&(b=j)}if((!w||!w.length)&&"function"==typeof x){var k=f&&f.length,S=x({xAxis:g?zw(zw({},g),{},{ticks:k?f:g.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!k||d);S4(Array.isArray(S),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof S,"]")),Array.isArray(S)&&(w=S)}return eh.createElement(Rb,{zIndex:i.zIndex},eh.createElement("g",{className:"recharts-cartesian-grid"},eh.createElement(zk,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),eh.createElement(zE,zN({},i,{horizontalPoints:b})),eh.createElement(zT,zN({},i,{verticalPoints:w})),eh.createElement(zC,zN({},i,{offset:r,horizontalPoints:b,xAxis:g,yAxis:v})),eh.createElement(z_,zN({},i,{offset:r,verticalPoints:w,xAxis:g,yAxis:v}))))}zD.displayName="CartesianGrid";let zP=["1h","12h","1d","7d","30d","90d"],zI=["created_at","mentioned_at","occurred_start"],zL="#8b5cf6",zR="#ec4899",zB="#6366f1",zF="var(--chart-5)",zz="var(--muted-foreground)",zV={world:{label:"World",color:zL},experience:{label:"Experience",color:zR},observation:{label:"Observations",color:zB}};function zH(e){if(e<1e3)return e.toString();if(e<1e6){let t=e/1e3;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}k`}if(e<1e9){let t=e/1e6;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}M`}let t=e/1e9;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}B`}function zU({value:e,className:t}){return(0,ed.jsx)("span",{className:t,title:e.toLocaleString(),children:zH(e)})}function zW({active:e,payload:t,label:n,valueLabel:r}){return e&&t&&0!==t.length?(0,ed.jsxs)("div",{className:"rounded-lg border border-border/60 bg-popover/95 backdrop-blur-sm px-3 py-2 shadow-md",children:[null!=n&&(0,ed.jsx)("div",{className:"text-[11px] font-medium text-foreground mb-1.5",children:n}),(0,ed.jsx)("div",{className:"space-y-1",children:t.map((e,t)=>(0,ed.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,ed.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color||e.payload?.fill}}),(0,ed.jsx)("span",{className:"text-muted-foreground",children:e.name||r||"Value"}),(0,ed.jsx)("span",{className:"ml-auto pl-3 font-semibold tabular-nums text-foreground",children:(e.value??0).toLocaleString()})]},t))})]}):null}function zY({children:e}){return(0,ed.jsx)("h3",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em] mb-3",children:e})}function zG(e,t){if(!e)return t?t("relativeTimeNever"):"Never";let n=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(n<1)return t?t("relativeTimeJustNow"):"just now";if(n<60)return t?t("relativeTimeMinutes",{mins:n}):`${n}m ago`;let r=Math.floor(n/60);if(r<24)return t?t("relativeTimeHours",{hours:r}):`${r}h ago`;let i=Math.floor(r/24);return t?t("relativeTimeDays",{days:i}):`${i}d ago`}function zX(e){return new Date(/[+Z-]$/.test(e)||/[+-]\d\d:?\d\d$/.test(e)?e:`${e}Z`)}function z$({done:e,total:t,doneColor:n}){let r=Math.round(100*(t>0?e/t:0));return(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,ed.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ed.jsx)("span",{className:"tabular-nums font-semibold text-foreground text-sm",children:e.toLocaleString()}),(0,ed.jsxs)("span",{className:"text-muted-foreground",children:[" / ",t.toLocaleString()]})]}),(0,ed.jsxs)("span",{className:"text-xs font-semibold tabular-nums text-foreground",children:[r,"%"]})]}),(0,ed.jsx)("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:(0,ed.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r}%`,backgroundColor:n}})})]})}function zq({title:e,items:t,emptyLabel:n}){let r=t.reduce((e,t)=>e+t.value,0);return(0,ed.jsxs)("div",{className:"space-y-3",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:e}),(0,ed.jsx)(zU,{value:r,className:"text-xs text-muted-foreground tabular-nums"})]}),0===r?(0,ed.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:n}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:t.filter(e=>e.value>0).map(e=>(0,ed.jsx)("div",{className:"h-full",style:{width:`${e.value/r*100}%`,backgroundColor:e.color},title:`${e.name}: ${e.value.toLocaleString()}`},e.name))}),(0,ed.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:t.map(e=>(0,ed.jsxs)("div",{className:"space-y-0.5",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color}}),(0,ed.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:e.name})]}),(0,ed.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,ed.jsx)(zU,{value:e.value,className:"text-base font-semibold tabular-nums"}),(0,ed.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:r>0?`${(e.value/r*100).toFixed(0)}%`:"0%"})]})]},e.name))})]})]})}function zK({icon:e,label:t,value:n}){return(0,ed.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,ed.jsx)("div",{className:"p-2 rounded-md bg-muted",children:(0,ed.jsx)(e,{className:"w-4 h-4 text-muted-foreground"})}),(0,ed.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ed.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:t}),(0,ed.jsx)(zU,{value:n,className:"text-2xl font-semibold text-foreground leading-tight tabular-nums block"})]})]})}let zZ=["completed","processing","pending","failed","cancelled"],zQ={completed:"#10b981",processing:"#3b82f6",pending:"#f59e0b",failed:"#ef4444",cancelled:"#6b7280"},zJ={completed:"completed",processing:"processing",pending:"pending",failed:"failed",cancelled:"cancelled"};function z0({byStatus:e}){let t=(0,ep.useTranslations)("bankStats"),n={completed:t("opsCompleted"),processing:t("opsProcessing"),pending:t("opsPending"),failed:t("opsFailed"),cancelled:t("opsCancelled")},r=zZ.map(t=>({status:t,label:n[t]??zJ[t],value:e[t]||0,color:zQ[t]}));for(let[t,n]of Object.entries(e))zZ.includes(t)||r.push({status:t,label:t,value:n,color:zz});let i=r.reduce((e,t)=>e+t.value,0),a=r.filter(e=>e.value>0);return(0,ed.jsxs)(pW.Card,{children:[(0,ed.jsxs)(pW.CardHeader,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,ed.jsxs)(pW.CardTitle,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ed.jsx)(wM,{className:"w-3.5 h-3.5 text-muted-foreground"}),t("operations")]}),(0,ed.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ed.jsx)(zU,{value:i})," ",t("totalSuffix")]})]}),(0,ed.jsx)(pW.CardContent,{children:0===i?(0,ed.jsx)("div",{className:"h-[100px] flex items-center justify-center text-sm text-muted-foreground",children:t("noOperationsYet")}):(0,ed.jsxs)("div",{className:"space-y-3",children:[(0,ed.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:a.map(e=>(0,ed.jsx)("div",{className:"h-full",style:{width:`${e.value/i*100}%`,backgroundColor:e.color},title:`${e.label}: ${e.value.toLocaleString()}`},e.status))}),(0,ed.jsx)("div",{className:"space-y-1.5",children:a.map(e=>(0,ed.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,ed.jsx)("span",{className:"w-2 h-2 rounded-[2px] flex-shrink-0",style:{backgroundColor:e.color}}),(0,ed.jsx)("span",{className:"text-muted-foreground flex-1",children:e.label}),(0,ed.jsx)(zU,{value:e.value,className:"font-semibold tabular-nums text-foreground"}),(0,ed.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums w-9 text-right",children:[(e.value/i*100).toFixed(0),"%"]})]},e.status))})]})})]})}function z1({done:e,pending:t,failed:n,total:r,lastConsolidatedAt:i}){let a=(0,ep.useTranslations)("bankStats"),[o,s]=(0,eh.useState)(!1),l=n>0;return(0,ed.jsxs)(pW.Card,{children:[(0,ed.jsx)(pW.CardHeader,{className:"pb-2",children:(0,ed.jsx)(pW.CardTitle,{className:"text-sm font-semibold",children:a("consolidation")})}),(0,ed.jsxs)(pW.CardContent,{className:"space-y-4",children:[(0,ed.jsx)(z$,{done:e,total:r,doneColor:zF}),(0,ed.jsxs)("div",{className:"grid grid-cols-4 gap-3 pt-1",children:[(0,ed.jsxs)("div",{className:"space-y-0.5",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)(wO.default,{className:"w-3 h-3 text-emerald-500"}),(0,ed.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:a("done")})]}),(0,ed.jsx)(zU,{value:e,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ed.jsxs)("div",{className:"space-y-0.5",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)(wi,{className:"w-3 h-3 text-amber-500"}),(0,ed.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:a("pending")})]}),(0,ed.jsx)(zU,{value:t,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ed.jsxs)("button",{type:"button",onClick:()=>l&&s(!0),disabled:!l,className:`text-left space-y-0.5 rounded-md -mx-1 px-1 py-0.5 transition-colors ${l?"cursor-pointer hover:bg-red-500/10 focus:outline-none focus:ring-2 focus:ring-red-500/40":"cursor-default"}`,title:l?a("viewFailedMemoriesLabel"):void 0,children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)(wA,{className:`w-3 h-3 ${l?"text-red-600 dark:text-red-400":"text-muted-foreground/50"}`}),(0,ed.jsx)("span",{className:`text-[10px] uppercase tracking-wider font-medium ${l?"text-red-600 dark:text-red-400":"text-muted-foreground"}`,children:a("failed")})]}),(0,ed.jsxs)("span",{className:`text-base font-semibold tabular-nums block ${l?"text-red-600 dark:text-red-400":"text-foreground"}`,children:[(0,ed.jsx)(zU,{value:n}),l&&(0,ed.jsx)(wD,{className:"inline w-3 h-3 ml-1 opacity-70"})]})]}),(0,ed.jsxs)("div",{className:"space-y-0.5",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)(eU,{className:"w-3 h-3 text-muted-foreground"}),(0,ed.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:a("last")})]}),(0,ed.jsx)("span",{className:"text-base font-semibold text-foreground block leading-tight",children:zG(i,a)})]})]})]}),(0,ed.jsx)(z2,{open:o,onOpenChange:s})]})}function z2({open:e,onOpenChange:t}){let n=(0,ep.useTranslations)("bankStats"),r=(0,ep.useTranslations)("failedConsolidations"),{currentBank:i}=(0,ev.useBank)(),[a,o]=(0,eh.useState)([]),[s,l]=(0,eh.useState)(0),[c,u]=(0,eh.useState)(!1),[d,h]=(0,eh.useState)(!1),[f,p]=(0,eh.useState)(0);(0,eh.useEffect)(()=>{if(!e||!i)return;let t=!1;return u(!0),eO.client.listMemories(i,{consolidationState:"failed",limit:200}).then(e=>{t||(o(e.items),l(e.total))}).catch(()=>{}).finally(()=>{t||u(!1)}),()=>{t=!0}},[e,i,f]);let g=async()=>{if(i){h(!0);try{let e=await eO.client.recoverConsolidation(i);e.retried_count>0&&await eO.client.triggerConsolidation(i),em.toast.success(r("recoverSuccess",{count:e.retried_count})),p(e=>e+1)}catch{}finally{h(!1)}}};return(0,ed.jsx)(tH.Dialog,{open:e,onOpenChange:t,children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-4xl max-h-[80vh] flex flex-col",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsxs)(tH.DialogTitle,{className:"flex items-center gap-2",children:[(0,ed.jsx)(wA,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),r("title")]}),(0,ed.jsx)(tH.DialogDescription,{children:r("description")})]}),(0,ed.jsxs)("div",{className:"flex items-center justify-between gap-2 py-2",children:[(0,ed.jsx)("span",{className:"text-sm text-muted-foreground",children:c?r("loading"):r("totalFailed",{total:s})}),(0,ed.jsxs)(eA.Button,{size:"sm",onClick:g,disabled:d||c||0===s,children:[(0,ed.jsx)(eV,{className:`w-3.5 h-3.5 mr-1.5 ${d?"animate-spin":""}`}),r("recoverAll")]})]}),(0,ed.jsx)("div",{className:"flex-1 min-h-0 overflow-auto border border-border rounded-md",children:(0,ed.jsxs)(eG,{children:[(0,ed.jsx)(eX,{children:(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eK,{className:"w-[140px]",children:r("colFailedAt")}),(0,ed.jsx)(eK,{className:"w-[100px]",children:r("colType")}),(0,ed.jsx)(eK,{children:r("colText")})]})}),(0,ed.jsxs)(e$,{children:[0===a.length&&!c&&(0,ed.jsx)(eq,{children:(0,ed.jsx)(eZ,{colSpan:3,className:"text-center text-muted-foreground py-8",children:r("noFailedConsolidations")})}),a.map(e=>(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eZ,{className:"text-xs text-muted-foreground whitespace-nowrap",children:zG(e.consolidation_failed_at,n)}),(0,ed.jsx)(eZ,{className:"text-xs capitalize",children:e.fact_type}),(0,ed.jsxs)(eZ,{className:"text-sm",children:[(0,ed.jsx)("div",{className:"line-clamp-2",children:e.text}),e.context&&(0,ed.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:e.context})]})]},e.id))]})]})})]})})}function z5({models:e,lastConsolidatedAt:t}){let n=(0,ep.useTranslations)("bankStats"),r=e.length,i=t?new Date(t).getTime():0,a=e.filter(e=>!i||!!e.last_refreshed_at&&new Date(e.last_refreshed_at).getTime()>=i).length,o=r-a;return(0,ed.jsxs)(pW.Card,{children:[(0,ed.jsx)(pW.CardHeader,{className:"pb-2",children:(0,ed.jsxs)(pW.CardTitle,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ed.jsx)(pG,{className:"w-3.5 h-3.5 text-muted-foreground"}),n("mentalModels")]})}),(0,ed.jsx)(pW.CardContent,{className:"space-y-4",children:0===r?(0,ed.jsx)("div",{className:"text-sm text-muted-foreground py-4",children:n("noMentalModels")}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(z$,{done:a,total:r,doneColor:zF}),(0,ed.jsxs)("div",{className:"grid grid-cols-3 gap-3 pt-1",children:[(0,ed.jsxs)("div",{className:"space-y-0.5",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)(wO.default,{className:"w-3 h-3 text-emerald-500"}),(0,ed.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:n("upToDate")})]}),(0,ed.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:a})]}),(0,ed.jsxs)("div",{className:"space-y-0.5",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)(wi,{className:"w-3 h-3 text-amber-500"}),(0,ed.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:n("stale")})]}),(0,ed.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:o})]}),(0,ed.jsxs)("div",{className:"space-y-0.5",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ed.jsx)(pG,{className:"w-3 h-3 text-muted-foreground"}),(0,ed.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:n("total")})]}),(0,ed.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:r})]})]})]})})]})}let z3={fontSize:11,fill:zz,fontWeight:500};function z4(){let e=(0,ep.useTranslations)("bankStats"),t={created_at:{short:e("timeFieldIngestedShort"),long:e("timeFieldIngestedLong")},mentioned_at:{short:e("timeFieldMentionedShort"),long:e("timeFieldMentionedLong")},occurred_start:{short:e("timeFieldOccurredShort"),long:e("timeFieldOccurredLong")}},{currentBank:n}=(0,ev.useBank)(),{features:r}=(0,b1.useFeatures)(),i=r?.observations??!1,[a,o]=(0,eh.useState)(null),[s,l]=(0,eh.useState)([]),[c,u]=(0,eh.useState)(!1),[d,h]=(0,eh.useState)("7d"),[f,p]=(0,eh.useState)("created_at"),[g,v]=(0,eh.useState)({trunc:"day",buckets:[]}),[x,y]=(0,eh.useState)({world:!0,experience:!0,observation:!0}),b=async()=>{if(n){u(!0);try{let[e,t]=await Promise.all([eO.client.getBankStats(n),eO.client.listMentalModels(n)]);o(e),l(t.items||[])}catch(e){console.error("Error loading bank stats:",e)}finally{u(!1)}}},w=async()=>{if(n)try{let e=await eO.client.getMemoriesTimeseries(n,d,f);v({trunc:e.trunc,buckets:e.buckets||[]})}catch(e){console.error("Error loading memories timeseries:",e)}};if((0,eh.useEffect)(()=>{if(n){b();let e=setInterval(b,5e3);return()=>clearInterval(e)}},[n]),(0,eh.useEffect)(()=>{if(n){w();let e=setInterval(w,5e3);return()=>clearInterval(e)}},[n,d,f]),c&&!a)return(0,ed.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ed.jsx)(eU,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"})});if(!a)return null;let N=i?["world","experience","observation"]:["world","experience"],j=g.buckets.map(e=>{var t,n,r,i;let a,o;return{...e,label:(t=e.time,n=g.trunc,a=zX(t),"day"===n?a.toLocaleDateString(void 0,{month:"short",day:"numeric"}):a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})),tooltipLabel:(r=e.time,i=g.trunc,o=zX(r),"day"===i?o.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):o.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}))}}),k=j.reduce((e,t)=>e+N.reduce((e,n)=>e+(x[n]&&t[n]||0),0),0),S=Math.max(0,a.total_nodes-a.pending_consolidation),C={world:e("world"),experience:e("experience"),observation:e("observations")};return(0,ed.jsxs)("div",{className:"space-y-8",children:[(0,ed.jsxs)("section",{children:[(0,ed.jsx)(zY,{children:e("memoryStore")}),(0,ed.jsx)(pW.Card,{children:(0,ed.jsxs)(pW.CardContent,{className:"p-0",children:[(0,ed.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 md:divide-x divide-y md:divide-y-0 divide-border/60",children:[(0,ed.jsx)(zK,{icon:eN,label:e("memories"),value:a.total_nodes}),(0,ed.jsx)(zK,{icon:wT,label:e("documents"),value:a.total_documents}),(0,ed.jsx)(zK,{icon:wE,label:e("links"),value:a.total_links})]}),(0,ed.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 md:divide-x divide-y md:divide-y-0 divide-border/60 border-t border-border/60",children:[(0,ed.jsx)("div",{className:"p-5",children:(0,ed.jsx)(zq,{title:e("memoryComposition"),items:[{name:e("world"),value:a.nodes_by_fact_type?.world||0,color:zL},{name:e("experience"),value:a.nodes_by_fact_type?.experience||0,color:zR},...i?[{name:e("observations"),value:a.total_observations||0,color:zB}]:[]],emptyLabel:e("noMemoriesYet")})}),(0,ed.jsx)("div",{className:"p-5",children:(0,ed.jsx)(zq,{title:e("linkTypes"),items:[{name:e("temporal"),value:a.links_by_link_type?.temporal||0,color:"#009296"},{name:e("semantic"),value:a.links_by_link_type?.semantic||0,color:"#0074d9"},{name:e("entity"),value:a.links_by_link_type?.entity||0,color:"#f59e0b"}],emptyLabel:e("noLinksYet")})})]})]})})]}),(0,ed.jsxs)("section",{children:[(0,ed.jsx)(zY,{children:e("consolidation")}),(0,ed.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ed.jsx)(z1,{done:S,pending:a.pending_consolidation,failed:a.failed_consolidation??0,total:a.total_nodes,lastConsolidatedAt:a.last_consolidated_at}),(0,ed.jsx)(z5,{models:s,lastConsolidatedAt:a.last_consolidated_at})]})]}),(0,ed.jsxs)("section",{children:[(0,ed.jsx)(zY,{children:e("activity")}),(0,ed.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,ed.jsxs)(pW.Card,{className:"lg:col-span-2",children:[(0,ed.jsxs)(pW.CardHeader,{className:"pb-2 space-y-2",children:[(0,ed.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,ed.jsx)(pW.CardTitle,{className:"text-sm font-semibold",children:e("memoriesByTimeChartTitle",{field:t[f].short.toLowerCase()})}),(0,ed.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:zP.map(e=>(0,ed.jsx)("button",{onClick:()=>h(e),className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors tabular-nums ${d===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e},e))})]}),(0,ed.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5 w-fit",children:zI.map(e=>(0,ed.jsx)("button",{onClick:()=>p(e),title:t[e].long,className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors ${f===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:t[e].short},e))}),(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsx)("div",{className:"flex items-center gap-1.5",children:N.map(e=>{let t=zV[e],n=x[e];return(0,ed.jsxs)("button",{onClick:()=>y(t=>({...t,[e]:!t[e]})),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] font-medium transition-all ${n?"bg-muted text-foreground":"bg-transparent text-muted-foreground/60 hover:text-muted-foreground"}`,children:[(0,ed.jsx)("span",{className:"w-2 h-2 rounded-[2px] transition-opacity",style:{backgroundColor:t.color,opacity:n?1:.3}}),C[e]]},e)})}),(0,ed.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ed.jsx)(zU,{value:k})," ",e("totalSuffix")]})]})]}),(0,ed.jsx)(pW.CardContent,{children:0===j.length||0===k?(0,ed.jsx)("div",{className:"h-[180px] flex items-center justify-center text-sm text-muted-foreground",children:e("noMemoriesIngestedInPeriod")}):(0,ed.jsx)("div",{className:"h-[180px]",children:(0,ed.jsx)(Cl,{width:"100%",height:"100%",children:(0,ed.jsxs)(Lc,{data:j,margin:{top:8,right:8,bottom:0,left:-10},children:[(0,ed.jsx)("defs",{children:N.map(e=>(0,ed.jsxs)("linearGradient",{id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ed.jsx)("stop",{offset:"0%",stopColor:zV[e].color,stopOpacity:.35}),(0,ed.jsx)("stop",{offset:"100%",stopColor:zV[e].color,stopOpacity:0})]},e))}),(0,ed.jsx)(zD,{vertical:!1,stroke:"var(--border)",strokeOpacity:.5,strokeDasharray:"2 4"}),(0,ed.jsx)(FN,{dataKey:"label",tick:z3,axisLine:!1,tickLine:!1,dy:4,minTickGap:20}),(0,ed.jsx)(FM,{tick:z3,axisLine:!1,tickLine:!1,width:40,allowDecimals:!1,tickFormatter:e=>zH(e)}),(0,ed.jsx)(zm,{content:(0,ed.jsx)(zW,{}),labelFormatter:(e,t)=>t?.[0]?.payload?.tooltipLabel||"",cursor:{stroke:zz,strokeWidth:1,strokeDasharray:"3 3"}}),N.map(e=>x[e]?(0,ed.jsx)(B2,{type:"monotone",dataKey:e,name:C[e],stackId:"a",stroke:zV[e].color,strokeWidth:2,fill:`url(#grad-${e})`,isAnimationActive:!1},e):null)]})})})})]}),(0,ed.jsx)(z0,{byStatus:a.operations_by_status||{}})]})]})]})}var tz=tz;let z6=(0,eb.default)("rotate-ccw",[["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"}]]),z7=(0,eb.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),z9=(0,eb.default)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),z8=[{value:"all",label:"All types"},{value:"retain",label:"Retain"},{value:"consolidation",label:"Consolidation"},{value:"refresh_mental_model",label:"Mental Model Refresh"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"},{value:"graph_maintenance",label:"Graph Maintenance"}];function Ve(){let e,t,n,r=(0,ep.useTranslations)("bankOperations"),{currentBank:i}=(0,ev.useBank)(),[a,o]=(0,eh.useState)([]),[s,l]=(0,eh.useState)(0),[c,u]=(0,eh.useState)(null),[d,h]=(0,eh.useState)(null),[f]=(0,eh.useState)(10),[p,g]=(0,eh.useState)(0),[v,x]=(0,eh.useState)(null),[y,b]=(0,eh.useState)(null),[w,N]=(0,eh.useState)(!1),[j,k]=(0,eh.useState)(null),[S,C]=(0,eh.useState)(!1),[_,E]=(0,eh.useState)(!1),[T,M]=(0,eh.useState)(!1),[O,A]=(0,eh.useState)(null),D=(0,eh.useCallback)(async(e=c,t=p,n=d)=>{if(i){N(!0);try{let r=await eO.client.listOperations(i,{status:e||void 0,type:n||void 0,limit:f,offset:t,excludeParents:!0});o(r.operations||[]),l(r.total||0)}catch(e){console.error("Error loading operations:",e)}finally{N(!1)}}},[i,c,p,d,f]),P=e=>{g(e),D(c,e,d)},I=async e=>{if(i){x(e);try{await eO.client.cancelOperation(i,e),await D()}catch(e){}finally{x(null)}}},L=async e=>{if(i){b(e);try{await eO.client.retryOperation(i,e),await D()}catch(e){}finally{b(null)}}},R=async e=>{if(i){E(!0),C(!0),A(null);try{let t=await eO.client.getOperationStatus(i,e);k(t)}catch(e){console.error("Error loading operation details:",e),k({error:"Failed to load operation details"})}finally{E(!1)}}},B=async()=>{if(i&&j?.operation_id){M(!0);try{let e=j.operation_id,t=await eO.client.getOperationStatus(i,e,{includePayload:!0});k(t),A(e)}catch(e){console.error("Error loading raw payload:",e)}finally{M(!1)}}};return((0,eh.useEffect)(()=>{if(i){D(c,p,d);let e=setInterval(()=>D(c,p,d),5e3);return()=>clearInterval(e)}},[i,c,p,d]),i)?(0,ed.jsxs)("div",{className:"space-y-4",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("h3",{className:"text-lg font-semibold",children:r("title")}),(0,ed.jsx)("button",{onClick:()=>D(),className:"p-1 rounded hover:bg-muted transition-colors",title:r("refreshOperations"),disabled:w,children:(0,ed.jsx)(eV,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${w?"animate-spin":""}`})})]}),(0,ed.jsxs)("p",{className:"text-sm text-muted-foreground",children:[s," operation",1!==s?"s":"",c?` (${c})`:""]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ed.jsxs)(tP.Select,{value:d??"all",onValueChange:e=>{var t;h(t="all"===e?null:e),g(0),D(c,0,t)},children:[(0,ed.jsx)(tP.SelectTrigger,{className:"h-9 w-[180px] text-sm",children:(0,ed.jsx)(tP.SelectValue,{placeholder:r("allTypes")})}),(0,ed.jsx)(tP.SelectContent,{children:z8.map(e=>(0,ed.jsx)(tP.SelectItem,{value:e.value,children:(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{children:e.label}),"all"!==e.value&&(0,ed.jsx)("div",{className:"text-xs text-muted-foreground font-mono",children:e.value})]})},e.value))})]}),(0,ed.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:[{value:null,label:"All"},{value:"pending",label:"Pending"},{value:"processing",label:"Processing"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"}].map(e=>(0,ed.jsx)("button",{onClick:()=>{var t;u(t=e.value),g(0),D(t,0,d)},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${c===e.value?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e.label},e.value??"all"))})]})]}),(0,ed.jsx)("div",{children:a.length>0?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("div",{className:"overflow-x-auto",children:(0,ed.jsxs)(eG,{children:[(0,ed.jsx)(eX,{children:(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eK,{className:"w-[100px]",children:"ID"}),(0,ed.jsx)(eK,{children:"Type"}),(0,ed.jsx)(eK,{children:"Created"}),(0,ed.jsx)(eK,{children:"Status"}),(0,ed.jsx)(eK,{className:"w-[80px]"})]})}),(0,ed.jsx)(e$,{children:a.map(e=>(0,ed.jsxs)(eq,{className:`cursor-pointer hover:bg-muted/50 ${"failed"===e.status?"bg-red-500/5":""}`,onClick:()=>R(e.id),children:[(0,ed.jsx)(eZ,{className:"font-mono text-xs text-muted-foreground",children:e.id.substring(0,8)}),(0,ed.jsx)(eZ,{className:"font-medium",children:e.task_type}),(0,ed.jsx)(eZ,{className:"text-sm text-muted-foreground",children:new Date(e.created_at).toLocaleString()}),(0,ed.jsxs)(eZ,{children:["pending"===e.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ed.jsx)(eU,{className:"w-3 h-3"}),"pending"]}),"processing"===e.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:[(0,ed.jsx)(tz.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===e.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",title:e.error_message??void 0,children:[(0,ed.jsx)(wi,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ed.jsx)(eH,{className:"w-3 h-3"}),"completed"]}),"cancelled"===e.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400 border border-gray-500/20",children:[(0,ed.jsx)(z9,{className:"w-3 h-3"}),"cancelled"]})]}),(0,ed.jsxs)(eZ,{children:["pending"===e.status&&(0,ed.jsxs)(eA.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:t=>{t.stopPropagation(),I(e.id)},disabled:v===e.id,children:[v===e.id?(0,ed.jsx)(tz.default,{className:"w-3 h-3 animate-spin"}):(0,ed.jsx)(tF.X,{className:"w-3 h-3 mr-1"}),v===e.id?"":"Cancel"]}),("failed"===e.status||"cancelled"===e.status)&&(0,ed.jsxs)(eA.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-blue-600 dark:hover:text-blue-400",onClick:t=>{t.stopPropagation(),L(e.id)},disabled:y===e.id,children:[y===e.id?(0,ed.jsx)(tz.default,{className:"w-3 h-3 animate-spin"}):(0,ed.jsx)(z6,{className:"w-3 h-3 mr-1"}),y===e.id?"":"Retry"]})]})]},e.id))})]})}),s>f&&(0,ed.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[(0,ed.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Showing ",p+1,"-",Math.min(p+f,s)," of"," ",s]}),(0,ed.jsxs)("div",{className:"flex gap-2",children:[(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>P(Math.max(0,p-f)),disabled:0===p,children:"Previous"}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>P(p+f),disabled:p+f>=s,children:"Next"})]})]})]}):(0,ed.jsxs)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:["No ",c?`${c} `:"","operations"]})}),(0,ed.jsx)(tH.Dialog,{open:S,onOpenChange:C,children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsx)(tH.DialogTitle,{children:r("operationDetails")}),(0,ed.jsx)(tH.DialogDescription,{children:j?.operation_id&&(0,ed.jsx)("span",{className:"font-mono text-xs",children:j.operation_id})})]}),_?(0,ed.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ed.jsx)(tz.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):j?(0,ed.jsx)("div",{className:"space-y-4",children:j.error?(0,ed.jsx)("div",{className:"text-red-600 dark:text-red-400",children:j.error}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),(0,ed.jsxs)("div",{className:"mt-1",children:["pending"===j.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ed.jsx)(eU,{className:"w-3 h-3"}),"pending"]}),"processing"===j.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:[(0,ed.jsx)(tz.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===j.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ed.jsx)(wi,{className:"w-3 h-3"}),"failed"]}),"completed"===j.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ed.jsx)(eH,{className:"w-3 h-3"}),"completed"]}),"cancelled"===j.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400 border border-gray-500/20",children:[(0,ed.jsx)(z9,{className:"w-3 h-3"}),"cancelled"]})]})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Type"}),(0,ed.jsx)("div",{className:"mt-1 font-mono text-sm",children:j.operation_type})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Created"}),(0,ed.jsx)("div",{className:"mt-1 text-sm",children:j.created_at?new Date(j.created_at).toLocaleString():"N/A"})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Updated"}),(0,ed.jsx)("div",{className:"mt-1 text-sm",children:j.updated_at?new Date(j.updated_at).toLocaleString():"N/A"})]}),j.completed_at&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Completed"}),(0,ed.jsx)("div",{className:"mt-1 text-sm",children:new Date(j.completed_at).toLocaleString()})]}),j.result_metadata?.items_count!==void 0&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:r("totalItems")}),(0,ed.jsx)("div",{className:"mt-1 text-sm",children:j.result_metadata.items_count})]})]}),("pending"===j.status||"failed"===j.status||"cancelled"===j.status)&&(0,ed.jsxs)("div",{className:"flex gap-2",children:["pending"===j.status&&(0,ed.jsxs)(eA.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>I(j.operation_id),disabled:v===j.operation_id,children:[v===j.operation_id?(0,ed.jsx)(tz.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,ed.jsx)(tF.X,{className:"w-3 h-3 mr-1"}),"Cancel"]}),("failed"===j.status||"cancelled"===j.status)&&(0,ed.jsxs)(eA.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>L(j.operation_id),disabled:y===j.operation_id,children:[y===j.operation_id?(0,ed.jsx)(tz.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,ed.jsx)(z6,{className:"w-3 h-3 mr-1"}),"Retry"]})]}),j.result_metadata&&Object.keys(j.result_metadata).length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Metadata"}),(0,ed.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.result_metadata,null,2)})]}),j.error_message&&(0,ed.jsxs)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3",children:[(0,ed.jsx)("div",{className:"text-sm font-medium text-red-600 dark:text-red-400 mb-1",children:"Error"}),(0,ed.jsx)("div",{className:"text-sm text-red-600/80 dark:text-red-400/80 font-mono",children:j.error_message})]}),j.child_operations&&j.child_operations.length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:r("subBatchesCount",{count:j.result_metadata?.num_sub_batches||j.child_operations.length})}),(0,ed.jsxs)(eG,{children:[(0,ed.jsx)(eX,{children:(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eK,{className:"w-[60px]",children:"Index"}),(0,ed.jsx)(eK,{className:"w-[100px]",children:"ID"}),(0,ed.jsx)(eK,{className:"w-[80px]",children:"Items"}),(0,ed.jsx)(eK,{children:"Status"})]})}),(0,ed.jsx)(e$,{children:j.child_operations.map(e=>(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eZ,{className:"text-sm",children:e.sub_batch_index}),(0,ed.jsx)(eZ,{className:"font-mono text-xs text-muted-foreground",children:e.operation_id.substring(0,8)}),(0,ed.jsx)(eZ,{className:"text-sm",children:e.items_count}),(0,ed.jsxs)(eZ,{children:["pending"===e.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400",children:[(0,ed.jsx)(eU,{className:"w-3 h-3"}),"pending"]}),"processing"===e.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400",children:[(0,ed.jsx)(tz.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===e.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400",title:e.error_message??void 0,children:[(0,ed.jsx)(wi,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:[(0,ed.jsx)(eH,{className:"w-3 h-3"}),"completed"]}),"cancelled"===e.status&&(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400",children:[(0,ed.jsx)(z9,{className:"w-3 h-3"}),"cancelled"]})]})]},e.operation_id))})]})]}),(e=O===j.operation_id,t=!!j.task_payload,n=!!j.result_metadata?.is_parent,(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ed.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:r("rawPayload")}),!e&&(0,ed.jsxs)(eA.Button,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:B,disabled:T,children:[T?(0,ed.jsx)(tz.default,{className:"w-3 h-3 mr-1 animate-spin"}):(0,ed.jsx)(z7,{className:"w-3 h-3 mr-1"}),r("loadRaw")]})]}),t?(0,ed.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.task_payload,null,2)}):e?(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:n?"This is a parent operation — the raw payload is stored on each sub-batch. Open a child operation to inspect its payload.":"No raw payload stored for this operation."}):(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:r("rawPayloadHelp")})]}))]})}):null]})})]}):null}var tz=tz;let Vt=(0,eb.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);function Vn(){let e=(0,ep.useTranslations)("mentalModels"),{currentBank:t}=(0,ev.useBank)(),[n,r]=(0,eh.useState)([]),[i,a]=(0,eh.useState)(!1),[o,s]=(0,eh.useState)("files"),[l,c]=(0,eh.useState)(""),[u,d]=(0,eh.useState)(1),[h,f]=(0,eh.useState)(!1),[p,g]=(0,eh.useState)(null),[v,x]=(0,eh.useState)(null),[y,b]=(0,eh.useState)([]),[w,N]=(0,eh.useState)("any"),[j,k]=(0,eh.useState)(!1),[S,C]=(0,eh.useState)(null),[_,E]=(0,eh.useState)(null),[T,M]=(0,eh.useState)(!1),[O,A]=(0,eh.useState)(null),[D,P]=(0,eh.useState)(!1),I=n.filter(e=>{if(!l)return!0;let t=l.toLowerCase();return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.source_query.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)}),L=async()=>{if(t){a(!0);try{let e=await eO.client.listMentalModels(t,y.length>0?y:void 0,y.length>0?w:void 0);r(e.items||[])}catch(e){console.error("Error loading mental models:",e)}finally{a(!1)}}},[R,B]=(0,eh.useState)(new Set),F=async n=>{if(!t)return;let i=n.last_refreshed_at;B(e=>new Set(e).add(n.id));try{await eO.client.refreshMentalModel(t,n.id);for(let a=0;a<120;a++){await new Promise(e=>setTimeout(e,1e3));let a=await eO.client.getMentalModel(t,n.id);if(a.last_refreshed_at!==i){r(e=>e.map(e=>e.id===n.id?a:e)),p?.id===n.id&&g(a),em.toast.success(e("toastRefreshed"));return}}em.toast.error(e("toastRefreshTimeout"))}catch{}finally{B(e=>{let t=new Set(e);return t.delete(n.id),t})}},z=async()=>{if(t&&_){M(!0);try{await eO.client.deleteMentalModel(t,_.id),r(e=>e.filter(e=>e.id!==_.id)),p?.id===_.id&&g(null),E(null)}catch(e){}finally{M(!1)}}},V=async()=>{if(t&&O){P(!0);try{let e=await eO.client.clearMentalModel(t,O.id);r(t=>t.map(t=>t.id===e.id?e:t)),p?.id===e.id&&g(e),em.toast.success("Mental model content cleared"),A(null)}catch{}finally{P(!1)}}};if((0,eh.useEffect)(()=>{t&&L()},[t,y,w]),(0,eh.useEffect)(()=>{let e=e=>{"Escape"===e.key&&g(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,eh.useEffect)(()=>{d(1)},[l,y,w]),!t)return(0,ed.jsx)(pW.Card,{children:(0,ed.jsx)(pW.CardContent,{className:"p-10 text-center",children:(0,ed.jsx)("p",{className:"text-muted-foreground",children:e("selectBankPrompt")})})});let H=Math.ceil(I.length/100),U=(u-1)*100,W=U+100,Y=I.slice(U,W);return(0,ed.jsxs)("div",{children:[i?(0,ed.jsxs)("div",{className:"text-center py-12",children:[(0,ed.jsx)(eV,{className:"w-8 h-8 mx-auto mb-3 text-muted-foreground animate-spin"}),(0,ed.jsx)("p",{className:"text-muted-foreground",children:e("loading")})]}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:"mb-4 flex items-center gap-3 flex-wrap",children:[(0,ed.jsx)(eD.Input,{type:"text",value:l,onChange:e=>c(e.target.value),placeholder:e("filterPlaceholder"),className:"w-80 h-9"}),(0,ed.jsx)(fZ,{value:y,onChange:b,fetchSuggestions:async e=>{if(!t)return[];let n=e?`${e}*`:void 0;return(await eO.client.listTags(t,n,20,"mental_models")).items.map(e=>e.tag)},matchMode:w,onMatchModeChange:N,className:"flex-1 min-w-[260px]"}),(0,ed.jsxs)(eA.Button,{onClick:()=>f(!0),size:"sm",children:[(0,ed.jsx)(fJ.Plus,{className:"w-4 h-4 mr-2"}),e("addMentalModel")]})]}),(0,ed.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ed.jsx)("div",{className:"text-sm text-muted-foreground",children:l||y.length>0?e("countFiltered",{filtered:I.length,total:n.length}):e("count",{count:n.length})}),(0,ed.jsx)("div",{className:"flex items-center gap-3",children:(0,ed.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ed.jsxs)("button",{onClick:()=>s("files"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"files"===o?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ed.jsx)(wT,{className:"w-4 h-4"}),e("viewList")]}),(0,ed.jsxs)("button",{onClick:()=>s("dashboard"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"dashboard"===o?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ed.jsx)(Vt,{className:"w-4 h-4"}),e("viewDashboard")]})]})})]}),I.length>0?(0,ed.jsxs)(ed.Fragment,{children:["dashboard"===o&&(0,ed.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Y.map(t=>(0,ed.jsx)(pW.Card,{className:`cursor-pointer transition-all hover:shadow-md hover:border-primary/50 ${p?.id===t.id?"border-primary shadow-md":""}`,onClick:()=>g(t),children:(0,ed.jsxs)(pW.CardContent,{className:"p-4",children:[(0,ed.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,ed.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ed.jsx)("h3",{className:"font-semibold text-foreground mb-1 truncate",children:t.name}),(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate",children:t.id}),(0,ed.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium flex-shrink-0 ${t.trigger?.refresh_after_consolidation?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-slate-500/10 text-slate-600 dark:text-slate-400"}`,children:t.trigger?.refresh_after_consolidation?e("badgeAutoRefresh"):e("badgeManual")})]})]}),(0,ed.jsx)(Vr,{m:t,refreshing:R.has(t.id),onEdit:e=>{C(e),k(!0)},onRefresh:F,onClear:e=>A({id:e.id,name:e.name}),onDelete:e=>E({id:e.id,name:e.name}),triggerClassName:"h-7 w-7 ml-2 flex-shrink-0"})]}),(0,ed.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:t.source_query}),(0,ed.jsxs)("div",{className:"relative mb-3 border-t border-border pt-3 max-h-40 overflow-hidden",children:[(0,ed.jsx)(bM,{children:t.content}),(0,ed.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-card to-transparent"})]}),(0,ed.jsxs)("div",{className:"flex items-center justify-between text-xs border-t border-border pt-3",children:[(0,ed.jsx)("div",{className:"flex items-center gap-2",children:t.tags.length>0&&(0,ed.jsxs)("div",{className:"flex gap-1",children:[t.tags.slice(0,2).map(e=>(0,ed.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e)),t.tags.length>2&&(0,ed.jsxs)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-muted text-muted-foreground",children:["+",t.tags.length-2]})]})}),(0,ed.jsx)("div",{className:"text-muted-foreground",title:bP(t.last_refreshed_at),children:bD(t.last_refreshed_at)})]})]})},t.id))}),"files"===o&&(0,ed.jsx)(Vo,{mentalModels:I,selectedId:v,onSelect:x,onOpenDetail:g,refreshingIds:R,onEdit:e=>{C(e),k(!0)},onRefresh:F,onClear:e=>A({id:e.id,name:e.name}),onDelete:e=>E({id:e.id,name:e.name})}),"files"!==o&&H>1&&(0,ed.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ed.jsxs)("div",{className:"text-xs text-muted-foreground",children:[U+1,"-",Math.min(W,I.length)," of"," ",I.length]}),(0,ed.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:1===u,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eR,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>d(e=>Math.max(1,e-1)),disabled:1===u,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eS,{className:"h-3 w-3"})}),(0,ed.jsxs)("span",{className:"text-xs px-2",children:[u," / ",H]}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>d(e=>Math.min(H,e+1)),disabled:u===H,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eC.ChevronRight,{className:"h-3 w-3"})}),(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>d(H),disabled:u===H,className:"h-7 w-7 p-0",children:(0,ed.jsx)(eB,{className:"h-3 w-3"})})]})]})]}):(0,ed.jsxs)("div",{className:"p-6 border border-dashed border-border rounded-lg text-center",children:[(0,ed.jsx)(ew,{className:"w-6 h-6 mx-auto mb-2 text-muted-foreground"}),(0,ed.jsx)("p",{className:"text-sm text-muted-foreground",children:l?e("emptyFilterMatch"):e("emptyNoModels")})]})]}),(0,ed.jsx)(Vi,{open:h,onClose:()=>f(!1),onCreated:()=>{f(!1),L()}}),(0,ed.jsx)(f8,{open:!!_,onOpenChange:e=>!e&&E(null),children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:e("deleteDialogTitle")}),(0,ed.jsxs)(pb,{children:[e("deleteDialogDescription",{name:_?.name??""}),(0,ed.jsx)("br",{}),(0,ed.jsx)("br",{}),(0,ed.jsx)("span",{className:"text-destructive font-semibold",children:e("deleteDialogWarning")})]})]}),(0,ed.jsxs)(px,{className:"flex-row justify-end space-x-2",children:[(0,ed.jsx)(pN,{className:"mt-0",children:e("deleteDialogCancel")}),(0,ed.jsxs)(pw,{onClick:z,disabled:T,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[T?(0,ed.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}):null,e("deleteDialogConfirm")]})]})]})}),(0,ed.jsx)(f8,{open:!!O,onOpenChange:e=>!e&&A(null),children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:e("clearDialogTitle")}),(0,ed.jsxs)(pb,{children:[e.rich("clearDialogDescription",{name:O?.name??"",bold:e=>(0,ed.jsx)("span",{className:"font-semibold",children:e})}),(0,ed.jsx)("br",{}),(0,ed.jsx)("br",{}),e("clearDialogReSynth")]})]}),(0,ed.jsxs)(px,{className:"flex-row justify-end space-x-2",children:[(0,ed.jsx)(pN,{className:"mt-0",children:e("cancelButton")}),(0,ed.jsxs)(pw,{onClick:V,disabled:D,children:[D?(0,ed.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}):null,e("clearDialogConfirm")]})]})]})}),(0,ed.jsx)(bG,{mentalModelId:p?.id??null,onClose:()=>g(null),onDelete:e=>E({id:e.id,name:e.name}),onClear:e=>A({id:e.id,name:e.name}),onEdit:e=>{C(e),k(!0)},onRefreshed:e=>{r(t=>t.map(t=>t.id===e.id?e:t)),g(e)}}),S&&(0,ed.jsx)(Va,{open:j,mentalModel:S,onClose:()=>{k(!1),C(null)},onUpdated:e=>{r(t=>t.map(t=>t.id===e.id?e:t)),g(e),k(!1),C(null)}})]})}function Vr({m:e,refreshing:t,onEdit:n,onRefresh:r,onClear:i,onDelete:a,triggerClassName:o}){let s=(0,ep.useTranslations)("mentalModels");return(0,ed.jsxs)(f2.DropdownMenu,{children:[(0,ed.jsx)(f2.DropdownMenuTrigger,{asChild:!0,children:(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",className:`p-0 text-muted-foreground ${o??"h-8 w-8"}`,onClick:e=>e.stopPropagation(),"aria-label":s("actionsAriaLabel"),children:(0,ed.jsx)(pS,{className:"h-4 w-4"})})}),(0,ed.jsxs)(f2.DropdownMenuContent,{align:"end",onClick:e=>e.stopPropagation(),children:[(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>n(e),children:[(0,ed.jsx)(pk,{className:"h-4 w-4 mr-2"}),s("actionEdit")]}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>r(e),disabled:t,children:[(0,ed.jsx)(eV,{className:`h-4 w-4 mr-2 ${t?"animate-spin":""}`}),s("actionRefresh")]}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>i(e),children:[(0,ed.jsx)(mA,{className:"h-4 w-4 mr-2"}),s("actionClearContent")]}),(0,ed.jsx)(f2.DropdownMenuSeparator,{}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>a(e),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ed.jsx)(pj,{className:"h-4 w-4 mr-2"}),s("actionDelete")]})]})]})}function Vi({open:e,onClose:t,onCreated:n}){let r=(0,ep.useTranslations)("mentalModels"),{currentBank:i}=(0,ev.useBank)(),[a,o]=(0,eh.useState)(!1),[s,l]=(0,eh.useState)({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),c=async()=>{if(i&&s.name.trim()&&s.sourceQuery.trim()){o(!0);try{let e,t=s.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),a=parseInt(s.maxTokens)||2048,o=s.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(s.tagGroups.trim())try{e=JSON.parse(s.tagGroups.trim())}catch{em.toast.error(r("invalidTagGroupsJson"));return}let c=s.recallMaxTokens.trim()?parseInt(s.recallMaxTokens,10):void 0,u=s.recallChunksMaxTokens.trim()?parseInt(s.recallChunksMaxTokens,10):void 0,d="true"===s.includeChunks||"false"!==s.includeChunks&&void 0;await eO.client.createMentalModel(i,{id:s.id.trim()||void 0,name:s.name.trim(),source_query:s.sourceQuery.trim(),tags:t.length>0?t:void 0,max_tokens:a,trigger:{mode:s.mode,refresh_after_consolidation:s.autoRefresh,fact_types:s.factTypes.length>0?s.factTypes:void 0,exclude_mental_models:s.excludeMentalModels||void 0,exclude_mental_model_ids:o.length>0?o:void 0,tags_match:s.tagsMatch||void 0,tag_groups:e,include_chunks:d,recall_max_tokens:c,recall_chunks_max_tokens:u}}),l({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),n()}catch(e){}finally{o(!1)}}};return(0,ed.jsx)(tH.Dialog,{open:e,onOpenChange:e=>{e||(l({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),t())},children:(0,ed.jsxs)(tH.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsx)(tH.DialogTitle,{children:r("createDialogTitle")}),(0,ed.jsx)(tH.DialogDescription,{children:r("createDialogDescription")})]}),(0,ed.jsxs)(tW.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ed.jsxs)(tW.TabsList,{className:"w-full",children:[(0,ed.jsx)(tW.TabsTrigger,{value:"general",className:"flex-1",children:r("tabGeneral")}),(0,ed.jsx)(tW.TabsTrigger,{value:"options",className:"flex-1",children:r("tabOptions")})]}),(0,ed.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 px-1.5",children:[(0,ed.jsxs)(tW.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("fieldId")}),(0,ed.jsx)(eD.Input,{value:s.id,onChange:e=>l({...s,id:e.target.value}),placeholder:r("fieldIdPlaceholder")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("fieldName")}),(0,ed.jsx)(eD.Input,{value:s.name,onChange:e=>l({...s,name:e.target.value}),placeholder:r("fieldNamePlaceholder")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("fieldSourceQuery")}),(0,ed.jsx)(pK.Textarea,{value:s.sourceQuery,onChange:e=>l({...s,sourceQuery:e.target.value}),placeholder:r("fieldSourceQueryPlaceholder"),className:"min-h-[140px] font-mono text-sm leading-6 whitespace-pre-wrap",spellCheck:!1})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("fieldMaxTokens")}),(0,ed.jsx)(eD.Input,{type:"number",value:s.maxTokens,onChange:e=>l({...s,maxTokens:e.target.value}),placeholder:r("fieldMaxTokensPlaceholder"),min:"256",max:"8192"})]})]}),(0,ed.jsxs)(tW.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ed.jsxs)("section",{className:"space-y-4",children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:r("optionsSectionRefresh")}),(0,ed.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ed.jsx)(pB.Checkbox,{id:"auto-refresh",checked:s.autoRefresh,onCheckedChange:e=>l({...s,autoRefresh:!0===e})}),(0,ed.jsx)("label",{htmlFor:"auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:r("optionsAutoRefreshLabel")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("optionsRefreshModeLabel")}),(0,ed.jsxs)(tP.Select,{value:s.mode,onValueChange:e=>l({...s,mode:e}),children:[(0,ed.jsx)(tP.SelectTrigger,{children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"full",children:r("optionsRefreshModeFull")}),(0,ed.jsx)(tP.SelectItem,{value:"delta",children:r("optionsRefreshModeDelta")})]})]}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:r("optionsRefreshModeDeltaDescription")})]})]}),(0,ed.jsxs)("section",{className:"space-y-4",children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:r("optionsSectionOtherModels")}),(0,ed.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ed.jsx)(pB.Checkbox,{id:"exclude-mental-models",checked:s.excludeMentalModels,onCheckedChange:e=>l({...s,excludeMentalModels:!0===e})}),(0,ed.jsx)("label",{htmlFor:"exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:r("optionsExcludeAllLabel")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("optionsExcludeIdsLabel")}),(0,ed.jsx)(eD.Input,{value:s.excludeMentalModelIds,onChange:e=>l({...s,excludeMentalModelIds:e.target.value}),placeholder:r("optionsExcludeIdsPlaceholder")})]})]}),(0,ed.jsxs)("section",{className:"space-y-4",children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:r("optionsSectionTags")}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("optionsTagsLabel")}),(0,ed.jsx)(eD.Input,{value:s.tags,onChange:e=>l({...s,tags:e.target.value}),placeholder:r("optionsTagsPlaceholder")}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:r("optionsTagsDescription")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("optionsTagsMatchLabel")}),(0,ed.jsxs)(tP.Select,{value:s.tagsMatch,onValueChange:e=>l({...s,tagsMatch:"default"===e?"":e}),children:[(0,ed.jsx)(tP.SelectTrigger,{children:(0,ed.jsx)(tP.SelectValue,{placeholder:r("optionsTagsMatchDefaultPlaceholder")})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"default",children:r("optionsTagsMatchDefault")}),(0,ed.jsx)(tP.SelectItem,{value:"any",children:r("optionsTagsMatchAny")}),(0,ed.jsx)(tP.SelectItem,{value:"all",children:r("optionsTagsMatchAll")}),(0,ed.jsx)(tP.SelectItem,{value:"any_strict",children:r("optionsTagsMatchAnyStrict")}),(0,ed.jsx)(tP.SelectItem,{value:"all_strict",children:r("optionsTagsMatchAllStrict")})]})]}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:r("optionsTagsMatchDescription")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("optionsTagGroupsLabel")}),(0,ed.jsx)(pK.Textarea,{value:s.tagGroups,onChange:e=>l({...s,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:r("optionsTagGroupsDescription")})]})]}),(0,ed.jsxs)("section",{className:"space-y-4",children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:r("optionsSectionRecall")}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:r("optionsRecallDescription")}),(0,ed.jsxs)("div",{className:"space-y-3",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("optionsFactTypesLabel")}),(0,ed.jsx)(pU,{value:s.factTypes,onChange:e=>l({...s,factTypes:e})}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:r("optionsFactTypesEmpty")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("optionsIncludeChunksLabel")}),(0,ed.jsxs)(tP.Select,{value:s.includeChunks||"default",onValueChange:e=>l({...s,includeChunks:"default"===e?"":e}),children:[(0,ed.jsx)(tP.SelectTrigger,{children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"default",children:r("optionsIncludeChunksDefault")}),(0,ed.jsx)(tP.SelectItem,{value:"true",children:r("optionsIncludeChunksYes")}),(0,ed.jsx)(tP.SelectItem,{value:"false",children:r("optionsIncludeChunksNo")})]})]})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("optionsRecallMaxTokensLabel")}),(0,ed.jsx)(eD.Input,{type:"number",value:s.recallMaxTokens,onChange:e=>l({...s,recallMaxTokens:e.target.value}),placeholder:r("optionsRecallMaxTokensPlaceholder"),min:"0"}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:r("optionsRecallMaxTokensDescription")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:r("optionsRecallChunksMaxTokensLabel")}),(0,ed.jsx)(eD.Input,{type:"number",value:s.recallChunksMaxTokens,onChange:e=>l({...s,recallChunksMaxTokens:e.target.value}),placeholder:r("optionsRecallChunksMaxTokensPlaceholder"),min:"0"}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:r("optionsRecallChunksMaxTokensDescription")})]})]})]})]})]}),(0,ed.jsxs)(tH.DialogFooter,{children:[(0,ed.jsx)(eA.Button,{variant:"outline",onClick:t,disabled:a,children:r("cancelButton")}),(0,ed.jsx)(eA.Button,{onClick:c,disabled:a||!s.name.trim()||!s.sourceQuery.trim(),children:a?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}),r("creatingButton")]}):r("createButton")})]})]})})}function Va({open:e,mentalModel:t,onClose:n,onUpdated:r}){let i=(0,ep.useTranslations)("mentalModels"),{currentBank:a}=(0,ev.useBank)(),[o,s]=(0,eh.useState)(!1),l=()=>({name:t.name,sourceQuery:t.source_query,maxTokens:String(t.max_tokens||2048),tags:t.tags.join(", "),autoRefresh:t.trigger?.refresh_after_consolidation||!1,mode:t.trigger?.mode||"full",factTypes:t.trigger?.fact_types||[],excludeMentalModels:t.trigger?.exclude_mental_models||!1,excludeMentalModelIds:(t.trigger?.exclude_mental_model_ids||[]).join(", "),tagsMatch:t.trigger?.tags_match||"",tagGroups:t.trigger?.tag_groups?JSON.stringify(t.trigger.tag_groups,null,2):"",includeChunks:t.trigger?.include_chunks===!0?"true":t.trigger?.include_chunks===!1?"false":"",recallMaxTokens:t.trigger?.recall_max_tokens!=null?String(t.trigger.recall_max_tokens):"",recallChunksMaxTokens:t.trigger?.recall_chunks_max_tokens!=null?String(t.trigger.recall_chunks_max_tokens):""}),[c,u]=(0,eh.useState)(l);(0,eh.useEffect)(()=>{e&&u(l())},[e,t]);let d=async()=>{if(a&&c.name.trim()&&c.sourceQuery.trim()){s(!0);try{let e,o=c.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),s=parseInt(c.maxTokens)||2048,l=c.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(c.tagGroups.trim())try{e=JSON.parse(c.tagGroups.trim())}catch{em.toast.error(i("invalidTagGroupsJson"));return}let u=c.recallMaxTokens.trim()?parseInt(c.recallMaxTokens,10):void 0,d=c.recallChunksMaxTokens.trim()?parseInt(c.recallChunksMaxTokens,10):void 0,h="true"===c.includeChunks||"false"!==c.includeChunks&&void 0,f=await eO.client.updateMentalModel(a,t.id,{name:c.name.trim(),source_query:c.sourceQuery.trim(),tags:o.length>0?o:void 0,max_tokens:s,trigger:{mode:c.mode,refresh_after_consolidation:c.autoRefresh,fact_types:c.factTypes.length>0?c.factTypes:void 0,exclude_mental_models:c.excludeMentalModels||void 0,exclude_mental_model_ids:l.length>0?l:void 0,tags_match:c.tagsMatch||void 0,tag_groups:e,include_chunks:h,recall_max_tokens:u,recall_chunks_max_tokens:d}});r(f),n()}catch(e){}finally{s(!1)}}};return(0,ed.jsx)(tH.Dialog,{open:e,onOpenChange:e=>!e&&n(),children:(0,ed.jsxs)(tH.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsx)(tH.DialogTitle,{children:i("updateDialogTitle")}),(0,ed.jsx)(tH.DialogDescription,{children:i("updateDialogDescription")})]}),(0,ed.jsxs)(tW.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ed.jsxs)(tW.TabsList,{className:"w-full",children:[(0,ed.jsx)(tW.TabsTrigger,{value:"general",className:"flex-1",children:i("tabGeneral")}),(0,ed.jsx)(tW.TabsTrigger,{value:"options",className:"flex-1",children:i("tabOptions")})]}),(0,ed.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 px-1.5",children:[(0,ed.jsxs)(tW.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:i("fieldId")}),(0,ed.jsx)(eD.Input,{value:t.id,disabled:!0,className:"bg-muted"})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("fieldName")}),(0,ed.jsx)(eD.Input,{value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:i("fieldNamePlaceholder")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("fieldSourceQuery")}),(0,ed.jsx)(pK.Textarea,{value:c.sourceQuery,onChange:e=>u({...c,sourceQuery:e.target.value}),placeholder:i("fieldSourceQueryPlaceholder"),className:"min-h-[140px] font-mono text-sm leading-6 whitespace-pre-wrap",spellCheck:!1})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("fieldMaxTokens")}),(0,ed.jsx)(eD.Input,{type:"number",value:c.maxTokens,onChange:e=>u({...c,maxTokens:e.target.value}),placeholder:i("fieldMaxTokensPlaceholder"),min:"256",max:"8192"})]})]}),(0,ed.jsxs)(tW.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ed.jsxs)("section",{className:"space-y-4",children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:i("optionsSectionRefresh")}),(0,ed.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ed.jsx)(pB.Checkbox,{id:"update-auto-refresh",checked:c.autoRefresh,onCheckedChange:e=>u({...c,autoRefresh:!0===e})}),(0,ed.jsx)("label",{htmlFor:"update-auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:i("optionsAutoRefreshLabel")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("optionsRefreshModeLabel")}),(0,ed.jsxs)(tP.Select,{value:c.mode,onValueChange:e=>u({...c,mode:e}),children:[(0,ed.jsx)(tP.SelectTrigger,{children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"full",children:i("optionsRefreshModeFull")}),(0,ed.jsx)(tP.SelectItem,{value:"delta",children:i("optionsRefreshModeDelta")})]})]}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:i("optionsRefreshModeDeltaDescription")})]})]}),(0,ed.jsxs)("section",{className:"space-y-4",children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:i("optionsSectionOtherModels")}),(0,ed.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ed.jsx)(pB.Checkbox,{id:"update-exclude-mental-models",checked:c.excludeMentalModels,onCheckedChange:e=>u({...c,excludeMentalModels:!0===e})}),(0,ed.jsx)("label",{htmlFor:"update-exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:i("optionsExcludeAllLabel")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("optionsExcludeIdsLabel")}),(0,ed.jsx)(eD.Input,{value:c.excludeMentalModelIds,onChange:e=>u({...c,excludeMentalModelIds:e.target.value}),placeholder:i("optionsExcludeIdsPlaceholder")})]})]}),(0,ed.jsxs)("section",{className:"space-y-4",children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:i("optionsSectionTags")}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("optionsTagsLabel")}),(0,ed.jsx)(eD.Input,{value:c.tags,onChange:e=>u({...c,tags:e.target.value}),placeholder:i("optionsTagsPlaceholder")}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:i("optionsTagsDescription")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("optionsTagsMatchLabel")}),(0,ed.jsxs)(tP.Select,{value:c.tagsMatch||"default",onValueChange:e=>u({...c,tagsMatch:"default"===e?"":e}),children:[(0,ed.jsx)(tP.SelectTrigger,{children:(0,ed.jsx)(tP.SelectValue,{placeholder:i("optionsTagsMatchDefaultPlaceholder")})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"default",children:i("optionsTagsMatchDefault")}),(0,ed.jsx)(tP.SelectItem,{value:"any",children:i("optionsTagsMatchAny")}),(0,ed.jsx)(tP.SelectItem,{value:"all",children:i("optionsTagsMatchAll")}),(0,ed.jsx)(tP.SelectItem,{value:"any_strict",children:i("optionsTagsMatchAnyStrict")}),(0,ed.jsx)(tP.SelectItem,{value:"all_strict",children:i("optionsTagsMatchAllStrict")})]})]}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:i("optionsTagsMatchDescription")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("optionsTagGroupsLabel")}),(0,ed.jsx)(pK.Textarea,{value:c.tagGroups,onChange:e=>u({...c,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:i("optionsTagGroupsDescription")})]})]}),(0,ed.jsxs)("section",{className:"space-y-4",children:[(0,ed.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:i("optionsSectionRecall")}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:i("optionsRecallDescription")}),(0,ed.jsxs)("div",{className:"space-y-3",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("optionsFactTypesLabel")}),(0,ed.jsx)(pU,{value:c.factTypes,onChange:e=>u({...c,factTypes:e})}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:i("optionsFactTypesEmpty")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("optionsIncludeChunksLabel")}),(0,ed.jsxs)(tP.Select,{value:c.includeChunks||"default",onValueChange:e=>u({...c,includeChunks:"default"===e?"":e}),children:[(0,ed.jsx)(tP.SelectTrigger,{children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"default",children:i("optionsIncludeChunksDefault")}),(0,ed.jsx)(tP.SelectItem,{value:"true",children:i("optionsIncludeChunksYes")}),(0,ed.jsx)(tP.SelectItem,{value:"false",children:i("optionsIncludeChunksNo")})]})]})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("optionsRecallMaxTokensLabel")}),(0,ed.jsx)(eD.Input,{type:"number",value:c.recallMaxTokens,onChange:e=>u({...c,recallMaxTokens:e.target.value}),placeholder:i("optionsRecallMaxTokensPlaceholder"),min:"0"}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:i("optionsRecallMaxTokensDescription")})]}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)("label",{className:"text-sm font-medium text-foreground",children:i("optionsRecallChunksMaxTokensLabel")}),(0,ed.jsx)(eD.Input,{type:"number",value:c.recallChunksMaxTokens,onChange:e=>u({...c,recallChunksMaxTokens:e.target.value}),placeholder:i("optionsRecallChunksMaxTokensPlaceholder"),min:"0"}),(0,ed.jsx)("p",{className:"text-xs text-muted-foreground",children:i("optionsRecallChunksMaxTokensDescription")})]})]})]})]})]}),(0,ed.jsxs)(tH.DialogFooter,{children:[(0,ed.jsx)(eA.Button,{variant:"outline",onClick:n,disabled:o,children:i("cancelButton")}),(0,ed.jsx)(eA.Button,{onClick:d,disabled:o||!c.name.trim()||!c.sourceQuery.trim(),children:o?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}),i("updatingButton")]}):i("updateButton")})]})]})})}function Vo({mentalModels:e,selectedId:t,onSelect:n,onOpenDetail:r,refreshingIds:i,onEdit:a,onRefresh:o,onClear:s,onDelete:l}){let c=(0,ep.useTranslations)("mentalModels"),u=t&&e.some(e=>e.id===t)?t:e[0]?.id??null,d=e.find(e=>e.id===u)??null;return(0,ed.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-[320px_1fr] gap-0 overflow-hidden min-h-[600px]",children:[(0,ed.jsx)("aside",{className:"border-r border-border bg-muted/30 overflow-y-auto max-h-[calc(100vh-260px)]",children:(0,ed.jsx)("ul",{className:"py-1",children:e.map(e=>{let t=e.id===u;return(0,ed.jsx)("li",{children:(0,ed.jsxs)("button",{onClick:()=>n(e.id),className:`w-full flex items-start gap-2 px-3 py-2 text-left transition-colors border-l-2 ${t?"bg-primary/10 border-primary text-foreground":"border-transparent text-muted-foreground hover:bg-muted hover:text-foreground"}`,title:`${e.name}
|
|
9
|
-
${e.source_query}`,children:[(0,ed.jsx)(ej.FileText,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5"}),(0,ed.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("span",{className:`truncate text-sm font-medium ${t?"text-foreground":""}`,children:e.name}),(0,ed.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",title:bP(e.last_refreshed_at),children:bD(e.last_refreshed_at)})]}),e.source_query&&(0,ed.jsx)("div",{className:"text-xs text-muted-foreground/80 truncate italic mt-0.5",children:e.source_query})]})]})},e.id)})})}),(0,ed.jsx)("section",{className:"overflow-y-auto max-h-[calc(100vh-260px)]",children:d?(0,ed.jsxs)("article",{className:"p-6",children:[(0,ed.jsx)("header",{className:"mb-4 pb-4 border-b border-border",children:(0,ed.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,ed.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ed.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:d.name}),d.source_query&&(0,ed.jsxs)("p",{className:"text-sm text-muted-foreground mt-1 italic",children:["“",d.source_query,"”"]}),(0,ed.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,ed.jsxs)("span",{title:bP(d.last_refreshed_at),children:["Refreshed ",bD(d.last_refreshed_at)]}),d.tags.length>0&&(0,ed.jsx)("div",{className:"flex gap-1",children:d.tags.map(e=>(0,ed.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e))})]})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,ed.jsx)(eA.Button,{variant:"outline",size:"sm",onClick:()=>r(d),children:"Open"}),(0,ed.jsx)(Vr,{m:d,refreshing:i.has(d.id),onEdit:a,onRefresh:o,onClear:s,onDelete:l})]})]})}),d.content?(0,ed.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:(0,ed.jsx)(bM,{children:d.content})}):(0,ed.jsx)("p",{className:"text-sm text-muted-foreground italic",children:c("emptyContent")})]}):(0,ed.jsxs)("div",{className:"p-10 text-center text-muted-foreground",children:[(0,ed.jsx)(ej.FileText,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),(0,ed.jsx)("p",{className:"text-sm",children:c("selectModelPrompt")})]})})]})}let Vs=(0,eb.default)("eye-off",[["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"}]]);var tz=tz;let Vl=["consolidation.completed","retain.completed"],Vc={url:"",secret:"",event_types:["consolidation.completed"],enabled:!0,http_config:{method:"POST",timeout_seconds:30,headers:[],params:[]}};function Vu(e){return Object.fromEntries(e.filter(e=>e.key.trim()).map(e=>[e.key,e.value]))}function Vd(e){return{method:e.method,timeout_seconds:e.timeout_seconds,headers:Vu(e.headers),params:Vu(e.params)}}function Vh({label:e,pairs:t,onChange:n}){let r=(0,ep.useTranslations)("webhooksView"),i=(e,r,i)=>{n(t.map((t,n)=>n===e?{...t,[r]:i}:t))};return(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsx)(e3,{children:e}),(0,ed.jsxs)(eA.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>n([...t,{key:"",value:""}]),children:[(0,ed.jsx)(fJ.Plus,{className:"w-3 h-3 mr-1"}),r("kvAdd")]})]}),t.length>0&&(0,ed.jsx)("div",{className:"space-y-1.5",children:t.map((e,a)=>(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)(eD.Input,{placeholder:r("kvKeyPlaceholder"),value:e.key,onChange:e=>i(a,"key",e.target.value),className:"h-8 text-sm flex-1"}),(0,ed.jsx)(eD.Input,{placeholder:r("kvValuePlaceholder"),value:e.value,onChange:e=>i(a,"value",e.target.value),className:"h-8 text-sm flex-1"}),(0,ed.jsx)("button",{type:"button",onClick:()=>n(t.filter((e,t)=>t!==a)),className:"text-muted-foreground hover:text-foreground shrink-0","aria-label":r("kvRemovePair"),children:(0,ed.jsx)(tF.X,{className:"w-4 h-4"})})]},a))})]})}function Vf({status:e}){let t=(0,ep.useTranslations)("webhooksView");return"completed"===e?(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ed.jsx)(eH,{className:"w-3 h-3"}),t("deliveryStatusDelivered")]}):"pending"===e?(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ed.jsx)(eU,{className:"w-3 h-3"}),t("deliveryStatusPending")]}):"failed"===e?(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ed.jsx)(wi,{className:"w-3 h-3"}),t("deliveryStatusFailed")]}):(0,ed.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:e})}function Vp({delivery:e,formatDate:t}){let n=(0,ep.useTranslations)("webhooksView"),[r,i]=(0,eh.useState)(!1),a=e.last_response_body||e.last_error;return(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)(eq,{className:a?"cursor-pointer hover:bg-muted/40":void 0,onClick:()=>a&&i(e=>!e),children:[(0,ed.jsx)(eZ,{className:"w-8 pl-3 pr-0",children:a?r?(0,ed.jsx)(pC.ChevronDown,{className:"w-4 h-4 text-muted-foreground"}):(0,ed.jsx)(eC.ChevronRight,{className:"w-4 h-4 text-muted-foreground"}):(0,ed.jsx)("span",{className:"w-4 h-4 inline-block"})}),(0,ed.jsx)(eZ,{children:(0,ed.jsx)(Vf,{status:e.status})}),(0,ed.jsx)(eZ,{children:null!=e.last_response_status?(0,ed.jsx)("span",{className:`font-mono text-xs px-1.5 py-0.5 rounded border ${e.last_response_status>=200&&e.last_response_status<300?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"}`,children:e.last_response_status}):(0,ed.jsx)("span",{className:"text-muted-foreground text-xs",children:"—"})}),(0,ed.jsx)(eZ,{className:"text-center text-sm",children:e.attempts}),(0,ed.jsx)(eZ,{className:"font-mono text-xs text-muted-foreground",children:e.event_type}),(0,ed.jsx)(eZ,{className:"text-xs text-muted-foreground whitespace-nowrap",children:t(e.created_at)})]}),r&&a&&(0,ed.jsx)(eq,{className:"bg-muted/20 hover:bg-muted/20",children:(0,ed.jsx)(eZ,{colSpan:6,className:"px-4 py-3",children:(0,ed.jsxs)("div",{className:"space-y-3",children:[e.last_error&&(0,ed.jsxs)("div",{className:"space-y-1",children:[(0,ed.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:n("expandedError")}),(0,ed.jsx)("p",{className:"font-mono text-xs text-red-600 dark:text-red-400 break-all",children:e.last_error})]}),e.last_response_body&&(0,ed.jsxs)("div",{className:"space-y-1",children:[(0,ed.jsxs)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:[n("expandedResponseBody"),e.last_attempt_at&&(0,ed.jsxs)("span",{className:"ml-2 normal-case font-normal",children:["· ",t(e.last_attempt_at)]})]}),(0,ed.jsx)("pre",{className:"font-mono text-xs bg-background rounded p-2 overflow-x-auto whitespace-pre-wrap break-all max-h-40 overflow-y-auto border border-border",children:e.last_response_body})]})]})})})]})}function Vm(){let e=(0,ep.useTranslations)("webhooksView"),{currentBank:t}=(0,ev.useBank)(),[n,r]=(0,eh.useState)([]),[i,a]=(0,eh.useState)(!1),[o,s]=(0,eh.useState)(!1),[l,c]=(0,eh.useState)(!1),[u,d]=(0,eh.useState)(null),[h,f]=(0,eh.useState)(null),[p,g]=(0,eh.useState)(!1),[v,x]=(0,eh.useState)(Vc),[y,b]=(0,eh.useState)(!1),[w,N]=(0,eh.useState)(null),[j,k]=(0,eh.useState)(Vc),[S,C]=(0,eh.useState)(!1),[_,E]=(0,eh.useState)(!1),[T,M]=(0,eh.useState)(!1),[O,A]=(0,eh.useState)(!1),[D,P]=(0,eh.useState)(null),[I,L]=(0,eh.useState)([]),[R,B]=(0,eh.useState)(!1),[F,z]=(0,eh.useState)(null),[V,H]=(0,eh.useState)(!1),U=async()=>{if(t){a(!0);try{let e=await eO.client.listWebhooks(t);r(e.items||[])}catch(e){console.error("Error loading webhooks:",e)}finally{a(!1)}}};(0,eh.useEffect)(()=>{t&&U()},[t]);let W=async()=>{if(t&&v.url){c(!0);try{await eO.client.createWebhook(t,{url:v.url,secret:v.secret||void 0,event_types:v.event_types.length>0?v.event_types:void 0,enabled:v.enabled,http_config:Vd(v.http_config)}),s(!1),x(Vc),g(!1),await U()}catch(e){}finally{c(!1)}}},Y=async e=>{if(t){d(e),f(null);try{await eO.client.deleteWebhook(t,e),await U()}catch(e){}finally{d(null)}}},G=async()=>{if(t&&w&&j.url){M(!0);try{let e={url:j.url,event_types:j.event_types,enabled:j.enabled,http_config:Vd(j.http_config)};_?e.secret=null:j.secret&&(e.secret=j.secret),await eO.client.updateWebhook(t,w.id,e),b(!1),await U()}catch{}finally{M(!1)}}},X=async e=>{if(t){P(e),A(!0),L([]),z(null),B(!0);try{let n=await eO.client.listWebhookDeliveries(t,e.id,50);L(n.items||[]),z(n.next_cursor??null)}catch(e){console.error("Error loading deliveries:",e)}finally{B(!1)}}},$=async()=>{if(t&&D&&F){H(!0);try{let e=await eO.client.listWebhookDeliveries(t,D.id,50,F);L(t=>[...t,...e.items||[]]),z(e.next_cursor??null)}catch(e){console.error("Error loading more deliveries:",e)}finally{H(!1)}}},q=t=>t?new Date(t).toLocaleString():e("formatDateNA");return t?(0,ed.jsxs)("div",{className:"space-y-4",children:[(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)("h3",{className:"text-lg font-semibold",children:e("title")}),(0,ed.jsx)("button",{onClick:()=>U(),className:"p-1 rounded hover:bg-muted transition-colors",title:e("refreshTitle"),"aria-label":e("refreshAriaLabel"),disabled:i,children:(0,ed.jsx)(eV,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${i?"animate-spin":""}`})})]}),(0,ed.jsx)("p",{className:"text-sm text-muted-foreground",children:e("webhookCount",{count:n.length})})]}),(0,ed.jsxs)(eA.Button,{size:"sm",onClick:()=>s(!0),children:[(0,ed.jsx)(fJ.Plus,{className:"w-4 h-4 mr-2"}),e("addWebhook")]})]}),n.length>0?(0,ed.jsx)("div",{className:"overflow-x-auto",children:(0,ed.jsxs)(eG,{children:[(0,ed.jsx)(eX,{children:(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eK,{children:e("tableHeaderUrl")}),(0,ed.jsx)(eK,{children:e("tableHeaderMethod")}),(0,ed.jsx)(eK,{children:e("tableHeaderEventTypes")}),(0,ed.jsx)(eK,{children:e("tableHeaderStatus")}),(0,ed.jsx)(eK,{children:e("tableHeaderCreatedAt")}),(0,ed.jsx)(eK,{className:"w-[120px]"})]})}),(0,ed.jsx)(e$,{children:n.map(t=>(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eZ,{className:"font-mono text-sm max-w-[300px] truncate",children:(0,ed.jsx)("span",{title:t.url,children:t.url})}),(0,ed.jsx)(eZ,{children:(0,ed.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium bg-muted text-muted-foreground border border-border",children:t.http_config?.method||"POST"})}),(0,ed.jsx)(eZ,{children:(0,ed.jsx)("div",{className:"flex flex-wrap gap-1",children:t.event_types.length>0?t.event_types.map(e=>(0,ed.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:e},e)):(0,ed.jsx)("span",{className:"text-xs text-muted-foreground",children:e("allEvents")})})}),(0,ed.jsx)(eZ,{children:t.enabled?(0,ed.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ed.jsx)(eH,{className:"w-3 h-3"}),e("statusEnabled")]}):(0,ed.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:e("statusDisabled")})}),(0,ed.jsx)(eZ,{className:"text-sm text-muted-foreground",children:q(t.created_at)}),(0,ed.jsx)(eZ,{children:(0,ed.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ed.jsxs)(eA.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>X(t),title:e("viewDeliveriesTitle"),children:[(0,ed.jsx)(ez,{className:"w-3 h-3 mr-1"}),e("deliveriesButton")]}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{let e;return N(t),void(k((e=t.http_config??{method:"POST",timeout_seconds:30,headers:{},params:{}},{url:t.url,secret:"",event_types:t.event_types,enabled:t.enabled,http_config:{method:e.method,timeout_seconds:e.timeout_seconds,headers:Object.entries(e.headers??{}).map(([e,t])=>({key:e,value:t})),params:Object.entries(e.params??{}).map(([e,t])=>({key:e,value:t}))}})),C(!1),E(!1),b(!0))},title:e("editWebhookTitle"),"aria-label":e("editWebhookAriaLabel"),children:(0,ed.jsx)(pk,{className:"w-3 h-3"})}),(0,ed.jsx)(eA.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:()=>f(t),disabled:u===t.id,title:e("deleteWebhookTitle"),"aria-label":e("deleteWebhookAriaLabel"),children:u===t.id?(0,ed.jsx)(tz.default,{className:"w-3 h-3 animate-spin"}):(0,ed.jsx)(pj,{className:"w-3 h-3"})})]})})]},t.id))})]})}):(0,ed.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:e("emptyStateCanManage")}),(0,ed.jsx)(tH.Dialog,{open:o,onOpenChange:e=>{e||(x(Vc),g(!1)),s(e)},children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsx)(tH.DialogTitle,{children:e("createDialogTitle")}),(0,ed.jsx)(tH.DialogDescription,{children:e("createDialogDescription")})]}),(0,ed.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsx)(e3,{children:e("formTypeLabel")}),(0,ed.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsxs)(e3,{htmlFor:"webhook-url",children:[e("formUrlLabel")," ",(0,ed.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ed.jsx)(eD.Input,{id:"webhook-url",type:"url",placeholder:e("formUrlPlaceholder"),value:v.url,onChange:e=>x(t=>({...t,url:e.target.value}))})]}),(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsx)(e3,{children:e("formMethodLabel")}),(0,ed.jsxs)(tP.Select,{value:v.http_config.method,onValueChange:e=>x(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ed.jsx)(tP.SelectTrigger,{children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"POST",children:"POST"}),(0,ed.jsx)(tP.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsx)(e3,{htmlFor:"webhook-timeout",children:e("formTimeoutLabel")}),(0,ed.jsx)(eD.Input,{id:"webhook-timeout",type:"number",min:1,max:300,value:v.http_config.timeout_seconds,onChange:e=>x(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsxs)(e3,{htmlFor:"webhook-secret",children:[e("formSecretLabel")," ",(0,ed.jsx)("span",{className:"text-muted-foreground text-xs",children:e("formSecretOptional")})]}),(0,ed.jsxs)("div",{className:"relative",children:[(0,ed.jsx)(eD.Input,{id:"webhook-secret",type:p?"text":"password",placeholder:e("formSecretPlaceholderOptional"),value:v.secret,onChange:e=>x(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ed.jsx)("button",{type:"button",onClick:()=>g(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,"aria-label":p?e("formHideSecret"):e("formShowSecret"),children:p?(0,ed.jsx)(Vs,{className:"w-4 h-4"}):(0,ed.jsx)(ez,{className:"w-4 h-4"})})]})]}),(0,ed.jsx)(Vh,{label:e("formCustomHeaders"),pairs:v.http_config.headers,onChange:e=>x(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ed.jsx)(Vh,{label:e("formQueryParams"),pairs:v.http_config.params,onChange:e=>x(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)(e3,{children:e("formEventTypes")}),(0,ed.jsx)("div",{className:"space-y-2",children:Vl.map(e=>(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)(pB.Checkbox,{id:`event-${e}`,checked:v.event_types.includes(e),onCheckedChange:()=>{x(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}}),(0,ed.jsx)(e3,{htmlFor:`event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ed.jsx)(tD.Switch,{id:"webhook-enabled",checked:v.enabled,onCheckedChange:e=>x(t=>({...t,enabled:e}))}),(0,ed.jsx)(e3,{htmlFor:"webhook-enabled",children:e("formEnabled")})]})]}),(0,ed.jsxs)(tH.DialogFooter,{children:[(0,ed.jsx)(eA.Button,{variant:"outline",onClick:()=>s(!1),disabled:l,children:e("cancel")}),(0,ed.jsx)(eA.Button,{onClick:W,disabled:l||!v.url,children:l?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),e("creating")]}):e("createWebhook")})]})]})}),(0,ed.jsx)(tH.Dialog,{open:y,onOpenChange:e=>{e||(N(null),k(Vc),C(!1),E(!1)),b(e)},children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsx)(tH.DialogTitle,{children:e("editDialogTitle")}),(0,ed.jsx)(tH.DialogDescription,{children:e("editDialogDescription")})]}),(0,ed.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsx)(e3,{children:e("formTypeLabel")}),(0,ed.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsxs)(e3,{htmlFor:"edit-webhook-url",children:[e("formUrlLabel")," ",(0,ed.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ed.jsx)(eD.Input,{id:"edit-webhook-url",type:"url",placeholder:e("formUrlPlaceholder"),value:j.url,onChange:e=>k(t=>({...t,url:e.target.value}))})]}),(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsx)(e3,{children:e("formMethodLabel")}),(0,ed.jsxs)(tP.Select,{value:j.http_config.method,onValueChange:e=>k(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ed.jsx)(tP.SelectTrigger,{children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{children:[(0,ed.jsx)(tP.SelectItem,{value:"POST",children:"POST"}),(0,ed.jsx)(tP.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsx)(e3,{htmlFor:"edit-webhook-timeout",children:e("formTimeoutLabel")}),(0,ed.jsx)(eD.Input,{id:"edit-webhook-timeout",type:"number",min:1,max:300,value:j.http_config.timeout_seconds,onChange:e=>k(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ed.jsxs)("div",{className:"space-y-1.5",children:[(0,ed.jsx)(e3,{htmlFor:"edit-webhook-secret",children:e("formSecretLabel")}),(0,ed.jsxs)("div",{className:"relative",children:[(0,ed.jsx)(eD.Input,{id:"edit-webhook-secret",type:S?"text":"password",placeholder:e("formSecretPlaceholderEdit"),value:j.secret,disabled:_,onChange:e=>k(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ed.jsx)("button",{type:"button",onClick:()=>C(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,"aria-label":S?e("formHideSecret"):e("formShowSecret"),children:S?(0,ed.jsx)(Vs,{className:"w-4 h-4"}):(0,ed.jsx)(ez,{className:"w-4 h-4"})})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ed.jsx)(pB.Checkbox,{id:"edit-clear-secret",checked:_,onCheckedChange:e=>{E(!!e),e&&k(e=>({...e,secret:""}))}}),(0,ed.jsx)(e3,{htmlFor:"edit-clear-secret",className:"text-xs text-muted-foreground cursor-pointer",children:e("formClearSecret")})]})]}),(0,ed.jsx)(Vh,{label:e("formCustomHeaders"),pairs:j.http_config.headers,onChange:e=>k(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ed.jsx)(Vh,{label:e("formQueryParams"),pairs:j.http_config.params,onChange:e=>k(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ed.jsxs)("div",{className:"space-y-2",children:[(0,ed.jsx)(e3,{children:e("formEventTypes")}),(0,ed.jsx)("div",{className:"space-y-2",children:Vl.map(e=>(0,ed.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ed.jsx)(pB.Checkbox,{id:`edit-event-${e}`,checked:j.event_types.includes(e),onCheckedChange:()=>k(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}),(0,ed.jsx)(e3,{htmlFor:`edit-event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ed.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ed.jsx)(tD.Switch,{id:"edit-webhook-enabled",checked:j.enabled,onCheckedChange:e=>k(t=>({...t,enabled:e}))}),(0,ed.jsx)(e3,{htmlFor:"edit-webhook-enabled",children:e("formEnabled")})]})]}),(0,ed.jsxs)(tH.DialogFooter,{children:[(0,ed.jsx)(eA.Button,{variant:"outline",onClick:()=>b(!1),disabled:T,children:e("cancel")}),(0,ed.jsx)(eA.Button,{onClick:G,disabled:T||!j.url,children:T?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),e("saving")]}):e("saveChanges")})]})]})}),(0,ed.jsx)(tH.Dialog,{open:!!h,onOpenChange:e=>{e||f(null)},children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-md",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsx)(tH.DialogTitle,{children:e("deleteDialogTitle")}),(0,ed.jsx)(tH.DialogDescription,{children:e("deleteDialogDescription")})]}),h&&(0,ed.jsx)("div",{className:"py-2",children:(0,ed.jsx)("p",{className:"font-mono text-sm truncate text-muted-foreground bg-muted px-3 py-2 rounded-md border border-border",children:h.url})}),(0,ed.jsxs)(tH.DialogFooter,{children:[(0,ed.jsx)(eA.Button,{variant:"outline",onClick:()=>f(null),children:e("cancel")}),(0,ed.jsx)(eA.Button,{variant:"destructive",onClick:()=>h&&Y(h.id),disabled:!!u,children:u?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),e("deleting")]}):e("deleteWebhookConfirm")})]})]})}),(0,ed.jsx)(tH.Dialog,{open:O,onOpenChange:e=>{e||(L([]),z(null)),A(e)},children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ed.jsxs)(tH.DialogHeader,{children:[(0,ed.jsx)(tH.DialogTitle,{children:e("deliveriesDialogTitle")}),D&&(0,ed.jsx)(tH.DialogDescription,{className:"font-mono text-xs truncate",children:D.url})]}),R?(0,ed.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ed.jsx)(tz.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):I.length>0?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("div",{className:"overflow-x-auto",children:(0,ed.jsxs)(eG,{children:[(0,ed.jsx)(eX,{children:(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eK,{className:"w-8 pl-3 pr-0"}),(0,ed.jsx)(eK,{children:e("deliveriesTableHeaderStatus")}),(0,ed.jsx)(eK,{children:e("deliveriesTableHeaderHttp")}),(0,ed.jsx)(eK,{className:"text-center",children:e("deliveriesTableHeaderAttempts")}),(0,ed.jsx)(eK,{children:e("deliveriesTableHeaderEvent")}),(0,ed.jsx)(eK,{children:e("deliveriesTableHeaderCreatedAt")})]})}),(0,ed.jsx)(e$,{children:I.map(e=>(0,ed.jsx)(Vp,{delivery:e,formatDate:q},e.id))})]})}),F&&(0,ed.jsx)("div",{className:"flex justify-center pt-2",children:(0,ed.jsxs)(eA.Button,{variant:"outline",size:"sm",onClick:$,disabled:V,children:[V&&(0,ed.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),e("loadMore")]})})]}):(0,ed.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:e("noDeliveries")})]})})]}):null}var Vg=["axis"],Vv=(0,eh.forwardRef)((e,t)=>eh.createElement(Ls,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Vg,tooltipPayloadSearcher:j5,categoricalChartProps:e,ref:t})),Vx=eh,Vy=["children"],Vb=(0,eh.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function Vw(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Vy);return eh.createElement(Vb.Provider,{value:n},t)}var VN=(e,t,n,r)=>AB(e,"xAxis",t,r),Vj=(e,t,n,r)=>AR(e,"xAxis",t,r),Vk=(e,t,n,r)=>AB(e,"yAxis",n,r),VS=(e,t,n,r)=>AR(e,"yAxis",n,r),VC=NX([Cf,VN,Vk,Vj,VS],(e,t,n,r,i)=>SA(e,"xAxis")?SF(t,r,!1):SF(n,i,!1));function V_(e){return"line"===e.type}var VE=NX([Om,(e,t,n,r,i)=>i],(e,t)=>e.filter(V_).find(e=>e.id===t)),VT=NX([Cf,VN,Vk,Vj,VS,VE,VC,Mc],(e,t,n,r,i,a,o,s)=>{var l,{chartData:c,dataStartIndex:u,dataEndIndex:d}=s;if(null!=a&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=o&&("horizontal"===e||"vertical"===e)){var{dataKey:h,data:f}=a;if(null!=(l=null!=f&&f.length>0?f:null==c?void 0:c.slice(u,d+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:l}=e;return l.map((e,l)=>{var c=SO(e,o);if("horizontal"===t)return{x:SL({axis:n,ticks:i,bandSize:s,entry:e,index:l}),y:null==c?null:r.scale(c),value:c,payload:e};var u=null==c?null:n.scale(c),d=SL({axis:r,ticks:a,bandSize:s,entry:e,index:l});return null==u||null==d?null:{x:u,y:d,value:c,payload:e}}).filter(Boolean)}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:h,bandSize:o,displayedData:l})}}),VM=e.i(7328);function VO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?VO(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VD(){return(VD=Object.assign.bind()).apply(null,arguments)}function VP(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var VI=(e,t,n,r,i)=>{var a=n-r;return jH(eo||(eo=VP(["M ",",",""])),e,t)+jH(es||(es=VP(["L ",",",""])),e+n,t)+jH(el||(el=VP(["L ",",",""])),e+n-a/2,t+i)+jH(ec||(ec=VP(["L ",",",""])),e+n-a/2-r,t+i)+jH(eu||(eu=VP(["L ",","," Z"])),e,t)},VL={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},VR=e=>{var t=Li(e,VL),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:l,animationDuration:c,animationBegin:u,isUpdateAnimationActive:d}=t,h=(0,eh.useRef)(null),[f,p]=(0,eh.useState)(-1),g=(0,eh.useRef)(i),v=(0,eh.useRef)(a),x=(0,eh.useRef)(o),y=(0,eh.useRef)(n),b=(0,eh.useRef)(r),w=Bu(e,"trapezoid-");if((0,eh.useEffect)(()=>{if(h.current&&h.current.getTotalLength)try{var e=h.current.getTotalLength();e&&p(e)}catch(e){}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||0===i&&0===a||0===o)return null;var N=(0,S5.clsx)("recharts-trapezoid",s);if(!d)return eh.createElement("g",null,eh.createElement("path",VD({},IT(t),{className:N,d:VI(n,r,i,a,o)})));var j=g.current,k=v.current,S=x.current,C=y.current,_=b.current,E="0px ".concat(-1===f?1:f,"px"),T="".concat(f,"px 0px"),M=Bv(["strokeDasharray"],c,l);return eh.createElement(BI,{animationId:w,key:w,canBegin:f>0,duration:c,easing:l,isActive:d,begin:u},e=>{var s=jQ(j,i,e),l=jQ(k,a,e),c=jQ(S,o,e),u=jQ(C,n,e),d=jQ(_,r,e);h.current&&(g.current=s,v.current=l,x.current=c,y.current=u,b.current=d);var f=e>0?{transition:M,strokeDasharray:T}:{strokeDasharray:E};return eh.createElement("path",VD({},IT(t),{className:N,d:VI(u,d,s,l,c),ref:h,style:VA(VA({},f),t.style)}))})};let VB=Math.cos,VF=Math.sin,Vz=Math.sqrt,VV=Math.PI,VH=2*VV;Vz(3);let VU={draw(e,t){let n=Vz(t/VV);e.moveTo(n,0),e.arc(0,0,n,0,VH)}},VW=Vz(1/3),VY=2*VW,VG=VF(VV/10)/VF(7*VV/10),VX=VF(VH/10)*VG,V$=-VB(VH/10)*VG,Vq=Vz(3);Vz(3);let VK=Vz(3)/2,VZ=1/Vz(12),VQ=(VZ/2+1)*3;var VJ=["type","size","sizeType"];function V0(){return(V0=Object.assign.bind()).apply(null,arguments)}function V1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function V2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V1(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var V5={symbolCircle:VU,symbolCross:{draw(e,t){let n=Vz(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},symbolDiamond:{draw(e,t){let n=Vz(t/VY),r=n*VW;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},symbolSquare:{draw(e,t){let n=Vz(t),r=-n/2;e.rect(r,r,n,n)}},symbolStar:{draw(e,t){let n=Vz(.8908130915292852*t),r=VX*n,i=V$*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=VH*t/5,o=VB(a),s=VF(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},symbolTriangle:{draw(e,t){let n=-Vz(t/(3*Vq));e.moveTo(0,2*n),e.lineTo(-Vq*n,-n),e.lineTo(Vq*n,-n),e.closePath()}},symbolWye:{draw(e,t){let n=Vz(t/VQ),r=n/2,i=n*VZ,a=n*VZ+n,o=-r;e.moveTo(r,i),e.lineTo(r,a),e.lineTo(o,a),e.lineTo(-.5*r-VK*i,VK*r+-.5*i),e.lineTo(-.5*r-VK*a,VK*r+-.5*a),e.lineTo(-.5*o-VK*a,VK*o+-.5*a),e.lineTo(-.5*r+VK*i,-.5*i-VK*r),e.lineTo(-.5*r+VK*a,-.5*a-VK*r),e.lineTo(-.5*o+VK*a,-.5*a-VK*o),e.closePath()}}},V3=Math.PI/180,V4=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=V2(V2({},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,VJ)),{},{type:t,size:n,sizeType:r}),a="circle";"string"==typeof t&&(a=t);var{className:o,cx:s,cy:l}=i,c=IT(i);return jG(s)&&jG(l)&&jG(n)?eh.createElement("path",V0({},c,{className:(0,S5.clsx)("recharts-symbols",o),transform:"translate(".concat(s,", ").concat(l,")"),d:(()=>{var e,t=(e=a,V5["symbol".concat(j0(e))]||VU),i=(function(e,t){let n=null,r=Lx(i);function i(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e="function"==typeof e?e:Sw(e||VU),t="function"==typeof t?t:Sw(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:Sw(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:Sw(+e),i):t},i.context=function(e){return arguments.length?(n=null==e?null:e,i):n},i})().type(t).size(((e,t,n)=>{if("area"===t)return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":var r=18*V3;return 1.25*e*e*(Math.tan(r)-Math.tan(2*r)*Math.tan(r)**2);case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}})(n,r,a))();if(null!==i)return i})()})):null};V4.registerSymbol=(e,t)=>{V5["symbol".concat(j0(e))]=t};var V6=["option","shapeType","activeClassName"];function V7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function V9(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V7(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V7(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function V8(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return eh.createElement(F3,n);case"trapezoid":return eh.createElement(VR,n);case"sector":return eh.createElement(zt,n);case"symbols":if("symbols"===t)return eh.createElement(V4,n);break;case"curve":return eh.createElement(Lq,n);default:return null}}function He(e){var t,{option:n,shapeType:r,activeClassName:i="recharts-active-shape"}=e,a=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,V6);if((0,eh.isValidElement)(n))t=(0,eh.cloneElement)(n,V9(V9({},a),(0,eh.isValidElement)(n)?n.props:n));else if("function"==typeof n)t=n(a,a.index);else if((0,VM.default)(n)&&"boolean"!=typeof n){var o=V9(V9({},a),n);t=eh.createElement(V8,{shapeType:r,elementProps:o})}else t=eh.createElement(V8,{shapeType:r,elementProps:a});return a.isActive?eh.createElement(LQ,{className:i},t):t}var Ht=["id"],Hn=["type","layout","connectNulls","needClip","shape"],Hr=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Hi(){return(Hi=Object.assign.bind()).apply(null,arguments)}function Ha(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ho(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ha(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ha(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hs(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Hl=Vx.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:SV(o,t),hide:s,type:c,color:r,unit:l,graphicalItemId:u}};return Vx.createElement(R4,{tooltipEntrySettings:d})}),Hc=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function Hu(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,l=I_(Hs(r,Ht));return Vx.createElement(R0,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:l,needClip:o,clipPathId:t})}function Hd(e){var{showLabels:t,children:n,points:r}=e,i=(0,Vx.useMemo)(()=>null==r?void 0:r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Ho(Ho({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return Vx.createElement(RH,{value:t?i:void 0},n)}function Hh(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:l,needClip:c,shape:u}=a,d=Ho(Ho({},IT(Hs(a,Hn))),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:r,type:o,layout:s,connectNulls:l,strokeDasharray:null!=i?i:a.strokeDasharray});return Vx.createElement(Vx.Fragment,null,(null==r?void 0:r.length)>1&&Vx.createElement(He,Hi({shapeType:"curve",option:u},d,{pathRef:n})),Vx.createElement(Hu,{points:r,clipPathId:t,props:a}))}function Hf(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:h,width:f,height:p,onAnimationEnd:g,onAnimationStart:v}=n,x=i.current,y=Bu(o,"recharts-line-"),b=(0,Vx.useRef)(y),[w,N]=(0,Vx.useState)(!1),j=(0,Vx.useCallback)(()=>{"function"==typeof g&&g(),N(!1)},[g]),k=(0,Vx.useCallback)(()=>{"function"==typeof v&&v(),N(!0)},[v]),S=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}(r.current),C=(0,Vx.useRef)(0);b.current!==y&&(C.current=a.current,b.current=y);var _=C.current;return Vx.createElement(Hd,{points:o,showLabels:!w},n.children,Vx.createElement(BI,{animationId:y,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:j,onAnimationStart:k,key:y},e=>{var c,u=Math.min(jQ(_,S+_,e),S);if(c=l?s?((e,t,n)=>{var r=n.reduce((e,t)=>e+t);if(!r)return Hc(t,e);for(var i=Math.floor(e/r),a=e%r,o=t-e,s=[],l=0,c=0;l<n.length;c+=n[l],++l)if(c+n[l]>a){s=[...n.slice(0,l),a-c];break}var u=s.length%2==0?[0,o]:[o];return[...function(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],i=0;i<t;++i)r=[...r,...n];return r}(n,i),...s,...u].map(e=>"".concat(e,"px")).join(", ")})(u,S,"".concat(s).split(/[,\s]+/gim).map(e=>parseFloat(e))):Hc(S,u):null==s?void 0:String(s),e>0&&S>0&&(i.current=o,a.current=Math.max(a.current,u)),x){var d=x.length/o.length,g=1===e?o:o.map((t,n)=>{var r=Math.floor(n*d);if(x[r]){var i=x[r];return Ho(Ho({},t),{},{x:jQ(i.x,t.x,e),y:jQ(i.y,t.y,e)})}return h?Ho(Ho({},t),{},{x:jQ(2*f,t.x,e),y:jQ(p/2,t.y,e)}):Ho(Ho({},t),{},{x:t.x,y:t.y})});return i.current=g,Vx.createElement(Hh,{props:n,points:g,clipPathId:t,pathRef:r,strokeDasharray:c})}return Vx.createElement(Hh,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),Vx.createElement(RY,{label:n.label}))}function Hp(e){var{clipPathId:t,props:n}=e,r=(0,Vx.useRef)(null),i=(0,Vx.useRef)(0),a=(0,Vx.useRef)(null);return Vx.createElement(Hf,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var Hm=(e,t)=>{var n,r;return{x:null!=(n=e.x)?n:void 0,y:null!=(r=e.y)?r:void 0,value:e.value,errorVal:SO(e.payload,t)}};class Hg extends Vx.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:s,width:l,height:c,id:u,needClip:d,zIndex:h}=this.props;if(e)return null;var f=(0,S5.clsx)("recharts-line",r),{r:p,strokeWidth:g}=BL(t),v=R$(t),x=2*p+g,y=d?"url(#clipPath-".concat(v?"":"dots-").concat(u,")"):void 0;return Vx.createElement(Rb,{zIndex:h},Vx.createElement(LQ,{className:f},d&&Vx.createElement("defs",null,Vx.createElement(R7,{clipPathId:u,xAxisId:i,yAxisId:a}),!v&&Vx.createElement("clipPath",{id:"clipPath-dots-".concat(u)},Vx.createElement("rect",{x:s-x/2,y:o-x/2,width:l+x,height:c+x}))),Vx.createElement(Vw,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:Hm,errorBarOffset:0},Vx.createElement(Hp,{props:this.props,clipPathId:u}))),Vx.createElement(R3,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:y}))}}var Hv={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:MB.line,type:"linear"};function Hx(e){var t=Li(e,Hv),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,hide:c,isAnimationActive:u,label:d,legendType:h,xAxisId:f,yAxisId:p,id:g}=t,v=Hs(t,Hr),{needClip:x}=R6(f,p),y=Sv(I9),b=Sv(Cf),w=S0(),N=Sv(e=>VT(e,f,p,w,g));if("horizontal"!==b&&"vertical"!==b||null==N||null==y)return null;var{height:j,width:k,x:S,y:C}=y;return Vx.createElement(Hg,Hi({},v,{id:g,connectNulls:s,dot:l,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:c,label:d,legendType:h,xAxisId:f,yAxisId:p,points:N,layout:b,height:j,width:k,left:S,top:C,needClip:x}))}var Hy=Vx.memo(function(e){var t=Li(e,Hv),n=S0();return Vx.createElement(Bf,{id:t.id,type:"line"},e=>Vx.createElement(Vx.Fragment,null,Vx.createElement(Bc,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:SV(n,t),payload:e}]})(t)}),Vx.createElement(Hl,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),Vx.createElement(Bp,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),Vx.createElement(Hx,Hi({},t,{id:e}))))},Ix);function Hb(e){return[{value:"all",label:e("actionAll")},{value:"retain",label:e("actionRetain")},{value:"recall",label:e("actionRecall")},{value:"reflect",label:e("actionReflect")},{value:"create_bank",label:e("actionCreateBank")},{value:"update_bank",label:e("actionUpdateBank")},{value:"delete_bank",label:e("actionDeleteBank")},{value:"clear_memories",label:e("actionClearMemories")},{value:"consolidation",label:e("actionConsolidation")},{value:"batch_retain",label:e("actionBatchRetain")},{value:"create_mental_model",label:e("actionCreateMentalModel")},{value:"refresh_mental_model",label:e("actionRefreshMentalModel")},{value:"delete_mental_model",label:e("actionDeleteMentalModel")},{value:"create_directive",label:e("actionCreateDirective")},{value:"delete_directive",label:e("actionDeleteDirective")},{value:"file_convert_retain",label:e("actionFileConvertRetain")},{value:"webhook_delivery",label:e("actionWebhookDelivery")}]}function Hw(e,t){if(!e||!t)return"—";let n=new Date(e).getTime(),r=new Date(t).getTime()-n;return r<1e3?`${r}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:`${(r/6e4).toFixed(1)}m`}function HN(e){return e?new Date(e).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"—"}function Hj({transport:e}){let t={http:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",mcp:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",system:"bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300"};return(0,ed.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${t[e]||t.system}`,children:e})}function Hk({bankId:e}){let t=(0,ep.useTranslations)("auditLogsView"),n=Hb(t),r=[{value:"1d",label:t("periodToday")},{value:"7d",label:t("periodLast7Days")},{value:"30d",label:t("periodLast30Days")}],[i,a]=(0,eh.useState)("7d"),[o,s]=(0,eh.useState)(null),[l,c]=(0,eh.useState)([]),[u,d]=(0,eh.useState)("day"),[h,f]=(0,eh.useState)(!1),p=(0,eh.useCallback)(async(t=i,n=o)=>{f(!0);try{let r=await eO.client.getAuditLogStats(e,{period:t,action:n||void 0});c(r.buckets||[]),d(r.trunc||"day")}catch(e){console.error("Error loading audit stats:",e)}finally{f(!1)}},[e,i,o]);(0,eh.useEffect)(()=>{p()},[e]);let g=l.map(e=>{var t;let n;return{time:(t=e.time,n=new Date(t),"hour"===u?n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString(void 0,{month:"short",day:"numeric"})),total:e.total}});return(0,ed.jsxs)(pW.Card,{children:[(0,ed.jsxs)(pW.CardHeader,{className:"pb-2 flex flex-row items-center justify-between space-y-0 gap-3",children:[(0,ed.jsx)(pW.CardTitle,{className:"text-sm font-semibold",children:t("requestVolume")}),(0,ed.jsxs)("div",{className:"flex gap-2",children:[(0,ed.jsxs)(tP.Select,{value:o||"all",onValueChange:e=>{let t="all"===e?null:e;s(t),p(i,t)},children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-[160px] h-8 text-xs",children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsx)(tP.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:n.map(e=>(0,ed.jsx)(tP.SelectItem,{value:e.value,children:e.label},e.value))})]}),r.map(e=>(0,ed.jsx)(eA.Button,{variant:i===e.value?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{a(e.value),p(e.value,o)},children:e.label},e.value))]})]}),(0,ed.jsx)(pW.CardContent,{children:(0,ed.jsx)("div",{className:"h-[120px]",children:h?(0,ed.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:t("chartLoading")}):0===g.length?(0,ed.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:t("chartNoData")}):(0,ed.jsx)(Cl,{width:"100%",height:"100%",children:(0,ed.jsxs)(Vv,{data:g,margin:{top:5,right:5,bottom:0,left:5},children:[(0,ed.jsx)(FN,{dataKey:"time",tick:{fontSize:10},axisLine:!1,tickLine:!1,className:"text-muted-foreground"}),(0,ed.jsx)(zm,{contentStyle:{backgroundColor:"var(--popover)",border:"1px solid var(--border)",borderRadius:"6px",fontSize:"12px",padding:"4px 8px"}}),(0,ed.jsx)(Hy,{type:"monotone",dataKey:"total",stroke:"var(--primary)",strokeWidth:2,dot:!1,activeDot:{r:3}})]})})})})]})}function HS(){let e=(0,ep.useTranslations)("auditLogsView"),t=Hb(e),n=[{value:"all",label:e("transportAll")},{value:"http",label:e("transportHttp")},{value:"mcp",label:e("transportMcp")},{value:"system",label:e("transportSystem")}],{currentBank:r}=(0,ev.useBank)(),[i,a]=(0,eh.useState)([]),[o,s]=(0,eh.useState)(0),[l,c]=(0,eh.useState)(null),[u,d]=(0,eh.useState)(null),[h,f]=(0,eh.useState)("all"),[p]=(0,eh.useState)(20),[g,v]=(0,eh.useState)(0),[x,y]=(0,eh.useState)(!1),[b,w]=(0,eh.useState)(null),[N,j]=(0,eh.useState)(!1),k=(0,eh.useCallback)(e=>{if("all"===e)return{};let t=new Date,n=new Date;return"1h"===e?n.setHours(t.getHours()-1):"1d"===e?n.setDate(t.getDate()-1):"7d"===e?n.setDate(t.getDate()-7):"30d"===e&&n.setDate(t.getDate()-30),{start_date:n.toISOString()}},[]),S=(0,eh.useCallback)(async(e=l,t=u,n=h,i=g)=>{if(r){y(!0);try{let o=k(n),l=await eO.client.listAuditLogs(r,{action:e||void 0,transport:t||void 0,start_date:o.start_date,end_date:o.end_date,limit:p,offset:i});a(l.items||[]),s(l.total||0)}catch(e){console.error("Error loading audit logs:",e)}finally{y(!1)}}},[r,l,u,h,g,p,k]),C=e=>{v(e),S(l,u,h,e)};(0,eh.useEffect)(()=>{r&&S(l,u,h,g)},[r]);let _=Math.ceil(o/p),E=Math.floor(g/p)+1;return r?(0,ed.jsxs)("div",{className:"space-y-6",children:[(0,ed.jsx)(Hk,{bankId:r}),(0,ed.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ed.jsxs)(tP.Select,{value:l||"all",onValueChange:e=>{let t="all"===e?null:e;c(t),v(0),S(t,u,h,0)},children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-[180px]",children:(0,ed.jsx)(tP.SelectValue,{placeholder:e("actionAll")})}),(0,ed.jsx)(tP.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:t.map(e=>(0,ed.jsx)(tP.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ed.jsxs)(tP.Select,{value:u||"all",onValueChange:e=>{let t="all"===e?null:e;d(t),v(0),S(l,t,h,0)},children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-[160px]",children:(0,ed.jsx)(tP.SelectValue,{placeholder:e("transportAll")})}),(0,ed.jsx)(tP.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:n.map(e=>(0,ed.jsx)(tP.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ed.jsxs)(tP.Select,{value:h,onValueChange:e=>{f(e),v(0),S(l,u,e,0)},children:[(0,ed.jsx)(tP.SelectTrigger,{className:"w-[150px]",children:(0,ed.jsx)(tP.SelectValue,{})}),(0,ed.jsxs)(tP.SelectContent,{position:"popper",children:[(0,ed.jsx)(tP.SelectItem,{value:"all",children:e("dateRangeAll")}),(0,ed.jsx)(tP.SelectItem,{value:"1h",children:e("dateRangeLastHour")}),(0,ed.jsx)(tP.SelectItem,{value:"1d",children:e("dateRangeLast24Hours")}),(0,ed.jsx)(tP.SelectItem,{value:"7d",children:e("dateRangeLast7Days")}),(0,ed.jsx)(tP.SelectItem,{value:"30d",children:e("dateRangeLast30Days")})]})]}),(0,ed.jsxs)(eA.Button,{variant:"outline",size:"sm",onClick:()=>S(l,u,h,g),disabled:x,children:[(0,ed.jsx)(eV,{className:`w-4 h-4 mr-1 ${x?"animate-spin":""}`}),e("refresh")]}),(0,ed.jsx)("span",{className:"text-sm text-muted-foreground ml-auto",children:e("entryCount",{count:o})})]}),(0,ed.jsxs)(eG,{children:[(0,ed.jsx)(eX,{children:(0,ed.jsxs)(eq,{children:[(0,ed.jsx)(eK,{className:"w-[200px]",children:e("tableHeaderTime")}),(0,ed.jsx)(eK,{children:e("tableHeaderAction")}),(0,ed.jsx)(eK,{className:"w-[100px]",children:e("tableHeaderTransport")}),(0,ed.jsx)(eK,{className:"w-[100px]",children:e("tableHeaderDuration")})]})}),(0,ed.jsx)(e$,{children:0===i.length?(0,ed.jsx)(eq,{children:(0,ed.jsx)(eZ,{colSpan:4,className:"text-center text-muted-foreground py-8",children:e(x?"tableLoading":"tableNoLogs")})}):i.map(e=>(0,ed.jsxs)(eq,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{w(e),j(!0)},children:[(0,ed.jsx)(eZ,{className:"text-sm font-mono",children:HN(e.started_at)}),(0,ed.jsx)(eZ,{className:"font-medium",children:e.action}),(0,ed.jsx)(eZ,{children:(0,ed.jsx)(Hj,{transport:e.transport})}),(0,ed.jsx)(eZ,{className:"text-sm text-muted-foreground font-mono",children:Hw(e.started_at,e.ended_at)})]},e.id))})]}),_>1&&(0,ed.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ed.jsx)("span",{className:"text-sm text-muted-foreground",children:e("paginationPage",{current:E,total:_})}),(0,ed.jsxs)("div",{className:"flex gap-2",children:[(0,ed.jsxs)(eA.Button,{variant:"outline",size:"sm",onClick:()=>C(Math.max(0,g-p)),disabled:0===g,children:[(0,ed.jsx)(eS,{className:"w-4 h-4 mr-1"}),e("previous")]}),(0,ed.jsxs)(eA.Button,{variant:"outline",size:"sm",onClick:()=>C(g+p),disabled:g+p>=o,children:[e("next"),(0,ed.jsx)(eC.ChevronRight,{className:"w-4 h-4 ml-1"})]})]})]}),(0,ed.jsx)(tH.Dialog,{open:N,onOpenChange:j,children:(0,ed.jsxs)(tH.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,ed.jsx)(tH.DialogHeader,{children:(0,ed.jsx)(tH.DialogTitle,{children:e("detailDialogTitle",{action:b?.action??""})})}),b&&(0,ed.jsxs)("div",{className:"space-y-4",children:[(0,ed.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:e("detailAction")})," ",(0,ed.jsx)("span",{className:"font-medium",children:b.action})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:e("detailTransport")})," ",(0,ed.jsx)(Hj,{transport:b.transport})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:e("detailStarted")})," ",(0,ed.jsx)("span",{className:"font-mono",children:HN(b.started_at)})]}),(0,ed.jsxs)("div",{children:[(0,ed.jsx)("span",{className:"text-muted-foreground",children:e("detailDuration")})," ",(0,ed.jsx)("span",{className:"font-mono",children:Hw(b.started_at,b.ended_at)})]})]}),b.request&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h4",{className:"text-sm font-semibold mb-2",children:e("detailRequest")}),(0,ed.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(b.request,null,2)})]}),b.response&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h4",{className:"text-sm font-semibold mb-2",children:e("detailResponse")}),(0,ed.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(b.response,null,2)})]}),b.metadata&&Object.keys(b.metadata).length>0&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h4",{className:"text-sm font-semibold mb-2",children:e("detailMetadata")}),(0,ed.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto",children:JSON.stringify(b.metadata,null,2)})]})]})]})})]}):null}Hy.displayName="Line";let HC=(0,eb.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var tz=tz;e.s(["default",0,function(){(0,ef.useParams)();let e=(0,ef.useRouter)(),t=(0,ef.useSearchParams)(),n=(0,ep.useTranslations)("bank"),r=(0,ep.useTranslations)("common"),{features:i}=(0,b1.useFeatures)(),{currentBank:a,setCurrentBank:o,loadBanks:s}=(0,ev.useBank)(),l=t.get("view")||"profile",c=t.get("subTab")||"world",u=t.get("bankConfigTab")||"general",d=i?.observations??!1,h=i?.bank_config_api??!1,[f,p]=(0,eh.useState)(!1),[g,v]=(0,eh.useState)(!1),[x,y]=(0,eh.useState)(!1),[b,w]=(0,eh.useState)(!1),[N,j]=(0,eh.useState)(!1),[k,S]=(0,eh.useState)(!1),[C,_]=(0,eh.useState)(!1),[E,T]=(0,eh.useState)(!1),M=t=>{a&&e.push((0,ex.bankRoute)(a,`?view=data&subTab=${t}`))},O=t=>{a&&e.push((0,ex.bankRoute)(a,`?view=profile&bankConfigTab=${t}`))},A=async()=>{if(a){v(!0);try{await eO.client.deleteBank(a),p(!1),o(null),await s(),e.push("/")}catch(e){}finally{v(!1)}}},D=async()=>{if(a){w(!0);try{let e=await eO.client.clearObservations(a);y(!1),em.toast.success(n("observationsCleared"),{description:e.message||n("observationsClearedDefault")})}catch(e){}finally{w(!1)}}},P=async()=>{if(a){T(!0);try{await eO.client.resetBankConfig(a),_(!1)}catch{}finally{T(!1)}}},I=async()=>{if(a){j(!0);try{await eO.client.triggerConsolidation(a)}catch(e){}finally{j(!1)}}},L=async()=>{if(a){S(!0);try{let e=await eO.client.recoverConsolidation(a);em.toast.success(n("recoveredMemories",{count:e.retried_count}))}catch(e){}finally{S(!1)}}};return(0,ed.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,ed.jsx)(eg.BankSelector,{}),(0,ed.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,ed.jsx)(eM,{currentTab:l,onTabChange:t=>{a&&e.push((0,ex.bankRoute)(a,`?view=${t}`))}}),(0,ed.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,ed.jsxs)("div",{className:"p-6",children:["profile"===l&&(0,ed.jsxs)("div",{children:[(0,ed.jsxs)("div",{className:"flex justify-between items-start mb-6",children:[(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:n("bankConfiguration")}),(0,ed.jsx)("p",{className:"text-muted-foreground",children:n("bankConfigurationDescription")})]}),(0,ed.jsxs)(f2.DropdownMenu,{children:[(0,ed.jsx)(f2.DropdownMenuTrigger,{asChild:!0,children:(0,ed.jsxs)(eA.Button,{variant:"outline",size:"sm",children:[n("actions"),(0,ed.jsx)(pS,{className:"w-4 h-4 ml-2"})]})}),(0,ed.jsxs)(f2.DropdownMenuContent,{align:"end",className:"w-48",children:[(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:async()=>{if(a)try{let e=await eO.client.exportBankTemplate(a),t=JSON.stringify(e,null,2);await navigator.clipboard.writeText(t),em.toast.success(n("templateCopied"))}catch{em.toast.error(n("failedToExportTemplate"))}},children:[(0,ed.jsx)(HC,{className:"w-4 h-4 mr-2"}),n("exportTemplate")]}),(0,ed.jsx)(f2.DropdownMenuSeparator,{}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:I,disabled:N||!d,title:d?void 0:"Observations feature is not enabled",children:[N?(0,ed.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ed.jsx)(pG,{className:"w-4 h-4 mr-2"}),N?n("consolidating"):n("runConsolidation"),!d&&(0,ed.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:L,disabled:k||!d,title:d?void 0:"Observations feature is not enabled",children:[k?(0,ed.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ed.jsx)(z6,{className:"w-4 h-4 mr-2"}),k?n("recovering"):n("recoverConsolidation"),!d&&(0,ed.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>y(!0),disabled:!d,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:d?void 0:"Observations feature is not enabled",children:[(0,ed.jsx)(pj,{className:"w-4 h-4 mr-2"}),n("clearObservations"),!d&&(0,ed.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ed.jsx)(f2.DropdownMenuSeparator,{}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>_(!0),disabled:!h,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:h?void 0:"Bank Config API is disabled",children:[(0,ed.jsx)(z6,{className:"w-4 h-4 mr-2"}),n("resetConfiguration"),!h&&(0,ed.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ed.jsx)(f2.DropdownMenuSeparator,{}),(0,ed.jsxs)(f2.DropdownMenuItem,{onClick:()=>p(!0),className:"text-red-600 dark:text-red-400 focus:text-red-700 dark:focus:text-red-300",children:[(0,ed.jsx)(pj,{className:"w-4 h-4 mr-2"}),n("deleteBank")]})]})]})]}),(0,ed.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ed.jsxs)("div",{className:"flex gap-1",children:[(0,ed.jsxs)("button",{onClick:()=>O("general"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"general"===u?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[n("general"),"general"===u&&(0,ed.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),h&&(0,ed.jsxs)("button",{onClick:()=>O("configuration"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"configuration"===u?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[n("configuration"),"configuration"===u&&(0,ed.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ed.jsxs)("button",{onClick:()=>O("webhooks"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"webhooks"===u?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[n("webhooks"),"webhooks"===u&&(0,ed.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ed.jsxs)("button",{onClick:()=>O("audit-logs"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"audit-logs"===u?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[n("auditLogs"),"audit-logs"===u&&(0,ed.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ed.jsxs)("div",{children:["general"===u&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:n("overviewAndOperations")}),(0,ed.jsxs)("div",{className:"space-y-6",children:[(0,ed.jsx)(z4,{}),(0,ed.jsx)(Ve,{}),(0,ed.jsx)(b6,{hideReflectFields:!0})]})]}),"configuration"===u&&h&&(0,ed.jsx)("div",{className:"space-y-6",children:(0,ed.jsx)(wp,{})}),"webhooks"===u&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:n("webhooksDescription")}),(0,ed.jsx)(Vm,{})]}),"audit-logs"===u&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:n("auditLogsDescription")}),(0,ed.jsx)(HS,{})]})]})]}),"recall"===l&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:n("recallAnalyzer")}),(0,ed.jsx)("p",{className:"text-muted-foreground mb-6",children:n("recallAnalyzerDescription")}),(0,ed.jsx)(b0,{})]}),"reflect"===l&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:n("reflect")}),(0,ed.jsx)("p",{className:"text-muted-foreground mb-6",children:n("reflectDescription")}),(0,ed.jsx)(bQ,{})]}),"data"===l&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:n("memories")}),(0,ed.jsx)("p",{className:"text-muted-foreground mb-6",children:n("memoriesDescription")}),(0,ed.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ed.jsxs)("div",{className:"flex gap-1",children:[(0,ed.jsxs)("button",{onClick:()=>M("world"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"world"===c?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[n("worldFacts"),"world"===c&&(0,ed.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ed.jsxs)("button",{onClick:()=>M("experience"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"experience"===c?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[n("experience"),"experience"===c&&(0,ed.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ed.jsxs)("button",{onClick:()=>M("observations"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"observations"===c?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[n("observations"),!d&&(0,ed.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"observations"===c&&(0,ed.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ed.jsxs)("button",{onClick:()=>M("mental-models"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"mental-models"===c?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[n("mentalModels"),"mental-models"===c&&(0,ed.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ed.jsxs)("div",{children:["world"===c&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:n("worldFactsDescription")}),(0,ed.jsx)(f0,{factType:"world"},"world")]}),"experience"===c&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:n("experienceDescription")}),(0,ed.jsx)(f0,{factType:"experience"},"experience")]}),"observations"===c&&(d?(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:n("observationsDescription")}),(0,ed.jsx)(f0,{factType:"observation"},"observations")]}):(0,ed.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,ed.jsx)("div",{className:"text-muted-foreground mb-2",children:(0,ed.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ed.jsx)("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Z"}),(0,ed.jsx)("path",{d:"M12 8v4"}),(0,ed.jsx)("path",{d:"M12 16h.01"})]})}),(0,ed.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-1",children:n("observationsNotEnabled")}),(0,ed.jsx)("p",{className:"text-sm text-muted-foreground max-w-md",children:n.rich("observationsDisabledMessage",{envVar:()=>(0,ed.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_ENABLE_OBSERVATIONS=true"})})})]})),"mental-models"===c&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:n("mentalModelsDescription")}),(0,ed.jsx)(Vn,{},"mental-models")]})]})]}),"documents"===l&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:n("documents")}),(0,ed.jsx)("p",{className:"text-muted-foreground mb-6",children:n("documentsDescription")}),(0,ed.jsx)(pL,{})]}),"entities"===l&&(0,ed.jsxs)("div",{children:[(0,ed.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:n("entities")}),(0,ed.jsx)("p",{className:"text-muted-foreground mb-6",children:n("entitiesDescription")}),(0,ed.jsx)(pR,{})]})]})})]}),(0,ed.jsx)(f8,{open:f,onOpenChange:p,children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:n("deleteMemoryBank")}),(0,ed.jsx)(pb,{asChild:!0,children:(0,ed.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ed.jsx)("p",{children:n.rich("deleteBankPrompt",{bankName:()=>(0,ed.jsx)("span",{className:"font-semibold text-foreground",children:a})})}),(0,ed.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:n("deleteBankWarning")})]})})]}),(0,ed.jsxs)(px,{children:[(0,ed.jsx)(pN,{disabled:g,children:r("cancel")}),(0,ed.jsx)(pw,{onClick:A,disabled:g,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:g?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),n("deleting")]}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(pj,{className:"w-4 h-4 mr-2"}),n("deleteBank")]})})]})]})}),(0,ed.jsx)(f8,{open:C,onOpenChange:_,children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:n("resetConfigTitle")}),(0,ed.jsx)(pb,{asChild:!0,children:(0,ed.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ed.jsx)("p",{children:n.rich("resetConfigPrompt",{bankName:()=>(0,ed.jsx)("span",{className:"font-semibold text-foreground",children:a})})}),(0,ed.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:n("resetConfigWarning")})]})})]}),(0,ed.jsxs)(px,{children:[(0,ed.jsx)(pN,{disabled:E,children:r("cancel")}),(0,ed.jsx)(pw,{onClick:P,disabled:E,children:E?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),n("resetting")]}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(z6,{className:"w-4 h-4 mr-2"}),n("resetConfiguration")]})})]})]})}),(0,ed.jsx)(f8,{open:x,onOpenChange:y,children:(0,ed.jsxs)(pg,{children:[(0,ed.jsxs)(pv,{children:[(0,ed.jsx)(py,{children:n("clearObservationsTitle")}),(0,ed.jsx)(pb,{asChild:!0,children:(0,ed.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ed.jsx)("p",{children:n.rich("clearObservationsPrompt",{bankName:()=>(0,ed.jsx)("span",{className:"font-semibold text-foreground",children:a})})}),(0,ed.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:n("clearObservationsWarning")})]})})]}),(0,ed.jsxs)(px,{children:[(0,ed.jsx)(pN,{disabled:b,children:r("cancel")}),(0,ed.jsx)(pw,{onClick:D,disabled:b,className:"bg-amber-500 text-white hover:bg-amber-600",children:b?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),n("clearing")]}):(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)(pj,{className:"w-4 h-4 mr-2"}),n("clearObservations")]})})]})]})})]})}],8004)}]);
|