semiotic 3.8.6 → 3.8.8
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/CLAUDE.md +34 -8
- package/README.md +93 -56
- package/ai/behaviorContracts.cjs +86 -1
- package/ai/componentMetadata.cjs +4 -9
- package/ai/dist/mcp-server.js +125 -12
- package/ai/examples.md +154 -7
- package/ai/schema.json +1742 -156
- package/ai/surface-manifest.json +12 -10
- package/ai/system-prompt.md +9 -3
- package/dist/{chunk-chartContainerDataAudit-FEOD5GTQ.module.min.js → chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js} +1 -1
- package/dist/chunk-chunk-2B3AIKUZ.module.min.js +2 -0
- package/dist/chunk-chunk-2NVFEB7P.module.min.js +2 -0
- package/dist/chunk-chunk-3GCILWPB.module.min.js +2 -0
- package/dist/chunk-chunk-46KRGJQP.module.min.js +1 -0
- package/dist/{chunk-chunk-G7WFWHAD.module.min.js → chunk-chunk-4ITOQRXM.module.min.js} +1 -1
- package/dist/chunk-chunk-4MLLQUGW.module.min.js +2 -0
- package/dist/chunk-chunk-57RBPDBQ.module.min.js +2 -0
- package/dist/chunk-chunk-5VVNW5AZ.module.min.js +1 -0
- package/dist/chunk-chunk-66PCWJUG.module.min.js +1 -0
- package/dist/chunk-chunk-6V5VQVCT.module.min.js +2 -0
- package/dist/chunk-chunk-7LE56WAE.module.min.js +2 -0
- package/dist/chunk-chunk-7T25U75Z.module.min.js +2 -0
- package/dist/chunk-chunk-AF53TBSN.module.min.js +2 -0
- package/dist/chunk-chunk-BTZYH2IE.module.min.js +1 -0
- package/dist/chunk-chunk-BWV55BZK.module.min.js +2 -0
- package/dist/chunk-chunk-BZNOAHJV.module.min.js +2 -0
- package/dist/chunk-chunk-CD6PVVS3.module.min.js +2 -0
- package/dist/chunk-chunk-DTSNLGRK.module.min.js +2 -0
- package/dist/chunk-chunk-FC3NZWYR.module.min.js +2 -0
- package/dist/chunk-chunk-FEPXDKJP.module.min.js +1 -0
- package/dist/chunk-chunk-FJ76HWQZ.module.min.js +1 -0
- package/dist/chunk-chunk-FQPKOAIH.module.min.js +2 -0
- package/dist/chunk-chunk-FRGBMTZR.module.min.js +1 -0
- package/dist/chunk-chunk-G75OPF5N.module.min.js +2 -0
- package/dist/chunk-chunk-H5IFO6CU.module.min.js +2 -0
- package/dist/chunk-chunk-HADHLMY5.module.min.js +1 -0
- package/dist/chunk-chunk-HBFA4NN6.module.min.js +1 -0
- package/dist/chunk-chunk-HCNDE26Q.module.min.js +2 -0
- package/dist/chunk-chunk-J5QD4RAM.module.min.js +2 -0
- package/dist/chunk-chunk-JJ4BSUYL.module.min.js +2 -0
- package/dist/chunk-chunk-JRHXQGEV.module.min.js +2 -0
- package/dist/chunk-chunk-L6FFYGYS.module.min.js +1 -0
- package/dist/chunk-chunk-LJDH3WV3.module.min.js +2 -0
- package/dist/chunk-chunk-LSJUXBMF.module.min.js +1 -0
- package/dist/chunk-chunk-N3Q33XCB.module.min.js +2 -0
- package/dist/chunk-chunk-NWIGA3UK.module.min.js +1 -0
- package/dist/chunk-chunk-OG3TTJGJ.module.min.js +2 -0
- package/dist/{chunk-chunk-XEVJDUTH.module.min.js → chunk-chunk-OZK46A5U.module.min.js} +1 -1
- package/dist/chunk-chunk-PMR47KRY.module.min.js +2 -0
- package/dist/chunk-chunk-QQJNG23C.module.min.js +2 -0
- package/dist/chunk-chunk-RGJ6TKAH.module.min.js +2 -0
- package/dist/{chunk-chunk-RA7JCG7D.module.min.js → chunk-chunk-SFLUSZ73.module.min.js} +1 -1
- package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
- package/dist/chunk-chunk-TCMHJWFJ.module.min.js +1 -0
- package/dist/chunk-chunk-TSCFL235.module.min.js +1 -0
- package/dist/{chunk-chunk-XP3OHHFX.module.min.js → chunk-chunk-UEZ6SHW5.module.min.js} +1 -1
- package/dist/chunk-chunk-UOQRPGPK.module.min.js +2 -0
- package/dist/chunk-chunk-VUWYT7DY.module.min.js +2 -0
- package/dist/{chunk-chunk-GFTVACTO.module.min.js → chunk-chunk-W5HWGQMD.module.min.js} +1 -1
- package/dist/chunk-chunk-WFHZHWT7.module.min.js +1 -0
- package/dist/chunk-chunk-WGROBM3I.module.min.js +2 -0
- package/dist/chunk-chunk-WSDJFBKX.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +2 -0
- package/dist/components/ai/SemioticVACPBridge.d.ts +22 -0
- package/dist/components/ai/chartCapabilities.d.ts +4 -3
- package/dist/components/ai/conversationArc.d.ts +2 -176
- package/dist/components/ai/conversationArcTypes.d.ts +202 -0
- package/dist/components/ai/readerGrounding.d.ts +12 -0
- package/dist/components/ai/vacpAdapter.d.ts +13 -0
- package/dist/components/ai/vacpAdapterActions.d.ts +2 -0
- package/dist/components/ai/vacpAdapterModel.d.ts +7 -0
- package/dist/components/ai/vacpAdapterRuntime.d.ts +26 -0
- package/dist/components/ai/vacpAdapterState.d.ts +3 -0
- package/dist/components/ai/vacpAdapterTypes.d.ts +169 -0
- package/dist/components/ai/vacpTypes.d.ts +160 -0
- package/dist/components/charts/index.d.ts +6 -6
- package/dist/components/charts/network/ProcessSankey.d.ts +105 -74
- package/dist/components/charts/network/processSankey/accessors.d.ts +7 -0
- package/dist/components/charts/network/processSankey/algorithm.d.ts +14 -193
- package/dist/components/charts/network/processSankey/axisChrome.d.ts +31 -0
- package/dist/components/charts/network/processSankey/bandPaths.d.ts +45 -0
- package/dist/components/charts/network/processSankey/buildScenes.d.ts +41 -3
- package/dist/components/charts/network/processSankey/fixtures.d.ts +17 -0
- package/dist/components/charts/network/processSankey/frameMargins.d.ts +11 -0
- package/dist/components/charts/network/processSankey/groupBonding.d.ts +13 -0
- package/dist/components/charts/network/processSankey/inventoryAtTime.d.ts +41 -0
- package/dist/components/charts/network/processSankey/labelPlacement.d.ts +34 -0
- package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +47 -0
- package/dist/components/charts/network/processSankey/layoutOrchestrator.d.ts +44 -0
- package/dist/components/charts/network/processSankey/layoutQualityProduct.d.ts +27 -0
- package/dist/components/charts/network/processSankey/massSimulation.d.ts +16 -0
- package/dist/components/charts/network/processSankey/ordering.d.ts +55 -0
- package/dist/components/charts/network/processSankey/orderingBond.d.ts +33 -0
- package/dist/components/charts/network/processSankey/orientation.d.ts +5 -0
- package/dist/components/charts/network/processSankey/packing.d.ts +8 -0
- package/dist/components/charts/network/processSankey/packingCache.d.ts +23 -0
- package/dist/components/charts/network/processSankey/processSankeyLayoutAsync.d.ts +27 -0
- package/dist/components/charts/network/processSankey/processSankeyLayoutWorkerClient.d.ts +72 -0
- package/dist/components/charts/network/processSankey/processSankeyTooltip.d.ts +26 -0
- package/dist/components/charts/network/processSankey/processSankeyTypes.d.ts +163 -0
- package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +26 -2
- package/dist/components/charts/network/processSankey/ribbonRunway.d.ts +45 -0
- package/dist/components/charts/network/processSankey/streamingLayout.d.ts +23 -0
- package/dist/components/charts/network/processSankey/time.d.ts +11 -0
- package/dist/components/charts/network/processSankey/useProcessSankeyPush.d.ts +29 -0
- package/dist/components/charts/network/processSankey/useProcessSankeyScenes.d.ts +26 -0
- package/dist/components/charts/network/processSankey/validation.d.ts +33 -0
- package/dist/components/charts/physics/ChainReactionChart.capability.d.ts +9 -0
- package/dist/components/charts/physics/ChainReactionChart.d.ts +29 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +1 -1
- package/dist/components/charts/physics/EventDropChart.d.ts +7 -2
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +1 -1
- package/dist/components/charts/physics/{PhysicsPileChart.capability.d.ts → PacketFlowChart.capability.d.ts} +1 -1
- package/dist/components/charts/physics/{PhysicalFlowChart.d.ts → PacketFlowChart.d.ts} +22 -6
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +1 -1
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +7 -4
- package/dist/components/charts/physics/{PhysicalFlowChart.capability.d.ts → UnitPileChart.capability.d.ts} +1 -1
- package/dist/components/charts/physics/{PhysicsPileChart.d.ts → UnitPileChart.d.ts} +19 -6
- package/dist/components/charts/physics/crucibleChartProps.d.ts +1 -1
- package/dist/components/charts/physics/crucibleChartUtils.d.ts +9 -0
- package/dist/components/charts/physics/gauntletChartProps.d.ts +6 -1
- package/dist/components/charts/physics/gauntletTerminal.d.ts +61 -0
- package/dist/components/charts/physics/packetFlowSemantics.d.ts +6 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +45 -2
- package/dist/components/charts/shared/auditAccessibilityStyles.d.ts +9 -0
- package/dist/components/charts/shared/chartFamilySets.d.ts +1 -0
- package/dist/components/charts/shared/formatUtils.d.ts +12 -1
- package/dist/components/charts/shared/hatchFill.d.ts +2 -0
- package/dist/components/charts/shared/hooks.d.ts +1 -1
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/charts/shared/leastSquaresRegression.d.ts +31 -0
- package/dist/components/charts/shared/styleRules.d.ts +5 -1
- package/dist/components/charts/shared/useChartLegend.d.ts +14 -1
- package/dist/components/charts/shared/useChartSetup.d.ts +8 -1
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/withChartWrapper.d.ts +0 -6
- package/dist/components/data/numericFieldProfiler.d.ts +2 -0
- package/dist/components/data/portability/capabilityBinding.d.ts +41 -0
- package/dist/components/data/portability/index.d.ts +2 -0
- package/dist/components/legendLayout.d.ts +56 -0
- package/dist/components/recipes/geographicDotGrid.d.ts +82 -0
- package/dist/components/recipes/geographicGrid.d.ts +100 -0
- package/dist/components/recipes/layout1d.d.ts +68 -0
- package/dist/components/recipes/physics.d.ts +2 -0
- package/dist/components/recipes/physicsStageGeography.d.ts +137 -0
- package/dist/components/semiotic-ai.d.ts +4 -3
- package/dist/components/semiotic-experimental-vacp.d.ts +11 -0
- package/dist/components/semiotic-experimental.d.ts +6 -3
- package/dist/components/semiotic-geo.d.ts +4 -0
- package/dist/components/semiotic-network.d.ts +2 -2
- package/dist/components/semiotic-physics.d.ts +9 -6
- package/dist/components/semiotic-recipes-core.d.ts +8 -1
- package/dist/components/semiotic.d.ts +2 -0
- package/dist/components/server/renderEvidence.d.ts +1 -1
- package/dist/components/server/renderToStaticSVG.d.ts +2 -1
- package/dist/components/server/serverChartConfigHeatmap.d.ts +6 -0
- package/dist/components/server/serverChartConfigNetworkStyles.d.ts +12 -0
- package/dist/components/server/serverChartConfigShared.d.ts +16 -0
- package/dist/components/server/serverChartConfigs.d.ts +2 -2
- package/dist/components/server/serverChartConfigsPhysics.d.ts +2 -2
- package/dist/components/server/serverChartConfigsXY.d.ts +0 -1
- package/dist/components/server/staticLegend.d.ts +6 -0
- package/dist/components/server/staticSVGChrome.d.ts +12 -3
- package/dist/components/server/staticValue.d.ts +8 -0
- package/dist/components/store/createStore.d.ts +2 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +3 -0
- package/dist/components/stream/PipelineStore.d.ts +5 -0
- package/dist/components/stream/accessorUtils.d.ts +21 -0
- package/dist/components/stream/frameKeyboardNavigation.d.ts +3 -2
- package/dist/components/stream/geoPipelineConfig.d.ts +10 -0
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +3 -8
- package/dist/components/stream/layouts/index.d.ts +1 -1
- package/dist/components/stream/legendRenderer.d.ts +8 -0
- package/dist/components/stream/moduleWorkerSession.d.ts +67 -0
- package/dist/components/stream/networkTypes.d.ts +2 -0
- package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +2 -1
- package/dist/components/stream/physics/PhysicsEvidence.d.ts +37 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +9 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +5 -0
- package/dist/components/stream/physics/physicsFramePipelineConfig.d.ts +19 -0
- package/dist/components/stream/physics/physicsPipelineSettle.d.ts +52 -0
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +23 -0
- package/dist/components/stream/pipelineIntroCancellation.d.ts +6 -0
- package/dist/components/stream/pipelineTransitions.d.ts +15 -1
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +16 -4
- package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +4 -0
- package/dist/components/stream/symbolPath.d.ts +8 -0
- package/dist/components/stream/types.d.ts +4 -0
- package/dist/components/stream/useCanvasFrameHost.d.ts +6 -0
- package/dist/components/stream/useSemanticFrameInteractions.d.ts +12 -3
- package/dist/components/stream/xyFrameAxisTypes.d.ts +4 -0
- package/dist/components/types/legendTypes.d.ts +17 -1
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- package/dist/forceLayoutWorker.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/processSankeyLayoutWorker.js +1 -0
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +4 -3
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental-vacp.d.ts +11 -0
- package/dist/semiotic-experimental-vacp.min.js +1 -0
- package/dist/semiotic-experimental-vacp.module.min.js +1 -0
- package/dist/semiotic-experimental.d.ts +6 -3
- package/dist/semiotic-experimental.min.js +2 -1
- package/dist/semiotic-experimental.module.min.js +2 -1
- package/dist/semiotic-geo.d.ts +4 -0
- package/dist/semiotic-network.d.ts +2 -2
- package/dist/semiotic-physics.d.ts +9 -6
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +8 -1
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-themes-core.module.min.js +1 -1
- package/dist/semiotic-themes-react.module.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils-react.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic.d.ts +2 -0
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +21 -4
- package/spec/README.md +94 -2
- package/spec/bindings/README.md +14 -3
- package/spec/v0.1/examples/annotation-provenance-reviewed-revision.json +27 -0
- package/spec/v0.1/examples/annotation-provenance-watcher-threshold.json +21 -0
- package/spec/v0.1/examples/audience-profile-executive-review.json +24 -0
- package/spec/v0.1/examples/audience-profile-incident-operators.json +42 -0
- package/spec/v0.1/examples/chart-capability-bar-comparison.json +48 -0
- package/spec/v0.1/examples/chart-capability-service-flow.json +54 -0
- package/dist/chunk-chunk-2CHN2TA3.module.min.js +0 -1
- package/dist/chunk-chunk-3NGIKFD6.module.min.js +0 -1
- package/dist/chunk-chunk-3SHB24AG.module.min.js +0 -1
- package/dist/chunk-chunk-4MMOOYTX.module.min.js +0 -2
- package/dist/chunk-chunk-5RKXZQ2P.module.min.js +0 -1
- package/dist/chunk-chunk-75OTQSXS.module.min.js +0 -1
- package/dist/chunk-chunk-7ALTGHK6.module.min.js +0 -1
- package/dist/chunk-chunk-A5GRQUOF.module.min.js +0 -1
- package/dist/chunk-chunk-AAF5LZAU.module.min.js +0 -2
- package/dist/chunk-chunk-ARZGA4LJ.module.min.js +0 -2
- package/dist/chunk-chunk-C4YA6TDR.module.min.js +0 -1
- package/dist/chunk-chunk-CAFLML4L.module.min.js +0 -2
- package/dist/chunk-chunk-CO5KQMGH.module.min.js +0 -1
- package/dist/chunk-chunk-DSNGDNJY.module.min.js +0 -1
- package/dist/chunk-chunk-FHBN7OEB.module.min.js +0 -2
- package/dist/chunk-chunk-GMQ5AYTD.module.min.js +0 -1
- package/dist/chunk-chunk-IP2UE74X.module.min.js +0 -1
- package/dist/chunk-chunk-ITDWLZXV.module.min.js +0 -2
- package/dist/chunk-chunk-JCG72SGW.module.min.js +0 -2
- package/dist/chunk-chunk-LPSPATPC.module.min.js +0 -1
- package/dist/chunk-chunk-OM6NWS4H.module.min.js +0 -2
- package/dist/chunk-chunk-PRDGLMJT.module.min.js +0 -2
- package/dist/chunk-chunk-PX5YQGDP.module.min.js +0 -2
- package/dist/chunk-chunk-Q2BS46W2.module.min.js +0 -2
- package/dist/chunk-chunk-QSQVBIJA.module.min.js +0 -1
- package/dist/chunk-chunk-RCF52Z42.module.min.js +0 -2
- package/dist/chunk-chunk-RNUHEXZA.module.min.js +0 -2
- package/dist/chunk-chunk-ROZWKEUG.module.min.js +0 -1
- package/dist/chunk-chunk-SMVD3EQJ.module.min.js +0 -2
- package/dist/chunk-chunk-T2FKJD4O.module.min.js +0 -2
- package/dist/chunk-chunk-UDREYOLV.module.min.js +0 -1
- package/dist/chunk-chunk-VOWE3SAP.module.min.js +0 -2
- package/dist/chunk-chunk-VQPNBUSW.module.min.js +0 -2
- package/dist/chunk-chunk-WAWCIHFJ.module.min.js +0 -1
- package/dist/chunk-chunk-WCX6U47H.module.min.js +0 -2
- package/dist/chunk-chunk-WYARAXHR.module.min.js +0 -2
- package/dist/chunk-chunk-XV3KGYTR.module.min.js +0 -2
- package/dist/chunk-chunk-YC2IVEPX.module.min.js +0 -1
- package/dist/chunk-chunk-ZOAQDIJO.module.min.js +0 -1
- package/dist/chunk-chunk-ZXIXAPRE.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +0 -2
- package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{CircularBrush as e,DirectManipulationControl as t}from"./chunk-chunk-G7WFWHAD.module.min.js";import{MobileStandardControls as n,VISUALIZATION_CONTROL_TYPES as r,auditVisualizationControls as i,clampMobileRange as a,createControlObservationAdapter as l,useMobileRangeControls as o,zoomMobileRange as s}from"./chunk-chunk-RCF52Z42.module.min.js";import*as c from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";var p="undefined"==typeof window?c.useEffect:c.useLayoutEffect,m={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},h={position:"absolute",zIndex:30,top:"calc(100% + 0.5rem)",left:0,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:8,width:"var(--sentence-filter-popover-width, 18rem)",maxWidth:"min(22rem, calc(100vw - 2rem))",maxHeight:"min(24rem, calc(100vh - 2rem))",overflow:"auto",padding:12,color:"var(--sentence-filter-text-color, var(--semiotic-fg, #1f2933))",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #cbd5e1)",borderRadius:6,boxShadow:"0 10px 28px rgba(15, 23, 42, 0.18)",fontFamily:"inherit",fontSize:"1rem",fontWeight:400,lineHeight:1.4,textAlign:"left",whiteSpace:"normal"},b={offsetX:0,placement:"below",maxHeight:null,maxWidth:null},y={boxSizing:"border-box",width:"100%",minHeight:38,padding:"6px 8px",color:"inherit",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #94a3b8)",borderRadius:4,font:"inherit"},v={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,width:"100%",minHeight:38,padding:"7px 8px",color:"inherit",backgroundColor:"transparent",border:0,borderRadius:4,font:"inherit",textAlign:"left",cursor:"pointer"};function g(e){return null==e||"boolean"==typeof e?"":"string"==typeof e||"number"==typeof e?e+"":Array.isArray(e)?e.map(g).join(""):c.isValidElement(e)?g(e.props.children):""}function x(e,t){return Object.is(e,t)}function w(e,t){return e.find(e=>x(e.value,t))}function k(e){return null==e||""===e||Array.isArray(e)&&0===e.length}function C(e,t){if(k(t))return e.emptyLabel??"Any";if("select"===e.type)return w(e.options,t)?.label??t+"";if("multiselect"===e.type){const n=t.map(t=>w(e.options,t)?.label??t+""),r="or"===e.conjunction?" or ":" and ";return n.map((e,t)=>f(c.Fragment,{children:[t>0?r:null,e]},t))}return"toggle"===e.type?t?e.trueLabel??"on":e.falseLabel??"off":"range"===e.type?`${t[0]} to ${t[1]}`:t+""}function L(e,t,n){return k(t)?g(e.emptyLabel??"Any"):e.getAccessibleValue?e.getAccessibleValue(t,n):g(C(e,t))||t+""}function E(e){return 0===e.detail?"keyboard":"pointer"}function M(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(e=>[g(e.label),...e.keywords??[]].some(e=>e.toLocaleLowerCase().includes(n))):e}function S(e,t,n){if(0===e.length)return-1;for(let r=1;e.length>=r;r+=1){const i=(t+n*r+e.length)%e.length;if(!e[i].disabled)return i}return-1}function A(e,t=0){const[n,r]=c.useState(()=>e[t]&&!e[t].disabled?t:S(e,-1,1)),i=c.useRef(null),a=c.useRef({value:"",at:0});c.useEffect(()=>{(0>n||!e[n]||e[n].disabled)&&r(S(e,-1,1))},[n,e]);const l=c.useCallback(e=>{0>e||(r(e),i.current?.querySelector(`[data-sentence-filter-option-index="${e}"]`)?.focus())},[]),o=c.useCallback(t=>{let r=-1;if("ArrowDown"===t.key)r=S(e,n,1);else if("ArrowUp"===t.key)r=S(e,n,-1);else if("Home"===t.key)r=S(e,-1,1);else if("End"===t.key)r=S(e,0,-1);else if(1===t.key.length&&!t.altKey&&!t.ctrlKey&&!t.metaKey){const i=Date.now(),l=a.current,o=`${i-l.at>600?"":l.value}${t.key}`.toLocaleLowerCase();a.current={value:o,at:i};for(let t=1;e.length>=t;t+=1){const i=(Math.max(n,-1)+t)%e.length,a=e[i],l=[g(a.label),...a.keywords??[]];if(!a.disabled&&l.some(e=>e.toLocaleLowerCase().startsWith(o))){r=i;break}}}0>r||(t.preventDefault(),l(r))},[n,l,e]);return{activeIndex:n,focusIndex:l,listRef:i,onKeyDown:o}}function D({option:e}){return f(u,{children:[d("span",{children:e.label}),null!=e.count?d("span",{"aria-label":e.count+" results",children:e.count}):null,e.description?d("span",{style:{display:"block",fontSize:"0.82em",opacity:.78},children:e.description}):null]})}function $({value:e,definition:t,setValue:n,close:r}){const i=t,[a,l]=c.useState(""),o=c.useMemo(()=>M(i.options,a),[a,i.options]),s=Math.max(0,o.findIndex(t=>x(t.value,e))),p=A(o,s);return f(u,{children:[i.searchable?d("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+i.label,value:a,onChange:e=>l(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),p.focusIndex(S(o,-1,1)))},style:y}):null,f("span",{ref:p.listRef,role:"listbox","aria-label":i.label,style:{display:"flex",flexDirection:"column",gap:2},children:[o.map((t,a)=>d("button",{"data-sentence-filter-option-index":a,"data-sentence-filter-autofocus":i.searchable||a!==p.activeIndex?void 0:"",type:"button",role:"option","aria-selected":x(t.value,e),tabIndex:a===p.activeIndex?0:-1,disabled:t.disabled,onKeyDown:p.onKeyDown,onClick:e=>{n(t.value,E(e)),r()},style:{...v,backgroundColor:x(t.value,e)?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",opacity:t.disabled?.5:1},children:d(D,{option:t})},`${t.value+""}-${a}`)),0===o.length?d("span",{role:"status",children:"No options found."}):null]})]})}function N({value:e,definition:t,setValue:n}){const r=t,[i,a]=c.useState(""),l=c.useMemo(()=>M(r.options,i),[r.options,i]),o=Array.isArray(e)?e:[],s=A(l);return f(u,{children:[r.searchable?d("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+r.label,value:i,onChange:e=>a(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),s.focusIndex(S(l,-1,1)))},style:y}):null,f("span",{ref:s.listRef,role:"group","aria-label":r.label,style:{display:"flex",flexDirection:"column",gap:2},children:[l.map((e,t)=>{const i=o.some(t=>x(t,e.value));return f("label",{style:{...v,justifyContent:"flex-start",opacity:e.disabled?.5:1},children:[d("input",{"data-sentence-filter-option-index":t,"data-sentence-filter-autofocus":r.searchable||t!==s.activeIndex?void 0:"",type:"checkbox",checked:i,disabled:e.disabled,tabIndex:t===s.activeIndex?0:-1,onKeyDown:s.onKeyDown,onChange:t=>{const r=t.currentTarget.checked?[...o,e.value]:o.filter(t=>!x(t,e.value));n(r,"input")}}),d("span",{style:{flex:1},children:d(D,{option:e})})]},`${e.value+""}-${t}`)}),0===l.length?d("span",{role:"status",children:"No options found."}):null]})]})}function V({value:e,definition:t,setValue:n}){const r=t,i=r.inputMode??"input",a={min:r.min,max:r.max,step:r.step??1,value:"number"==typeof e?e:r.min??0,onChange:e=>{const t=e.currentTarget.valueAsNumber;Number.isFinite(t)&&n(t,"input")}};return f(u,{children:["slider"!==i?d("input",{...a,"data-sentence-filter-autofocus":!0,type:"number","aria-label":r.label,style:y}):null,"input"!==i?d("input",{...a,"data-sentence-filter-autofocus":"slider"===i?"":void 0,type:"range","aria-label":r.label,style:{width:"100%"}}):null]})}function I({value:e,definition:t,setValue:n}){const r=t,i=Array.isArray(e)&&e.length>=2?[Number(e[0]),Number(e[1])]:[r.min,r.max],a=(e,t)=>{if(!Number.isFinite(t))return;const a=Math.min(r.max,Math.max(r.min,t));n(0===e?[Math.min(a,i[1]),i[1]]:[i[0],Math.max(a,i[0])],"input")},l={min:r.min,max:r.max,step:r.step??1};return f(u,{children:[f("span",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[f("label",{children:[d("span",{children:"Minimum"}),d("input",{...l,"data-sentence-filter-autofocus":!0,type:"number",value:i[0],onChange:e=>a(0,e.currentTarget.valueAsNumber),style:y})]}),f("label",{children:[d("span",{children:"Maximum"}),d("input",{...l,type:"number",value:i[1],onChange:e=>a(1,e.currentTarget.valueAsNumber),style:y})]})]}),f("label",{children:[f("span",{style:m,children:["Minimum ",r.label]}),d("input",{...l,type:"range",value:i[0],onChange:e=>a(0,e.currentTarget.valueAsNumber),style:{width:"100%"}})]}),f("label",{children:[f("span",{style:m,children:["Maximum ",r.label]}),d("input",{...l,type:"range",value:i[1],onChange:e=>a(1,e.currentTarget.valueAsNumber),style:{width:"100%"}})]})]})}function F({value:e,definition:t,setValue:n,close:r}){const i=t,a=[{value:!0,label:i.trueLabel??"On"},{value:!1,label:i.falseLabel??"Off"}],l=A(a.map(e=>({...e})),!1===e?1:0);return d("span",{ref:l.listRef,role:"listbox","aria-label":i.label,style:{display:"flex",gap:4},children:a.map((t,i)=>d("button",{"data-sentence-filter-option-index":i,"data-sentence-filter-autofocus":i===l.activeIndex?"":void 0,type:"button",role:"option","aria-selected":e===t.value,tabIndex:i===l.activeIndex?0:-1,onKeyDown:l.onKeyDown,onClick:e=>{n(t.value,E(e)),r()},style:{...v,justifyContent:"center",backgroundColor:e===t.value?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent"},children:t.label},t.value+""))})}function R({value:e,definition:t,setValue:n,close:r}){const i=t,a="string"==typeof e?e:"",[l,o]=c.useState(""),s=c.useMemo(()=>M(i.suggestions??[],l),[l,i.suggestions]),p=A(s);return f(u,{children:[d("input",{"data-sentence-filter-autofocus":!0,type:"text","aria-label":i.label,placeholder:i.placeholder,value:a,onChange:e=>{o(e.currentTarget.value),n(e.currentTarget.value,"input")},onKeyDown:e=>{"ArrowDown"===e.key&&s.length>0&&(e.preventDefault(),p.focusIndex(S(s,-1,1)))},style:y}),s.length>0?d("span",{ref:p.listRef,role:"listbox","aria-label":i.label+" suggestions",style:{display:"flex",flexDirection:"column",gap:2},children:s.map((e,t)=>d("button",{"data-sentence-filter-option-index":t,type:"button",role:"option","aria-selected":e.value===a,disabled:e.disabled,tabIndex:t===p.activeIndex?0:-1,onKeyDown:p.onKeyDown,onClick:t=>{n(e.value,E(t)),r()},style:{...v,opacity:e.disabled?.5:1},children:d(D,{option:e})},`${e.value}-${t}`))}):null]})}function W(e){switch(e.definition.type){case"select":return d($,{...e});case"multiselect":return d(N,{...e});case"number":return d(V,{...e});case"range":return d(I,{...e});case"toggle":return d(F,{...e});case"text":return d(R,{...e})}}function H({sentence:e,filters:t,defaultFilters:n,definitions:r,onChange:i,as:a="div",className:l,style:o,size:s="inherit",align:u="start",wrap:y=!0,disabled:g=!1,readOnly:x=!1,ariaLabel:w,id:E,renderControl:M,onOpenChange:S}){const[A,D]=c.useState(()=>({...n??{}})),$=t??A,N=c.useRef($);N.current=$;const V=void 0!==t,I=c.useMemo(()=>function(e){const t=[];let n="";const r=()=>{if(!n)return;const e=t[t.length-1];"text"===e?.type?e.value+=n:t.push({type:"text",value:n}),n=""};for(let i=0;e.length>i;)if(e.startsWith("{{",i))n+="{",i+=2;else if(e.startsWith("}}",i))n+="}",i+=2;else{if("{"===e[i]){const n=e.indexOf("}",i+1);if(-1!==n){const a=e.slice(i+1,n);if(a.length>0&&!a.includes("{")){r(),t.push({type:"filter",key:a}),i=n+1;continue}}}n+=e[i],i+=1}return r(),t}(e),[e]),[F,R]=c.useState(null),[H,K]=c.useState(b),z=c.useRef(F);z.current=F;const T=c.useRef(null),j=c.useRef(null),O=c.useRef(new Set),[B,X]=c.useState(""),[q,_]=c.useState(null),[P,Z]=c.useState(null),G=c.useId().replace(/:/g,""),U=E??"sentence-filter-"+G;c.useEffect(()=>{if("undefined"==typeof process||"production"!==process.env?.NODE_ENV)for(const e of I){if("filter"!==e.type)continue;let t=null;r[e.key]?e.key in $||(t=`SentenceFilter: placeholder "{${e.key}}" has no matching filter value.`):t=`SentenceFilter: placeholder "{${e.key}}" has no matching definition.`,t&&!O.current.has(t)&&(O.current.add(t),console.warn(t))}},[r,$,I]);const J=c.useCallback(()=>{z.current&&(z.current=null,R(null),K(b),S?.(null),j.current?.focus())},[S]);c.useEffect(()=>{if(!F)return;const e=e=>{T.current?.contains(e.target)||J()},t=e=>{"Escape"===e.key&&(e.preventDefault(),J())};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("click",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("click",e),document.removeEventListener("keydown",t)}},[J,F]),p(()=>{if(!F||"undefined"==typeof window)return;const e=T.current?.querySelector(`[data-sentence-filter-popover="${F.occurrence}"]`);if(!e)return;const t=()=>{const t=16,n=e.getBoundingClientRect();if(0>=n.width)return;const r=j.current?.getBoundingClientRect(),i=window.visualViewport,a=i?.offsetLeft??0,l=i?.offsetTop??0,o=i?.width??window.innerWidth,s=a+o,c=l+(i?.height??window.innerHeight),u=window.getComputedStyle(e),d=Number.parseFloat(u.getPropertyValue("--sentence-filter-popover-viewport-inset-top")),f=Number.parseFloat(u.getPropertyValue("--sentence-filter-popover-viewport-inset-bottom"));let p=l+(Number.isFinite(d)?Math.max(0,d):0),m=c-(Number.isFinite(f)?Math.max(0,f):0),h=j.current?.parentElement??null;for(;h;){const e=window.getComputedStyle(h);if("sticky"===e.position){const t=h.getBoundingClientRect(),n=Number.parseFloat(e.top),r=Number.parseFloat(e.bottom);Number.isFinite(n)&&1>=Math.abs(t.top-(l+n))&&(p=Math.max(p,t.bottom)),Number.isFinite(r)&&1>=Math.abs(t.bottom-(c-r))&&(m=Math.min(m,t.top))}h=h.parentElement}const b=n.left-H.offsetX,y=n.right-H.offsetX;let v=0;y>s-t&&(v-=y-(s-t)),a+t>b+v&&(v+=a+t-(b+v));const g=r?m-r.bottom-8-t:m-p-32,x=r?r.top-p-8-t:0,w=Math.min(Math.max(n.height,e.scrollHeight),160)>g&&x>g?"above":"below",k=Math.max(0,Math.min(384,Math.floor("above"===w?x:g))),C=Math.max(0,Math.floor(o-32));K(e=>e.offsetX===v&&e.placement===w&&e.maxHeight===k&&e.maxWidth===C?e:{offsetX:v,placement:w,maxHeight:k,maxWidth:C})};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),window.visualViewport?.addEventListener("resize",t),window.visualViewport?.addEventListener("scroll",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),window.visualViewport?.removeEventListener("resize",t),window.visualViewport?.removeEventListener("scroll",t)}},[F,H]),c.useEffect(()=>{if(!F)return;const e=T.current?.querySelector(`[data-sentence-filter-popover="${F.occurrence}"]`),t=e?.querySelector("[data-sentence-filter-autofocus]")??e;t?.focus()},[F]),c.useEffect(()=>{F&&(g||x||r[F.key]?.disabled)&&J()},[J,r,g,F,x]);const Q=c.useCallback((e,t,n)=>{const a=N.current,l=a[e]??null,o={...a,[e]:t};V||(N.current=o,D(o));const s={key:e,previousValue:l,value:t,source:n};i?.(o,s);const c=r[e];if(c){const e=L(c,l,a),n=L(c,t,o);X(`${c.label} changed from ${e} to ${n}.`)}},[V,r,i]),Y=c.useMemo(()=>I.map(e=>{if("text"===e.type)return e.value;const t=r[e.key];return t?L(t,$[e.key],$):`{${e.key}}`}).join(""),[r,$,I]),ee={position:"relative",margin:0,color:"var(--sentence-filter-text-color, inherit)",fontFamily:"inherit",fontSize:"small"===s?"0.875rem":"medium"===s?"1rem":"large"===s?"1.5rem":"inherit",lineHeight:"inherit",textAlign:"start"===u?"start":"end"===u?"end":"center",whiteSpace:y?"normal":"nowrap",...o},te=["semiotic-sentence-filter",l].filter(Boolean).join(" ");let ne=0;return f(a,{ref:e=>{T.current=e},id:U,className:te,style:ee,role:"div"===a||"span"===a?"group":void 0,"aria-label":w??Y,"data-semiotic-control":"sentence-filter","data-sentence-filter-state":V?"controlled":"uncontrolled",children:[I.map((e,t)=>{if("text"===e.type)return d("span",{"aria-hidden":"true",children:e.value},t);const n=r[e.key];if(!n)return d("span",{"aria-hidden":"true",children:`{${e.key}}`},t);const i=ne;ne+=1;const a=$[e.key]??null,l=function(e,t,n){return k(t)?e.emptyLabel??"Any":e.formatValue?e.formatValue(t,n):C(e,t)}(n,a,$),o=L(n,a,$),s=F?.key===e.key&&F.occurrence===i,c=g||x||!!n.disabled,u=e.key.replace(/[^a-zA-Z0-9_-]/g,"-"),p=`${U}-${u}-${i}-popover`;return f("span",{className:"semiotic-sentence-filter__value",style:{position:"relative",display:"inline"},children:[d("button",{type:"button","aria-haspopup":"dialog","aria-expanded":s,"aria-controls":p,"aria-label":`${n.label}: ${o}. Activate to change.`,disabled:c,"data-sentence-filter-key":e.key,"data-sentence-filter-type":n.type,"data-sentence-filter-open":s||void 0,onMouseEnter:()=>_(i),onMouseLeave:()=>_(e=>e===i?null:e),onFocus:()=>Z(i),onBlur:()=>Z(e=>e===i?null:e),onClick:t=>{if(c)return;if(s)return void J();j.current=t.currentTarget;const r={key:e.key,occurrence:i};z.current=r,K(b),R(r),X(n.label+" control opened."),S?.(e.key)},style:{appearance:"none",display:"inline",minWidth:24,padding:"0.35em 0.12em",margin:"-0.35em 0",color:n.accent??"var(--sentence-filter-accent, var(--semiotic-primary, #4e79a7))",backgroundColor:q===i||s?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",border:0,borderBottom:"var(--sentence-filter-underline-thickness, 0.09em) solid currentColor",borderRadius:2,outline:P===i?"2px solid var(--sentence-filter-focus-color, currentColor)":"2px solid transparent",outlineOffset:2,font:"inherit",fontWeight:600,lineHeight:"inherit",textAlign:"inherit",cursor:c?"default":"pointer",opacity:c?.6:1},children:l}),s?f("span",{id:p,role:"dialog","aria-label":n.label,"aria-describedby":n.description?p+"-description":void 0,tabIndex:-1,"data-sentence-filter-popover":i,"data-sentence-filter-key":e.key,style:{...h,top:"below"===H.placement?"calc(100% + 0.5rem)":"auto",bottom:"above"===H.placement?"calc(100% + 0.5rem)":"auto",left:H.offsetX,maxHeight:H.maxHeight??h.maxHeight,maxWidth:H.maxWidth??h.maxWidth},children:[d("span",{style:{fontWeight:650},children:n.label}),n.description?d("span",{id:p+"-description",style:{fontSize:"0.88em",opacity:.78},children:n.description}):null,M?M({key:e.key,value:a,filters:$,definition:n,setValue:(t,n="programmatic")=>Q(e.key,t,n),close:J}):d(W,{value:a,definition:n,setValue:(t,n)=>Q(e.key,t,n),close:J}),n.allowClear&&!k(a)?f("button",{type:"button",onClick:()=>{Q(e.key,"multiselect"===n.type?[]:null,"clear"),J()},style:{...v,justifyContent:"center",border:"1px solid var(--semiotic-border, #cbd5e1)"},children:["Clear ",n.label]}):null]}):null]},`${e.key}-${i}`)}),d("span",{role:"status","aria-live":"polite","aria-atomic":"true","data-sentence-filter-live-region":!0,style:m,children:B})]})}export{e as CircularBrush,t as DirectManipulationControl,n as MobileStandardControls,H as SentenceFilter,r as VISUALIZATION_CONTROL_TYPES,i as auditVisualizationControls,a as clampMobileRange,l as createControlObservationAdapter,o as useMobileRangeControls,s as zoomMobileRange};
|
|
2
|
+
import{CircularBrush as e,DirectManipulationControl as t}from"./chunk-chunk-4ITOQRXM.module.min.js";import{MobileStandardControls as n,clampMobileRange as r,useMobileRangeControls as i,zoomMobileRange as a}from"./chunk-chunk-UOQRPGPK.module.min.js";import{VISUALIZATION_CONTROL_TYPES as l,auditVisualizationControls as o,createControlObservationAdapter as s}from"./chunk-chunk-FQPKOAIH.module.min.js";import*as u from"react";import{Fragment as c,jsx as d,jsxs as f}from"react/jsx-runtime";var p="undefined"==typeof window?u.useEffect:u.useLayoutEffect,m={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},h={position:"absolute",zIndex:30,top:"calc(100% + 0.5rem)",left:0,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:8,width:"var(--sentence-filter-popover-width, 18rem)",maxWidth:"min(22rem, calc(100vw - 2rem))",maxHeight:"min(24rem, calc(100vh - 2rem))",overflow:"auto",padding:12,color:"var(--sentence-filter-text-color, var(--semiotic-text, #1f2933))",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #cbd5e1)",borderRadius:6,boxShadow:"0 10px 28px rgba(15, 23, 42, 0.18)",fontFamily:"inherit",fontSize:"1rem",fontWeight:400,lineHeight:1.4,textAlign:"left",whiteSpace:"normal"},b={offsetX:0,placement:"below",maxHeight:null,maxWidth:null},y={boxSizing:"border-box",width:"100%",minHeight:38,padding:"6px 8px",color:"inherit",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #94a3b8)",borderRadius:4,font:"inherit"},v={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,width:"100%",minHeight:38,padding:"7px 8px",color:"inherit",backgroundColor:"transparent",border:0,borderRadius:4,font:"inherit",textAlign:"left",cursor:"pointer"};function g(e){return null==e||"boolean"==typeof e?"":"string"==typeof e||"number"==typeof e?e+"":Array.isArray(e)?e.map(g).join(""):u.isValidElement(e)?g(e.props.children):""}function x(e,t){return Object.is(e,t)}function w(e,t){return e.find(e=>x(e.value,t))}function k(e){return null==e||""===e||Array.isArray(e)&&0===e.length}function C(e,t){if(k(t))return e.emptyLabel??"Any";if("select"===e.type)return w(e.options,t)?.label??t+"";if("multiselect"===e.type){const n=t.map(t=>w(e.options,t)?.label??t+""),r="or"===e.conjunction?" or ":" and ";return n.map((e,t)=>f(u.Fragment,{children:[t>0?r:null,e]},t))}return"toggle"===e.type?t?e.trueLabel??"on":e.falseLabel??"off":"range"===e.type?`${t[0]} to ${t[1]}`:t+""}function L(e,t,n){return k(t)?g(e.emptyLabel??"Any"):e.getAccessibleValue?e.getAccessibleValue(t,n):g(C(e,t))||t+""}function M(e){return 0===e.detail?"keyboard":"pointer"}function E(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(e=>[g(e.label),...e.keywords??[]].some(e=>e.toLocaleLowerCase().includes(n))):e}function S(e,t,n){if(0===e.length)return-1;for(let r=1;e.length>=r;r+=1){const i=(t+n*r+e.length)%e.length;if(!e[i].disabled)return i}return-1}function A(e,t=0){const[n,r]=u.useState(()=>e[t]&&!e[t].disabled?t:S(e,-1,1)),i=u.useRef(null),a=u.useRef({value:"",at:0});u.useEffect(()=>{(0>n||!e[n]||e[n].disabled)&&r(S(e,-1,1))},[n,e]);const l=u.useCallback(e=>{0>e||(r(e),i.current?.querySelector(`[data-sentence-filter-option-index="${e}"]`)?.focus())},[]),o=u.useCallback(t=>{let r=-1;if("ArrowDown"===t.key)r=S(e,n,1);else if("ArrowUp"===t.key)r=S(e,n,-1);else if("Home"===t.key)r=S(e,-1,1);else if("End"===t.key)r=S(e,0,-1);else if(1===t.key.length&&!t.altKey&&!t.ctrlKey&&!t.metaKey){const i=Date.now(),l=a.current,o=`${i-l.at>600?"":l.value}${t.key}`.toLocaleLowerCase();a.current={value:o,at:i};for(let t=1;e.length>=t;t+=1){const i=(Math.max(n,-1)+t)%e.length,a=e[i],l=[g(a.label),...a.keywords??[]];if(!a.disabled&&l.some(e=>e.toLocaleLowerCase().startsWith(o))){r=i;break}}}0>r||(t.preventDefault(),l(r))},[n,l,e]);return{activeIndex:n,focusIndex:l,listRef:i,onKeyDown:o}}function D({option:e}){return f(c,{children:[d("span",{children:e.label}),null!=e.count?d("span",{"aria-label":e.count+" results",children:e.count}):null,e.description?d("span",{style:{display:"block",fontSize:"0.82em",opacity:.78},children:e.description}):null]})}function $({value:e,definition:t,setValue:n,close:r}){const i=t,[a,l]=u.useState(""),o=u.useMemo(()=>E(i.options,a),[a,i.options]),s=Math.max(0,o.findIndex(t=>x(t.value,e))),p=A(o,s);return f(c,{children:[i.searchable?d("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+i.label,value:a,onChange:e=>l(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),p.focusIndex(S(o,-1,1)))},style:y}):null,f("span",{ref:p.listRef,role:"listbox","aria-label":i.label,style:{display:"flex",flexDirection:"column",gap:2},children:[o.map((t,a)=>d("button",{"data-sentence-filter-option-index":a,"data-sentence-filter-autofocus":i.searchable||a!==p.activeIndex?void 0:"",type:"button",role:"option","aria-selected":x(t.value,e),tabIndex:a===p.activeIndex?0:-1,disabled:t.disabled,onKeyDown:p.onKeyDown,onClick:e=>{n(t.value,M(e)),r()},style:{...v,backgroundColor:x(t.value,e)?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",opacity:t.disabled?.5:1},children:d(D,{option:t})},`${t.value+""}-${a}`)),0===o.length?d("span",{role:"status",children:"No options found."}):null]})]})}function N({value:e,definition:t,setValue:n}){const r=t,[i,a]=u.useState(""),l=u.useMemo(()=>E(r.options,i),[r.options,i]),o=Array.isArray(e)?e:[],s=A(l);return f(c,{children:[r.searchable?d("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+r.label,value:i,onChange:e=>a(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),s.focusIndex(S(l,-1,1)))},style:y}):null,f("span",{ref:s.listRef,role:"group","aria-label":r.label,style:{display:"flex",flexDirection:"column",gap:2},children:[l.map((e,t)=>{const i=o.some(t=>x(t,e.value));return f("label",{style:{...v,justifyContent:"flex-start",opacity:e.disabled?.5:1},children:[d("input",{"data-sentence-filter-option-index":t,"data-sentence-filter-autofocus":r.searchable||t!==s.activeIndex?void 0:"",type:"checkbox",checked:i,disabled:e.disabled,tabIndex:t===s.activeIndex?0:-1,onKeyDown:s.onKeyDown,onChange:t=>{const r=t.currentTarget.checked?[...o,e.value]:o.filter(t=>!x(t,e.value));n(r,"input")}}),d("span",{style:{flex:1},children:d(D,{option:e})})]},`${e.value+""}-${t}`)}),0===l.length?d("span",{role:"status",children:"No options found."}):null]})]})}function I({value:e,definition:t,setValue:n}){const r=t,i=r.inputMode??"input",a={min:r.min,max:r.max,step:r.step??1,value:"number"==typeof e?e:r.min??0,onChange:e=>{const t=e.currentTarget.valueAsNumber;Number.isFinite(t)&&n(t,"input")}};return f(c,{children:["slider"!==i?d("input",{...a,"data-sentence-filter-autofocus":!0,type:"number","aria-label":r.label,style:y}):null,"input"!==i?d("input",{...a,"data-sentence-filter-autofocus":"slider"===i?"":void 0,type:"range","aria-label":r.label,style:{width:"100%"}}):null]})}function V({value:e,definition:t,setValue:n}){const r=t,i=Array.isArray(e)&&e.length>=2?[Number(e[0]),Number(e[1])]:[r.min,r.max],a=(e,t)=>{if(!Number.isFinite(t))return;const a=Math.min(r.max,Math.max(r.min,t));n(0===e?[Math.min(a,i[1]),i[1]]:[i[0],Math.max(a,i[0])],"input")},l={min:r.min,max:r.max,step:r.step??1};return f(c,{children:[f("span",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[f("label",{children:[d("span",{children:"Minimum"}),d("input",{...l,"data-sentence-filter-autofocus":!0,type:"number",value:i[0],onChange:e=>a(0,e.currentTarget.valueAsNumber),style:y})]}),f("label",{children:[d("span",{children:"Maximum"}),d("input",{...l,type:"number",value:i[1],onChange:e=>a(1,e.currentTarget.valueAsNumber),style:y})]})]}),f("label",{children:[f("span",{style:m,children:["Minimum ",r.label]}),d("input",{...l,type:"range",value:i[0],onChange:e=>a(0,e.currentTarget.valueAsNumber),style:{width:"100%"}})]}),f("label",{children:[f("span",{style:m,children:["Maximum ",r.label]}),d("input",{...l,type:"range",value:i[1],onChange:e=>a(1,e.currentTarget.valueAsNumber),style:{width:"100%"}})]})]})}function R({value:e,definition:t,setValue:n,close:r}){const i=t,a=[{value:!0,label:i.trueLabel??"On"},{value:!1,label:i.falseLabel??"Off"}],l=A(a.map(e=>({...e})),!1===e?1:0);return d("span",{ref:l.listRef,role:"listbox","aria-label":i.label,style:{display:"flex",gap:4},children:a.map((t,i)=>d("button",{"data-sentence-filter-option-index":i,"data-sentence-filter-autofocus":i===l.activeIndex?"":void 0,type:"button",role:"option","aria-selected":e===t.value,tabIndex:i===l.activeIndex?0:-1,onKeyDown:l.onKeyDown,onClick:e=>{n(t.value,M(e)),r()},style:{...v,justifyContent:"center",backgroundColor:e===t.value?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent"},children:t.label},t.value+""))})}function F({value:e,definition:t,setValue:n,close:r}){const i=t,a="string"==typeof e?e:"",[l,o]=u.useState(""),s=u.useMemo(()=>E(i.suggestions??[],l),[l,i.suggestions]),p=A(s);return f(c,{children:[d("input",{"data-sentence-filter-autofocus":!0,type:"text","aria-label":i.label,placeholder:i.placeholder,value:a,onChange:e=>{o(e.currentTarget.value),n(e.currentTarget.value,"input")},onKeyDown:e=>{"ArrowDown"===e.key&&s.length>0&&(e.preventDefault(),p.focusIndex(S(s,-1,1)))},style:y}),s.length>0?d("span",{ref:p.listRef,role:"listbox","aria-label":i.label+" suggestions",style:{display:"flex",flexDirection:"column",gap:2},children:s.map((e,t)=>d("button",{"data-sentence-filter-option-index":t,type:"button",role:"option","aria-selected":e.value===a,disabled:e.disabled,tabIndex:t===p.activeIndex?0:-1,onKeyDown:p.onKeyDown,onClick:t=>{n(e.value,M(t)),r()},style:{...v,opacity:e.disabled?.5:1},children:d(D,{option:e})},`${e.value}-${t}`))}):null]})}function K(e){switch(e.definition.type){case"select":return d($,{...e});case"multiselect":return d(N,{...e});case"number":return d(I,{...e});case"range":return d(V,{...e});case"toggle":return d(R,{...e});case"text":return d(F,{...e})}}function H({sentence:e,filters:t,defaultFilters:n,definitions:r,onChange:i,as:a="div",className:l,style:o,size:s="inherit",align:c="start",wrap:y=!0,disabled:g=!1,readOnly:x=!1,ariaLabel:w,id:M,renderControl:E,onOpenChange:S}){const[A,D]=u.useState(()=>({...n??{}})),$=t??A,N=u.useRef($);N.current=$;const I=void 0!==t,V=u.useMemo(()=>function(e){const t=[];let n="";const r=()=>{if(!n)return;const e=t[t.length-1];"text"===e?.type?e.value+=n:t.push({type:"text",value:n}),n=""};for(let i=0;e.length>i;)if(e.startsWith("{{",i))n+="{",i+=2;else if(e.startsWith("}}",i))n+="}",i+=2;else{if("{"===e[i]){const n=e.indexOf("}",i+1);if(-1!==n){const a=e.slice(i+1,n);if(a.length>0&&!a.includes("{")){r(),t.push({type:"filter",key:a}),i=n+1;continue}}}n+=e[i],i+=1}return r(),t}(e),[e]),[R,F]=u.useState(null),[H,W]=u.useState(b),T=u.useRef(R);T.current=R;const j=u.useRef(null),z=u.useRef(null),O=u.useRef(new Set),[X,B]=u.useState(""),[P,q]=u.useState(null),[_,Q]=u.useState(null),U=u.useId().replace(/:/g,""),G=M??"sentence-filter-"+U;u.useEffect(()=>{if("undefined"==typeof process||"production"!==process.env?.NODE_ENV)for(const e of V){if("filter"!==e.type)continue;let t=null;r[e.key]?e.key in $||(t=`SentenceFilter: placeholder "{${e.key}}" has no matching filter value.`):t=`SentenceFilter: placeholder "{${e.key}}" has no matching definition.`,t&&!O.current.has(t)&&(O.current.add(t),console.warn(t))}},[r,$,V]);const Z=u.useCallback(()=>{T.current&&(T.current=null,F(null),W(b),S?.(null),z.current?.focus())},[S]);u.useEffect(()=>{if(!R)return;const e=e=>{j.current?.contains(e.target)||Z()},t=e=>{"Escape"===e.key&&(e.preventDefault(),Z())};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("click",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("click",e),document.removeEventListener("keydown",t)}},[Z,R]),p(()=>{if(!R||"undefined"==typeof window)return;const e=j.current?.querySelector(`[data-sentence-filter-popover="${R.occurrence}"]`);if(!e)return;const t=()=>{const t=16,n=e.getBoundingClientRect();if(0>=n.width)return;const r=z.current?.getBoundingClientRect(),i=window.visualViewport,a=i?.offsetLeft??0,l=i?.offsetTop??0,o=i?.width??window.innerWidth,s=a+o,u=l+(i?.height??window.innerHeight),c=window.getComputedStyle(e),d=Number.parseFloat(c.getPropertyValue("--sentence-filter-popover-viewport-inset-top")),f=Number.parseFloat(c.getPropertyValue("--sentence-filter-popover-viewport-inset-bottom"));let p=l+(Number.isFinite(d)?Math.max(0,d):0),m=u-(Number.isFinite(f)?Math.max(0,f):0),h=z.current?.parentElement??null;for(;h;){const e=window.getComputedStyle(h);if("sticky"===e.position){const t=h.getBoundingClientRect(),n=Number.parseFloat(e.top),r=Number.parseFloat(e.bottom);Number.isFinite(n)&&1>=Math.abs(t.top-(l+n))&&(p=Math.max(p,t.bottom)),Number.isFinite(r)&&1>=Math.abs(t.bottom-(u-r))&&(m=Math.min(m,t.top))}h=h.parentElement}const b=n.left-H.offsetX,y=n.right-H.offsetX;let v=0;y>s-t&&(v-=y-(s-t)),a+t>b+v&&(v+=a+t-(b+v));const g=r?m-r.bottom-8-t:m-p-32,x=r?r.top-p-8-t:0,w=Math.min(Math.max(n.height,e.scrollHeight),160)>g&&x>g?"above":"below",k=Math.max(0,Math.min(384,Math.floor("above"===w?x:g))),C=Math.max(0,Math.floor(o-32));W(e=>e.offsetX===v&&e.placement===w&&e.maxHeight===k&&e.maxWidth===C?e:{offsetX:v,placement:w,maxHeight:k,maxWidth:C})};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),window.visualViewport?.addEventListener("resize",t),window.visualViewport?.addEventListener("scroll",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),window.visualViewport?.removeEventListener("resize",t),window.visualViewport?.removeEventListener("scroll",t)}},[R,H]),u.useEffect(()=>{if(!R)return;const e=j.current?.querySelector(`[data-sentence-filter-popover="${R.occurrence}"]`),t=e?.querySelector("[data-sentence-filter-autofocus]")??e;t?.focus()},[R]),u.useEffect(()=>{R&&(g||x||r[R.key]?.disabled)&&Z()},[Z,r,g,R,x]);const J=u.useCallback((e,t,n)=>{const a=N.current,l=a[e]??null,o={...a,[e]:t};I||(N.current=o,D(o));const s={key:e,previousValue:l,value:t,source:n};i?.(o,s);const u=r[e];if(u){const e=L(u,l,a),n=L(u,t,o);B(`${u.label} changed from ${e} to ${n}.`)}},[I,r,i]),Y=u.useMemo(()=>V.map(e=>{if("text"===e.type)return e.value;const t=r[e.key];return t?L(t,$[e.key],$):`{${e.key}}`}).join(""),[r,$,V]),ee={position:"relative",margin:0,color:"var(--sentence-filter-text-color, inherit)",fontFamily:"inherit",fontSize:"small"===s?"0.875rem":"medium"===s?"1rem":"large"===s?"1.5rem":"inherit",lineHeight:"inherit",textAlign:"start"===c?"start":"end"===c?"end":"center",whiteSpace:y?"normal":"nowrap",...o},te=["semiotic-sentence-filter",l].filter(Boolean).join(" ");let ne=0;return f(a,{ref:e=>{j.current=e},id:G,className:te,style:ee,role:"div"===a||"span"===a?"group":void 0,"aria-label":w??Y,"data-semiotic-control":"sentence-filter","data-sentence-filter-state":I?"controlled":"uncontrolled",children:[V.map((e,t)=>{if("text"===e.type)return d("span",{"aria-hidden":"true",children:e.value},t);const n=r[e.key];if(!n)return d("span",{"aria-hidden":"true",children:`{${e.key}}`},t);const i=ne;ne+=1;const a=$[e.key]??null,l=function(e,t,n){return k(t)?e.emptyLabel??"Any":e.formatValue?e.formatValue(t,n):C(e,t)}(n,a,$),o=L(n,a,$),s=R?.key===e.key&&R.occurrence===i,u=g||x||!!n.disabled,c=e.key.replace(/[^a-zA-Z0-9_-]/g,"-"),p=`${G}-${c}-${i}-popover`;return f("span",{className:"semiotic-sentence-filter__value",style:{position:"relative",display:"inline"},children:[d("button",{type:"button","aria-haspopup":"dialog","aria-expanded":s,"aria-controls":p,"aria-label":`${n.label}: ${o}. Activate to change.`,disabled:u,"data-sentence-filter-key":e.key,"data-sentence-filter-type":n.type,"data-sentence-filter-open":s||void 0,onMouseEnter:()=>q(i),onMouseLeave:()=>q(e=>e===i?null:e),onFocus:()=>Q(i),onBlur:()=>Q(e=>e===i?null:e),onClick:t=>{if(u)return;if(s)return void Z();z.current=t.currentTarget;const r={key:e.key,occurrence:i};T.current=r,W(b),F(r),B(n.label+" control opened."),S?.(e.key)},style:{appearance:"none",display:"inline",minWidth:24,padding:"0.35em 0.12em",margin:"-0.35em 0",color:n.accent??"var(--sentence-filter-accent, var(--semiotic-primary, #4e79a7))",backgroundColor:P===i||s?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",border:0,borderBottom:"var(--sentence-filter-underline-thickness, 0.09em) solid currentColor",borderRadius:2,outline:_===i?"2px solid var(--sentence-filter-focus-color, currentColor)":"2px solid transparent",outlineOffset:2,font:"inherit",fontWeight:600,lineHeight:"inherit",textAlign:"inherit",cursor:u?"default":"pointer",opacity:u?.6:1},children:l}),s?f("span",{id:p,role:"dialog","aria-label":n.label,"aria-describedby":n.description?p+"-description":void 0,tabIndex:-1,"data-sentence-filter-popover":i,"data-sentence-filter-key":e.key,style:{...h,top:"below"===H.placement?"calc(100% + 0.5rem)":"auto",bottom:"above"===H.placement?"calc(100% + 0.5rem)":"auto",left:H.offsetX,maxHeight:H.maxHeight??h.maxHeight,maxWidth:H.maxWidth??h.maxWidth},children:[d("span",{style:{fontWeight:650},children:n.label}),n.description?d("span",{id:p+"-description",style:{fontSize:"0.88em",opacity:.78},children:n.description}):null,E?E({key:e.key,value:a,filters:$,definition:n,setValue:(t,n="programmatic")=>J(e.key,t,n),close:Z}):d(K,{value:a,definition:n,setValue:(t,n)=>J(e.key,t,n),close:Z}),n.allowClear&&!k(a)?f("button",{type:"button",onClick:()=>{J(e.key,"multiselect"===n.type?[]:null,"clear"),Z()},style:{...v,justifyContent:"center",border:"1px solid var(--semiotic-border, #cbd5e1)"},children:["Clear ",n.label]}):null]}):null]},`${e.key}-${i}`)}),d("span",{role:"status","aria-live":"polite","aria-atomic":"true","data-sentence-filter-live-region":!0,style:m,children:X})]})}export{e as CircularBrush,t as DirectManipulationControl,n as MobileStandardControls,H as SentenceFilter,l as VISUALIZATION_CONTROL_TYPES,o as auditVisualizationControls,r as clampMobileRange,s as createControlObservationAdapter,i as useMobileRangeControls,a as zoomMobileRange};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{forceCenter as e,forceCollide as t,forceLink as o,forceManyBody as n,forceSimulation as r,forceX as a,forceY as f}from"d3-force";function c(c,s,i={}){const d=i.seed??1,u=i.iterations??260,l=i.repulsion??5200,g=i.linkDistance??165,h=i.linkStrength??.045,y=i.centerStrength??.018,b=i.damping??.84,m=i.nodeRadius??12,p=i.nodePadding??3,M=i.inset??.06,x=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(d),S=new Map;for(const e of c)S.set(e.id,0);for(const e of s)S.set(e.source,(S.get(e.source)??0)+1),S.set(e.target,(S.get(e.target)??0)+1);const k=500,w=c.map(e=>({id:e.id,data:e,x:200+600*x(),y:200+600*x()})),v=new Set(c.map(e=>e.id)),q=s.filter(e=>v.has(e.source)&&v.has(e.target)).map(e=>({source:e.source,target:e.target}));if(u>0){const c=r(w).randomSource(x).alphaDecay(1-Math.pow(.001,1/u)).velocityDecay(Math.max(0,Math.min(1,1-b))).force("charge",n().strength(e=>{const t=S.get(e.id)??0;return 2.5*-Math.sqrt(l)*Math.sqrt(t+1)})).force("collide",t(e=>(e=>"function"==typeof m?m(e.data):m)(e)+p).strength(.9).iterations(2)).force("center",e(k,k).strength(.8)).force("x",a(k).strength(y)).force("y",f(k).strength(y));q.length>0&&c.force("link",o(q).id(e=>e.id).distance(g).strength(e=>{const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id,n=Math.max(1,Math.min(S.get(t)??1,S.get(o)??1));return h/.045/n})),c.stop();for(let e=0;e<u;e+=1)c.tick()}let z=1/0,I=1/0,R=-1/0,$=-1/0;for(const e of w){const t=e.x??k,o=e.y??k;t<z&&(z=t),o<I&&(I=o),t>R&&(R=t),o>$&&($=o)}const E=R-z,_=$-I,C={};for(const e of w)C[e.id]={x:0===E?.5:M+((e.x??k)-z)/E*(1-2*M),y:0===_?.5:M+((e.y??k)-I)/_*(1-2*M)};return C}import{forceSimulation as s,forceCenter as i,forceX as d,forceY as u,forceLink as l,forceManyBody as g,forceCollide as h}from"d3-force";import{scaleLinear as y}from"d3-scale";function b(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function m(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function p(e){const t=e.map(b),o=t.length-1;return e=>{if(e<=0){const[e,o,n]=t[0];return m(e,o,n)}if(e>=1){const[e,n,r]=t[o];return m(e,n,r)}const n=e*o,r=Math.floor(n),a=n-r,[f,c,s]=t[r],[i,d,u]=t[r+1];return m(Math.round(f+(i-f)*a),Math.round(c+(d-c)*a),Math.round(s+(u-s)*a))}}var M=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];p(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),p(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),p(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),p(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),p(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),p(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),p(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),p(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),p(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),p(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),p(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),p(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),p(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),p(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),p(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),p(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),p(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var x=new Set,S=new WeakMap;function k(e,t){if(!e||!e.data||"object"!=typeof e.data)return e;let o=S.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,S.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;x.has(e)||(x.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}var w={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const r=o.forceStrength??.1,a=n[0]/2,f=n[1]/2,c=Math.max(.1,Math.min(1,Math.min(n[0],n[1])/200)),y=Math.min(.5,.06+1.8*(1-c)),b=o.__previousPositions;let m=0;const p=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=b?.get(t.id);e?m++:o?(t.x=o.x,t.y=o.y,m++):p.push(t)}const M=e.length>0?p.length/e.length:1,x=m>0&&M<=.3;if(x){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of p){const n=v(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const r=q(e.id),a=r%360*(Math.PI/180),f=(10+r%20)*c;e.x=t/n.length+f*Math.cos(a),e.y=o/n.length+f*Math.sin(a)}else{const t=q(e.id),o=t%360*(Math.PI/180),n=(15+t%30)*c;e.x=a+n*Math.cos(o),e.y=f+n*Math.sin(o)}}}else{const t=Math.PI*(3-Math.sqrt(5));for(let o=0;o<e.length;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5)*c,r=o*t;n.x=a+e*Math.cos(r),n.y=f+e*Math.sin(r)}}}const S=e.length,k=o.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(S-30)))),w=o.__skipForceSimulation||0===o.iterations?0:x?40:k,I=z(o.nodeSize,o.nodeSizeRange,e),R=e=>I(e);if(w>0){const b=new Map,m=new Map;for(const t of e)b.set(t.id,0),m.set(t.id,t);for(const e of t){const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id;b.set(t,(b.get(t)??0)+1),b.set(o,(b.get(o)??0)+1)}const p=l().strength(e=>{const t=e.weight,o="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,a=Math.max(1,Math.min(b.get(o)??1,b.get(n)??1)),f=t&&t>0?Math.sqrt(t):1;return Math.min(2.5,f*r/(.1*a))}).distance(e=>{const t="string"==typeof e.source?m.get(e.source):e.source,o="string"==typeof e.target?m.get(e.target):e.target,n=(t?R(t):0)+(o?R(o):0)+Math.max(6,12*c);return Math.max(16,40*c,n)}).id(e=>e.id),M=s();if(void 0===o.random&&void 0===o.seed||M.randomSource(o.random??function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(o.seed)),M.force("charge",g().strength(e=>{const t=b.get(e.id)??0;return-15*c*R(e)*Math.sqrt(t+1)})).force("collide",h(e=>R(e)+3*c).strength(.9).iterations(2)).force("center",i(a,f).strength(.8)).force("x",d(a).strength(y)).force("y",u(f).strength(y)).force("bounds",function(e,t,o=2,n=.6){let r=[];const a=a=>{const f=n*Math.max(a,.2);for(const n of r){const r=n.x??e[0]/2,a=n.y??e[1]/2,c=n.vx??0,s=n.vy??0,i=t(n)+o,d=Math.min(e[0]/2,i),u=Math.max(e[0]/2,e[0]-i),l=Math.min(e[1]/2,i),g=Math.max(e[1]/2,e[1]-i),h=r+c,y=a+s;h<d?n.vx=c+(d-h)*f:h>u&&(n.vx=c+(u-h)*f),y<l?n.vy=s+(l-y)*f:y>g&&(n.vy=s+(g-y)*f)}};return a.initialize=e=>{r=e},a}(n,R)),M.nodes(e),t.length>0){const e=t.map(e=>({...e,source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));p.links(e),M.force("link",p)}x?M.alpha(.3):M.alpha()<.1&&M.alpha(1),M.stop();for(let e=0;e<w;++e)M.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=R(t),o=w>0?2:0,r=Math.min(n[0]/2,e+o),a=Math.min(n[1]/2,e+o);t.x=Math.max(r,Math.min(n[0]-r,t.x)),t.y=Math.max(a,Math.min(n[1]-a,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const $=new Map;for(const t of e)$.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=$.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=$.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){const r=o.nodeStyle,a=o.edgeStyle,f=z(o.nodeSize,o.nodeSizeRange,e),c=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:M,s=new Map;e.forEach((e,t)=>{s.set(e.id,c[t%c.length])});const i=[],d=[],u=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=f(k(t,"nodeSize")),n=r?r(k(t,"nodeStyle")):{},a={fill:n.fill||s.get(t.id)||o.themeSemantic?.primary||"#007bff",stroke:n.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??2,opacity:n.opacity};i.push({type:"circle",cx:t.x,cy:t.y,r:e,style:a,datum:t,id:t.id,label:t.id})}const l=new Map;for(const t of e)l.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:l.get(e.source),n="object"==typeof e.target?e.target:l.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const r=a?a(k(e,"edgeStyle")):{},f={stroke:r.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:r.strokeWidth??1,opacity:r.opacity??.6};d.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:f,datum:e})}if(!1!==o.showLabels){const t=(g=o.nodeLabel)?"function"==typeof g?g:e=>e[g]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=f(k(o,"nodeSize"));u.push({x:o.x,y:o.y-n-4,text:String(e),anchor:"middle",baseline:"auto",fontSize:11})}}var g;return{sceneNodes:i,sceneEdges:d,labels:u}}};function v(e,t,o){const n=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,a="string"==typeof r.target?r.target:r.target.id;let f=null;if(t===e?f=a:a===e&&(f=t),f){const e=o.get(f);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function q(e){let t=0;for(let o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function z(e,t,o){if(o.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const n=t||[5,20],r=[];for(const t of o){const o=t.data?.[e];"number"==typeof o&&r.push(o)}if(0===r.length)return()=>n[0];const[a,f]=function(e){let t=1/0,o=-1/0;for(const n of e)n<t&&(t=n),n>o&&(o=n);return[t,o]}(r);if(a===f)return()=>(n[0]+n[1])/2;const c=y().domain([a,f]).range(n).clamp(!0);return t=>{const o=t.data?.[e];return null==o||"number"!=typeof o?n[0]:c(o)}}self.onmessage=e=>{const t=e.data,o=t?.requestId,n=t?.request??t;try{if("normalized"===n.kind){const e=n.nodeRadii,t=e?{...n.options,nodeRadius:t=>e[t.id]??12}:n.options;return void self.postMessage({requestId:o,positions:c(n.nodes,n.edges,t)})}const e=n.nodes,t=n.edges;w.computeLayout(e,t,n.config,n.size),self.postMessage({requestId:o,positions:Object.fromEntries(e.map(e=>[e.id,{x:e.x,y:e.y}]))})}catch(e){self.postMessage({requestId:o,error:{message:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:"Error",stack:e instanceof Error?e.stack:void 0}})}};
|
|
1
|
+
import{forceCenter as e,forceCollide as t,forceLink as n,forceManyBody as o,forceSimulation as a,forceX as r,forceY as f}from"d3-force";function c(c,s,i={}){const d=i.seed??1,l=i.iterations??260,u=i.repulsion??5200,h=i.linkDistance??165,g=i.linkStrength??.045,b=i.centerStrength??.018,m=i.damping??.84,y=i.nodeRadius??12,p=i.nodePadding??3,M=i.inset??.06,x=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(d),S=new Map;for(const e of c)S.set(e.id,0);for(const e of s)S.set(e.source,(S.get(e.source)??0)+1),S.set(e.target,(S.get(e.target)??0)+1);const k=500,w=c.map(e=>({id:e.id,data:e,x:200+600*x(),y:200+600*x()})),v=new Set(c.map(e=>e.id)),q=s.filter(e=>v.has(e.source)&&v.has(e.target)).map(e=>({source:e.source,target:e.target}));if(l>0){const c=a(w).randomSource(x).alphaDecay(1-Math.pow(.001,1/l)).velocityDecay(Math.max(0,Math.min(1,1-m))).force("charge",o().strength(e=>{const t=S.get(e.id)??0;return 2.5*-Math.sqrt(u)*Math.sqrt(t+1)})).force("collide",t(e=>(e=>"function"==typeof y?y(e.data):y)(e)+p).strength(.9).iterations(2)).force("center",e(k,k).strength(.8)).force("x",r(k).strength(b)).force("y",f(k).strength(b));q.length>0&&c.force("link",n(q).id(e=>e.id).distance(h).strength(e=>{const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(S.get(t)??1,S.get(n)??1));return g/.045/o})),c.stop();for(let e=0;e<l;e+=1)c.tick()}let z=1/0,I=1/0,R=-1/0,$=-1/0;for(const e of w){const t=e.x??k,n=e.y??k;t<z&&(z=t),n<I&&(I=n),t>R&&(R=t),n>$&&($=n)}const E=R-z,_=$-I,C={};for(const e of w)C[e.id]={x:0===E?.5:M+((e.x??k)-z)/E*(1-2*M),y:0===_?.5:M+((e.y??k)-I)/_*(1-2*M)};return C}import{forceSimulation as s,forceCenter as i,forceX as d,forceY as l,forceLink as u,forceManyBody as h,forceCollide as g}from"d3-force";import{scaleLinear as b}from"d3-scale";function m(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function y(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function p(e){const t=e.map(m),n=t.length-1;return e=>{if(e<=0){const[e,n,o]=t[0];return y(e,n,o)}if(e>=1){const[e,o,a]=t[n];return y(e,o,a)}const o=e*n,a=Math.floor(o),r=o-a,[f,c,s]=t[a],[i,d,l]=t[a+1];return y(Math.round(f+(i-f)*r),Math.round(c+(d-c)*r),Math.round(s+(l-s)*r))}}var M=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];p(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),p(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),p(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),p(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),p(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),p(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),p(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),p(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),p(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),p(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),p(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),p(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),p(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),p(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),p(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),p(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),p(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var x=new Set,S=new WeakMap;function k(e,t){if(!e||!e.data||"object"!=typeof e.data)return e;let n=S.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,S.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;x.has(e)||(x.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}function w(e){return"string"==typeof e?e:e.id}var v={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const a=n.forceStrength??.1,r=o[0]/2,f=o[1]/2,c=Math.max(.1,Math.min(1,Math.min(o[0],o[1])/200)),b=Math.min(.5,.06+1.8*(1-c)),m=n.__previousPositions;let y=0;const p=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=m?.get(t.id);e?y++:n?(t.x=n.x,t.y=n.y,y++):p.push(t)}const M=e.length>0?p.length/e.length:1,x=y>0&&M<=.3;if(x){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of p){const o=q(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const a=z(e.id),r=a%360*(Math.PI/180),f=(10+a%20)*c;e.x=t/o.length+f*Math.cos(r),e.y=n/o.length+f*Math.sin(r)}else{const t=z(e.id),n=t%360*(Math.PI/180),o=(15+t%30)*c;e.x=r+o*Math.cos(n),e.y=f+o*Math.sin(n)}}}else{const t=Math.PI*(3-Math.sqrt(5));for(let n=0;n<e.length;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5)*c,a=n*t;o.x=r+e*Math.cos(a),o.y=f+e*Math.sin(a)}}}const S=e.length,k=n.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(S-30)))),v=n.__skipForceSimulation||0===n.iterations?0:x?40:k,R=I(n.nodeSize,n.nodeSizeRange,e),$=e=>R(e);if(v>0){const m=new Map,y=new Map;for(const t of e)m.set(t.id,0),y.set(t.id,t);for(const e of t){const t=w(e.source),n=w(e.target);m.set(t,(m.get(t)??0)+1),m.set(n,(m.get(n)??0)+1)}const p=u().strength(e=>{const t=e.weight,n=w(e.source),o=w(e.target),r=Math.max(1,Math.min(m.get(n)??1,m.get(o)??1)),f=t&&t>0?Math.sqrt(t):1;return Math.min(2.5,f*a/(.1*r))}).distance(e=>{const t="string"==typeof e.source?y.get(e.source):e.source,n="string"==typeof e.target?y.get(e.target):e.target,o=(t?$(t):0)+(n?$(n):0)+Math.max(6,12*c);return Math.max(16,40*c,o)}).id(e=>e.id),M=s();if(void 0===n.random&&void 0===n.seed||M.randomSource(n.random??function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n.seed)),M.force("charge",h().strength(e=>{const t=m.get(e.id)??0;return-15*c*$(e)*Math.sqrt(t+1)})).force("collide",g(e=>$(e)+3*c).strength(.9).iterations(2)).force("center",i(r,f).strength(.8)).force("x",d(r).strength(b)).force("y",l(f).strength(b)).force("bounds",function(e,t,n=2,o=.6){let a=[];const r=r=>{const f=o*Math.max(r,.2);for(const o of a){const a=o.x??e[0]/2,r=o.y??e[1]/2,c=o.vx??0,s=o.vy??0,i=t(o)+n,d=Math.min(e[0]/2,i),l=Math.max(e[0]/2,e[0]-i),u=Math.min(e[1]/2,i),h=Math.max(e[1]/2,e[1]-i),g=a+c,b=r+s;g<d?o.vx=c+(d-g)*f:g>l&&(o.vx=c+(l-g)*f),b<u?o.vy=s+(u-b)*f:b>h&&(o.vy=s+(h-b)*f)}};return r.initialize=e=>{a=e},r}(o,$)),M.nodes(e),t.length>0){const e=t.map(e=>({...e,source:w(e.source),target:w(e.target)}));p.links(e),M.force("link",p)}x?M.alpha(.3):M.alpha()<.1&&M.alpha(1),M.stop();for(let e=0;e<v;++e)M.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=$(t),n=v>0?2:0,a=Math.min(o[0]/2,e+n),r=Math.min(o[1]/2,e+n);t.x=Math.max(a,Math.min(o[0]-a,t.x)),t.y=Math.max(r,Math.min(o[1]-r,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const E=new Map;for(const t of e)E.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=E.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=E.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){const a=n.nodeStyle,r=n.edgeStyle,f=I(n.nodeSize,n.nodeSizeRange,e),c=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:M,s=new Map;e.forEach((e,t)=>{s.set(e.id,c[t%c.length])});const i=[],d=[],l=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=f(k(t,"nodeSize")),o=a?a(k(t,"nodeStyle")):{},r={fill:o.fill||s.get(t.id)||n.themeSemantic?.primary||"#007bff",stroke:o.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:o.strokeWidth??2,opacity:o.opacity};i.push({type:"circle",cx:t.x,cy:t.y,r:e,style:r,datum:t,id:t.id,label:t.id})}const u=new Map;for(const t of e)u.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:u.get(e.source),o="object"==typeof e.target?e.target:u.get(e.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const a=r?r(k(e,"edgeStyle")):{},f={stroke:a.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:a.strokeWidth??1,opacity:a.opacity??.6};d.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:f,datum:e})}if(!1!==n.showLabels){const t=(h=n.nodeLabel)?"function"==typeof h?h:e=>e[h]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=f(k(n,"nodeSize"));l.push({x:n.x,y:n.y-o-4,text:String(e),anchor:"middle",baseline:"auto",fontSize:11})}}var h;return{sceneNodes:i,sceneEdges:d,labels:l}}};function q(e,t,n){const o=[];for(const a of t){const t=w(a.source),r=w(a.target);let f=null;if(t===e?f=r:r===e&&(f=t),f){const e=n.get(f);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function z(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function I(e,t,n){if(n.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const o=t||[5,20],a=[];for(const t of n){const n=t.data?.[e];"number"==typeof n&&a.push(n)}if(0===a.length)return()=>o[0];const[r,f]=function(e){let t=1/0,n=-1/0;for(const o of e)o<t&&(t=o),o>n&&(n=o);return[t,n]}(a);if(r===f)return()=>(o[0]+o[1])/2;const c=b().domain([r,f]).range(o).clamp(!0);return t=>{const n=t.data?.[e];return null==n||"number"!=typeof n?o[0]:c(n)}}self.onmessage=e=>{const t=e.data,n=t?.requestId,o=t?.request??t;try{if("normalized"===o.kind){const e=o.nodeRadii,t=e?{...o.options,nodeRadius:t=>e[t.id]??12}:o.options;return void self.postMessage({requestId:n,positions:c(o.nodes,o.edges,t)})}const e=o.nodes,t=o.edges;v.computeLayout(e,t,o.config,o.size),self.postMessage({requestId:n,positions:Object.fromEntries(e.map(e=>[e.id,{x:e.x,y:e.y}]))})}catch(e){self.postMessage({requestId:n,error:{message:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:"Error",stack:e instanceof Error?e.stack:void 0}})}};
|