forgebook 0.1.3 → 0.1.5
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/README.md +99 -6
- package/dist/bin/forgebook/agentClient.d.ts +17 -0
- package/dist/bin/forgebook/agentClient.d.ts.map +1 -1
- package/dist/bin/forgebook/agentClient.js +21 -0
- package/dist/bin/forgebook/agentClient.js.map +1 -1
- package/dist/bin/forgebook/agentLoopCommands.d.mts +9 -0
- package/dist/bin/forgebook/agentLoopCommands.d.mts.map +1 -0
- package/dist/bin/forgebook/agentLoopCommands.mjs +217 -0
- package/dist/bin/forgebook/agentLoopCommands.mjs.map +1 -0
- package/dist/bin/forgebook/agentText.d.ts +37 -1
- package/dist/bin/forgebook/agentText.d.ts.map +1 -1
- package/dist/bin/forgebook/agentText.js +49 -2
- package/dist/bin/forgebook/agentText.js.map +1 -1
- package/dist/bin/forgebook/agents.md +51 -0
- package/dist/bin/forgebook/agentsText.d.ts +29 -0
- package/dist/bin/forgebook/agentsText.d.ts.map +1 -0
- package/dist/bin/forgebook/agentsText.js +48 -0
- package/dist/bin/forgebook/agentsText.js.map +1 -0
- package/dist/bin/forgebook/catalogueCommands.d.ts +51 -0
- package/dist/bin/forgebook/catalogueCommands.d.ts.map +1 -0
- package/dist/bin/forgebook/catalogueCommands.js +90 -0
- package/dist/bin/forgebook/catalogueCommands.js.map +1 -0
- package/dist/bin/forgebook/errorsRun.d.ts +27 -0
- package/dist/bin/forgebook/errorsRun.d.ts.map +1 -0
- package/dist/bin/forgebook/errorsRun.js +60 -0
- package/dist/bin/forgebook/errorsRun.js.map +1 -0
- package/dist/bin/forgebook/forgebook.mjs +121 -86
- package/dist/bin/forgebook/forgebook.mjs.map +1 -1
- package/dist/bin/forgebook/importers/storybook.d.ts +53 -0
- package/dist/bin/forgebook/importers/storybook.d.ts.map +1 -0
- package/dist/bin/forgebook/importers/storybook.js +318 -0
- package/dist/bin/forgebook/importers/storybook.js.map +1 -0
- package/dist/bin/forgebook/initCommands.d.mts +9 -0
- package/dist/bin/forgebook/initCommands.d.mts.map +1 -0
- package/dist/bin/forgebook/initCommands.mjs +86 -0
- package/dist/bin/forgebook/initCommands.mjs.map +1 -0
- package/dist/bin/forgebook/initConfig.d.ts +22 -0
- package/dist/bin/forgebook/initConfig.d.ts.map +1 -0
- package/dist/bin/forgebook/initConfig.js +51 -0
- package/dist/bin/forgebook/initConfig.js.map +1 -0
- package/dist/bin/forgebook/mcpTools.d.ts +29 -3
- package/dist/bin/forgebook/mcpTools.d.ts.map +1 -1
- package/dist/bin/forgebook/mcpTools.js +130 -7
- package/dist/bin/forgebook/mcpTools.js.map +1 -1
- package/dist/bin/forgebook/newStories.d.ts +27 -0
- package/dist/bin/forgebook/newStories.d.ts.map +1 -0
- package/dist/bin/forgebook/newStories.js +109 -0
- package/dist/bin/forgebook/newStories.js.map +1 -0
- package/dist/bin/forgebook/newStoriesFile.d.ts +18 -0
- package/dist/bin/forgebook/newStoriesFile.d.ts.map +1 -0
- package/dist/bin/forgebook/newStoriesFile.js +58 -0
- package/dist/bin/forgebook/newStoriesFile.js.map +1 -0
- package/dist/bin/forgebook/storyCheckRun.d.ts +49 -0
- package/dist/bin/forgebook/storyCheckRun.d.ts.map +1 -0
- package/dist/bin/forgebook/storyCheckRun.js +178 -0
- package/dist/bin/forgebook/storyCheckRun.js.map +1 -0
- package/dist/bin/forgebook/touchWindowRun.d.ts +17 -0
- package/dist/bin/forgebook/touchWindowRun.d.ts.map +1 -0
- package/dist/bin/forgebook/touchWindowRun.js +21 -0
- package/dist/bin/forgebook/touchWindowRun.js.map +1 -0
- package/dist/bin/forgebook-docs/catalogueDocs.d.ts +24 -0
- package/dist/bin/forgebook-docs/catalogueDocs.d.ts.map +1 -0
- package/dist/bin/forgebook-docs/catalogueDocs.js +71 -0
- package/dist/bin/forgebook-docs/catalogueDocs.js.map +1 -0
- package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts +8 -0
- package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts.map +1 -1
- package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts +3 -1
- package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts.map +1 -1
- package/dist/bin/forgebook-docs/catalogueMarkdown.js +62 -42
- package/dist/bin/forgebook-docs/catalogueMarkdown.js.map +1 -1
- package/dist/bin/forgebook-docs/catalogueOptions.d.ts +39 -0
- package/dist/bin/forgebook-docs/catalogueOptions.d.ts.map +1 -0
- package/dist/bin/forgebook-docs/catalogueOptions.js +76 -0
- package/dist/bin/forgebook-docs/catalogueOptions.js.map +1 -0
- package/dist/bin/forgebook-docs/collectDocs.d.ts +3 -1
- package/dist/bin/forgebook-docs/collectDocs.d.ts.map +1 -1
- package/dist/bin/forgebook-docs/collectDocs.js +37 -13
- package/dist/bin/forgebook-docs/collectDocs.js.map +1 -1
- package/dist/bin/forgebook-docs/forgebook-docs.mjs +17 -80
- package/dist/bin/forgebook-docs/forgebook-docs.mjs.map +1 -1
- package/dist/bin/forgebook-docs/llmsText.d.ts +24 -0
- package/dist/bin/forgebook-docs/llmsText.d.ts.map +1 -0
- package/dist/bin/forgebook-docs/llmsText.js +33 -0
- package/dist/bin/forgebook-docs/llmsText.js.map +1 -0
- package/dist/bin/forgebook-docs/sourceId.d.ts +9 -0
- package/dist/bin/forgebook-docs/sourceId.d.ts.map +1 -0
- package/dist/bin/forgebook-docs/sourceId.js +45 -0
- package/dist/bin/forgebook-docs/sourceId.js.map +1 -0
- package/dist/bin/frameworkDocs.d.ts +10 -0
- package/dist/bin/frameworkDocs.d.ts.map +1 -0
- package/dist/bin/frameworkDocs.js +43 -0
- package/dist/bin/frameworkDocs.js.map +1 -0
- package/dist/src/argTypes.d.ts +23 -0
- package/dist/src/argTypes.d.ts.map +1 -1
- package/dist/src/argTypes.js +27 -0
- package/dist/src/argTypes.js.map +1 -1
- package/dist/src/catalogue.d.ts +70 -3
- package/dist/src/catalogue.d.ts.map +1 -1
- package/dist/src/catalogue.js +85 -3
- package/dist/src/catalogue.js.map +1 -1
- package/dist/src/controlKeys.d.ts +85 -0
- package/dist/src/controlKeys.d.ts.map +1 -0
- package/dist/src/controlKeys.js +118 -0
- package/dist/src/controlKeys.js.map +1 -0
- package/dist/src/frame/frame.css +33 -2
- package/dist/src/frame/frameView.d.ts +2 -2
- package/dist/src/frame/frameView.d.ts.map +1 -1
- package/dist/src/frame/frameView.js +7 -3
- package/dist/src/frame/frameView.js.map +1 -1
- package/dist/src/frame/mountFrame.d.ts.map +1 -1
- package/dist/src/frame/mountFrame.js +30 -2
- package/dist/src/frame/mountFrame.js.map +1 -1
- package/dist/src/frame/spillOutline.d.ts +10 -0
- package/dist/src/frame/spillOutline.d.ts.map +1 -0
- package/dist/src/frame/spillOutline.js +80 -0
- package/dist/src/frame/spillOutline.js.map +1 -0
- package/dist/src/frame/touchDots.d.ts +32 -0
- package/dist/src/frame/touchDots.d.ts.map +1 -0
- package/dist/src/frame/touchDots.js +52 -0
- package/dist/src/frame/touchDots.js.map +1 -0
- package/dist/src/frame/touchEvents.d.ts +66 -0
- package/dist/src/frame/touchEvents.d.ts.map +1 -0
- package/dist/src/frame/touchEvents.js +152 -0
- package/dist/src/frame/touchEvents.js.map +1 -0
- package/dist/src/frame/touchGesture.d.ts +80 -0
- package/dist/src/frame/touchGesture.d.ts.map +1 -0
- package/dist/src/frame/touchGesture.js +87 -0
- package/dist/src/frame/touchGesture.js.map +1 -0
- package/dist/src/frame/touchLayer.d.ts +7 -0
- package/dist/src/frame/touchLayer.d.ts.map +1 -0
- package/dist/src/frame/touchLayer.js +399 -0
- package/dist/src/frame/touchLayer.js.map +1 -0
- package/dist/src/frame/touchScroll.d.ts +51 -0
- package/dist/src/frame/touchScroll.d.ts.map +1 -0
- package/dist/src/frame/touchScroll.js +137 -0
- package/dist/src/frame/touchScroll.js.map +1 -0
- package/dist/src/liveErrors.d.ts +57 -0
- package/dist/src/liveErrors.d.ts.map +1 -0
- package/dist/src/liveErrors.js +52 -0
- package/dist/src/liveErrors.js.map +1 -0
- package/dist/src/messages.d.ts +12 -0
- package/dist/src/messages.d.ts.map +1 -1
- package/dist/src/messages.js +4 -0
- package/dist/src/messages.js.map +1 -1
- package/dist/src/namedViews.d.ts +80 -0
- package/dist/src/namedViews.d.ts.map +1 -0
- package/dist/src/namedViews.js +88 -0
- package/dist/src/namedViews.js.map +1 -0
- package/dist/src/realTouch.d.ts +21 -0
- package/dist/src/realTouch.d.ts.map +1 -0
- package/dist/src/realTouch.js +16 -0
- package/dist/src/realTouch.js.map +1 -0
- package/dist/src/shell/AppearanceMenu.d.ts +15 -0
- package/dist/src/shell/AppearanceMenu.d.ts.map +1 -0
- package/dist/src/shell/AppearanceMenu.js +28 -0
- package/dist/src/shell/AppearanceMenu.js.map +1 -0
- package/dist/src/shell/BoxWidth.d.ts +40 -0
- package/dist/src/shell/BoxWidth.d.ts.map +1 -0
- package/dist/src/shell/BoxWidth.js +56 -0
- package/dist/src/shell/BoxWidth.js.map +1 -0
- package/dist/src/shell/ComponentPage.d.ts +17 -1
- package/dist/src/shell/ComponentPage.d.ts.map +1 -1
- package/dist/src/shell/ComponentPage.js +19 -54
- package/dist/src/shell/ComponentPage.js.map +1 -1
- package/dist/src/shell/ControlKeyField.d.ts +21 -0
- package/dist/src/shell/ControlKeyField.d.ts.map +1 -0
- package/dist/src/shell/ControlKeyField.js +46 -0
- package/dist/src/shell/ControlKeyField.js.map +1 -0
- package/dist/src/shell/ControlRow.d.ts +31 -0
- package/dist/src/shell/ControlRow.d.ts.map +1 -0
- package/dist/src/shell/ControlRow.js +30 -0
- package/dist/src/shell/ControlRow.js.map +1 -0
- package/dist/src/shell/Example.d.ts +58 -0
- package/dist/src/shell/Example.d.ts.map +1 -0
- package/dist/src/shell/Example.js +89 -0
- package/dist/src/shell/Example.js.map +1 -0
- package/dist/src/shell/InfoTip.d.ts +23 -0
- package/dist/src/shell/InfoTip.d.ts.map +1 -0
- package/dist/src/shell/InfoTip.js +51 -0
- package/dist/src/shell/InfoTip.js.map +1 -0
- package/dist/src/shell/NamedViews.d.ts +23 -0
- package/dist/src/shell/NamedViews.d.ts.map +1 -0
- package/dist/src/shell/NamedViews.js +49 -0
- package/dist/src/shell/NamedViews.js.map +1 -0
- package/dist/src/shell/PinnedControl.d.ts +25 -0
- package/dist/src/shell/PinnedControl.d.ts.map +1 -0
- package/dist/src/shell/PinnedControl.js +82 -0
- package/dist/src/shell/PinnedControl.js.map +1 -0
- package/dist/src/shell/PropsTab.d.ts +5 -2
- package/dist/src/shell/PropsTab.d.ts.map +1 -1
- package/dist/src/shell/PropsTab.js +12 -15
- package/dist/src/shell/PropsTab.js.map +1 -1
- package/dist/src/shell/Shell.d.ts.map +1 -1
- package/dist/src/shell/Shell.js +27 -2
- package/dist/src/shell/Shell.js.map +1 -1
- package/dist/src/shell/Sidebar.d.ts +11 -9
- package/dist/src/shell/Sidebar.d.ts.map +1 -1
- package/dist/src/shell/Sidebar.js +48 -42
- package/dist/src/shell/Sidebar.js.map +1 -1
- package/dist/src/shell/SidebarEntries.d.ts +50 -0
- package/dist/src/shell/SidebarEntries.d.ts.map +1 -0
- package/dist/src/shell/SidebarEntries.js +51 -0
- package/dist/src/shell/SidebarEntries.js.map +1 -0
- package/dist/src/shell/Stage.d.ts.map +1 -1
- package/dist/src/shell/Stage.js +19 -2
- package/dist/src/shell/Stage.js.map +1 -1
- package/dist/src/shell/Toolbar.d.ts +7 -3
- package/dist/src/shell/Toolbar.d.ts.map +1 -1
- package/dist/src/shell/Toolbar.js +38 -68
- package/dist/src/shell/Toolbar.js.map +1 -1
- package/dist/src/shell/ToolbarControl.d.ts +47 -0
- package/dist/src/shell/ToolbarControl.d.ts.map +1 -0
- package/dist/src/shell/ToolbarControl.js +150 -0
- package/dist/src/shell/ToolbarControl.js.map +1 -0
- package/dist/src/shell/UsedIn.d.ts +38 -0
- package/dist/src/shell/UsedIn.d.ts.map +1 -0
- package/dist/src/shell/UsedIn.js +77 -0
- package/dist/src/shell/UsedIn.js.map +1 -0
- package/dist/src/shell/ViewMenu.d.ts +37 -0
- package/dist/src/shell/ViewMenu.d.ts.map +1 -0
- package/dist/src/shell/ViewMenu.js +219 -0
- package/dist/src/shell/ViewMenu.js.map +1 -0
- package/dist/src/shell/controlCycle.d.ts +28 -0
- package/dist/src/shell/controlCycle.d.ts.map +1 -0
- package/dist/src/shell/controlCycle.js +51 -0
- package/dist/src/shell/controlCycle.js.map +1 -0
- package/dist/src/shell/dockTabs.d.ts +3 -0
- package/dist/src/shell/dockTabs.d.ts.map +1 -1
- package/dist/src/shell/dockTabs.js +1 -1
- package/dist/src/shell/dockTabs.js.map +1 -1
- package/dist/src/shell/icons.d.ts +7 -0
- package/dist/src/shell/icons.d.ts.map +1 -1
- package/dist/src/shell/icons.js +8 -1
- package/dist/src/shell/icons.js.map +1 -1
- package/dist/src/shell/keyboard.d.ts +2 -1
- package/dist/src/shell/keyboard.d.ts.map +1 -1
- package/dist/src/shell/keyboard.js +5 -2
- package/dist/src/shell/keyboard.js.map +1 -1
- package/dist/src/shell/shell.css +876 -244
- package/dist/src/shell/strings.d.ts +46 -0
- package/dist/src/shell/strings.d.ts.map +1 -1
- package/dist/src/shell/strings.js +46 -0
- package/dist/src/shell/strings.js.map +1 -1
- package/dist/src/shell/useAppearance.d.ts +17 -0
- package/dist/src/shell/useAppearance.d.ts.map +1 -0
- package/dist/src/shell/useAppearance.js +36 -0
- package/dist/src/shell/useAppearance.js.map +1 -0
- package/dist/src/shell/useControlKeys.d.ts +23 -0
- package/dist/src/shell/useControlKeys.d.ts.map +1 -0
- package/dist/src/shell/useControlKeys.js +44 -0
- package/dist/src/shell/useControlKeys.js.map +1 -0
- package/dist/src/shell/useFold.d.ts +27 -0
- package/dist/src/shell/useFold.d.ts.map +1 -0
- package/dist/src/shell/useFold.js +87 -0
- package/dist/src/shell/useFold.js.map +1 -0
- package/dist/src/shell/useFrameMessages.d.ts +2 -0
- package/dist/src/shell/useFrameMessages.d.ts.map +1 -1
- package/dist/src/shell/useFrameMessages.js +3 -0
- package/dist/src/shell/useFrameMessages.js.map +1 -1
- package/dist/src/shell/useFullPage.d.ts +45 -0
- package/dist/src/shell/useFullPage.d.ts.map +1 -0
- package/dist/src/shell/useFullPage.js +149 -0
- package/dist/src/shell/useFullPage.js.map +1 -0
- package/dist/src/shell/usePopover.d.ts +17 -3
- package/dist/src/shell/usePopover.d.ts.map +1 -1
- package/dist/src/shell/usePopover.js +65 -4
- package/dist/src/shell/usePopover.js.map +1 -1
- package/dist/src/shell/useStored.d.ts +13 -2
- package/dist/src/shell/useStored.d.ts.map +1 -1
- package/dist/src/shell/useStored.js +1 -1
- package/dist/src/shell/useStored.js.map +1 -1
- package/dist/src/shell/useToolbarLayout.d.ts +39 -0
- package/dist/src/shell/useToolbarLayout.d.ts.map +1 -0
- package/dist/src/shell/useToolbarLayout.js +58 -0
- package/dist/src/shell/useToolbarLayout.js.map +1 -0
- package/dist/src/shell/useToolbarOverflow.d.ts +31 -0
- package/dist/src/shell/useToolbarOverflow.d.ts.map +1 -0
- package/dist/src/shell/useToolbarOverflow.js +62 -0
- package/dist/src/shell/useToolbarOverflow.js.map +1 -0
- package/dist/src/shell/useWorstCase.d.ts +46 -0
- package/dist/src/shell/useWorstCase.d.ts.map +1 -0
- package/dist/src/shell/useWorstCase.js +42 -0
- package/dist/src/shell/useWorstCase.js.map +1 -0
- package/dist/src/shell/worstArgs.d.ts +42 -0
- package/dist/src/shell/worstArgs.d.ts.map +1 -0
- package/dist/src/shell/worstArgs.js +47 -0
- package/dist/src/shell/worstArgs.js.map +1 -0
- package/dist/src/spills.d.ts +31 -0
- package/dist/src/spills.d.ts.map +1 -0
- package/dist/src/spills.js +65 -0
- package/dist/src/spills.js.map +1 -0
- package/dist/src/storyCheck.d.ts +105 -0
- package/dist/src/storyCheck.d.ts.map +1 -0
- package/dist/src/storyCheck.js +63 -0
- package/dist/src/storyCheck.js.map +1 -0
- package/dist/src/switches.d.ts +26 -4
- package/dist/src/switches.d.ts.map +1 -1
- package/dist/src/switches.js +50 -5
- package/dist/src/switches.js.map +1 -1
- package/dist/src/toolbarLayout.d.ts +119 -0
- package/dist/src/toolbarLayout.d.ts.map +1 -0
- package/dist/src/toolbarLayout.js +155 -0
- package/dist/src/toolbarLayout.js.map +1 -0
- package/dist/src/usedIn.d.ts +60 -0
- package/dist/src/usedIn.d.ts.map +1 -0
- package/dist/src/usedIn.js +92 -0
- package/dist/src/usedIn.js.map +1 -0
- package/dist/src/viewState.d.ts +9 -11
- package/dist/src/viewState.d.ts.map +1 -1
- package/dist/src/viewState.js +24 -20
- package/dist/src/viewState.js.map +1 -1
- package/dist/src/viewWords.d.ts +26 -0
- package/dist/src/viewWords.d.ts.map +1 -0
- package/dist/src/viewWords.js +29 -0
- package/dist/src/viewWords.js.map +1 -0
- package/dist/src/vite/adapter.d.ts +13 -4
- package/dist/src/vite/adapter.d.ts.map +1 -1
- package/dist/src/vite/adapter.js +4 -2
- package/dist/src/vite/adapter.js.map +1 -1
- package/dist/src/vite/agent.types.d.ts +32 -2
- package/dist/src/vite/agent.types.d.ts.map +1 -1
- package/dist/src/vite/agentApi.d.ts +15 -3
- package/dist/src/vite/agentApi.d.ts.map +1 -1
- package/dist/src/vite/agentApi.js +63 -9
- package/dist/src/vite/agentApi.js.map +1 -1
- package/dist/src/vite/agentRoutes.d.ts +8 -3
- package/dist/src/vite/agentRoutes.d.ts.map +1 -1
- package/dist/src/vite/agentRoutes.js +84 -23
- package/dist/src/vite/agentRoutes.js.map +1 -1
- package/dist/src/vite/configFile.d.ts +2 -1
- package/dist/src/vite/configFile.d.ts.map +1 -1
- package/dist/src/vite/configFile.js +29 -11
- package/dist/src/vite/configFile.js.map +1 -1
- package/dist/src/vite/docsExtractor.d.ts +26 -2
- package/dist/src/vite/docsExtractor.d.ts.map +1 -1
- package/dist/src/vite/docsExtractor.js +12 -9
- package/dist/src/vite/docsExtractor.js.map +1 -1
- package/dist/src/vite/docsWorker.js +18 -2
- package/dist/src/vite/docsWorker.js.map +1 -1
- package/dist/src/vite/forcedStates.d.ts +6 -2
- package/dist/src/vite/forcedStates.d.ts.map +1 -1
- package/dist/src/vite/forcedStates.js +20 -4
- package/dist/src/vite/forcedStates.js.map +1 -1
- package/dist/src/vite/forgebookPlugin.d.ts.map +1 -1
- package/dist/src/vite/forgebookPlugin.js +104 -16
- package/dist/src/vite/forgebookPlugin.js.map +1 -1
- package/dist/src/vite/indexStoryFile.d.ts +14 -0
- package/dist/src/vite/indexStoryFile.d.ts.map +1 -1
- package/dist/src/vite/indexStoryFile.js +13 -4
- package/dist/src/vite/indexStoryFile.js.map +1 -1
- package/dist/src/vite/mcpProtocol.d.ts +9 -0
- package/dist/src/vite/mcpProtocol.d.ts.map +1 -1
- package/dist/src/vite/mcpProtocol.js +6 -3
- package/dist/src/vite/mcpProtocol.js.map +1 -1
- package/dist/src/vite/storyFilesModule.d.ts +44 -1
- package/dist/src/vite/storyFilesModule.d.ts.map +1 -1
- package/dist/src/vite/storyFilesModule.js +49 -14
- package/dist/src/vite/storyFilesModule.js.map +1 -1
- package/dist/src/vite/touchMedia.d.ts +35 -0
- package/dist/src/vite/touchMedia.d.ts.map +1 -0
- package/dist/src/vite/touchMedia.js +187 -0
- package/dist/src/vite/touchMedia.js.map +1 -0
- package/dist/src/vite/usageGraph.d.ts +45 -0
- package/dist/src/vite/usageGraph.d.ts.map +1 -0
- package/dist/src/vite/usageGraph.js +246 -0
- package/dist/src/vite/usageGraph.js.map +1 -0
- package/dist/src/vite/usageModule.d.ts +33 -0
- package/dist/src/vite/usageModule.d.ts.map +1 -0
- package/dist/src/vite/usageModule.js +135 -0
- package/dist/src/vite/usageModule.js.map +1 -0
- package/dist/src/worstCase.d.ts +16 -0
- package/dist/src/worstCase.d.ts.map +1 -0
- package/dist/src/worstCase.js +16 -0
- package/dist/src/worstCase.js.map +1 -0
- package/package.json +18 -2
- package/dist/src/shell/SchemeSwitches.d.ts +0 -24
- package/dist/src/shell/SchemeSwitches.d.ts.map +0 -1
- package/dist/src/shell/SchemeSwitches.js +0 -36
- package/dist/src/shell/SchemeSwitches.js.map +0 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/** A finger's contact size, in CSS px: about a fingertip's. */
|
|
2
|
+
const CONTACT_PX = 22;
|
|
3
|
+
/** The pointer events a finger sends, and whether each bubbles. */
|
|
4
|
+
const BUBBLES = {
|
|
5
|
+
pointerover: true,
|
|
6
|
+
pointerenter: false,
|
|
7
|
+
pointerdown: true,
|
|
8
|
+
pointermove: true,
|
|
9
|
+
pointerup: true,
|
|
10
|
+
pointercancel: true,
|
|
11
|
+
pointerout: true,
|
|
12
|
+
pointerleave: false,
|
|
13
|
+
gotpointercapture: true,
|
|
14
|
+
lostpointercapture: true
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Sends a finger's pointer event to the element that holds its pointer.
|
|
18
|
+
*
|
|
19
|
+
* @param type - the event (`pointerdown`, `pointermove`…).
|
|
20
|
+
* @param finger - the finger.
|
|
21
|
+
* @param isDown - whether it touches the screen after this event.
|
|
22
|
+
* @returns whether no handler cancelled it.
|
|
23
|
+
*/
|
|
24
|
+
export const sendPointer = (type, finger, isDown) => {
|
|
25
|
+
const view = finger.captureTarget.ownerDocument.defaultView;
|
|
26
|
+
return finger.captureTarget.dispatchEvent(new PointerEvent(type, {
|
|
27
|
+
bubbles: BUBBLES[type] ?? true,
|
|
28
|
+
cancelable: type !== "pointerenter" && type !== "pointerleave" && type !== "lostpointercapture",
|
|
29
|
+
composed: true,
|
|
30
|
+
view,
|
|
31
|
+
pointerId: finger.id,
|
|
32
|
+
pointerType: "touch",
|
|
33
|
+
isPrimary: finger.isPrimary,
|
|
34
|
+
clientX: finger.point.x,
|
|
35
|
+
clientY: finger.point.y,
|
|
36
|
+
screenX: finger.point.x,
|
|
37
|
+
screenY: finger.point.y,
|
|
38
|
+
width: CONTACT_PX,
|
|
39
|
+
height: CONTACT_PX,
|
|
40
|
+
pressure: isDown ? 0.5 : 0,
|
|
41
|
+
button: type === "pointerdown" || type === "pointerup" ? 0 : -1,
|
|
42
|
+
buttons: isDown ? 1 : 0
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
/** Whether the browser lets a page build touch events (Chromium does; Safari and Firefox on a computer do not). */
|
|
46
|
+
export const canBuildTouches = () => {
|
|
47
|
+
if (typeof Touch !== "function" || typeof TouchEvent !== "function")
|
|
48
|
+
return false;
|
|
49
|
+
try {
|
|
50
|
+
new Touch({ identifier: 0, target: document.documentElement });
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* A finger as a `Touch`.
|
|
59
|
+
*
|
|
60
|
+
* @param finger - the finger.
|
|
61
|
+
*/
|
|
62
|
+
const touchOf = (finger) => {
|
|
63
|
+
const view = finger.startTarget.ownerDocument.defaultView;
|
|
64
|
+
return new Touch({
|
|
65
|
+
identifier: finger.id,
|
|
66
|
+
target: finger.startTarget,
|
|
67
|
+
clientX: finger.point.x,
|
|
68
|
+
clientY: finger.point.y,
|
|
69
|
+
pageX: finger.point.x + (view?.scrollX ?? 0),
|
|
70
|
+
pageY: finger.point.y + (view?.scrollY ?? 0),
|
|
71
|
+
screenX: finger.point.x,
|
|
72
|
+
screenY: finger.point.y,
|
|
73
|
+
radiusX: CONTACT_PX / 2,
|
|
74
|
+
radiusY: CONTACT_PX / 2,
|
|
75
|
+
force: 0.5
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Sends a touch event for the fingers that changed, to the element the first of them went down on; nothing where the
|
|
80
|
+
* browser cannot build one.
|
|
81
|
+
*
|
|
82
|
+
* @param type - the event (`touchstart`, `touchmove`, `touchend`, `touchcancel`).
|
|
83
|
+
* @param down - every finger on the screen after this event.
|
|
84
|
+
* @param changed - the fingers this event is about.
|
|
85
|
+
* @param isCancelable - whether a handler may cancel it (a move once the page scrolls may not).
|
|
86
|
+
* @returns whether no handler cancelled it; `true` where no event was sent.
|
|
87
|
+
*/
|
|
88
|
+
export const sendTouch = (type, down, changed, isCancelable) => {
|
|
89
|
+
const [first] = changed;
|
|
90
|
+
if (first === undefined || !canBuildTouches())
|
|
91
|
+
return true;
|
|
92
|
+
const target = first.startTarget;
|
|
93
|
+
return target.dispatchEvent(new TouchEvent(type, {
|
|
94
|
+
bubbles: true,
|
|
95
|
+
cancelable: isCancelable,
|
|
96
|
+
composed: true,
|
|
97
|
+
view: target.ownerDocument.defaultView,
|
|
98
|
+
touches: down.map(touchOf),
|
|
99
|
+
targetTouches: down.filter((finger) => finger.startTarget === target).map(touchOf),
|
|
100
|
+
changedTouches: changed.map(touchOf)
|
|
101
|
+
}));
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Sends a mouse event at a finger's point, to the element under it: a tap's compatibility events (`mousedown`,
|
|
105
|
+
* `mouseup`) and a long press's `contextmenu`.
|
|
106
|
+
*
|
|
107
|
+
* @param type - the event.
|
|
108
|
+
* @param finger - the finger.
|
|
109
|
+
* @returns whether no handler cancelled it.
|
|
110
|
+
*/
|
|
111
|
+
export const sendMouse = (type, finger) => {
|
|
112
|
+
const document = finger.startTarget.ownerDocument;
|
|
113
|
+
const target = document.elementFromPoint(finger.point.x, finger.point.y) ?? finger.startTarget;
|
|
114
|
+
return target.dispatchEvent(new MouseEvent(type, {
|
|
115
|
+
bubbles: true,
|
|
116
|
+
cancelable: true,
|
|
117
|
+
composed: true,
|
|
118
|
+
view: document.defaultView,
|
|
119
|
+
clientX: finger.point.x,
|
|
120
|
+
clientY: finger.point.y,
|
|
121
|
+
screenX: finger.point.x,
|
|
122
|
+
screenY: finger.point.y,
|
|
123
|
+
button: type === "contextmenu" ? 2 : 0,
|
|
124
|
+
buttons: type === "mousedown" ? 1 : 0
|
|
125
|
+
}));
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Sends a tap's click, of the `touch` type, to the element the real click went to: the element still reacts as to a
|
|
129
|
+
* click (a checkbox toggles, a link opens), and a handler that reads `pointerType` sees a finger.
|
|
130
|
+
*
|
|
131
|
+
* @param target - the real click's target.
|
|
132
|
+
* @param finger - the finger that tapped.
|
|
133
|
+
*/
|
|
134
|
+
export const sendClick = (target, finger) => {
|
|
135
|
+
target.dispatchEvent(new PointerEvent("click", {
|
|
136
|
+
bubbles: true,
|
|
137
|
+
cancelable: true,
|
|
138
|
+
composed: true,
|
|
139
|
+
view: finger.startTarget.ownerDocument.defaultView,
|
|
140
|
+
detail: 1,
|
|
141
|
+
pointerId: finger.id,
|
|
142
|
+
pointerType: "touch",
|
|
143
|
+
isPrimary: true,
|
|
144
|
+
clientX: finger.point.x,
|
|
145
|
+
clientY: finger.point.y,
|
|
146
|
+
screenX: finger.point.x,
|
|
147
|
+
screenY: finger.point.y,
|
|
148
|
+
width: CONTACT_PX,
|
|
149
|
+
height: CONTACT_PX
|
|
150
|
+
}));
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=touchEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"touchEvents.js","sourceRoot":"","sources":["../../../src/frame/touchEvents.ts"],"names":[],"mappings":"AA4BA,+DAA+D;AAC/D,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,mEAAmE;AACnE,MAAM,OAAO,GAAsC;IACjD,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,KAAK;IACnB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,KAAK;IACnB,iBAAiB,EAAE,IAAI;IACvB,kBAAkB,EAAE,IAAI;CACzB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,MAAc,EAAE,MAAe,EAAW,EAAE;IACpF,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,C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C;AACJ,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAmB,EAAE,MAAc,EAAQ,EAAE;IACrE,MAAM,CAAC,aAAa,CAClB,IAAI,YAAY,CAAC,OAAO,EAAE;QACxB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,WAAW;QAClD,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,MAAM,CAAC,EAAE;QACpB,WAAW,EAAE,OAAO;QACpB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,KAAK,EAAE,UAAU;QACjB,MAAM,EAAE,UAAU;KACnB,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The touch simulation's reckoning, apart from the page: what a press was (a tap, a long press, a drag), where the
|
|
3
|
+
* second finger is, which axes a `touch-action` lets a finger scroll, and how a flung scroll slows down.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Pure, so the frame's touch layer (`touchLayer.ts`) stays the events' plumbing. The numbers are the platforms'
|
|
7
|
+
* usual ones: a finger may wander 10 px and still tap, a press held half a second is long, a fling loses about 5% of
|
|
8
|
+
* its speed every 16 ms.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** How far a finger may move and still tap, in CSS px. */
|
|
13
|
+
export declare const TAP_SLOP_PX = 10;
|
|
14
|
+
/** How long a press lasts before it is a long press, in ms. */
|
|
15
|
+
export declare const LONG_PRESS_MS = 500;
|
|
16
|
+
/** A point in the frame's viewport, in CSS px. */
|
|
17
|
+
export type Point = {
|
|
18
|
+
/** From the viewport's left edge. */
|
|
19
|
+
readonly x: number;
|
|
20
|
+
/** From its top edge. */
|
|
21
|
+
readonly y: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* How far a finger moved from where it went down.
|
|
25
|
+
*
|
|
26
|
+
* @param start - where it went down.
|
|
27
|
+
* @param current - where it is.
|
|
28
|
+
*/
|
|
29
|
+
export declare const distance: (start: Point, current: Point) => number;
|
|
30
|
+
/**
|
|
31
|
+
* Whether a finger that went down at `start` and is now at `current` has started to drag.
|
|
32
|
+
*
|
|
33
|
+
* @param start - where it went down.
|
|
34
|
+
* @param current - where it is.
|
|
35
|
+
*/
|
|
36
|
+
export declare const isDragging: (start: Point, current: Point) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The second finger of a two-finger gesture: mirrored around where the gesture started, so one movement of the mouse
|
|
39
|
+
* pinches and rotates at once.
|
|
40
|
+
*
|
|
41
|
+
* @param center - where the gesture started.
|
|
42
|
+
* @param first - the first finger, under the mouse.
|
|
43
|
+
*/
|
|
44
|
+
export declare const mirroredFinger: (center: Point, first: Point) => Point;
|
|
45
|
+
/**
|
|
46
|
+
* The axis a drag goes along: the one it moved further on, which a scroll then keeps to, as a phone locks a drag's
|
|
47
|
+
* axis.
|
|
48
|
+
*
|
|
49
|
+
* @param start - where the finger went down.
|
|
50
|
+
* @param current - where it is.
|
|
51
|
+
*/
|
|
52
|
+
export declare const dragAxis: (start: Point, current: Point) => "x" | "y";
|
|
53
|
+
/** The axes a finger may scroll. */
|
|
54
|
+
export type PanAxes = {
|
|
55
|
+
/** Whether it may scroll sideways. */
|
|
56
|
+
readonly x: boolean;
|
|
57
|
+
/** Whether it may scroll up and down. */
|
|
58
|
+
readonly y: boolean;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The axes one element's `touch-action` lets a finger scroll.
|
|
62
|
+
*
|
|
63
|
+
* @param touchAction - its computed `touch-action`.
|
|
64
|
+
*/
|
|
65
|
+
export declare const panAxesOf: (touchAction: string) => PanAxes;
|
|
66
|
+
/**
|
|
67
|
+
* The axes a finger may scroll through several elements: each one's `touch-action` narrows them, as the browser
|
|
68
|
+
* intersects them from the touched element up to the scrolled one.
|
|
69
|
+
*
|
|
70
|
+
* @param touchActions - the computed `touch-action` of each element on the way.
|
|
71
|
+
*/
|
|
72
|
+
export declare const allowedPan: (touchActions: readonly string[]) => PanAxes;
|
|
73
|
+
/**
|
|
74
|
+
* A fling's speed after some time, or zero once it is too slow to see.
|
|
75
|
+
*
|
|
76
|
+
* @param speed - the speed now, in CSS px per ms (signed).
|
|
77
|
+
* @param ms - the time passed.
|
|
78
|
+
*/
|
|
79
|
+
export declare const flungSpeed: (speed: number, ms: number) => number;
|
|
80
|
+
//# sourceMappingURL=touchGesture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"touchGesture.d.ts","sourceRoot":"","sources":["../../../src/frame/touchGesture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,+DAA+D;AAC/D,eAAO,MAAM,aAAa,MAAM,CAAC;AAQjC,kDAAkD;AAClD,MAAM,MAAM,KAAK,GAAG;IAClB,qCAAqC;IACrC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,KAAK,EAAE,SAAS,KAAK,KAAG,MACF,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,KAAK,EAAE,SAAS,KAAK,KAAG,OAAiD,CAAC;AAE5G;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,KAAK,EAAE,OAAO,KAAK,KAAG,KAG3D,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,KAAK,EAAE,SAAS,KAAK,KAAG,GAAG,GAAG,GACa,CAAC;AAE5E,oCAAoC;AACpC,MAAM,MAAM,OAAO,GAAG;IACpB,sCAAsC;IACtC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IACpB,yCAAyC;IACzC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,aAAa,MAAM,KAAG,OAO/C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,cAAc,SAAS,MAAM,EAAE,KAAG,OAIzD,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,IAAI,MAAM,KAAG,MAGtD,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The touch simulation's reckoning, apart from the page: what a press was (a tap, a long press, a drag), where the
|
|
3
|
+
* second finger is, which axes a `touch-action` lets a finger scroll, and how a flung scroll slows down.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Pure, so the frame's touch layer (`touchLayer.ts`) stays the events' plumbing. The numbers are the platforms'
|
|
7
|
+
* usual ones: a finger may wander 10 px and still tap, a press held half a second is long, a fling loses about 5% of
|
|
8
|
+
* its speed every 16 ms.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** How far a finger may move and still tap, in CSS px. */
|
|
13
|
+
export const TAP_SLOP_PX = 10;
|
|
14
|
+
/** How long a press lasts before it is a long press, in ms. */
|
|
15
|
+
export const LONG_PRESS_MS = 500;
|
|
16
|
+
/** How much of a fling's speed is kept every 16 ms. */
|
|
17
|
+
const FLING_KEPT = 0.95;
|
|
18
|
+
/** Below this speed a fling stops, in CSS px per ms. */
|
|
19
|
+
const FLING_STOP = 0.02;
|
|
20
|
+
/**
|
|
21
|
+
* How far a finger moved from where it went down.
|
|
22
|
+
*
|
|
23
|
+
* @param start - where it went down.
|
|
24
|
+
* @param current - where it is.
|
|
25
|
+
*/
|
|
26
|
+
export const distance = (start, current) => Math.hypot(current.x - start.x, current.y - start.y);
|
|
27
|
+
/**
|
|
28
|
+
* Whether a finger that went down at `start` and is now at `current` has started to drag.
|
|
29
|
+
*
|
|
30
|
+
* @param start - where it went down.
|
|
31
|
+
* @param current - where it is.
|
|
32
|
+
*/
|
|
33
|
+
export const isDragging = (start, current) => distance(start, current) > TAP_SLOP_PX;
|
|
34
|
+
/**
|
|
35
|
+
* The second finger of a two-finger gesture: mirrored around where the gesture started, so one movement of the mouse
|
|
36
|
+
* pinches and rotates at once.
|
|
37
|
+
*
|
|
38
|
+
* @param center - where the gesture started.
|
|
39
|
+
* @param first - the first finger, under the mouse.
|
|
40
|
+
*/
|
|
41
|
+
export const mirroredFinger = (center, first) => ({
|
|
42
|
+
x: 2 * center.x - first.x,
|
|
43
|
+
y: 2 * center.y - first.y
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* The axis a drag goes along: the one it moved further on, which a scroll then keeps to, as a phone locks a drag's
|
|
47
|
+
* axis.
|
|
48
|
+
*
|
|
49
|
+
* @param start - where the finger went down.
|
|
50
|
+
* @param current - where it is.
|
|
51
|
+
*/
|
|
52
|
+
export const dragAxis = (start, current) => Math.abs(current.x - start.x) > Math.abs(current.y - start.y) ? "x" : "y";
|
|
53
|
+
/**
|
|
54
|
+
* The axes one element's `touch-action` lets a finger scroll.
|
|
55
|
+
*
|
|
56
|
+
* @param touchAction - its computed `touch-action`.
|
|
57
|
+
*/
|
|
58
|
+
export const panAxesOf = (touchAction) => {
|
|
59
|
+
const words = touchAction.split(/\s+/);
|
|
60
|
+
if (words.includes("auto") || words.includes("manipulation"))
|
|
61
|
+
return { x: true, y: true };
|
|
62
|
+
return {
|
|
63
|
+
x: words.some((word) => word === "pan-x" || word === "pan-left" || word === "pan-right"),
|
|
64
|
+
y: words.some((word) => word === "pan-y" || word === "pan-up" || word === "pan-down")
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The axes a finger may scroll through several elements: each one's `touch-action` narrows them, as the browser
|
|
69
|
+
* intersects them from the touched element up to the scrolled one.
|
|
70
|
+
*
|
|
71
|
+
* @param touchActions - the computed `touch-action` of each element on the way.
|
|
72
|
+
*/
|
|
73
|
+
export const allowedPan = (touchActions) => touchActions.map(panAxesOf).reduce((axes, each) => ({ x: axes.x && each.x, y: axes.y && each.y }), {
|
|
74
|
+
x: true,
|
|
75
|
+
y: true
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* A fling's speed after some time, or zero once it is too slow to see.
|
|
79
|
+
*
|
|
80
|
+
* @param speed - the speed now, in CSS px per ms (signed).
|
|
81
|
+
* @param ms - the time passed.
|
|
82
|
+
*/
|
|
83
|
+
export const flungSpeed = (speed, ms) => {
|
|
84
|
+
const next = speed * FLING_KEPT ** (ms / 16);
|
|
85
|
+
return Math.abs(next) < FLING_STOP ? 0 : next;
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=touchGesture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"touchGesture.js","sourceRoot":"","sources":["../../../src/frame/touchGesture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAE9B,+DAA+D;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC,uDAAuD;AACvD,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,wDAAwD;AACxD,MAAM,UAAU,GAAG,IAAI,CAAC;AAUxB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAY,EAAE,OAAc,EAAU,EAAE,CAC/D,IAAI,C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