@web-noise/core 0.0.15-alpha → 0.0.15

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.
@@ -1 +1 @@
1
- {"mappings":"IO+LG,EC3KA,C,Q,O,C,C,Q,C,C,Y,C,K,mB,A,Q,a,C,C,iB,C,C,U,C,C,O,C,C,Y,C,K,gB,A,Q,M,iB,A,Q,U,C,K,Q,A,Q,Y,C,C,a,C,C,W,C,C,e,C,C,U,C,K,O,A,Q,U,C,K,iB,A,Q,W,C,C,gB,C,C,c,C,C,iB,C,K,gB,A,Q,mB,C,K,kB,A,Q,G,qB,C,C,W,C,C,oB,C,C,oB,C,C,Y,C,C,uB,C,C,c,C,C,qB,C,C,W,C,C,qB,C,C,gB,C,C,Y,C,C,U,C,C,iB,C,C,iB,C,K,W,A,Q,U,C,K,S,A,Q,qB,C,C,e,C,K,kB,A,Q,W,C,C,S,C,C,U,C,K,e,A,Q,gB,C,K,c,A,O,0B,A,Q,kB,C,C,Q,C,C,Q,C,C,a,C,K,iB,A,O,yC,A,Q,M,Y,A,Q,gB,C,K,W,A,Q,Y,C,K,iB,A,Q,gB,C,C,c,E,C,e,E,C,S,E,C,Y,E,K,gB,A,Q,a,E,K,c,A,Q,O,mB,A,O,kC,A,Q,c,E,C,gB,E,K,gB,A,Q,e,E,K,gB,A,Q,O,qB,A,O,oC,A,Q,U,E,K,Q,CJpBI,IAAM,GAAoB,wBACpB,GAAuB,CAAA,CAAA,EAAI,GAAA,CAAmB,IAG9C,EAKX,EADU,GAAA,IAAA,CAAA,GAAQ,CAAA,CAAA,GAClB,IAAA,CAAA,OACA,GAAA,MAAA,CAAA,SACA,GAAA,KAAA,CAAA,QACA,GAAA,GAAA,CAAA,MGMF,IAAM,GAAc,AAAc,GACzB,KAAK,KAAK,CAAC,KAAK,SAAS,CAAC,IEVtB,GAAgB,CAC3B,EACA,KAEA,IAAM,EAAU,IAAI,IAAI,EAAK,GAAG,CAAC,AAAC,G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AAM,AAAA,GAAa,GAClC,EAAQ,CACN,KAAM,QAEN,GAAI,CAAA,WAAA,EAAc,CAAC,IAAI,KAAA,CAAQ,CAC/B,KAAM,EAAK,IAAI,CACf,KAAM,CACP,GACD,MACF,CACA,QAAQ,KAAK,CAAC,wBAAyB,EACzC,EACF,EA6GwB,SAAA,CAElB,AAAA,EAAC,GAAa,CAAA,SAAA,CACX,EAAQ,KAAK,CAAC,GAAG,CAAC,CAAC,EAAM,IACxB,AAAA,EAAC,GAAG,CACF,QAAS,KACP,EAAoB,EACtB,EAEA,OAAQ,IAAU,EAAgB,SAAA,CAElC,AAAA,EAAC,GAAa,CACZ,SAAU,AAAC,GAAQ,EAAe,EAAO,GACzC,MAAO,EAAK,IAAI,EAAI,SAAS,GAE/B,AAAA,EAAC,GAAS,CACR,QAAS,AAAC,IACR,EAAM,eAAe,GAElB,OAAO,OAAO,CAAC,6CAIlB,EAAW,GACkB,IAAzB,EAAQ,KAAK,CAAC,MAAM,GACtB,EAAQ,MACR,EAAoB,GACpB,KAEJ,CAAC,GACD,AAAA,EAtBG,IAyBT,AAAA,EAAC,GAAc,CACb,QAAS,KACP,EAAQ,MACR,EAAoB,EAAQ,KAAK,CAAC,MAAM,CAC1C,EAAC,SAED,AAAA,EAAC,GAAW,CAAA,EAAG,GACA,AAAA,GAEnB,AAAA,EAAC,GAAsB,CAAA,SACrB,AAAA,EAAC,GAAe,CAAC,KAAM,EAAY,GAAM,CAAK,AAAA,EAAI,GAEnD,GACC,AAAA,EAAC,GAAgB,CAAA,SAAA,uCAAA,GAGlB,AAAA,GACU,AAAA,EAGnB,S,M,M,C,M,e,C,M,I,C,M,M,C,M,Q,C,M,U,C,M,W,C,M,Y,C,M,U,C,M,W,C,M,I,C,M,K,C,M,a,C,M,Y,C,M,O,C,M,Q,C,M,Q,C,M,K,C,M,O,C,M,O,C,M,Q","sources":["<anon>","packages/core/index.ts","packages/core/src/components/App.tsx","packages/core/src/store/index.ts","packages/core/src/constants.ts","packages/core/src/helpers/generateNodeId.ts","packages/core/src/store/nodesStore.ts","packages/core/src/store/history/index.ts","packages/core/src/store/audioPatch/index.ts","packages/core/src/store/audioPatch/compareGraphs.ts","packages/core/src/store/projectStore.ts","packages/core/src/helpers/projectFile.ts","packages/core/src/styles.ts","packages/core/src/theme.ts","packages/core/src/components/Editor/index.tsx","packages/core/src/components/contextMenu/EdgeContextMenu.tsx","packages/core/src/hooks/useTheme.ts","packages/core/src/components/contextMenu/styles.tsx","packages/core/src/components/contextMenu/EditorContextMenu.tsx","packages/core/src/components/AddNode/index.tsx","packages/core/src/components/Modal.tsx","packages/core/src/components/AddNode/Filters.tsx","packages/core/src/components/AddNode/Plugins.tsx","packages/core/src/components/UploadAudio.tsx","packages/core/src/lib/index.ts","packages/core/src/lib/hooks/useWorker.ts","packages/core/src/lib/hooks/useMessageChannel.ts","packages/core/src/lib/helpers.ts","packages/core/src/components/contextMenu/NodeContextMenu.tsx","packages/core/src/components/ControlPanel/index.tsx","packages/core/src/components/ControlPanel/ControlPanelItem.tsx","packages/core/src/hooks/useAudioNode.ts","packages/core/src/hooks/useNode.ts","packages/core/src/components/ControlPanel/styles.tsx","packages/core/src/components/Node/index.tsx","packages/core/src/components/EditableLabel.tsx","packages/core/src/components/NodeInfoModal.tsx","packages/core/src/components/Help/index.tsx","packages/core/src/components/Help/HelpModal.tsx","node_modules/@parcel/runtime-js/lib/bundles/runtime-978e9eb42c1113ef.js","packages/core/src/components/ResumeContext.tsx","packages/core/src/components/ToggleMinimap.tsx","packages/core/src/components/Wire.tsx"],"sourcesContent":["import {jsx as $but2J$jsx, jsxs as $but2J$jsxs, Fragment as $but2J$Fragment} from \"react/jsx-runtime\";\nimport {withTheme as $but2J$withTheme, ThemeProvider as $but2J$ThemeProvider, Global as $but2J$Global, css as $but2J$css, useTheme as $but2J$useTheme} from \"@emotion/react\";\nimport $but2J$emotionstyled from \"@emotion/styled\";\nimport {nanoid as $but2J$nanoid} from \"nanoid\";\nimport {useState as $but2J$useState, useEffect as $but2J$useEffect, useMemo as $but2J$useMemo, useCallback as $but2J$useCallback, useRef as $but2J$useRef} from \"react\";\nimport {FaPlus as $but2J$FaPlus} from \"react-icons/fa6\";\nimport {MdClose as $but2J$MdClose, MdDragHandle as $but2J$MdDragHandle, MdSettings as $but2J$MdSettings, MdInfoOutline as $but2J$MdInfoOutline} from \"react-icons/md\";\nimport {registerFetcher as $but2J$registerFetcher} from \"@web-noise/fetch\";\nimport $but2J$reactflow, {getConnectedEdges as $but2J$getConnectedEdges, addEdge as $but2J$addEdge, applyNodeChanges as $but2J$applyNodeChanges, applyEdgeChanges as $but2J$applyEdgeChanges, Controls as $but2J$Controls, useOnViewportChange as $but2J$useOnViewportChange, Background as $but2J$Background, BackgroundVariant as $but2J$BackgroundVariant, MiniMap as $but2J$MiniMap, ReactFlowProvider as $but2J$ReactFlowProvider, useReactFlow as $but2J$useReactFlow, Position as $but2J$Position, Handle as $but2J$Handle, ControlButton as $but2J$ControlButton, getBezierPath as $but2J$getBezierPath} from \"reactflow\";\nimport {create as $but2J$create} from \"zustand\";\nimport {setAudioNodeTypes as $but2J$setAudioNodeTypes, createPatch as $but2J$createPatch} from \"@web-noise/patch\";\nimport {reverse as $but2J$reverse, patch as $but2J$patch, create as $but2J$create1} from \"jsondiffpatch\";\nimport {injectGlobal as $but2J$injectGlobal} from \"@emotion/css\";\nimport \"reactflow/dist/style.css\";\nimport {useContextMenu as $but2J$useContextMenu, Item as $but2J$Item, Menu as $but2J$Menu, Separator as $but2J$Separator} from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport $but2J$hotkeysjs from \"hotkeys-js\";\nimport {createPortal as $but2J$createPortal} from \"react-dom\";\nimport {FileDrop as $but2J$FileDrop} from \"react-file-drop\";\nimport {FaFileUpload as $but2J$FaFileUpload, FaQuestion as $but2J$FaQuestion, FaVolumeOff as $but2J$FaVolumeOff, FaMap as $but2J$FaMap, FaRegMap as $but2J$FaRegMap} from \"react-icons/fa\";\nimport {Resizable as $but2J$Resizable} from \"re-resizable\";\nimport $but2J$reactgridlayout from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport {AiFillLock as $but2J$AiFillLock, AiFillUnlock as $but2J$AiFillUnlock} from \"react-icons/ai\";\nimport {RxDashboard as $but2J$RxDashboard} from \"react-icons/rx\";\nimport $but2J$reactmoderndrawer from \"react-modern-drawer\";\nimport \"react-modern-drawer/dist/index.css\";\nimport {marked as $but2J$marked} from \"marked\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\n\n\n\n\n\n\n\n\n\n\nconst $73e253e9a60dc018$export$956b3cf15d7c363 = \"web-noise-drag-handle\";\nconst $73e253e9a60dc018$export$21d634b1d5d9bee3 = `.${$73e253e9a60dc018$export$956b3cf15d7c363}`;\nconst $73e253e9a60dc018$export$9f05d3e6ade4c09e = {\n rowHeight: 10,\n cols: 4\n};\nvar $73e253e9a60dc018$export$b0b7b95ee465c83c;\n(function(PortType) {\n PortType[\"Gate\"] = \"gate\";\n PortType[\"Number\"] = \"number\";\n PortType[\"Audio\"] = \"audio\";\n PortType[\"Any\"] = \"any\";\n})($73e253e9a60dc018$export$b0b7b95ee465c83c || ($73e253e9a60dc018$export$b0b7b95ee465c83c = {}));\n\n\nconst $d4298e88fc7d0886$var$generateNodeId = (node)=>{\n const random = +new Date() + Math.floor(Math.random() * 1000);\n if (!node?.type) return random.toString();\n return `${node.type}-${random}`;\n};\nvar $d4298e88fc7d0886$export$2e2bcd8739ae039 = $d4298e88fc7d0886$var$generateNodeId;\n\n\n\n\nconst $44ab4fe1439b009e$var$nodesStateCreator = (set, get)=>({\n nodes: [],\n edges: [],\n onNodesChange: (changes)=>{\n set(({ nodes: nodes })=>({\n nodes: (0, $but2J$applyNodeChanges)(changes, nodes).map((node)=>({\n dragHandle: (0, $73e253e9a60dc018$export$21d634b1d5d9bee3),\n ...node\n }))\n }));\n },\n onEdgesChange: (changes)=>{\n set(({ edges: edges })=>({\n edges: (0, $but2J$applyEdgeChanges)(changes, edges)\n }));\n },\n onConnect: (connection)=>{\n set(({ edges: edges })=>({\n edges: (0, $but2J$addEdge)(connection, edges)\n }));\n },\n addNode: (node)=>{\n set(({ nodes: nodes })=>({\n nodes: nodes.concat(node)\n }));\n },\n setNodes: (nodes)=>{\n set({\n nodes: nodes\n });\n },\n setEdges: (edges)=>{\n set({\n edges: edges\n });\n },\n setNodesAndEdges: ({ nodes: nodes, edges: edges })=>{\n set({\n nodes: nodes,\n edges: edges\n });\n },\n getNodesAndEdges: ()=>{\n const { nodes: nodes, edges: edges } = get();\n return {\n nodes: nodes,\n edges: edges\n };\n },\n clearElements: ()=>{\n set({\n nodes: [],\n edges: []\n });\n },\n getNode: (id)=>{\n const { nodes: nodes } = get();\n const node = nodes.find((node)=>node.id === id);\n return node || null;\n },\n updateNodeData: (id, data)=>{\n set(({ nodes: nodes })=>{\n return {\n nodes: nodes.map((node)=>{\n if (node.id === id) return {\n ...node,\n data: {\n ...node.data,\n ...data\n }\n };\n return node;\n })\n };\n });\n },\n nodeTypes: {},\n setNodeTypes: (nodeTypes)=>set({\n nodeTypes: nodeTypes\n })\n });\nvar $44ab4fe1439b009e$export$2e2bcd8739ae039 = $44ab4fe1439b009e$var$nodesStateCreator;\n\n\n\nconst $db60a1ce8fd45a15$var$cloneObject = (input)=>{\n return JSON.parse(JSON.stringify(input));\n};\nconst $db60a1ce8fd45a15$export$b1b92d12d1c2ae0e = (set, get)=>({\n history: {\n maxHistoryLength: 5,\n buffer: [],\n pointer: 0,\n skipCollect: false,\n push: (changes)=>{\n const { history: history } = get();\n const { maxHistoryLength: maxHistoryLength, skipCollect: skipCollect } = history;\n if (skipCollect) {\n set({\n history: {\n ...history,\n skipCollect: false\n }\n });\n return;\n }\n set(({ history: history })=>{\n if (!history) return {};\n const { buffer: buffer, pointer: pointer } = history;\n const newBuffer = buffer.slice(Math.max(pointer - maxHistoryLength + 1, 0), pointer);\n return {\n history: {\n ...history,\n buffer: [\n ...newBuffer,\n changes\n ],\n pointer: Math.min(pointer + 1, maxHistoryLength)\n }\n };\n });\n },\n back: ()=>{\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, history: history } = get();\n const { buffer: buffer, pointer: pointer } = history;\n const patchData = buffer[pointer - 1];\n if (!patchData) return;\n const reversedPatchData = $but2J$reverse(patchData);\n if (!reversedPatchData) return;\n const updates = $db60a1ce8fd45a15$var$cloneObject({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel\n });\n const patch = $but2J$patch(updates, reversedPatchData);\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer - 1,\n skipCollect: true\n }\n });\n },\n forward: ()=>{\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, history: history } = get();\n const { buffer: buffer, pointer: pointer } = history;\n const patchData = buffer[pointer];\n if (!patchData) return;\n const updates = $db60a1ce8fd45a15$var$cloneObject({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel\n });\n const patch = $but2J$patch(updates, patchData);\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer + 1,\n skipCollect: true\n }\n });\n },\n // @TODO: remove this method and store history per file\n clear: ()=>{\n const { history: history } = get();\n set({\n history: {\n ...history,\n buffer: [],\n pointer: 0,\n skipCollect: true\n }\n });\n }\n }\n });\nconst $db60a1ce8fd45a15$var$COLLECT_CHANGES_DEBOUNCE_TIME = 500;\nconst $db60a1ce8fd45a15$export$4e64751394766316 = (set, get)=>{\n const jsondiffpatchInstance = $but2J$create1({\n propertyFilter: (name, context)=>{\n //@TODO: rework this function, find better solution\n if (context.parent?.parent?.childName === \"controlPanel\") return true;\n if (// @ts-ignore\n [\n \"data\",\n \"position\",\n \"controlPanel\"\n ].includes(context.parent?.childName)) return true;\n return [\n \"controlPanel\",\n \"size\",\n \"edges\",\n \"nodes\",\n \"data\",\n \"label\",\n \"config\",\n \"values\",\n \"position\",\n \"x\",\n \"y\"\n ].includes(name);\n }\n });\n let oldState = get();\n let timer;\n return (state, prevState)=>{\n if (state.currentFileIndex !== prevState.currentFileIndex) get().history.clear();\n clearTimeout(timer);\n if (!oldState) oldState = prevState;\n timer = setTimeout(()=>{\n const changes = jsondiffpatchInstance.diff(oldState, state);\n oldState = null;\n if (changes) get().history.push(changes);\n }, $db60a1ce8fd45a15$var$COLLECT_CHANGES_DEBOUNCE_TIME);\n };\n};\nconst $db60a1ce8fd45a15$var$history = (config)=>(set, get, api)=>{\n const collectChanges = $db60a1ce8fd45a15$export$4e64751394766316(set, get);\n api.subscribe(collectChanges);\n return config((...args)=>set(...args), get, api);\n };\nvar $db60a1ce8fd45a15$export$2e2bcd8739ae039 = $db60a1ce8fd45a15$var$history;\n\n\n\nconst $b69bc78343b7b1b2$export$e364ea0c1dfb25e5 = (left, right)=>{\n const setLeft = new Set(left.map((item)=>item.id));\n const setRight = new Set(right.map((item)=>item.id));\n const added = right.filter((item)=>!setLeft.has(item.id));\n const removed = left.filter((item)=>!setRight.has(item.id));\n return {\n added: added,\n removed: removed\n };\n};\n\n\nconst $91a653e423ed8b08$export$62647b40ff8aed70 = (set, get)=>({\n patch: (0, $but2J$createPatch)(),\n nodesState: {}\n });\nconst $91a653e423ed8b08$var$audioPatch = (config)=>(set, get, api)=>{\n api.subscribe(async (state, prevState)=>{});\n const promises = new Set();\n let currentState = {\n ...get(),\n nodes: [],\n edges: []\n };\n return config(async (...args)=>{\n const oldState = get();\n const [storeChanges] = args;\n //@ts-ignore\n const newState = {\n ...currentState,\n ...typeof storeChanges === \"function\" ? storeChanges({\n ...currentState\n }) : storeChanges\n };\n const nodeChanges = (0, $b69bc78343b7b1b2$export$e364ea0c1dfb25e5)(currentState.nodes, newState.nodes);\n const edgeChanges = (0, $b69bc78343b7b1b2$export$e364ea0c1dfb25e5)(currentState.edges, newState.edges);\n //@ts-ignore\n currentState = newState;\n const newNodes = nodeChanges.added;\n const newEdges = edgeChanges.added;\n const removedEdges = edgeChanges.removed;\n const removedNodes = nodeChanges.removed;\n const { patch: patch } = oldState;\n if (newNodes.length) {\n const promise = patch.registerAudioNodes(//@ts-ignore\n newNodes);\n promises.add(promise);\n await promise;\n promises.delete(promise);\n }\n if (!(newEdges.length || removedEdges.length || removedNodes.length)) {\n set(...args);\n return;\n }\n if (promises.size) try {\n await Promise.all([\n ...promises.values()\n ]);\n } catch (e) {\n console.log(\"some error\", e);\n }\n if (newEdges.length) patch.registerAudioConnections(//@ts-ignore\n newEdges);\n if (removedEdges.length) //@ts-ignore\n patch.unregisterAudioConnections(removedEdges);\n if (removedNodes.length) //@ts-ignore\n patch.unregisterAudioNodes(removedNodes);\n set(...args);\n }, get, api);\n };\nvar $91a653e423ed8b08$export$2e2bcd8739ae039 = $91a653e423ed8b08$var$audioPatch;\n\n\nconst $d6879eb00f829ebf$export$e698b79c63b74136 = (file)=>!(\"type\" in file) || file.type === \"patch\";\nconst $d6879eb00f829ebf$export$31c2336f657dc59f = (file)=>file.type === \"audio\";\n\n\nconst $fa1b05fefde68ed4$var$projectStateCreator = (set, get)=>({\n project: {\n files: []\n },\n setProject (project) {\n set({\n project: project,\n currentFileIndex: 0\n });\n },\n getProject () {\n return get().project;\n },\n pullEditorChanges () {\n const { getEditorState: getEditorState, currentFileIndex: currentFileIndex, updateFileContent: updateFileContent, project: project } = get();\n const currentFile = project.files[currentFileIndex];\n if ((0, $d6879eb00f829ebf$export$31c2336f657dc59f)(currentFile)) return;\n updateFileContent(currentFileIndex, {\n ...currentFile,\n file: getEditorState()\n });\n },\n syncEditorWithCurrentFile: ()=>{\n const { currentFileIndex: currentFileIndex, setEditorState: setEditorState, project: project } = get();\n const currentFile = project.files[currentFileIndex];\n if (currentFile.type === \"audio\") {\n console.log(\"audio file. skipping\");\n return;\n }\n setEditorState(currentFile.file);\n },\n currentFileIndex: 0,\n setCurrentFileIndex (newFileIndex) {\n const { currentFileIndex: currentFileIndex } = get();\n if (newFileIndex === currentFileIndex) return;\n set({\n currentFileIndex: newFileIndex\n });\n },\n updateFileContent (index, file) {\n const { project: project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i)=>{\n if (i === index) return {\n // @TODO check again if merging is really needed here\n ...f,\n ...file\n };\n return f;\n })\n }\n });\n },\n updateFileName (index, fileName) {\n const { project: project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i)=>{\n if (i === index) return {\n ...f,\n name: fileName\n };\n return f;\n })\n }\n });\n },\n addFile (file) {\n const { project: project } = get();\n const files = [\n ...project.files,\n file\n ];\n set({\n project: {\n ...project,\n files: files\n }\n });\n },\n deleteFile: (fileIndex)=>{\n const { project: project, currentFileIndex: currentFileIndex } = get();\n set({\n project: {\n ...project,\n files: project.files.filter((_, index)=>fileIndex !== index)\n }\n });\n if (fileIndex <= currentFileIndex) {\n const newIndex = Math.max(0, currentFileIndex - 1);\n set({\n currentFileIndex: newIndex\n });\n }\n }\n });\nvar $fa1b05fefde68ed4$export$2e2bcd8739ae039 = $fa1b05fefde68ed4$var$projectStateCreator;\n\n\nconst $40b3df4f7825b834$export$34c5bc865219488e = (...args)=>{\n const [set, get] = args;\n return {\n ...(0, $44ab4fe1439b009e$export$2e2bcd8739ae039)(...args),\n ...(0, $db60a1ce8fd45a15$export$b1b92d12d1c2ae0e)(...args),\n ...(0, $91a653e423ed8b08$export$62647b40ff8aed70)(...args),\n ...(0, $fa1b05fefde68ed4$export$2e2bcd8739ae039)(...args),\n setGraph: async ({ nodes: nodes, edges: edges })=>{\n const { patch: patch, createNodes: createNodes, createEdges: createEdges, setNodesAndEdges: setNodesAndEdges, nodes: activeNodes, edges: activeEdges } = get();\n setNodesAndEdges({\n nodes: [],\n edges: []\n });\n await createNodes(nodes);\n createEdges(edges);\n },\n clearGraph: ()=>{\n const { setGraph: setGraph } = get();\n setGraph({\n nodes: [],\n edges: []\n });\n },\n createNodes: async (nodes)=>{\n const { createNode: createNode } = get();\n await Promise.all(nodes.map((node)=>createNode(node)));\n },\n createNode: (nodeData)=>{\n const { addNode: addNode, nodesConfiguration: nodesConfiguration } = get();\n const { type: type, id: id, data: data } = nodeData;\n if (typeof type === \"undefined\") throw new Error(`node type is not defined for node: ${id}`);\n const node = {\n ...nodeData,\n data: {\n ...data,\n config: {\n ...nodesConfiguration[type]?.defaultConfig,\n ...data?.config\n }\n }\n };\n addNode(node);\n },\n removeNode: (node)=>get().removeNodes([\n node\n ]),\n removeNodes: (nodes)=>{\n const { edges: edges, nodes: currentNodes, onNodesDelete: onNodesDelete, removeEdges: removeEdges, removeNodesFromControlPanel: removeNodesFromControlPanel } = get();\n const parentNodeIds = nodes.map(({ id: id })=>id);\n const children = currentNodes.filter(({ parentNode: parentNode })=>parentNode && parentNodeIds.includes(parentNode));\n const resultingNodes = [\n ...nodes,\n ...children\n ];\n removeNodesFromControlPanel(resultingNodes);\n const connectedEdges = (0, $but2J$getConnectedEdges)(resultingNodes, edges);\n removeEdges(connectedEdges);\n onNodesDelete(resultingNodes);\n const nodeIds = resultingNodes.map(({ id: id })=>id);\n set({\n nodes: currentNodes.filter(({ id: id })=>!nodeIds.includes(id))\n });\n },\n removeEdges: (edges)=>{\n const { edges: currentEdges, onEdgesDelete: onEdgesDelete } = get();\n const edgeIds = edges.map(({ id: id })=>id);\n onEdgesDelete(edges);\n set({\n edges: currentEdges.filter(({ id: id })=>!edgeIds.includes(id))\n });\n },\n createEdges: (newEdges)=>{\n const { patch: patch, edges: edges, setEdges: setEdges } = get();\n setEdges(newEdges);\n },\n onConnect: async (connection)=>{\n const { edges: edges, createEdges: createEdges } = get();\n const newEdges = (0, $but2J$addEdge)(connection, edges);\n createEdges(newEdges);\n },\n onEdgesDelete: (edges)=>{\n const { patch: patch } = get();\n },\n onNodesDelete: async (nodes)=>{\n const { removeNodesFromControlPanel: removeNodesFromControlPanel, patch: patch } = get();\n removeNodesFromControlPanel(nodes);\n },\n plugins: [],\n setPlugins: async (plugins)=>{\n const { setNodeTypes: setNodeTypes } = get();\n set({\n plugins: plugins\n });\n const nodesConf = plugins.reduce((acc, plugin)=>{\n return {\n ...acc,\n ...plugin.components.reduce((subAcc, item)=>({\n ...subAcc,\n [item.type]: item\n }), {})\n };\n }, {});\n const nodeTypes = Object.keys(nodesConf).reduce((acc, type)=>{\n return {\n ...acc,\n [type]: nodesConf[type].node\n };\n }, {});\n const audioNodeTypes = Object.keys(nodesConf).reduce((acc, type)=>{\n return {\n ...acc,\n [type]: nodesConf[type].audioNode\n };\n }, {});\n (0, $but2J$setAudioNodeTypes)(audioNodeTypes);\n setNodeTypes(nodeTypes);\n set(({ nodesConfiguration: nodesConfiguration })=>({\n nodesConfiguration: {\n ...nodesConfiguration,\n ...nodesConf\n }\n }));\n },\n nodesConfiguration: {},\n config: {\n showMinimap: false\n },\n setConfig: (changes)=>{\n set(({ config: config })=>({\n config: {\n ...config,\n ...changes\n }\n }));\n },\n getEditorState: ()=>{\n const { getNodesAndEdges: getNodesAndEdges, controlPanel: controlPanel, viewport: viewport } = get();\n return {\n ...getNodesAndEdges(),\n controlPanel: controlPanel,\n viewport: viewport\n };\n },\n setEditorState: async ({ nodes: nodes, edges: edges, controlPanel: controlPanel, viewport: viewport })=>{\n const { setGraph: setGraph } = get();\n await setGraph({\n nodes: nodes,\n edges: edges\n });\n // @TODO: remove this line once audio patch initialisation is reworked\n await new Promise((r)=>setTimeout(r, 1000));\n set({\n controlPanel: controlPanel,\n viewport: viewport\n });\n },\n isHelpShown: false,\n toggleHelp: ()=>{\n const { isHelpShown: showHelp } = get();\n set({\n isHelpShown: !showHelp\n });\n },\n copyBuffer: {\n nodes: [],\n edges: []\n },\n copy: (elements)=>{\n set({\n copyBuffer: elements\n });\n },\n copySelectedItems: ()=>{\n const { nodes: currentNodes, edges: currentEdges, copy: copy } = get();\n const nodes = currentNodes.filter(({ selected: selected })=>selected);\n const edges = currentEdges.filter(({ selected: selected })=>selected);\n if (!nodes.length) return;\n copy({\n nodes: nodes,\n edges: edges\n });\n },\n pasteBuffer: (x = 0, y = 0)=>{\n const { copyBuffer: copyBuffer, createNodes: createNodes, setEdges: setEdges, nodes: nodes, edges: edges } = get();\n const { nodes: nodesToCopy, edges: edgesToCopy } = copyBuffer;\n if (!nodesToCopy.length) return;\n set({\n nodes: nodes.map((node)=>({\n ...node,\n selected: false\n }))\n });\n const topLeftNode = nodesToCopy.reduce((acc, node)=>{\n if (!acc) return node;\n if (node.position.x < acc.position.x && node.position.y < acc.position.y) return node;\n return acc;\n });\n const xDelta = topLeftNode.position.x - x;\n const yDelta = topLeftNode.position.y - y;\n const { nodes: newNodes, mapping: mapping } = nodesToCopy.reduce((acc, node)=>{\n const newNodeId = (0, $d4298e88fc7d0886$export$2e2bcd8739ae039)(node);\n return {\n nodes: [\n ...acc.nodes,\n {\n ...node,\n id: newNodeId,\n position: {\n x: node.position.x - xDelta,\n y: node.position.y - yDelta\n },\n selected: true\n }\n ],\n mapping: {\n ...acc.mapping,\n [node.id]: newNodeId\n }\n };\n }, {\n nodes: [],\n mapping: {}\n });\n createNodes(newNodes);\n const newEdges = edgesToCopy.map((edge)=>{\n const source = mapping[edge.source] || edge.source;\n const target = mapping[edge.target] || edge.target;\n return {\n ...edge,\n id: edge.id.replace(edge.source, source).replace(edge.target, target),\n source: source,\n target: target,\n selected: true\n };\n });\n setEdges([\n ...edges.map((edge)=>({\n ...edge,\n selected: false\n })),\n ...newEdges\n ]);\n },\n getControlPanelNode: (node)=>{\n const { nodesConfiguration: nodesConfiguration } = get();\n const { type: type } = node;\n if (!type) return null;\n const controlPanelNode = nodesConfiguration[type]?.controlPanelNode;\n if (!controlPanelNode) {\n console.error(`could not find node for type ${type}`);\n return null;\n }\n return controlPanelNode;\n },\n controlPanel: {\n show: true,\n nodes: [],\n size: {\n width: 200,\n height: 100\n }\n },\n showControlPanel: ()=>set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n show: true\n }\n })),\n hideControlPanel: ()=>set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n show: false\n }\n })),\n addNodeToControlPanel: (node)=>{\n const { nodesConfiguration: nodesConfiguration } = get();\n const defaultConfig = node.type ? nodesConfiguration[node.type]?.defaultConfig : {};\n const { height: height } = defaultConfig?.size || {};\n const newNode = {\n id: node.id,\n ...height ? {\n height: height / (0, $73e253e9a60dc018$export$9f05d3e6ade4c09e).rowHeight\n } : {}\n };\n set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n nodes: [\n ...controlPanel.nodes,\n newNode\n ]\n }\n }));\n },\n removeNodeFromControlPanel: (node)=>get().removeNodesFromControlPanel([\n node\n ]),\n removeNodesFromControlPanel: (nodes)=>{\n const nodeIds = nodes.map(({ id: id })=>id);\n set(({ controlPanel: controlPanel })=>{\n const nodes = controlPanel.nodes.filter(({ id: id })=>!nodeIds.includes(id));\n return {\n controlPanel: {\n ...controlPanel,\n nodes: nodes\n }\n };\n });\n },\n setControlPanelNodes: (nodes)=>{\n set(({ controlPanel: controlPanel })=>{\n return {\n controlPanel: {\n ...controlPanel,\n nodes: nodes\n }\n };\n });\n },\n setControlPanelSize: (size)=>{\n set(({ controlPanel: controlPanel })=>{\n return {\n controlPanel: {\n ...controlPanel,\n size: size\n }\n };\n });\n },\n viewport: {\n x: 0,\n y: 0,\n zoom: 1\n },\n setViewport: (viewport)=>set({\n viewport: viewport\n })\n };\n};\nconst $40b3df4f7825b834$var$useStore = (0, $but2J$create)((0, $91a653e423ed8b08$export$2e2bcd8739ae039)((0, $db60a1ce8fd45a15$export$2e2bcd8739ae039)($40b3df4f7825b834$export$34c5bc865219488e)));\nvar $40b3df4f7825b834$export$2e2bcd8739ae039 = $40b3df4f7825b834$var$useStore;\n\n\n\nconst $731cc06061de042d$var$LEVA_COLOR_ACCENT2_BLUE = \"#007bff\";\nconst $731cc06061de042d$var$COLOR_GREEN_PRIMARY = \"#14df42\";\nconst $731cc06061de042d$var$COLOR_WHITE_PRIMARY = \"#ffffff\";\nconst $731cc06061de042d$var$colors = {\n elevation1: \"#292d39\",\n elevation2: \"#181c20\",\n elevation3: \"#373c4b\",\n accent1: \"#0066dc\",\n accent2: $731cc06061de042d$var$LEVA_COLOR_ACCENT2_BLUE,\n accent3: \"#3c93ff\",\n highlight1: \"#535760\",\n highlight2: \"#8c92a4\",\n highlight3: \"#fefefe\",\n vivid1: $731cc06061de042d$var$COLOR_GREEN_PRIMARY,\n whitePrimary: $731cc06061de042d$var$COLOR_WHITE_PRIMARY,\n error: \"#db5353\"\n};\nconst $731cc06061de042d$var$zIndex = {\n modal: 9998,\n controlPanel: 9999,\n resumeContextLayout: 10003\n};\nconst $731cc06061de042d$var$theme = {\n colors: $731cc06061de042d$var$colors,\n zIndex: $731cc06061de042d$var$zIndex\n};\nvar $731cc06061de042d$export$2e2bcd8739ae039 = $731cc06061de042d$var$theme;\n\n\n(0, $but2J$injectGlobal)`\n .react-flow {\n .react-flow__pane {\n /* background: rgb(106 106 106); */\n /* background: \"white\"; */\n // background: #292d39;\n background: ${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.elevation3};\n }\n\n .react-flow__background {\n /* background: #efefef; */\n stroke: white;\n }\n\n .react-flow__node-default {\n background: #292d39;\n color: white;\n border: none;\n /* background: transparent; */\n }\n\n .react-flow__node {\n padding: 0;\n width: auto;\n }\n\n .react-flow__edge-path {\n stroke: ${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.accent2};\n }\n\n .react-flow__node.selected {\n border: 1px solid ${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.accent2};\n box-shadow: 0 0 0 0.5px #${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.accent2};\n }\n\n .react-flow__node-default.selected, .react-flow__node-default.selected:hover {\n box-shadow: 0 0 0 0.5px #${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.accent2};\n }\n\n /* .react-flow__minimap-mask {\n fill: ${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.elevation1}\n }\n\n .react-flow__minimap-node {\n fill:${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.accent2}\n } */\n }\n\n`;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $04218161d9aa484d$var$useTheme = ()=>{\n const customTheme = (0, $but2J$useTheme)();\n const theme = {\n ...(0, $731cc06061de042d$export$2e2bcd8739ae039),\n ...customTheme\n };\n return theme;\n};\nvar $04218161d9aa484d$export$2e2bcd8739ae039 = $04218161d9aa484d$var$useTheme;\n\n\n\n\n\n\nconst $f3e787b52be18373$export$ef9839ae55b8ba40 = (0, $but2J$emotionstyled)((0, $but2J$Item))``;\nconst $f3e787b52be18373$export$98eff9c5659394e3 = (0, $but2J$emotionstyled)((0, $but2J$Menu))`\n background: ${({ colors: colors })=>colors.elevation2};\n padding: 0;\n border-radius: 0;\n\n .react-contexify__item__content {\n color: ${({ colors: colors })=>colors.whitePrimary};\n }\n\n .react-contexify__separator {\n background-color: ${({ colors: colors })=>colors.elevation1};\n margin: 0;\n }\n`;\n\n\nconst $e54d25e5d65b9790$export$d4cd258d01c03112 = \"editor-edge-menu\";\nconst $e54d25e5d65b9790$export$8b2e4a15453bac1e = ()=>{\n const { show: show } = (0, $but2J$useContextMenu)({\n id: $e54d25e5d65b9790$export$d4cd258d01c03112\n });\n const onContextMenu = (0, $but2J$useCallback)((event, edge)=>{\n event.stopPropagation();\n show(event, {\n props: {\n edge: edge\n }\n });\n }, [\n show\n ]);\n return {\n onContextMenu: onContextMenu\n };\n};\nconst $e54d25e5d65b9790$var$EdgeContextMenu = ()=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const removeEdges = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.removeEdges);\n return (0, $but2J$jsx)((0, $but2J$Fragment), {\n children: (0, $but2J$jsx)((0, $f3e787b52be18373$export$98eff9c5659394e3), {\n id: $e54d25e5d65b9790$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: (event)=>removeEdges([\n event.props.edge\n ]),\n children: \"Delete Edge (DEL)\"\n })\n })\n });\n};\nvar $e54d25e5d65b9790$export$2e2bcd8739ae039 = $e54d25e5d65b9790$var$EdgeContextMenu;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $628ee4b8a62b71a2$var$ModalOuter = (0, $but2J$emotionstyled).div`\n position: fixed;\n z-index: ${({ theme: theme })=>theme.zIndex.modal};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: ${({ theme: theme })=>theme.colors.elevation3}cc;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\nconst $628ee4b8a62b71a2$var$ModalInner = (0, $but2J$emotionstyled).div`\n background: ${({ theme: theme })=>theme.colors.elevation2};\n box-shadow: 1px 1px 1px 1px ${({ theme: theme })=>theme.colors.elevation1};\n color: white;\n width: 70%;\n height: 80%;\n overflow-y: scroll;\n position: relative;\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n font-weight: bold;\n unicode-bidi: isolate;\n }\n\n h1 {\n font-size: 2em;\n margin-block-start: 0.67em;\n margin-block-end: 0.67em;\n }\n\n h2 {\n font-size: 1.5em;\n margin-block-start: 0.83em;\n margin-block-end: 0.83em;\n }\n\n h3 {\n font-size: 1.17em;\n margin-block-start: 1em;\n margin-block-end: 1em;\n }\n\n ul {\n display: block;\n list-style-type: disc;\n margin-block-start: 1em;\n margin-block-end: 1em;\n padding-inline-start: 40px;\n unicode-bidi: isolate;\n }\n\n p {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n unicode-bidi: isolate;\n }\n`;\nconst $628ee4b8a62b71a2$var$ModalCloser = (0, $but2J$emotionstyled)((0, $but2J$MdClose))`\n position: absolute;\n top: 0.2rem;\n right: 0.2rem;\n cursor: pointer;\n`;\nconst $628ee4b8a62b71a2$export$2b77a92f1a5ad772 = ({ children: children, onClose: onClose, ...props })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n (0, $but2J$useEffect)(()=>{\n const escHandler = (event)=>{\n if (event.key === \"Escape\") onClose?.();\n };\n document.addEventListener(\"keydown\", escHandler);\n return ()=>{\n document.removeEventListener(\"keydown\", escHandler);\n };\n }, [\n onClose\n ]);\n return /*#__PURE__*/ (0, $but2J$createPortal)((0, $but2J$jsx)($628ee4b8a62b71a2$var$ModalOuter, {\n theme: theme,\n onClick: onClose,\n children: (0, $but2J$jsxs)($628ee4b8a62b71a2$var$ModalInner, {\n ...props,\n onClick: (e)=>{\n e.stopPropagation();\n },\n theme: theme,\n children: [\n children,\n (0, $but2J$jsx)($628ee4b8a62b71a2$var$ModalCloser, {\n theme: theme,\n onClick: onClose\n })\n ]\n })\n }), document.body);\n};\nvar $628ee4b8a62b71a2$export$2e2bcd8739ae039 = $628ee4b8a62b71a2$export$2b77a92f1a5ad772;\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $d8badf9492e6c707$var$PluginsWrapper = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n width: 100%;\n`);\nconst $d8badf9492e6c707$var$PluginWrapper = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n`);\nconst $d8badf9492e6c707$var$NodesList = (0, $but2J$withTheme)((0, $but2J$emotionstyled).ul`\n list-style: none;\n margin: 0;\n padding: 0;\n padding-bottom: 10px;\n columns: 2;\n\n li {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 4px;\n overflow: hidden;\n border: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n border-radius: 4px;\n margin-bottom: 0.5rem;\n &:hover {\n border-color: ${({ theme: theme })=>theme.colors.accent2};\n cursor: pointer;\n }\n }\n`);\nconst $d8badf9492e6c707$var$NodeTitle = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`);\nconst $d8badf9492e6c707$var$NodeDescription = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n color: ${({ theme: theme })=>theme.colors.highlight2};\n font-size: 12px;\n`);\nconst $d8badf9492e6c707$export$48f6b48a42d49a36 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n display: flex;\n gap: 0.2rem;\n flex-wrap: wrap;\n`);\nconst $d8badf9492e6c707$export$7129a6e2db131a76 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).span`\n cursor: pointer;\n font-size: 10px;\n background: ${({ theme: theme, isActive: isActive })=>isActive ? theme.colors.highlight1 : theme.colors.elevation3};\n border-radius: 2px;\n padding: 0.1rem 0.2rem;\n border: 1px solid;\n border-color: ${({ theme: theme })=>theme.colors.elevation2};\n &:hover {\n border-color: ${({ theme: theme })=>theme.colors.accent2};\n }\n`);\nconst $d8badf9492e6c707$var$PluginHeader = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div``);\nconst $d8badf9492e6c707$var$PluginTitle = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n font-size: 1.1rem;\n padding: 0.25rem 0;\n color: ${({ theme: theme })=>theme.colors.highlight3};\n`);\nconst $d8badf9492e6c707$var$PluginDescription = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n color: ${({ theme: theme })=>theme.colors.highlight2};\n font-size: 12px;\n`);\nconst $d8badf9492e6c707$var$Plugins = ({ onComponentClick: onComponentClick, filters: { plugin: plugin, search: search = \"\", tags: tags }, onTagClick: onTagClick })=>{\n const plugins = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ plugins: plugins })=>plugins);\n const pluginsGroup = (0, $but2J$useMemo)(()=>{\n if (!plugin) return plugins;\n return plugins.filter(({ name: name })=>name === plugin);\n }, [\n plugins,\n plugin\n ]);\n const filteredPlugins = (0, $but2J$useMemo)(()=>{\n if (!search && !tags?.length) return pluginsGroup;\n const filteredByTags = pluginsGroup.map((plugin)=>({\n ...plugin,\n components: tags?.length ? plugin.components.filter((component)=>tags?.every((tag)=>component.tags?.includes(tag))) : plugin.components\n }));\n return filteredByTags.map((plugin)=>({\n ...plugin,\n components: plugin.components.filter(({ type: type, name: name })=>type.toLocaleLowerCase().includes(search.toLocaleLowerCase()) || name?.toLocaleLowerCase().includes(search.toLocaleLowerCase()))\n }));\n }, [\n pluginsGroup,\n search,\n tags\n ]);\n return (0, $but2J$jsx)($d8badf9492e6c707$var$PluginsWrapper, {\n children: filteredPlugins.map(({ name: name, description: description, components: components }, index)=>{\n if (!components.length) return null;\n return (0, $but2J$jsxs)($d8badf9492e6c707$var$PluginWrapper, {\n children: [\n (0, $but2J$jsxs)($d8badf9492e6c707$var$PluginHeader, {\n children: [\n (0, $but2J$jsx)($d8badf9492e6c707$var$PluginTitle, {\n children: name\n }),\n (0, $but2J$jsx)($d8badf9492e6c707$var$PluginDescription, {\n children: description\n })\n ]\n }),\n (0, $but2J$jsx)($d8badf9492e6c707$var$NodesList, {\n children: components.sort((a, b)=>a.type.toLowerCase() > b.type.toLowerCase() ? 1 : -1).map((component, idx)=>(0, $but2J$jsxs)(\"li\", {\n onClick: ()=>onComponentClick(component),\n children: [\n (0, $but2J$jsx)($d8badf9492e6c707$var$NodeTitle, {\n children: component.name || component.type\n }),\n component.description && (0, $but2J$jsx)($d8badf9492e6c707$var$NodeDescription, {\n children: component.description\n }),\n (0, $but2J$jsx)($d8badf9492e6c707$export$48f6b48a42d49a36, {\n children: component.tags?.map((tag, tagIdx)=>(0, $but2J$jsx)($d8badf9492e6c707$export$7129a6e2db131a76, {\n isActive: tags?.includes(tag),\n onClickCapture: (event)=>{\n event.stopPropagation();\n onTagClick(tag);\n },\n children: tag\n }, tagIdx))\n })\n ]\n }, idx))\n })\n ]\n }, index);\n })\n });\n};\nvar $d8badf9492e6c707$export$2e2bcd8739ae039 = $d8badf9492e6c707$var$Plugins;\n\n\nconst $18ae22c0cb4ff02c$var$InputWrapper = (0, $but2J$emotionstyled).div`\n display: flex;\n position: relative;\n`;\nconst $18ae22c0cb4ff02c$var$InputInner = (0, $but2J$emotionstyled).input`\n padding-right: 2rem;\n padding-left: 0.3rem;\n width: 100%;\n appearance: textfield;\n font-size: inherit;\n background: none;\n border: none;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n appearance: textfield;\n cursor: auto;\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n border-radius: 0.1rem;\n height: 2rem;\n color: ${({ theme: theme })=>theme.colors.highlight2};\n\n &:focus,\n &:hover {\n box-shadow: 0 0 0 var(--leva-borderWidths-focus)\n ${({ theme: theme })=>theme.colors.accent2};\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin-right: 1rem;\n }\n`;\nconst $18ae22c0cb4ff02c$var$FiltersWrapper = (0, $but2J$emotionstyled).div`\n display: flex;\n flex-direction: column;\n padding: 0.6rem;\n gap: 0.6rem;\n border-right: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n min-width: 14rem;\n`;\nconst $18ae22c0cb4ff02c$var$PluginName = (0, $but2J$emotionstyled).label`\n user-select: none;\n input {\n display: none;\n }\n input:checked + span {\n color: ${({ theme: theme })=>theme.colors.accent2};\n }\n &:hover {\n color: ${({ theme: theme })=>theme.colors.accent3};\n cursor: pointer;\n }\n`;\nconst $18ae22c0cb4ff02c$var$StyledPluginTag = (0, $but2J$withTheme)((0, $but2J$emotionstyled)((0, $d8badf9492e6c707$export$7129a6e2db131a76))`\n font-size: 12px;\n padding: 0.2rem 0.4rem;\n &:hover {\n }\n &::after {\n content: \"×\";\n margin-left: 0.4rem;\n }\n`);\nconst $18ae22c0cb4ff02c$var$Filters = ({ onChange: onChange, value: value })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const plugins = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ plugins: plugins })=>plugins);\n const inputRef = (0, $but2J$useRef)(null);\n (0, $but2J$useEffect)(()=>{\n if (!inputRef.current) return;\n inputRef.current.focus();\n }, [\n inputRef\n ]);\n return (0, $but2J$jsxs)($18ae22c0cb4ff02c$var$FiltersWrapper, {\n theme: theme,\n children: [\n (0, $but2J$jsx)($18ae22c0cb4ff02c$var$InputWrapper, {\n children: (0, $but2J$jsx)($18ae22c0cb4ff02c$var$InputInner, {\n ref: inputRef,\n theme: theme,\n value: value.search || \"\",\n placeholder: \"search...\",\n onChange: (event)=>onChange({\n ...value,\n search: event.target.value\n })\n })\n }),\n (0, $but2J$jsx)((0, $d8badf9492e6c707$export$48f6b48a42d49a36), {\n children: value.tags?.map((tag, index)=>(0, $but2J$jsx)($18ae22c0cb4ff02c$var$StyledPluginTag, {\n isActive: true,\n onClick: ()=>{\n const newTags = value.tags?.filter((t)=>t !== tag) || [];\n onChange({\n ...value,\n tags: newTags\n });\n },\n children: tag\n }, index))\n }),\n plugins.map(({ name: name, components: components }, index)=>{\n if (!name) return null;\n return (0, $but2J$jsxs)($18ae22c0cb4ff02c$var$PluginName, {\n theme: theme,\n children: [\n (0, $but2J$jsx)(\"input\", {\n type: \"checkbox\",\n name: \"plugin\",\n value: name,\n checked: name === value.plugin,\n onChange: ()=>{\n onChange({\n ...value,\n plugin: name === value.plugin ? null : name\n });\n }\n }),\n (0, $but2J$jsx)(\"span\", {\n children: name\n })\n ]\n }, index);\n })\n ]\n });\n};\nvar $18ae22c0cb4ff02c$export$2e2bcd8739ae039 = $18ae22c0cb4ff02c$var$Filters;\n\n\n\nconst $fc033f275cd8346c$var$AddNodeWrapper = (0, $but2J$emotionstyled).div`\n height: 100%;\n width: 100%;\n display: flex;\n gap: 1rem;\n`;\nconst $fc033f275cd8346c$var$PluginsPanel = (0, $but2J$emotionstyled).div`\n flex-grow: 1;\n height: 100%;\n overflow-y: scroll;\n`;\nconst $fc033f275cd8346c$var$AddNode = ({ isOpen: isOpen, closeMenu: closeMenu, mousePosition: mousePosition })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const { screenToFlowPosition: screenToFlowPosition } = (0, $but2J$useReactFlow)();\n const { createNode: createNode } = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ createNode: createNode })=>({\n createNode: createNode\n }));\n const [filtersState, setFiltersState] = (0, $but2J$useState)({});\n const onComponentClick = (0, $but2J$useCallback)(({ type: type })=>{\n const { x: x, y: y } = screenToFlowPosition(mousePosition);\n const newNode = {\n //@TODO: generate node id in `createNode` function\n id: `${type}-${+new Date()}`,\n type: type,\n data: {\n label: type\n },\n position: {\n x: x,\n y: y\n },\n targetPosition: (0, $but2J$Position).Left,\n sourcePosition: (0, $but2J$Position).Right\n };\n createNode(newNode);\n closeMenu();\n }, [\n mousePosition,\n screenToFlowPosition,\n createNode,\n closeMenu,\n mousePosition\n ]);\n return isOpen ? (0, $but2J$jsx)((0, $628ee4b8a62b71a2$export$2e2bcd8739ae039), {\n onClose: ()=>{\n closeMenu();\n setFiltersState({});\n },\n children: (0, $but2J$jsxs)($fc033f275cd8346c$var$AddNodeWrapper, {\n theme: theme,\n children: [\n (0, $but2J$jsx)((0, $18ae22c0cb4ff02c$export$2e2bcd8739ae039), {\n onChange: setFiltersState,\n value: filtersState\n }),\n (0, $but2J$jsx)($fc033f275cd8346c$var$PluginsPanel, {\n theme: theme,\n children: (0, $but2J$jsx)((0, $d8badf9492e6c707$export$2e2bcd8739ae039), {\n filters: filtersState,\n onTagClick: (tag)=>{\n setFiltersState((state)=>({\n ...state,\n tags: state.tags?.includes(tag) ? state.tags.filter((t)=>t !== tag) : [\n ...state.tags || [],\n tag\n ]\n }));\n },\n onComponentClick: (component)=>{\n onComponentClick(component);\n setFiltersState({});\n }\n })\n })\n ]\n })\n }) : null;\n};\nvar $fc033f275cd8346c$export$2e2bcd8739ae039 = $fc033f275cd8346c$var$AddNode;\n\n\n\n\n\n\n\n\n\n\n\n\nconst $840c562c77aee4a1$export$3a5757a785a34769 = (url)=>{\n const [worker, setWorker] = (0, $but2J$useState)(null);\n (0, $but2J$useEffect)(()=>{\n const newWorker = new Worker(url);\n setWorker(newWorker);\n return ()=>{\n newWorker?.terminate();\n setWorker(null);\n };\n }, []);\n return worker;\n};\nvar $840c562c77aee4a1$export$2e2bcd8739ae039 = $840c562c77aee4a1$export$3a5757a785a34769;\n\n\n\nconst $069e47322ee9145a$export$1e86115ead375efc = ()=>{\n const [channel, setChannel] = (0, $but2J$useState)(null);\n (0, $but2J$useEffect)(()=>{\n const newChannel = new MessageChannel();\n newChannel.port2.start();\n setChannel(newChannel);\n return ()=>{\n setChannel(null);\n newChannel.port2.close();\n };\n }, []);\n return channel;\n};\nvar $069e47322ee9145a$export$2e2bcd8739ae039 = $069e47322ee9145a$export$1e86115ead375efc;\n\n\nconst $459a4e08a0372e29$export$cd440e094f060920 = (param, value, audioContext)=>{\n if (typeof value === \"undefined\") return;\n param.setValueAtTime(value, audioContext.currentTime);\n};\nconst $459a4e08a0372e29$export$25df2e315be8e003 = (file)=>{\n return new Promise((resolve, reject)=>{\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = ()=>resolve(reader.result?.toString() || \"\");\n reader.onerror = (error)=>reject(error);\n });\n};\n\n\n\n\nconst $a5a5b1a37c474365$var$UploadAudioWrapper = (0, $but2J$emotionstyled).div`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme: theme })=>theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\nconst $a5a5b1a37c474365$var$DropZoneInner = (0, $but2J$emotionstyled).div`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\nconst $a5a5b1a37c474365$var$FileUploadIcon = (0, $but2J$emotionstyled)((0, $but2J$FaFileUpload))`\n width: 100%;\n height: 8rem;\n`;\nconst $a5a5b1a37c474365$var$FileUploadMessage = (0, $but2J$emotionstyled).div`\n font-size: 2rem;\n`;\nconst $a5a5b1a37c474365$var$UploadAudio = ({ isOpen: isOpen, closeMenu: closeMenu })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const setGraph = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ setGraph: setGraph })=>setGraph);\n const setEditorState = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setEditorState);\n const addFile = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.addFile);\n const fileInputRef = (0, $but2J$useRef)(null);\n const uploadFile = (0, $but2J$useCallback)(async (files)=>{\n const [file] = files || [];\n const base64 = await (0, $459a4e08a0372e29$export$25df2e315be8e003)(file);\n addFile({\n type: \"audio\",\n // @TODO: use nanoid here\n id: `audio-file-${+new Date()}`,\n name: file.name,\n file: base64\n });\n closeMenu();\n }, [\n addFile,\n closeMenu\n ]);\n const onTargetClick = ()=>{\n fileInputRef.current?.click();\n };\n return isOpen ? (0, $but2J$jsx)((0, $628ee4b8a62b71a2$export$2e2bcd8739ae039), {\n onClose: closeMenu,\n children: (0, $but2J$jsxs)($a5a5b1a37c474365$var$UploadAudioWrapper, {\n theme: theme,\n children: [\n (0, $but2J$jsx)(\"input\", {\n onChange: ({ target: { files: files } })=>uploadFile(files),\n ref: fileInputRef,\n type: \"file\",\n className: \"hidden\",\n style: {\n display: \"none\"\n },\n accept: \".wav,.mp3,.ogg\"\n }),\n (0, $but2J$jsx)((0, $but2J$FileDrop), {\n className: \"drop-zone-wrapper\",\n targetClassName: \"drop-zone\",\n draggingOverTargetClassName: \"drop-zone-drag-over\",\n onTargetClick: onTargetClick,\n onDrop: (files)=>uploadFile(files),\n children: (0, $but2J$jsxs)($a5a5b1a37c474365$var$DropZoneInner, {\n theme: theme,\n children: [\n (0, $but2J$jsx)($a5a5b1a37c474365$var$FileUploadIcon, {}),\n (0, $but2J$jsx)($a5a5b1a37c474365$var$FileUploadMessage, {\n children: \"click or drop file here\"\n })\n ]\n })\n })\n ]\n })\n }) : null;\n};\nvar $a5a5b1a37c474365$export$2e2bcd8739ae039 = $a5a5b1a37c474365$var$UploadAudio;\n\n\nconst $fee9f929ba5c051a$export$d4cd258d01c03112 = \"editor-menu\";\nconst $fee9f929ba5c051a$export$59ce2a6808e35a29 = ()=>{\n const { show: show } = (0, $but2J$useContextMenu)({\n id: $fee9f929ba5c051a$export$d4cd258d01c03112\n });\n return {\n onContextMenu: show\n };\n};\nconst $fee9f929ba5c051a$var$EditorContextMenu = ({ editorContextMenu: editorContextMenu = [] })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const [mousePosition, setMousePosition] = (0, $but2J$useState)({\n x: 0,\n y: 0\n });\n const [showAddNode, setShowAddNode] = (0, $but2J$useState)(false);\n const [showUploadAudio, setShowUploadAudio] = (0, $but2J$useState)(false);\n const addNodeHandler = (0, $but2J$useCallback)((x, y)=>{\n setMousePosition({\n x: x,\n y: y\n });\n setShowAddNode(true);\n }, [\n setShowAddNode\n ]);\n const pasteBuffer = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.pasteBuffer);\n const { screenToFlowPosition: screenToFlowPosition } = (0, $but2J$useReactFlow)();\n const pasteBufferHandler = (0, $but2J$useCallback)((mousePosition)=>{\n const { x: x, y: y } = screenToFlowPosition(mousePosition);\n pasteBuffer(x, y);\n }, [\n setShowAddNode,\n screenToFlowPosition\n ]);\n const clearGraph = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ clearGraph: clearGraph })=>clearGraph);\n const deleteAllHandler = (0, $but2J$useCallback)(()=>{\n clearGraph();\n }, [\n clearGraph\n ]);\n const toggleHelp = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n const historyBack = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.history.back);\n const historyForward = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.history.forward);\n const historyPointer = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.history.pointer);\n const historyBuffer = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.history.buffer);\n const copySelectedItems = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.copySelectedItems);\n const nodes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodes);\n const selectedNodes = (0, $but2J$useMemo)(()=>nodes.filter(({ selected: selected })=>selected), [\n nodes\n ]);\n const currentCopyBuffer = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.copyBuffer);\n const reactFlowInstance = (0, $but2J$useReactFlow)();\n (0, $but2J$useEffect)(()=>{\n (0, $but2J$hotkeysjs)(\"command+shift+a\", ()=>{\n addNodeHandler(200, 50);\n return false;\n });\n //@TODO: find more elegant way to handle ?\n (0, $but2J$hotkeysjs)(\"shift+/\", ()=>{\n toggleHelp();\n return false;\n });\n (0, $but2J$hotkeysjs)(\"command+z\", ()=>{\n historyBack();\n return false;\n });\n (0, $but2J$hotkeysjs)(\"command+shift+z\", ()=>{\n historyForward();\n return false;\n });\n (0, $but2J$hotkeysjs)(\"command+c\", ()=>{\n copySelectedItems();\n return false;\n });\n (0, $but2J$hotkeysjs)(\"command+v\", ()=>{\n pasteBufferHandler({\n x: 200,\n y: 50\n });\n return false;\n });\n return ()=>{\n (0, $but2J$hotkeysjs).unbind();\n };\n }, [\n addNodeHandler,\n pasteBufferHandler\n ]);\n return (0, $but2J$jsxs)((0, $but2J$Fragment), {\n children: [\n (0, $but2J$jsx)((0, $fc033f275cd8346c$export$2e2bcd8739ae039), {\n isOpen: showAddNode,\n closeMenu: ()=>setShowAddNode(false),\n mousePosition: mousePosition\n }),\n (0, $but2J$jsx)((0, $a5a5b1a37c474365$export$2e2bcd8739ae039), {\n isOpen: showUploadAudio,\n closeMenu: ()=>setShowUploadAudio(false)\n }),\n (0, $but2J$jsxs)((0, $f3e787b52be18373$export$98eff9c5659394e3), {\n id: $fee9f929ba5c051a$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: [\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: ({ triggerEvent: { clientX: clientX, clientY: clientY } })=>addNodeHandler(clientX, clientY),\n children: \"Add Node (\\u2318+\\u21E7+A)\"\n }),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: deleteAllHandler,\n children: \"Delete All\"\n }),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: ()=>setShowUploadAudio(true),\n children: \"Upload Audio File\"\n }),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n disabled: historyPointer === 0,\n onClick: historyBack,\n children: \"Undo (\\u2318+z)\"\n }),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n disabled: historyPointer === historyBuffer.length,\n onClick: historyForward,\n children: \"Redo (\\u2318+\\u21E7+Z)\"\n }),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n disabled: !selectedNodes.length,\n onClick: copySelectedItems,\n children: \"Copy Selected (\\u2318+c)\"\n }),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n disabled: !currentCopyBuffer.nodes.length,\n onClick: ({ triggerEvent: { clientX: x, clientY: y } })=>pasteBufferHandler({\n x: x,\n y: y\n }),\n children: \"Paste (\\u2318+v)\"\n }),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n editorContextMenu.map((item, index)=>item === null ? (0, $but2J$jsx)((0, $but2J$Separator), {}, index) : (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n children: item\n }, index)),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: toggleHelp,\n children: \"Help (\\u21E7+?)\"\n })\n ]\n })\n ]\n });\n};\nvar $fee9f929ba5c051a$export$2e2bcd8739ae039 = $fee9f929ba5c051a$var$EditorContextMenu;\n\n\n\n\n\n\n\n\n\nconst $617fd1d922572ac4$export$d4cd258d01c03112 = \"editor-node-menu\";\nconst $617fd1d922572ac4$export$cbbbfb9fb15f3780 = ()=>{\n const { show: show } = (0, $but2J$useContextMenu)({\n id: $617fd1d922572ac4$export$d4cd258d01c03112\n });\n const onContextMenu = (0, $but2J$useCallback)((event, node)=>{\n event.stopPropagation();\n show(event, {\n props: {\n node: node\n }\n });\n }, []);\n return {\n onContextMenu: onContextMenu\n };\n};\nconst $617fd1d922572ac4$var$NodeContextMenu = (args)=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const removeNodes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.removeNodes);\n const addNodeToControlPanel = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.addNodeToControlPanel);\n const removeNodeFromControlPanel = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.removeNodeFromControlPanel);\n const copy = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.copy);\n const nodesConfiguration = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration);\n const controlPanelNodes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.controlPanel.nodes);\n const isOnControlPanel = (0, $but2J$useCallback)(({ props: props })=>{\n if (!props?.node.type) return false;\n return !!controlPanelNodes.find(({ id: id })=>id === props.node.id);\n }, [\n controlPanelNodes\n ]);\n const hasControlPanelNode = (0, $but2J$useCallback)(({ props: props })=>{\n if (!props?.node.type) return false;\n const nodeConfiguration = nodesConfiguration[props.node.type];\n return !!nodeConfiguration?.controlPanelNode;\n }, [\n nodesConfiguration\n ]);\n return (0, $but2J$jsx)((0, $but2J$Fragment), {\n children: (0, $but2J$jsxs)((0, $f3e787b52be18373$export$98eff9c5659394e3), {\n id: $617fd1d922572ac4$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: [\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: (event)=>removeNodes([\n event.props.node\n ]),\n children: \"Delete Node (DEL)\"\n }),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n hidden: (...args)=>!hasControlPanelNode(...args) || isOnControlPanel(...args),\n onClick: (event)=>addNodeToControlPanel(event.props.node),\n children: \"Add To Control Panel\"\n }),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n hidden: (...args)=>!hasControlPanelNode(...args) || !isOnControlPanel(...args),\n onClick: (event)=>removeNodeFromControlPanel(event.props.node),\n children: \"Remove From Control Panel\"\n }),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: (event)=>copy({\n nodes: [\n event.props.node\n ],\n edges: []\n }),\n children: \"Copy (\\u2318+c)\"\n })\n ]\n })\n });\n};\nvar $617fd1d922572ac4$export$2e2bcd8739ae039 = $617fd1d922572ac4$var$NodeContextMenu;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $027dbe8e99154283$var$useAudioNode = (id)=>{\n const patch = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ patch: patch })=>patch);\n return patch.audioNodes.get(id);\n};\nvar $027dbe8e99154283$export$2e2bcd8739ae039 = $027dbe8e99154283$var$useAudioNode;\n\n\n\n\nconst $9630f1cf400b3c5a$var$useNode = (id)=>{\n const updateNodeData = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ updateNodeData: updateNodeData })=>updateNodeData);\n const updateNodeValues = (0, $but2J$useCallback)((values)=>updateNodeData(id, {\n values: values\n }), [\n id,\n updateNodeData\n ]);\n const updateNodeConfig = (0, $but2J$useCallback)((config)=>updateNodeData(id, {\n config: config\n }), [\n id,\n updateNodeData\n ]);\n const updateNodeLabel = (0, $but2J$useCallback)((label)=>updateNodeData(id, {\n label: label\n }), [\n id,\n updateNodeData\n ]);\n return {\n updateNodeValues: updateNodeValues,\n updateNodeConfig: updateNodeConfig,\n updateNodeLabel: updateNodeLabel\n };\n};\nvar $9630f1cf400b3c5a$export$2e2bcd8739ae039 = $9630f1cf400b3c5a$var$useNode;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $cad26a5b9571a093$export$5abe11f802ebd1f2 = (0, $but2J$emotionstyled).input`\n width: 100%;\n background: none;\n border: none;\n text-align: center;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n\n &:focus {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-within {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-vissible {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:not([readonly]):focus {\n color: #fff;\n appearance: none;\n cursor: auto;\n background-color: var(--leva-colors-elevation2);\n padding: 0.3rem;\n border-radius: 0.2rem;\n }\n`;\nconst $cad26a5b9571a093$var$EditableLabel = ({ onChange: onChange, value: value = \"\", className: className })=>{\n const labelInputRef = (0, $but2J$useRef)(null);\n const [labelEditMode, setLabelEditMode] = (0, $but2J$useState)(false);\n const editNodeLabel = (0, $but2J$useCallback)((event)=>{\n //@ts-ignore\n event.target?.select();\n setLabelEditMode(true);\n }, [\n setLabelEditMode\n ]);\n const exitEditMode = (0, $but2J$useCallback)(()=>{\n window.getSelection()?.collapseToEnd();\n setLabelEditMode(false);\n }, [\n setLabelEditMode\n ]);\n const saveNodeLabel = (0, $but2J$useCallback)(()=>{\n exitEditMode();\n if (labelInputRef.current) onChange(labelInputRef.current.value);\n }, [\n labelInputRef,\n exitEditMode,\n onChange\n ]);\n const cancelNodeLabelEdit = (0, $but2J$useCallback)(()=>{\n exitEditMode();\n if (labelInputRef.current && value) labelInputRef.current.value = value;\n }, [\n labelInputRef,\n exitEditMode,\n value\n ]);\n (0, $but2J$useEffect)(()=>{\n if (!labelInputRef.current) return;\n labelInputRef.current.value = value;\n }, [\n value,\n labelInputRef\n ]);\n return (0, $but2J$jsx)($cad26a5b9571a093$export$5abe11f802ebd1f2, {\n ref: labelInputRef,\n type: \"text\",\n readOnly: !labelEditMode,\n onDoubleClick: (event)=>editNodeLabel(event),\n onBlur: saveNodeLabel,\n onKeyDown: (event)=>{\n switch(event.key){\n case \"Escape\":\n cancelNodeLabelEdit();\n break;\n case \"Enter\":\n saveNodeLabel();\n break;\n }\n },\n className: className\n });\n};\nvar $cad26a5b9571a093$export$2e2bcd8739ae039 = $cad26a5b9571a093$var$EditableLabel;\n\n\n\n\n\n\n\n\n\nconst $78270d26f6f09c4c$var$NodeInfoWrapper = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n height: 100%;\n width: 100%;\n overflow: scroll;\n padding: 0.6rem;\n box-sizing: border-box;\n\n hr {\n border: none;\n border-bottom: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n }\n\n code {\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n color: ${({ theme: theme })=>theme.colors.highlight3};\n font-family:\n source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n }\n\n pre {\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n padding: 0.2rem 0.3rem;\n border-radius: 1px;\n }\n\n a {\n color: ${({ theme: theme })=>theme.colors.accent1};\n }\n`);\nconst $78270d26f6f09c4c$var$useNodeManifest = (type)=>{\n const data = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration[type]);\n return data;\n};\nconst $78270d26f6f09c4c$var$NodeInfoModal = ({ isOpen: isOpen, onClose: onClose, type: nodeType, node: node })=>{\n const { info: info, portsDescription: portsDescription } = $78270d26f6f09c4c$var$useNodeManifest(nodeType);\n const portsInfo = (0, $but2J$useMemo)(()=>{\n const parts = [];\n const inputPorts = node.inputs;\n if (inputPorts) {\n parts.push(`## Inputs`);\n for(const portName in inputPorts){\n const port = inputPorts[portName];\n parts.push(`### *${portName}*`);\n const description = portsDescription?.inputs?.[portName];\n if (description) parts.push(description);\n if (Array.isArray(port.type)) parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n else parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n if (port.range) parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n if (port.defaultValue !== undefined) parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n const outputPorts = node.outputs;\n if (outputPorts) {\n parts.push(`## Outputs`);\n for(const portName in outputPorts){\n const port = outputPorts[portName];\n parts.push(`### *${portName}*`);\n const description = portsDescription?.outputs?.[portName];\n if (description) parts.push(description);\n if (Array.isArray(port.type)) parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n else parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n if (port.range) parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n if (port.defaultValue !== undefined) parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n return parts.join(\"\\n\\n\");\n }, [\n node,\n portsDescription\n ]);\n const combinedInfo = (info || \"\") + \"\\n\\n\" + portsInfo;\n return isOpen ? (0, $but2J$jsx)((0, $628ee4b8a62b71a2$export$2e2bcd8739ae039), {\n onClose: onClose,\n children: (0, $but2J$jsx)($78270d26f6f09c4c$var$NodeInfoWrapper, {\n dangerouslySetInnerHTML: {\n __html: (0, $but2J$marked)(combinedInfo || \"\")\n }\n })\n }) : null;\n};\nvar $78270d26f6f09c4c$export$2e2bcd8739ae039 = $78270d26f6f09c4c$var$NodeInfoModal;\n\n\nconst $5a72e86517ffe32d$var$NodeWrapper = (0, $but2J$emotionstyled).div`\n background-color: var(--leva-colors-elevation1);\n`;\nconst $5a72e86517ffe32d$var$NodeLoaderWrapper = (0, $but2J$emotionstyled)($5a72e86517ffe32d$var$NodeWrapper)`\n padding: 2rem 5rem;\n`;\nconst $5a72e86517ffe32d$var$NodeErrorWrapper = (0, $but2J$emotionstyled)($5a72e86517ffe32d$var$NodeWrapper)`\n padding: 1rem 2rem;\n`;\nconst $5a72e86517ffe32d$var$SettingsIconWrapper = (0, $but2J$emotionstyled)((0, $but2J$MdSettings))`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\nconst $5a72e86517ffe32d$var$InfoIconWrapper = (0, $but2J$emotionstyled)((0, $but2J$MdInfoOutline))`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\nconst $5a72e86517ffe32d$var$Section = (0, $but2J$emotionstyled).div`\n position: relative;\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n background-color: var(--leva-colors-elevation1);\n`;\nconst $5a72e86517ffe32d$export$1bdb8f2d1fe25c22 = (0, $but2J$emotionstyled)($5a72e86517ffe32d$var$Section)`\n display: flex;\n height: var(--leva-sizes-titleBarHeight);\n touch-action: none;\n align-items: center;\n justify-content: center;\n flex: 1 1 0%;\n color: var(--leva-colors-highlight1);\n padding: 0 0.4rem;\n gap: 0.3rem;\n`;\nconst $5a72e86517ffe32d$export$bfd3bd1fa283e3c6 = (0, $but2J$emotionstyled)($5a72e86517ffe32d$var$Section)(({ theme: theme })=>`\n display: grid;\n grid-template-areas: \"inputs outputs\";\n background: ${theme.colors.elevation2};\n border-bottom: 1px solid ${theme.colors.elevation1};\n color: ${theme.colors.highlight3};\n font-size: 0.6rem;\n`);\nconst $5a72e86517ffe32d$export$f1afba0ff9ea1277 = (0, $but2J$emotionstyled).div`\n grid-area: inputs;\n text-align: left;\n`;\nconst $5a72e86517ffe32d$export$af4f9b41fc32ed9e = (0, $but2J$emotionstyled).div`\n grid-area: outputs;\n text-align: right;\n`;\nconst $5a72e86517ffe32d$export$a2d375858cc72119 = (0, $but2J$emotionstyled).div`\n position: relative;\n padding: 5px 10px;\n`;\nconst $5a72e86517ffe32d$var$portColors = {\n [(0, $73e253e9a60dc018$export$b0b7b95ee465c83c).Audio]: \"#4ade80\",\n [(0, $73e253e9a60dc018$export$b0b7b95ee465c83c).Gate]: \"#c084fc\",\n [(0, $73e253e9a60dc018$export$b0b7b95ee465c83c).Number]: \"#38bdf8\",\n [(0, $73e253e9a60dc018$export$b0b7b95ee465c83c).Any]: \"#ffffff\"\n};\nconst $5a72e86517ffe32d$var$StyledHandle = (0, $but2J$withTheme)((0, $but2J$emotionstyled)((0, $but2J$Handle), {\n shouldForwardProp: (prop)=>prop !== \"portType\"\n})`\n --port-color: ${(props)=>{\n if (!props.portType) return props.theme.colors.highlight2;\n if (Array.isArray(props.portType)) {\n const colors = props.portType.map((type)=>$5a72e86517ffe32d$var$portColors[type]);\n return `linear-gradient(0.25turn, ${colors.join(\", \")});`;\n } else return $5a72e86517ffe32d$var$portColors[props.portType];\n}};\n border-color: var(--port-color);\n background: var(--port-color);\n box-shadow: 0px 0px 0px 1px ${({ theme: theme })=>theme.colors.elevation2} inset;\n`);\nconst $5a72e86517ffe32d$var$StyledInputHandle = (0, $but2J$withTheme)((0, $but2J$emotionstyled)($5a72e86517ffe32d$var$StyledHandle)`\n left: -3px;\n`);\nconst $5a72e86517ffe32d$export$9ea0feffc20ee81 = ({ ...props })=>(0, $but2J$jsx)($5a72e86517ffe32d$var$StyledInputHandle, {\n ...props,\n type: \"target\",\n position: (0, $but2J$Position).Left\n });\nconst $5a72e86517ffe32d$export$222539e2a2fac4e0 = (0, $but2J$withTheme)((0, $but2J$emotionstyled)($5a72e86517ffe32d$var$StyledHandle)`\n right: -3px;\n`);\nconst $5a72e86517ffe32d$export$496e5e1ee1696f64 = (props)=>(0, $but2J$jsx)($5a72e86517ffe32d$export$222539e2a2fac4e0, {\n ...props,\n type: \"source\",\n position: (0, $but2J$Position).Right\n });\nconst $5a72e86517ffe32d$export$7e0b3af1e60a3273 = ({ className: className, ...props })=>(0, $but2J$jsx)($5a72e86517ffe32d$export$1bdb8f2d1fe25c22, {\n ...props,\n className: [\n className,\n (0, $73e253e9a60dc018$export$956b3cf15d7c363)\n ].join(\" \")\n });\nconst $5a72e86517ffe32d$var$useNodeManifest = (type)=>{\n const data = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration[type]);\n return data;\n};\nconst $5a72e86517ffe32d$var$useConfigNode = (type)=>{\n const { configNode: ConfigNode } = $5a72e86517ffe32d$var$useNodeManifest(type);\n return {\n ConfigNode: ConfigNode\n };\n};\nconst $5a72e86517ffe32d$export$361064385d50ec44 = (props)=>{\n const { id: id, children: children, selected: selected, ...rest } = props;\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const getNode = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ getNode: getNode })=>getNode);\n const nodesConfiguration = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration);\n const [isInfoModalShown, setIsInfoModalShown] = (0, $but2J$useState)(false);\n const { info: info } = $5a72e86517ffe32d$var$useNodeManifest(props.type);\n const isResizeable = (0, $but2J$useMemo)(()=>nodesConfiguration[props.type].resizable ?? false, [\n nodesConfiguration,\n props.type\n ]);\n const { updateNodeLabel: updateNodeLabel, updateNodeConfig: updateNodeConfig } = (0, $9630f1cf400b3c5a$export$2e2bcd8739ae039)(id);\n const { data: data } = getNode(id) || {};\n const audioNode = (0, $027dbe8e99154283$export$2e2bcd8739ae039)(id);\n const { ConfigNode: ConfigNode } = $5a72e86517ffe32d$var$useConfigNode(rest.type);\n const [configMode, setShowConfigMode] = (0, $but2J$useState)(false);\n if (!audioNode) return (0, $but2J$jsx)($5a72e86517ffe32d$var$NodeLoaderWrapper, {\n className: (0, $73e253e9a60dc018$export$956b3cf15d7c363),\n children: \"can't find audio node\"\n });\n if (audioNode.loading) return (0, $but2J$jsx)($5a72e86517ffe32d$var$NodeLoaderWrapper, {\n className: (0, $73e253e9a60dc018$export$956b3cf15d7c363),\n children: \"loading\"\n });\n if (audioNode.error) return (0, $but2J$jsxs)($5a72e86517ffe32d$var$NodeErrorWrapper, {\n className: (0, $73e253e9a60dc018$export$956b3cf15d7c363),\n children: [\n \"error: \",\n audioNode.error.toString()\n ]\n });\n if (!audioNode.node) return (0, $but2J$jsx)($5a72e86517ffe32d$var$NodeLoaderWrapper, {\n className: (0, $73e253e9a60dc018$export$956b3cf15d7c363),\n children: \"can't find audio node\"\n });\n const size = data?.config?.size;\n const { node: { inputs: inputs, outputs: outputs } } = audioNode;\n return (0, $but2J$jsxs)($5a72e86517ffe32d$var$NodeWrapper, {\n children: [\n (0, $but2J$jsxs)($5a72e86517ffe32d$export$7e0b3af1e60a3273, {\n children: [\n info && (0, $but2J$jsx)($5a72e86517ffe32d$var$InfoIconWrapper, {\n onClickCapture: ()=>setIsInfoModalShown(true)\n }),\n (0, $but2J$jsx)((0, $cad26a5b9571a093$export$2e2bcd8739ae039), {\n value: data?.label ?? \"No Name\",\n onChange: updateNodeLabel\n }),\n ConfigNode && (0, $but2J$jsx)($5a72e86517ffe32d$var$SettingsIconWrapper, {\n onClickCapture: ()=>setShowConfigMode((isShown)=>!isShown)\n })\n ]\n }),\n (0, $but2J$jsxs)($5a72e86517ffe32d$export$bfd3bd1fa283e3c6, {\n theme: theme,\n children: [\n (0, $but2J$jsx)($5a72e86517ffe32d$export$f1afba0ff9ea1277, {\n children: inputs ? Object.keys(inputs).map((key, index)=>(0, $but2J$jsxs)($5a72e86517ffe32d$export$a2d375858cc72119, {\n children: [\n (0, $but2J$jsx)($5a72e86517ffe32d$export$9ea0feffc20ee81, {\n id: key,\n portType: inputs[key].type\n }),\n (0, $but2J$jsx)(\"span\", {\n children: key\n })\n ]\n }, index)) : null\n }),\n (0, $but2J$jsx)($5a72e86517ffe32d$export$af4f9b41fc32ed9e, {\n children: outputs ? Object.keys(outputs).map((key, index)=>(0, $but2J$jsxs)($5a72e86517ffe32d$export$a2d375858cc72119, {\n children: [\n (0, $but2J$jsx)($5a72e86517ffe32d$export$496e5e1ee1696f64, {\n id: key,\n portType: outputs[key].type\n }),\n (0, $but2J$jsx)(\"span\", {\n children: key\n })\n ]\n }, index)) : null\n })\n ]\n }),\n ConfigNode && configMode && selected ? (0, $but2J$jsx)(ConfigNode, {\n ...props\n }) : isResizeable ? (0, $but2J$jsx)((0, $but2J$Resizable), {\n size: size,\n minWidth: 180,\n minHeight: 30,\n enable: {\n bottom: true,\n bottomRight: true,\n right: true\n },\n onResizeStop: (e, direction, ref, d)=>{\n const newSize = size ? {\n width: size.width + d.width,\n height: size.height + d.height\n } : ref.getBoundingClientRect();\n updateNodeConfig({\n ...data?.config,\n size: newSize\n });\n },\n children: children\n }) : children,\n (0, $but2J$jsx)((0, $78270d26f6f09c4c$export$2e2bcd8739ae039), {\n isOpen: isInfoModalShown,\n type: props.type,\n onClose: ()=>setIsInfoModalShown(false),\n node: audioNode.node\n })\n ]\n });\n};\n\n\nconst $99522cb4c544c0e3$export$86de09faaa70680d = (0, $but2J$emotionstyled).div`\n width: 100%;\n padding: 0.4rem 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\nconst $99522cb4c544c0e3$export$548ca3bae446ddc2 = (0, $but2J$emotionstyled)((0, $5a72e86517ffe32d$export$7e0b3af1e60a3273))`\n display: flex;\n gap: 0.1rem;\n padding: 0 0.4rem;\n justify-content: start;\n font-size: 0.6rem;\n height: auto;\n min-width: 0;\n`;\nconst $99522cb4c544c0e3$export$9fb15e3cc717240 = (0, $but2J$emotionstyled).div`\n display: flex;\n align-items: center;\n height: 70%;\n width: auto;\n gap: 0.4rem;\n`;\nconst $99522cb4c544c0e3$export$be58b4326e23250f = (0, $but2J$emotionstyled).span`\n width: auto;\n height: 100%;\n cursor: pointer;\n svg {\n width: auto;\n height: 100%;\n }\n &:hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n\n\nconst $a9eb7fd7f79ff3fb$var$ControlPanelNodeWrapper = (0, $but2J$emotionstyled).div`\n height: 100%;\n display: grid;\n grid-template-rows: auto 1fr;\n`;\nconst $a9eb7fd7f79ff3fb$var$PanelNode = (props)=>{\n const { node: node } = props;\n const getControlPanelNode = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.getControlPanelNode);\n const ControlPanelNode = (0, $but2J$useMemo)(()=>getControlPanelNode(node), [\n node\n ]);\n if (!ControlPanelNode) return null;\n return (0, $but2J$jsx)(ControlPanelNode, {\n ...props\n });\n};\nconst $a9eb7fd7f79ff3fb$var$ControlPanelItem = (props)=>{\n const { node: node, showControls: showControls, onDelete: onDelete } = props;\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const { id: id } = node;\n const { node: audioNode } = (0, $027dbe8e99154283$export$2e2bcd8739ae039)(id) || {};\n const { updateNodeValues: updateNodeValues } = (0, $9630f1cf400b3c5a$export$2e2bcd8739ae039)(id);\n return (0, $but2J$jsxs)($a9eb7fd7f79ff3fb$var$ControlPanelNodeWrapper, {\n theme: theme,\n children: [\n (0, $but2J$jsxs)((0, $99522cb4c544c0e3$export$548ca3bae446ddc2), {\n theme: theme,\n children: [\n (0, $but2J$jsx)((0, $99522cb4c544c0e3$export$86de09faaa70680d), {\n children: node.data.label\n }),\n showControls && (0, $but2J$jsxs)((0, $99522cb4c544c0e3$export$9fb15e3cc717240), {\n children: [\n (0, $but2J$jsx)((0, $99522cb4c544c0e3$export$be58b4326e23250f), {\n theme: theme,\n children: (0, $but2J$jsx)((0, $but2J$MdDragHandle), {\n className: \"grid-item-handle\"\n })\n }),\n (0, $but2J$jsx)((0, $99522cb4c544c0e3$export$be58b4326e23250f), {\n theme: theme,\n children: (0, $but2J$jsx)((0, $but2J$MdClose), {\n onClick: ()=>onDelete(node)\n })\n })\n ]\n })\n ]\n }),\n (0, $but2J$jsx)($a9eb7fd7f79ff3fb$var$PanelNode, {\n node: node,\n audioNode: audioNode,\n updateNodeValues: updateNodeValues\n })\n ]\n });\n};\nvar $a9eb7fd7f79ff3fb$export$2e2bcd8739ae039 = $a9eb7fd7f79ff3fb$var$ControlPanelItem;\n\n\n\nconst $8f357eb500334b2f$var$ControlPanelIconWrapper = (0, $but2J$emotionstyled).div`\n position: fixed;\n z-index: 5;\n box-shadow: 0px 1px 2px ${({ theme: theme })=>theme.colors.elevation2};\n left: 1rem;\n top: 4rem;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background: ${({ theme: theme })=>theme.colors.elevation1};\n color: ${({ theme: theme })=>theme.colors.highlight1};\n\n :hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n cursor: pointer;\n }\n`;\nconst $8f357eb500334b2f$var$ControlPanelIconsBar = (0, $but2J$emotionstyled)((0, $99522cb4c544c0e3$export$9fb15e3cc717240))`\n height: 80%;\n`;\nconst $8f357eb500334b2f$var$CloseIconWrapper = (0, $but2J$emotionstyled)((0, $99522cb4c544c0e3$export$be58b4326e23250f))`\n font-size: 1rem;\n display: flex;\n align-items: center;\n`;\nconst $8f357eb500334b2f$var$ControlPanelHeader = (0, $but2J$emotionstyled)((0, $99522cb4c544c0e3$export$548ca3bae446ddc2))`\n grid-template-columns: 1fr auto;\n border-bottom: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n font-size: 0.7rem;\n`;\nconst $8f357eb500334b2f$var$ControlPanelTitle = (0, $but2J$emotionstyled)((0, $99522cb4c544c0e3$export$86de09faaa70680d))`\n text-align: center;\n`;\nconst $8f357eb500334b2f$var$ControlPanelWrapper = (0, $but2J$emotionstyled).div`\n height: 100%;\n width: 100%;\n padding: 0.3rem 0.4rem;\n box-sizing: border-box;\n`;\nconst $8f357eb500334b2f$var$ControlPanelBody = (0, $but2J$emotionstyled).div`\n height: auto;\n padding: 0;\n max-height: 95vh;\n overflow-y: scroll;\n border: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n`;\nconst $8f357eb500334b2f$var$ControlPanelSettings = (0, $but2J$emotionstyled).div`\n padding: 1rem 0;\n font-family: var(--leva-fonts-mono);\n font-size: 0.8rem;\n`;\nconst $8f357eb500334b2f$var$LockGridWrapper = (0, $but2J$emotionstyled).div`\n display: flex;\n align-items: center;\n gap: 0.5rem;\n cursor: pointer;\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n }\n`;\nconst $8f357eb500334b2f$var$GridResizeHandle = (0, $but2J$emotionstyled).div`\n position: absolute;\n height: 1rem;\n top: 0;\n bottom: 0;\n margin: auto;\n left: 0.5rem;\n border-right: 1px solid ${({ theme: theme })=>theme.colors.whitePrimary};\n`;\nconst $8f357eb500334b2f$var$ControlPanelItemWrapper = (0, $but2J$emotionstyled).div`\n box-sizing: border-box;\n overflow: hidden;\n .react-resizable-handle:after {\n border-color: ${({ theme: theme })=>theme.colors.whitePrimary};\n border-width: 1px;\n }\n`;\nconst $8f357eb500334b2f$var$ControlPanel = ()=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const nodeRef = (0, $but2J$useRef)(null);\n const nodes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodes);\n const { show: show, nodes: controlPanelNodes, size: size } = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.controlPanel);\n const { width: width = 200, height: height } = size;\n const filteredNodes = (0, $but2J$useMemo)(()=>{\n const nodeIds = controlPanelNodes.map(({ id: id })=>id);\n return nodes.filter(({ id: id })=>nodeIds.includes(id));\n }, [\n nodes,\n controlPanelNodes\n ]);\n const showControlPanel = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.showControlPanel);\n const hideControlPanel = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.hideControlPanel);\n const setControlPanelNodes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setControlPanelNodes);\n const setControlPanelSize = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setControlPanelSize);\n const removeNodeFromControlPanel = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.removeNodeFromControlPanel);\n const [isGridLocked, setGridLocked] = (0, $but2J$useState)(true);\n const layout = (0, $but2J$useMemo)(()=>{\n const fallbackY = controlPanelNodes.reduce((acc, { height: height = (0, $73e253e9a60dc018$export$9f05d3e6ade4c09e).rowHeight, x: x, y: y = 0 })=>{\n const Y = y + height;\n return Y > acc ? Y : acc;\n }, 0);\n return controlPanelNodes.map(({ id: i, width: width, height: height, x: x, y: y })=>{\n return {\n i: i,\n w: width || (0, $73e253e9a60dc018$export$9f05d3e6ade4c09e).cols,\n h: height || 6,\n x: x ?? 0,\n y: y ?? fallbackY\n };\n });\n }, [\n controlPanelNodes\n ]);\n if (!filteredNodes.length) return null;\n return (0, $but2J$jsxs)((0, $but2J$Fragment), {\n children: [\n (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelIconWrapper, {\n theme: theme,\n ref: nodeRef,\n onClick: showControlPanel,\n children: (0, $but2J$jsx)((0, $but2J$RxDashboard), {})\n }),\n (0, $but2J$jsxs)((0, $but2J$reactmoderndrawer), {\n open: show,\n onClose: hideControlPanel,\n direction: \"left\",\n className: \"\",\n size: \"auto\",\n enableOverlay: false,\n style: {\n background: theme.colors.elevation1,\n position: \"absolute\"\n },\n children: [\n (0, $but2J$jsxs)($8f357eb500334b2f$var$ControlPanelHeader, {\n theme: theme,\n children: [\n (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelTitle, {\n children: \"Control Panel\"\n }),\n (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelIconsBar, {\n children: (0, $but2J$jsx)($8f357eb500334b2f$var$CloseIconWrapper, {\n onClick: hideControlPanel,\n theme: theme,\n children: (0, $but2J$jsx)((0, $but2J$MdClose), {})\n })\n })\n ]\n }),\n (0, $but2J$jsxs)($8f357eb500334b2f$var$ControlPanelWrapper, {\n children: [\n (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelSettings, {\n children: isGridLocked ? (0, $but2J$jsxs)($8f357eb500334b2f$var$LockGridWrapper, {\n theme: theme,\n onClick: ()=>setGridLocked(false),\n children: [\n (0, $but2J$jsx)((0, $but2J$AiFillLock), {}),\n \"Unlock grid\"\n ]\n }) : (0, $but2J$jsxs)($8f357eb500334b2f$var$LockGridWrapper, {\n theme: theme,\n onClick: ()=>setGridLocked(true),\n children: [\n (0, $but2J$jsx)((0, $but2J$AiFillUnlock), {}),\n \"Lock grid\"\n ]\n })\n }),\n (0, $but2J$jsx)((0, $but2J$Resizable), {\n enable: {\n top: false,\n right: !isGridLocked,\n bottom: false,\n left: false,\n topRight: false,\n bottomRight: false,\n bottomLeft: false,\n topLeft: false\n },\n handleComponent: {\n right: (0, $but2J$jsx)($8f357eb500334b2f$var$GridResizeHandle, {\n theme: theme\n })\n },\n minWidth: 120,\n size: {\n width: width,\n height: \"auto\"\n },\n onResizeStop: (e, direction, ref, d)=>{\n setControlPanelSize({\n width: width + d.width,\n height: height + d.height\n });\n },\n children: (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelBody, {\n theme: theme,\n children: (0, $but2J$jsx)((0, $but2J$reactgridlayout), {\n layout: layout,\n className: \"layout\",\n cols: (0, $73e253e9a60dc018$export$9f05d3e6ade4c09e).cols,\n rowHeight: (0, $73e253e9a60dc018$export$9f05d3e6ade4c09e).rowHeight,\n width: width,\n margin: [\n 0,\n 0\n ],\n isResizable: !isGridLocked,\n draggableHandle: \".grid-item-handle\",\n onLayoutChange: (nodes)=>{\n requestAnimationFrame(()=>{\n setControlPanelNodes(nodes.map(({ i: i, w: w, h: h, x: x, y: y })=>({\n id: i,\n width: w,\n height: h,\n x: x,\n y: y\n })));\n });\n },\n children: filteredNodes.map((node)=>{\n return (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelItemWrapper, {\n theme: theme,\n children: (0, $but2J$jsx)((0, $a9eb7fd7f79ff3fb$export$2e2bcd8739ae039), {\n node: node,\n showControls: !isGridLocked,\n onDelete: removeNodeFromControlPanel\n })\n }, node.id);\n })\n })\n })\n })\n ]\n })\n ]\n })\n ]\n });\n};\nvar $8f357eb500334b2f$export$2e2bcd8739ae039 = $8f357eb500334b2f$var$ControlPanel;\n\n\n\n\n\n\n\n\n\n\n\n\nvar $f82470e1f8a957ac$exports = {};\n$f82470e1f8a957ac$exports = \"# Quick start\\n\\n## Add node\\n - Mouse right click\\n - Select **'Add Node'** from context menu\\n\\n ### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or\\n\\n - Press `CMD+SHIFT+A`\\n\\n<br/>\\n\\n## Connect nodes\\n - Mouse left click and hold on source port\\n - Drop on target port\\n\\n<br/>\\n\\n## Delete Node or Connection\\n - Mouse right click on node/connection\\n - Select **'Delete Node'**/**'Delete Connection'** from context menu\\n\\n ### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or\\n\\n - Mouse left click on node/connection, then press `Backspace`\\n\\n<br/>\\n\\n\\n## Move node\\n - Drag and Drop\\n\\n<br/>\\n\\n## Rename node\\n - Doubleclick the node title\\n\\n<br/>\\n\\n## Undo/Redo\\n - `CMD+Z` to Undo / `CMD+SHIFT+Z` to Redo\\n - Select **'Undo'**/**'Redo'** from the Edit menu\\n\\n<br/>\\n\\n## Upload file\\n - Drag and drop audio or patch files onto the application\\n - Uploaded file appears as a new tab in the tabs bar at the top\\n - Click on the tab to view or edit the file\\n\\n<br/>\\n\\n## Rename file in the project\\n - Doubleclick the tab title\\n\\n\\n\";\n\n\nconst $72ce7400f28463b9$var$MdPreview = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n font-family: var(--leva-fonts-mono);\n font-size: 0.7rem;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n overflow: scroll;\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n padding: 0 0.5rem;\n\n code {\n color: ${({ theme: theme })=>theme.colors.accent3};\n filter: hue-rotate(180deg);\n }\n`);\nconst $72ce7400f28463b9$var$ModalContent = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n padding: 1rem;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n overflow: hidden;\n`);\nconst $72ce7400f28463b9$var$HelpModal = ()=>{\n const isHelpShown = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.isHelpShown);\n const toggleHelp = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n if (!isHelpShown) return null;\n return (0, $but2J$jsx)((0, $628ee4b8a62b71a2$export$2e2bcd8739ae039), {\n onClose: ()=>{\n toggleHelp();\n },\n children: (0, $but2J$jsx)($72ce7400f28463b9$var$ModalContent, {\n children: (0, $but2J$jsx)($72ce7400f28463b9$var$MdPreview, {\n dangerouslySetInnerHTML: {\n __html: (0, $but2J$marked)((0, (/*@__PURE__*/$parcel$interopDefault($f82470e1f8a957ac$exports))))\n },\n onWheelCapture: (event)=>event.stopPropagation()\n })\n })\n });\n};\nvar $72ce7400f28463b9$export$2e2bcd8739ae039 = $72ce7400f28463b9$var$HelpModal;\n\n\nconst $5acaa12be69dfa8a$export$78bddedbcf2939ac = ()=>{\n const toggleHelp = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n return (0, $but2J$jsx)((0, $but2J$Fragment), {\n children: (0, $but2J$jsx)((0, $but2J$ControlButton), {\n onClick: toggleHelp,\n children: (0, $but2J$jsx)((0, $but2J$FaQuestion), {})\n })\n });\n};\n\n\n\n\n\n\n\n\nconst $4379ac7ed25061a0$var$Layout = (0, $but2J$emotionstyled).div`\n position: fixed;\n z-index: ${({ theme: theme })=>theme.zIndex.resumeContextLayout};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: rgb(24 28 32 / 90%);\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n cursor: pointer;\n`;\nconst $4379ac7ed25061a0$var$Row = (0, $but2J$emotionstyled).div`\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n`;\nconst $4379ac7ed25061a0$var$Message = (0, $but2J$emotionstyled).div`\n font-family: var(--leva-fonts-mono);\n font-size: 2rem;\n`;\nconst $4379ac7ed25061a0$var$Icon = (0, $but2J$emotionstyled)((0, $but2J$FaVolumeOff))`\n width: 7rem;\n height: 7rem;\n`;\nconst $4379ac7ed25061a0$var$ResumeContext = ()=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const patch = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ patch: patch })=>patch);\n const audioContext = patch.audioContext;\n const [isContextResumed, setIsContextResumed] = (0, $but2J$useState)(audioContext.state === \"running\");\n if (isContextResumed) return null;\n return (0, $but2J$jsxs)($4379ac7ed25061a0$var$Layout, {\n theme: theme,\n onClick: ()=>{\n audioContext.resume();\n setIsContextResumed(true);\n },\n children: [\n (0, $but2J$jsx)($4379ac7ed25061a0$var$Row, {\n children: (0, $but2J$jsx)($4379ac7ed25061a0$var$Message, {\n theme: theme,\n children: \"Click anywhere to resume audio context\"\n })\n }),\n (0, $but2J$jsx)($4379ac7ed25061a0$var$Row, {\n children: (0, $but2J$jsx)($4379ac7ed25061a0$var$Icon, {})\n })\n ]\n });\n};\nvar $4379ac7ed25061a0$export$2e2bcd8739ae039 = $4379ac7ed25061a0$var$ResumeContext;\n\n\n\n\n\n\nconst $5536f4f171f9bf88$var$ToggleMinimap = ()=>{\n const setConfig = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ setConfig: setConfig })=>setConfig);\n const { showMinimap: showMinimap } = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ config: config })=>config);\n return (0, $but2J$jsx)((0, $but2J$ControlButton), {\n onClick: ()=>setConfig({\n showMinimap: !showMinimap\n }),\n children: showMinimap ? (0, $but2J$jsx)((0, $but2J$FaMap), {}) : (0, $but2J$jsx)((0, $but2J$FaRegMap), {})\n });\n};\nvar $5536f4f171f9bf88$export$2e2bcd8739ae039 = $5536f4f171f9bf88$var$ToggleMinimap;\n\n\n\n\n\n\n\nconst $8b2e0523152bfd06$var$Wire = ({ id: id, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, style: style = {}, data: data, markerStart: markerStart, markerEnd: markerEnd, source: source, target: target, sourceHandleId: sourceHandleId, targetHandleId: targetHandleId, selected: selected })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const getNode = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ getNode: getNode })=>getNode);\n const sourceNode = getNode(source);\n const targetNode = getNode(target);\n const isConnectedToSelected = sourceNode?.selected || targetNode?.selected;\n (0, $but2J$useEffect)(()=>{\n if (!sourceHandleId || !targetHandleId) return;\n console.log(`connected ${source} to ${target}`);\n return ()=>{\n console.log(`disconnected ${source} from ${target}`);\n };\n }, [\n source,\n sourceHandleId,\n target,\n targetHandleId\n ]);\n const [edgePath] = (0, $but2J$getBezierPath)({\n targetX: targetX,\n targetY: targetY,\n targetPosition: targetPosition,\n sourceX: sourceX,\n sourceY: sourceY,\n sourcePosition: sourcePosition\n });\n return (0, $but2J$jsxs)((0, $but2J$Fragment), {\n children: [\n (0, $but2J$jsx)(\"path\", {\n id: id,\n style: {\n ...style,\n stroke: selected ? theme.colors.accent2 : isConnectedToSelected ? theme.colors.highlight3 : theme.colors.highlight2\n },\n className: \"react-flow__edge-path Wire\",\n d: edgePath,\n markerEnd: markerEnd\n }),\n (0, $but2J$jsx)(\"path\", {\n style: {\n ...style,\n strokeWidth: 8,\n color: \"transparent\",\n opacity: 0,\n cursor: \"pointer\"\n },\n d: edgePath,\n markerEnd: markerEnd\n })\n ]\n });\n};\nvar $8b2e0523152bfd06$export$2e2bcd8739ae039 = $8b2e0523152bfd06$var$Wire;\n\n\nconst $6bb27c07aa83529c$var$StyledControls = (0, $but2J$withTheme)((0, $but2J$emotionstyled)((0, $but2J$Controls))`\n &.bottom {\n right: 1rem;\n bottom: 40%;\n }\n\n svg {\n color: ${({ theme: theme })=>theme.colors.elevation2};\n }\n`);\nconst $6bb27c07aa83529c$var$onNodeDragStop = (_event, node)=>console.log(\"drag stop\", node);\nconst $6bb27c07aa83529c$var$onNodeClick = (_event, element)=>console.log(\"click\", element);\nconst $6bb27c07aa83529c$var$snapGrid = [\n 20,\n 20\n];\nconst $6bb27c07aa83529c$export$72cb76f559fbafcf = ({ editorState: editorState, plugins: plugins = [], editorContextMenu: editorContextMenu = [], onChange: onChange = ()=>{}, ...props })=>{\n const edgeTypes = (0, $but2J$useMemo)(()=>({\n wire: (0, $8b2e0523152bfd06$export$2e2bcd8739ae039)\n }), []);\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, onNodesChange: onNodesChange, onNodesDelete: onNodesDelete, onEdgesChange: onEdgesChange, onEdgesDelete: onEdgesDelete, onConnect: onConnect, setPlugins: setPlugins, setViewport: setViewport, viewport: viewport } = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)();\n const editorConfig = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ config: config })=>config);\n const nodeTypes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ nodeTypes: nodeTypes })=>nodeTypes);\n (0, $but2J$useEffect)(()=>{\n setPlugins(plugins);\n }, [\n plugins\n ]);\n const [reactflowInstance, setReactflowInstance] = (0, $but2J$useState)(null);\n (0, $but2J$useEffect)(()=>{\n if (!reactflowInstance) return;\n onChange({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel,\n viewport: viewport\n });\n }, [\n nodes,\n edges,\n controlPanel,\n viewport\n ]);\n const onInit = (0, $but2J$useCallback)((rfi)=>{\n if (!reactflowInstance) {\n setReactflowInstance(rfi);\n console.log(\"flow loaded:\", rfi);\n }\n }, [\n reactflowInstance\n ]);\n const { onContextMenu: onEditorContextMenu } = (0, $fee9f929ba5c051a$export$59ce2a6808e35a29)();\n const { onContextMenu: onNodeContextMenu } = (0, $617fd1d922572ac4$export$cbbbfb9fb15f3780)();\n const { onContextMenu: onEdgeContextMenu } = (0, $e54d25e5d65b9790$export$8b2e4a15453bac1e)();\n (0, $but2J$useEffect)(()=>{\n if (!viewport) return;\n reactflowInstance?.setViewport(viewport);\n }, [\n viewport,\n reactflowInstance\n ]);\n (0, $but2J$useOnViewportChange)({\n onEnd: setViewport\n });\n return (0, $but2J$jsxs)((0, $but2J$reactflow), {\n nodes: nodes,\n edges: edges,\n onNodesChange: onNodesChange,\n onNodesDelete: onNodesDelete,\n onEdgesChange: onEdgesChange,\n onConnect: onConnect,\n onNodeDragStop: $6bb27c07aa83529c$var$onNodeDragStop,\n onEdgesDelete: onEdgesDelete,\n onInit: onInit,\n onNodeClick: $6bb27c07aa83529c$var$onNodeClick,\n onContextMenu: onEditorContextMenu,\n onNodeContextMenu: onNodeContextMenu,\n onEdgeContextMenu: onEdgeContextMenu,\n nodeTypes: nodeTypes,\n edgeTypes: edgeTypes,\n snapGrid: $6bb27c07aa83529c$var$snapGrid,\n defaultViewport: editorState?.viewport,\n defaultEdgeOptions: {\n type: \"wire\"\n },\n snapToGrid: true,\n fitView: true,\n disableKeyboardA11y: true,\n children: [\n (0, $but2J$jsx)((0, $but2J$Background), {\n variant: (0, $but2J$BackgroundVariant).Dots,\n gap: 12\n }),\n editorConfig.showMinimap ? (0, $but2J$jsx)((0, $but2J$MiniMap), {}) : null,\n (0, $but2J$jsxs)($6bb27c07aa83529c$var$StyledControls, {\n showInteractive: false,\n position: \"bottom-right\",\n children: [\n (0, $but2J$jsx)((0, $5536f4f171f9bf88$export$2e2bcd8739ae039), {}),\n (0, $but2J$jsx)((0, $5acaa12be69dfa8a$export$78bddedbcf2939ac), {})\n ]\n }),\n (0, $but2J$jsx)((0, $4379ac7ed25061a0$export$2e2bcd8739ae039), {}),\n (0, $but2J$jsx)((0, $8f357eb500334b2f$export$2e2bcd8739ae039), {}),\n (0, $but2J$jsx)((0, $72ce7400f28463b9$export$2e2bcd8739ae039), {}),\n (0, $but2J$jsx)((0, $fee9f929ba5c051a$export$2e2bcd8739ae039), {\n editorContextMenu: editorContextMenu\n }),\n (0, $but2J$jsx)((0, $617fd1d922572ac4$export$2e2bcd8739ae039), {}),\n (0, $but2J$jsx)((0, $e54d25e5d65b9790$export$2e2bcd8739ae039), {})\n ]\n });\n};\nconst $6bb27c07aa83529c$export$7cda8d932e2f33c0 = (props)=>(0, $but2J$jsx)((0, $but2J$ReactFlowProvider), {\n children: (0, $but2J$jsx)($6bb27c07aa83529c$export$72cb76f559fbafcf, {\n ...props\n })\n });\nvar $6bb27c07aa83529c$export$2e2bcd8739ae039 = $6bb27c07aa83529c$export$7cda8d932e2f33c0;\n\n\n\n\n\nconst $1729b5eaa1e6c3bc$export$d31000d36961d6c2 = {\n nodes: [],\n edges: [],\n controlPanel: {\n nodes: [],\n show: false,\n size: {\n width: 200,\n height: 100\n }\n },\n viewport: {\n x: 0,\n y: 0,\n zoom: 1.5\n }\n};\nconst $1729b5eaa1e6c3bc$export$6cd5d5c1dae69a36 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n`);\nconst $1729b5eaa1e6c3bc$export$6bc5189622b1f4ec = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n position: fixed;\n height: 100%;\n width: 100%;\n background: rgba(0, 0, 0, 0.7);\n color: white;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 2rem;\n`);\nconst $1729b5eaa1e6c3bc$export$8d546ef2006cd0a2 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n height: 100%;\n width: 100%;\n display: flex;\n position: relative;\n`);\nconst $1729b5eaa1e6c3bc$export$10efbd348f877f87 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n background: ${({ theme: theme })=>theme.colors.elevation3};\n`);\nconst $1729b5eaa1e6c3bc$export$8c347812506d5ac9 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n background: ${({ theme: theme })=>theme.colors.elevation2};\n opacity: 0.7;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 1;\n font-family: var(--leva-fonts-mono);\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n display: ${({ show: show })=>show ? \"flex\" : \"none\"};\n align-items: center;\n justify-content: center;\n font-size: 6rem;\n`);\nconst $1729b5eaa1e6c3bc$export$b38a2fd24b22fb35 = (props)=>{\n const pullEditorChanges = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.pullEditorChanges);\n const currentFileIndex = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.currentFileIndex);\n const project = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.project);\n const [showLoader, setShowLoader] = (0, $but2J$useState)(true);\n (0, $but2J$useEffect)(()=>{\n props.onChange?.(project);\n }, [\n project,\n props.onChange\n ]);\n (0, $but2J$useEffect)(()=>{\n setShowLoader(true);\n setTimeout(()=>{\n setShowLoader(false);\n }, 1600);\n }, [\n currentFileIndex\n ]);\n const { file: file } = props;\n if (!file) return null;\n if (file.type === \"audio\") return (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$10efbd348f877f87, {\n children: (0, $but2J$jsx)(\"audio\", {\n src: file.file,\n controls: true\n })\n });\n return (0, $but2J$jsxs)((0, $but2J$Fragment), {\n children: [\n (0, $but2J$jsx)((0, $6bb27c07aa83529c$export$7cda8d932e2f33c0), {\n ...props,\n onChange: (state)=>{\n pullEditorChanges();\n },\n editorState: file.file || $1729b5eaa1e6c3bc$export$d31000d36961d6c2\n }),\n (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$8c347812506d5ac9, {\n show: showLoader,\n children: \"Loading...\"\n })\n ]\n });\n};\nconst $1729b5eaa1e6c3bc$export$2206531ad8592d57 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n height: 2rem;\n display: flex;\n align-items: center;\n background: ${({ theme: theme })=>theme.colors.elevation2};\n`);\nconst $1729b5eaa1e6c3bc$export$3e41faf802a29e71 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 100%;\n box-sizing: border-box;\n padding: 0.3rem 0.4rem;\n\n border-right: 1px solid ${({ theme: theme })=>theme.colors.elevation1};\n\n input {\n color: ${({ theme: theme, active: active })=>active ? theme.colors.whitePrimary : theme.colors.highlight1};\n\n &:not([readonly]):focus {\n background-color: ${({ theme: theme })=>theme.colors.elevation1};\n }\n }\n`);\nconst $1729b5eaa1e6c3bc$export$61e5b3c7bace77b8 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 0.5rem;\n cursor: pointer;\n\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n`);\nconst $1729b5eaa1e6c3bc$export$3aef34186a092045 = (0, $but2J$withTheme)((0, $but2J$emotionstyled)((0, $but2J$FaPlus))`\n height: 40%;\n width: auto;\n`);\nconst $1729b5eaa1e6c3bc$export$cae179f078f4b4a4 = (0, $but2J$withTheme)((0, $but2J$emotionstyled)((0, $but2J$MdClose))`\n height: 70%;\n width: auto;\n cursor: pointer;\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n`);\nconst $1729b5eaa1e6c3bc$var$generateId = ()=>{\n return (0, $but2J$nanoid)();\n};\nconst $1729b5eaa1e6c3bc$var$generateEmptyFile = ()=>({\n file: $1729b5eaa1e6c3bc$export$d31000d36961d6c2,\n name: \"Unnamed\",\n type: \"patch\",\n id: $1729b5eaa1e6c3bc$var$generateId()\n });\nconst $1729b5eaa1e6c3bc$export$86fbec116b87613f = ({ ...props })=>{\n const { projectState: projectState, theme: theme } = props;\n const currentFileIndex = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.currentFileIndex);\n const currentFile = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.project.files[store.currentFileIndex]);\n const setCurrentFileIndex = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setCurrentFileIndex);\n const project = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.project);\n const setProject = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setProject);\n const getProject = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.getProject);\n const updateFileName = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.updateFileName);\n const addFile = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.addFile);\n const deleteFile = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.deleteFile);\n const syncEditorWithCurrentFile = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.syncEditorWithCurrentFile);\n const setEditorState = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setEditorState);\n const pullEditorChanges = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.pullEditorChanges);\n const [isDragging, setIsDragging] = (0, $but2J$useState)(false);\n const handleDragLeave = (e)=>{\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n };\n const handleDragOver = (e)=>{\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(true);\n };\n const handleDrop = (e)=>{\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n const files = Array.from(e.dataTransfer.files);\n files.forEach(async (file)=>{\n if (file.type === \"application/json\") {\n const fileData = JSON.parse(await file.text());\n if (fileData.files && fileData.files.length) {\n if (!window.confirm(\"This action will replace your current project. Continue?\")) return;\n setProject(fileData);\n setCurrentFileIndex(0);\n syncEditorWithCurrentFile();\n return;\n }\n const emptyFile = $1729b5eaa1e6c3bc$var$generateEmptyFile();\n const newGraphState = {\n ...emptyFile,\n file: {\n ...fileData,\n controlPanel: {\n ...$1729b5eaa1e6c3bc$export$d31000d36961d6c2.controlPanel,\n ...fileData.controlPanel\n }\n },\n name: file.name\n };\n addFile(newGraphState, file.name);\n return;\n }\n if (file.type.match(/^audio\\//)) {\n const base64 = await (0, $459a4e08a0372e29$export$25df2e315be8e003)(file);\n addFile({\n type: \"audio\",\n // @TODO: use nanoid here\n id: `audio-file-${+new Date()}`,\n name: file.name,\n file: base64\n });\n return;\n }\n console.error(\"Unsupported file type\", file);\n });\n };\n (0, $but2J$useEffect)(()=>{\n setProject(projectState || {\n files: [\n $1729b5eaa1e6c3bc$var$generateEmptyFile()\n ]\n });\n const file = projectState?.files[0];\n file?.file && file?.type !== \"audio\" && setEditorState(file.file);\n }, [\n projectState\n ]);\n // EXPERIMENTAL CODE\n (0, $but2J$useEffect)(()=>{\n const fetcher = async (...args)=>{\n const request = new Request(...args);\n const files = getProject().files;\n const index = request.url.replace(\"project://\", \"\");\n const file = files.find(({ id: id })=>id === index);\n if (!file) return new Response(`File not found: ${request.url}`, {\n status: 404\n });\n if ((0, $d6879eb00f829ebf$export$e698b79c63b74136)(file)) return new Response(JSON.stringify(file.file ?? null));\n if ((0, $d6879eb00f829ebf$export$31c2336f657dc59f)(file)) return fetch(file.file);\n return new Response(null);\n };\n (0, $but2J$registerFetcher)(\"project://*\", fetcher);\n return ()=>{\n //unregister here\n };\n }, [\n getProject\n ]);\n (0, $but2J$useEffect)(()=>{\n syncEditorWithCurrentFile();\n }, [\n currentFileIndex,\n syncEditorWithCurrentFile\n ]);\n return (0, $but2J$jsxs)((0, $but2J$ThemeProvider), {\n theme: theme || (0, $731cc06061de042d$export$2e2bcd8739ae039),\n children: [\n (0, $but2J$jsx)((0, $but2J$Global), {\n styles: (0, $but2J$css)`\n :root {\n --leva-colors-elevation1: #292d39;\n --leva-colors-elevation2: #181c20;\n --leva-colors-elevation3: #373c4b;\n --leva-colors-accent1: #0066dc;\n --leva-colors-accent2: #007bff;\n --leva-colors-accent3: #3c93ff;\n --leva-colors-highlight1: #535760;\n --leva-colors-highlight2: #8c92a4;\n --leva-colors-highlight3: #fefefe;\n --leva-colors-vivid1: #ffcc00;\n --leva-colors-folderWidgetColor: var(--leva-colors-highlight2);\n --leva-colors-folderTextColor: var(--leva-colors-highlight3);\n --leva-colors-toolTipBackground: var(--leva-colors-highlight3);\n --leva-colors-toolTipText: var(--leva-colors-elevation2);\n --leva-radii-xs: 2px;\n --leva-radii-sm: 3px;\n --leva-radii-lg: 10px;\n --leva-space-xs: 3px;\n --leva-space-sm: 6px;\n --leva-space-md: 10px;\n --leva-space-rowGap: 7px;\n --leva-space-colGap: 7px;\n --leva-fonts-mono:\n ui-monospace, SFMono-Regular, Menlo, \"Roboto Mono\", monospace;\n --leva-fonts-sans: system-ui, sans-serif;\n --leva-fontSizes-root: 11px;\n --leva-fontSizes-toolTip: var(--leva-fontSizes-root);\n --leva-sizes-rootWidth: 280px;\n --leva-sizes-controlWidth: 160px;\n --leva-sizes-numberInputMinWidth: 38px;\n --leva-sizes-scrubberWidth: 8px;\n --leva-sizes-scrubberHeight: 16px;\n --leva-sizes-rowHeight: 24px;\n --leva-sizes-folderTitleHeight: 20px;\n --leva-sizes-checkboxSize: 16px;\n --leva-sizes-joystickWidth: 100px;\n --leva-sizes-joystickHeight: 100px;\n --leva-sizes-colorPickerWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-colorPickerHeight: 100px;\n --leva-sizes-imagePreviewWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-imagePreviewHeight: 100px;\n --leva-sizes-monitorHeight: 60px;\n --leva-sizes-titleBarHeight: 39px;\n --leva-shadows-level1: 0 0 9px 0 #00000088;\n --leva-shadows-level2: 0 4px 14px #00000033;\n --leva-borderWidths-root: 0px;\n --leva-borderWidths-input: 1px;\n --leva-borderWidths-focus: 1px;\n --leva-borderWidths-hover: 1px;\n --leva-borderWidths-active: 1px;\n --leva-borderWidths-folder: 1px;\n --leva-fontWeights-label: normal;\n --leva-fontWeights-folder: normal;\n --leva-fontWeights-button: normal;\n }\n `\n }),\n (0, $but2J$jsxs)($1729b5eaa1e6c3bc$export$6cd5d5c1dae69a36, {\n onDragOver: handleDragOver,\n onDragLeave: handleDragLeave,\n onDrop: handleDrop,\n children: [\n (0, $but2J$jsxs)($1729b5eaa1e6c3bc$export$2206531ad8592d57, {\n children: [\n project.files.map((file, index)=>(0, $but2J$jsxs)($1729b5eaa1e6c3bc$export$3e41faf802a29e71, {\n onClick: ()=>{\n setCurrentFileIndex(index);\n },\n active: index === currentFileIndex,\n children: [\n (0, $but2J$jsx)((0, $cad26a5b9571a093$export$2e2bcd8739ae039), {\n onChange: (val)=>updateFileName(index, val),\n value: file.name || \"Unnamed\"\n }),\n (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$cae179f078f4b4a4, {\n onClick: (event)=>{\n event.stopPropagation();\n if (!window.confirm(\"Do you really want to delete this file?\")) return;\n deleteFile(index);\n if (project.files.length === 1) {\n addFile($1729b5eaa1e6c3bc$var$generateEmptyFile());\n setCurrentFileIndex(0);\n syncEditorWithCurrentFile();\n }\n }\n })\n ]\n }, index)),\n (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$61e5b3c7bace77b8, {\n onClick: ()=>{\n addFile($1729b5eaa1e6c3bc$var$generateEmptyFile());\n setCurrentFileIndex(project.files.length);\n },\n children: (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$3aef34186a092045, {})\n })\n ]\n }),\n (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$8d546ef2006cd0a2, {\n children: (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$b38a2fd24b22fb35, {\n file: currentFile,\n ...props\n })\n }),\n isDragging && (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$6bc5189622b1f4ec, {\n children: \"Drop file(s) to upload to the project\"\n })\n ]\n })\n ]\n });\n};\nvar $1729b5eaa1e6c3bc$export$2e2bcd8739ae039 = $1729b5eaa1e6c3bc$export$86fbec116b87613f;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nexport {$1729b5eaa1e6c3bc$export$2e2bcd8739ae039 as Editor, $1729b5eaa1e6c3bc$export$d31000d36961d6c2 as EDITOR_DEFAULTS, $8b2e0523152bfd06$export$2e2bcd8739ae039 as Wire, $5a72e86517ffe32d$export$361064385d50ec44 as WNNode, $5a72e86517ffe32d$export$7e0b3af1e60a3273 as TitleBar, $5a72e86517ffe32d$export$bfd3bd1fa283e3c6 as PortsPanel, $5a72e86517ffe32d$export$af4f9b41fc32ed9e as OutputPorts, $5a72e86517ffe32d$export$496e5e1ee1696f64 as OutputHandle, $5a72e86517ffe32d$export$f1afba0ff9ea1277 as InputPorts, $5a72e86517ffe32d$export$9ea0feffc20ee81 as InputHandle, $5a72e86517ffe32d$export$a2d375858cc72119 as Port, $628ee4b8a62b71a2$export$2e2bcd8739ae039 as Modal, $cad26a5b9571a093$export$2e2bcd8739ae039 as EditableLabel, $027dbe8e99154283$export$2e2bcd8739ae039 as useAudioNode, $9630f1cf400b3c5a$export$2e2bcd8739ae039 as useNode, $04218161d9aa484d$export$2e2bcd8739ae039 as useTheme, $40b3df4f7825b834$export$2e2bcd8739ae039 as useStore, $731cc06061de042d$export$2e2bcd8739ae039 as theme, $d6879eb00f829ebf$export$31c2336f657dc59f as isAudio, $d6879eb00f829ebf$export$e698b79c63b74136 as isPatch, $73e253e9a60dc018$export$b0b7b95ee465c83c as PortType};\n//# sourceMappingURL=module.js.map\n","export { default as Editor, EDITOR_DEFAULTS } from \"./src/components/App\";\nexport { default as Wire } from \"./src/components/Wire\";\nexport {\n WNNode,\n TitleBar,\n type WNNodeProps,\n PortsPanel,\n OutputPorts,\n OutputHandle,\n InputPorts,\n InputHandle,\n Port,\n} from \"./src/components/Node\";\nexport { default as Modal } from \"./src/components/Modal\";\nexport { default as EditableLabel } from \"./src/components/EditableLabel\";\nexport { default as useAudioNode } from \"./src/hooks/useAudioNode\";\nexport { default as useNode } from \"./src/hooks/useNode\";\nexport { default as useTheme } from \"./src/hooks/useTheme\";\nexport { default as useStore } from \"./src/store\";\nexport { default as theme } from \"./src/theme\";\nexport { isAudio, isPatch } from \"./src/helpers/projectFile\";\n\nexport { PortType } from \"./src/constants\";\n\nexport type {\n WNAudioNode,\n CreateWNAudioNode,\n ControlPanelNodeProps,\n PluginConfig,\n PluginComponent,\n ControlPanelNode,\n WNNodeData,\n WNNode as TWNNode,\n InputPort,\n OutputPort,\n EditorState,\n Project,\n WNEdge as TWNEdge,\n EditorStoreState,\n} from \"./src/types\";\n\nexport type { Theme } from \"./src/theme\";\n","import { css, Global, ThemeProvider, withTheme } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\nimport { nanoid } from \"nanoid\";\nimport { ComponentProps, ReactNode, useEffect, useMemo, useState } from \"react\";\nimport { FaPlus as IconAdd } from \"react-icons/fa6\";\nimport { MdClose } from \"react-icons/md\";\nimport { registerFetcher } from \"@web-noise/fetch\";\nimport useStore from \"../store\";\nimport \"../styles\";\nimport defaultTheme, { Theme } from \"../theme\";\nimport type {\n EditorFile,\n EditorState,\n PluginConfig,\n Project,\n ProjectFile,\n} from \"../types\";\nimport { Editor } from \"./Editor\";\nimport EditableLabel from \"./EditableLabel\";\nimport { isAudio, isPatch } from \"../helpers/projectFile\";\nimport { fileToBase64 } from \"../lib\";\nimport { ProjectState } from \"../store/projectStore\";\n\n// @TODO: move default state to editor\nexport const EDITOR_DEFAULTS = {\n nodes: [],\n edges: [],\n controlPanel: {\n nodes: [],\n show: false,\n size: {\n width: 200,\n height: 100,\n },\n },\n viewport: { x: 0, y: 0, zoom: 1.5 },\n};\n\nexport const AppWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n`);\n\nexport const FileUploadLayout = withTheme(styled.div<{ theme: Theme }>`\n position: fixed;\n height: 100%;\n width: 100%;\n background: rgba(0, 0, 0, 0.7);\n color: white;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 2rem;\n`);\n\nexport const EditorContainerWrapper = withTheme(styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n display: flex;\n position: relative;\n`);\n\nexport const AudioTabWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n background: ${({ theme }) => theme.colors.elevation3};\n`);\n\nexport const EditorLoadingOverlay = withTheme(styled.div<{\n theme: Theme;\n show: boolean;\n}>`\n background: ${({ theme }) => theme.colors.elevation2};\n opacity: 0.7;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 1;\n font-family: var(--leva-fonts-mono);\n color: ${({ theme }) => theme.colors.whitePrimary};\n display: ${({ show }) => (show ? \"flex\" : \"none\")};\n align-items: center;\n justify-content: center;\n font-size: 6rem;\n`);\n\ntype EditorContainerProps = AppProps & {\n file: ProjectFile;\n};\n\nexport const EditorContainer = (props: EditorContainerProps) => {\n const pullEditorChanges = useStore((store) => store.pullEditorChanges);\n const currentFileIndex = useStore((store) => store.currentFileIndex);\n const project = useStore((store) => store.project);\n\n const [showLoader, setShowLoader] = useState(true);\n\n useEffect(() => {\n props.onChange?.(project);\n }, [project, props.onChange]);\n\n useEffect(() => {\n setShowLoader(true);\n setTimeout(() => {\n setShowLoader(false);\n }, 1600);\n }, [currentFileIndex]);\n\n const { file } = props;\n if (!file) return null;\n\n if (file.type === \"audio\") {\n return (\n <AudioTabWrapper>\n <audio src={file.file} controls />\n </AudioTabWrapper>\n );\n }\n\n return (\n <>\n <Editor\n {...props}\n onChange={(state) => {\n pullEditorChanges();\n }}\n editorState={(file as EditorFile).file || EDITOR_DEFAULTS}\n />\n\n <EditorLoadingOverlay show={showLoader}>Loading...</EditorLoadingOverlay>\n </>\n );\n};\n\nexport const TabsContainer = withTheme(styled.div<{ theme: Theme }>`\n height: 2rem;\n display: flex;\n align-items: center;\n background: ${({ theme }) => theme.colors.elevation2};\n`);\n\nexport const Tab = withTheme(styled.div<{ theme: Theme; active?: boolean }>`\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 100%;\n box-sizing: border-box;\n padding: 0.3rem 0.4rem;\n\n border-right: 1px solid ${({ theme }) => theme.colors.elevation1};\n\n input {\n color: ${({ theme, active }) =>\n active ? theme.colors.whitePrimary : theme.colors.highlight1};\n\n &:not([readonly]):focus {\n background-color: ${({ theme }) => theme.colors.elevation1};\n }\n }\n`);\n\nexport const TabIconWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 0.5rem;\n cursor: pointer;\n\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n`);\n\nexport const AddFileIcon = withTheme(styled(IconAdd)<{ theme: Theme }>`\n height: 40%;\n width: auto;\n`);\n\nexport const CloseIcon = withTheme(styled(MdClose)<{ theme: Theme }>`\n height: 70%;\n width: auto;\n cursor: pointer;\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n`);\n\nconst generateId = (): string => {\n return nanoid();\n};\n\nconst generateEmptyFile = (): ProjectFile => ({\n file: EDITOR_DEFAULTS,\n name: \"Unnamed\",\n type: \"patch\",\n id: generateId(),\n});\n\ninterface AppProps {\n projectState?: Project;\n plugins?: Array<PluginConfig>;\n editorContextMenu?: Array<ReactNode>;\n onChange?: (project: Project) => void;\n theme?: Theme;\n}\n\nexport const App = ({ ...props }: AppProps) => {\n const { projectState, theme } = props;\n const currentFileIndex = useStore((store) => store.currentFileIndex);\n const currentFile = useStore(\n (store) => store.project.files[store.currentFileIndex],\n );\n const setCurrentFileIndex = useStore((store) => store.setCurrentFileIndex);\n\n const project = useStore((store) => store.project);\n const setProject = useStore((store) => store.setProject);\n const getProject = useStore((store) => store.getProject);\n const updateFileName = useStore((store) => store.updateFileName);\n\n const addFile = useStore((store) => store.addFile);\n const deleteFile = useStore((store) => store.deleteFile);\n const syncEditorWithCurrentFile = useStore(\n (store) => store.syncEditorWithCurrentFile,\n );\n\n const setEditorState = useStore((store) => store.setEditorState);\n const pullEditorChanges = useStore((store) => store.pullEditorChanges);\n\n const [isDragging, setIsDragging] = useState(false);\n\n const handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n };\n\n const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(true);\n };\n\n const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n\n setIsDragging(false);\n\n const files = Array.from(e.dataTransfer.files);\n files.forEach(async (file) => {\n if (file.type === \"application/json\") {\n const fileData = JSON.parse(await file.text());\n if (fileData.files && fileData.files.length) {\n if (\n !window.confirm(\n \"This action will replace your current project. Continue?\",\n )\n ) {\n return;\n }\n setProject(fileData);\n setCurrentFileIndex(0);\n syncEditorWithCurrentFile();\n return;\n }\n const emptyFile = generateEmptyFile();\n const newGraphState = {\n ...emptyFile,\n file: {\n ...fileData,\n controlPanel: {\n ...EDITOR_DEFAULTS.controlPanel,\n ...fileData.controlPanel,\n },\n },\n name: file.name,\n };\n addFile(newGraphState, file.name);\n return;\n }\n if (file.type.match(/^audio\\//)) {\n const base64 = await fileToBase64(file);\n addFile({\n type: \"audio\",\n // @TODO: use nanoid here\n id: `audio-file-${+new Date()}`,\n name: file.name,\n file: base64,\n });\n return;\n }\n console.error(\"Unsupported file type\", file);\n });\n };\n\n useEffect(() => {\n setProject(\n projectState || {\n files: [generateEmptyFile()],\n },\n );\n const file = projectState?.files[0];\n file?.file && file?.type !== \"audio\" && setEditorState(file.file);\n }, [projectState]);\n\n // EXPERIMENTAL CODE\n useEffect(() => {\n const fetcher: typeof fetch = async (...args) => {\n const request = new Request(...args);\n const files = getProject().files;\n const index = request.url.replace(\"project://\", \"\");\n const file = files.find(({ id }) => id === index);\n\n if (!file) {\n return new Response(`File not found: ${request.url}`, { status: 404 });\n }\n\n if (isPatch(file)) {\n return new Response(JSON.stringify(file.file ?? null));\n }\n\n if (isAudio(file)) {\n return fetch(file.file);\n }\n\n return new Response(null);\n };\n registerFetcher(\"project://*\", fetcher);\n return () => {\n //unregister here\n };\n }, [getProject]);\n\n useEffect(() => {\n syncEditorWithCurrentFile();\n }, [currentFileIndex, syncEditorWithCurrentFile]);\n\n return (\n <ThemeProvider theme={theme || defaultTheme}>\n <Global\n styles={css`\n :root {\n --leva-colors-elevation1: #292d39;\n --leva-colors-elevation2: #181c20;\n --leva-colors-elevation3: #373c4b;\n --leva-colors-accent1: #0066dc;\n --leva-colors-accent2: #007bff;\n --leva-colors-accent3: #3c93ff;\n --leva-colors-highlight1: #535760;\n --leva-colors-highlight2: #8c92a4;\n --leva-colors-highlight3: #fefefe;\n --leva-colors-vivid1: #ffcc00;\n --leva-colors-folderWidgetColor: var(--leva-colors-highlight2);\n --leva-colors-folderTextColor: var(--leva-colors-highlight3);\n --leva-colors-toolTipBackground: var(--leva-colors-highlight3);\n --leva-colors-toolTipText: var(--leva-colors-elevation2);\n --leva-radii-xs: 2px;\n --leva-radii-sm: 3px;\n --leva-radii-lg: 10px;\n --leva-space-xs: 3px;\n --leva-space-sm: 6px;\n --leva-space-md: 10px;\n --leva-space-rowGap: 7px;\n --leva-space-colGap: 7px;\n --leva-fonts-mono:\n ui-monospace, SFMono-Regular, Menlo, \"Roboto Mono\", monospace;\n --leva-fonts-sans: system-ui, sans-serif;\n --leva-fontSizes-root: 11px;\n --leva-fontSizes-toolTip: var(--leva-fontSizes-root);\n --leva-sizes-rootWidth: 280px;\n --leva-sizes-controlWidth: 160px;\n --leva-sizes-numberInputMinWidth: 38px;\n --leva-sizes-scrubberWidth: 8px;\n --leva-sizes-scrubberHeight: 16px;\n --leva-sizes-rowHeight: 24px;\n --leva-sizes-folderTitleHeight: 20px;\n --leva-sizes-checkboxSize: 16px;\n --leva-sizes-joystickWidth: 100px;\n --leva-sizes-joystickHeight: 100px;\n --leva-sizes-colorPickerWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-colorPickerHeight: 100px;\n --leva-sizes-imagePreviewWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-imagePreviewHeight: 100px;\n --leva-sizes-monitorHeight: 60px;\n --leva-sizes-titleBarHeight: 39px;\n --leva-shadows-level1: 0 0 9px 0 #00000088;\n --leva-shadows-level2: 0 4px 14px #00000033;\n --leva-borderWidths-root: 0px;\n --leva-borderWidths-input: 1px;\n --leva-borderWidths-focus: 1px;\n --leva-borderWidths-hover: 1px;\n --leva-borderWidths-active: 1px;\n --leva-borderWidths-folder: 1px;\n --leva-fontWeights-label: normal;\n --leva-fontWeights-folder: normal;\n --leva-fontWeights-button: normal;\n }\n `}\n />\n <AppWrapper\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n >\n <TabsContainer>\n {project.files.map((file, index) => (\n <Tab\n onClick={() => {\n setCurrentFileIndex(index);\n }}\n key={index}\n active={index === currentFileIndex}\n >\n <EditableLabel\n onChange={(val) => updateFileName(index, val)}\n value={file.name || \"Unnamed\"}\n />\n <CloseIcon\n onClick={(event) => {\n event.stopPropagation();\n if (\n !window.confirm(\"Do you really want to delete this file?\")\n ) {\n return;\n }\n deleteFile(index);\n if (project.files.length === 1) {\n addFile(generateEmptyFile());\n setCurrentFileIndex(0);\n syncEditorWithCurrentFile();\n }\n }}\n />\n </Tab>\n ))}\n <TabIconWrapper\n onClick={() => {\n addFile(generateEmptyFile());\n setCurrentFileIndex(project.files.length);\n }}\n >\n <AddFileIcon />\n </TabIconWrapper>\n </TabsContainer>\n <EditorContainerWrapper>\n <EditorContainer file={currentFile!} {...props} />\n </EditorContainerWrapper>\n {isDragging && (\n <FileUploadLayout>\n Drop file(s) to upload to the project\n </FileUploadLayout>\n )}\n </AppWrapper>\n </ThemeProvider>\n );\n};\n\nexport default App;\n","import {\n addEdge,\n getConnectedEdges,\n NodeTypes,\n OnConnect,\n Viewport,\n} from \"reactflow\";\nimport { create, StateCreator } from \"zustand\";\nimport { setAudioNodeTypes, AudioNodeTypes } from \"@web-noise/patch\";\nimport { CONTROL_PANEL_GRID_CONFIG } from \"../constants\";\nimport generateNodeId from \"../helpers/generateNodeId\";\nimport {\n ControlPanelNode,\n ControlPanelNodes,\n PluginComponent,\n PluginConfig,\n WNEdge,\n WNNode,\n GraphState,\n EditorState,\n ControlPanelState,\n EditorStoreState,\n} from \"../types\";\nimport nodesStateCreator, { NodesState } from \"./nodesStore\";\nimport history, { historyStateCreator, HistoryState } from \"./history\";\nimport audioPatch, {\n AudioPatchState,\n audioPatchStateCreator,\n} from \"./audioPatch\";\nimport projectStateCreator, { ProjectState } from \"./projectStore\";\n\nexport type { AudioNodeTypes, NodesState, GraphState };\n\ninterface EditorConfig {\n showMinimap: boolean;\n}\n\ntype NodesConfiguration = Record<string, PluginComponent>;\n\nexport type StoreState = NodesState &\n HistoryState &\n ProjectState &\n AudioPatchState & {\n setGraph: (elements: { nodes: WNNode[]; edges: WNEdge[] }) => Promise<void>;\n clearGraph: () => void;\n createNode: (node: WNNode) => void;\n createNodes: (node: WNNode[]) => Promise<void>;\n removeNode: (node: WNNode) => void;\n removeNodes: (nodes: WNNode[]) => void;\n removeEdges: (nodes: WNEdge[]) => void;\n onConnect: OnConnect;\n createEdges: (edge: WNEdge[]) => void;\n onEdgesDelete: (edges: WNEdge[]) => void;\n onNodesDelete: (nodes: WNNode[]) => Promise<void>;\n plugins: Array<PluginConfig>;\n setPlugins: (plugins: Array<PluginConfig>) => void;\n nodesConfiguration: NodesConfiguration;\n config: EditorConfig;\n setConfig: (config: Partial<EditorConfig>) => void;\n getEditorState: () => EditorState;\n setEditorState: (state: EditorState) => Promise<void>;\n isHelpShown: boolean;\n toggleHelp: () => void;\n copyBuffer: { nodes: WNNode[]; edges: WNEdge[] };\n copy: (elements: { nodes: WNNode[]; edges: WNEdge[] }) => void;\n copySelectedItems: () => void;\n pasteBuffer: (x: number, y: number) => void;\n /* move to control panel store */\n getControlPanelNode: (node: WNNode) => ControlPanelNode | null;\n controlPanel: ControlPanelState;\n setControlPanelNodes: (nodes: ControlPanelNodes) => void;\n showControlPanel: () => void;\n hideControlPanel: () => void;\n setControlPanelSize: (width: { width: number; height: number }) => void;\n addNodeToControlPanel: (node: WNNode) => void;\n removeNodeFromControlPanel: (node: WNNode) => void;\n removeNodesFromControlPanel: (nodes: WNNode[]) => void;\n /* / move to control panel store */\n viewport: Viewport;\n setViewport: (viewport: Viewport) => void;\n };\n\nexport const stateCreator: StateCreator<StoreState> = (...args) => {\n const [set, get] = args;\n return {\n ...nodesStateCreator(...args),\n ...historyStateCreator(...args),\n ...audioPatchStateCreator(...args),\n ...projectStateCreator(...args),\n\n setGraph: async ({ nodes, edges }) => {\n const {\n patch,\n createNodes,\n createEdges,\n setNodesAndEdges,\n nodes: activeNodes,\n edges: activeEdges,\n } = get();\n setNodesAndEdges({ nodes: [], edges: [] });\n\n await createNodes(nodes);\n createEdges(edges);\n },\n clearGraph: () => {\n const { setGraph } = get();\n setGraph({ nodes: [], edges: [] });\n },\n createNodes: async (nodes) => {\n const { createNode } = get();\n await Promise.all(nodes.map((node) => createNode(node)));\n },\n createNode: (nodeData) => {\n const { addNode, nodesConfiguration } = get();\n\n const { type, id, data } = nodeData;\n\n if (typeof type === \"undefined\") {\n throw new Error(`node type is not defined for node: ${id}`);\n }\n\n const node = {\n ...nodeData,\n data: {\n ...data,\n config: {\n ...nodesConfiguration[type]?.defaultConfig,\n ...data?.config,\n },\n },\n };\n\n addNode(node);\n },\n removeNode: (node) => get().removeNodes([node]),\n removeNodes: (nodes) => {\n const {\n edges,\n nodes: currentNodes,\n onNodesDelete,\n removeEdges,\n removeNodesFromControlPanel,\n } = get();\n const parentNodeIds = nodes.map(({ id }) => id);\n const children = currentNodes.filter(\n ({ parentNode }) => parentNode && parentNodeIds.includes(parentNode),\n );\n const resultingNodes = [...nodes, ...children];\n removeNodesFromControlPanel(resultingNodes);\n const connectedEdges = getConnectedEdges(resultingNodes, edges);\n removeEdges(connectedEdges);\n onNodesDelete(resultingNodes);\n const nodeIds = resultingNodes.map(({ id }) => id);\n set({\n nodes: currentNodes.filter(({ id }) => !nodeIds.includes(id)),\n });\n },\n removeEdges: (edges) => {\n const { edges: currentEdges, onEdgesDelete } = get();\n const edgeIds = edges.map(({ id }) => id);\n onEdgesDelete(edges);\n set({\n edges: currentEdges.filter(({ id }) => !edgeIds.includes(id)),\n });\n },\n createEdges: (newEdges) => {\n const { patch, edges, setEdges } = get();\n setEdges(newEdges);\n },\n onConnect: async (connection) => {\n const { edges, createEdges } = get();\n const newEdges = addEdge(connection, edges);\n createEdges(newEdges);\n },\n onEdgesDelete: (edges) => {\n const { patch } = get();\n },\n onNodesDelete: async (nodes) => {\n const { removeNodesFromControlPanel, patch } = get();\n removeNodesFromControlPanel(nodes);\n },\n plugins: [],\n setPlugins: async (plugins) => {\n const { setNodeTypes } = get();\n set({ plugins });\n\n const nodesConf: NodesConfiguration = plugins.reduce((acc, plugin) => {\n return {\n ...acc,\n ...plugin.components.reduce(\n (subAcc, item) => ({\n ...subAcc,\n [item.type]: item,\n }),\n {},\n ),\n };\n }, {});\n\n const nodeTypes: NodeTypes = Object.keys(nodesConf).reduce(\n (acc, type) => {\n return {\n ...acc,\n [type]: nodesConf[type].node,\n };\n },\n {},\n );\n\n const audioNodeTypes: AudioNodeTypes = Object.keys(nodesConf).reduce(\n (acc, type) => {\n return {\n ...acc,\n [type]: nodesConf[type].audioNode,\n };\n },\n {},\n );\n\n setAudioNodeTypes(audioNodeTypes);\n setNodeTypes(nodeTypes);\n\n set(({ nodesConfiguration }) => ({\n nodesConfiguration: { ...nodesConfiguration, ...nodesConf },\n }));\n },\n nodesConfiguration: {},\n config: { showMinimap: false },\n setConfig: (changes) => {\n set(({ config }) => ({ config: { ...config, ...changes } }));\n },\n getEditorState: () => {\n const { getNodesAndEdges, controlPanel, viewport } = get();\n return {\n ...getNodesAndEdges(),\n controlPanel,\n viewport,\n };\n },\n setEditorState: async ({ nodes, edges, controlPanel, viewport }) => {\n const { setGraph } = get();\n await setGraph({ nodes, edges });\n // @TODO: remove this line once audio patch initialisation is reworked\n await new Promise((r) => setTimeout(r, 1000));\n set({\n controlPanel,\n viewport,\n });\n },\n isHelpShown: false,\n toggleHelp: () => {\n const { isHelpShown: showHelp } = get();\n set({ isHelpShown: !showHelp });\n },\n copyBuffer: { nodes: [], edges: [] },\n copy: (elements) => {\n set({ copyBuffer: elements });\n },\n copySelectedItems: () => {\n const { nodes: currentNodes, edges: currentEdges, copy } = get();\n const nodes = currentNodes.filter(({ selected }) => selected);\n const edges = currentEdges.filter(({ selected }) => selected);\n if (!nodes.length) {\n return;\n }\n copy({ nodes, edges });\n },\n pasteBuffer: (x = 0, y = 0) => {\n const { copyBuffer, createNodes, setEdges, nodes, edges } = get();\n const { nodes: nodesToCopy, edges: edgesToCopy } = copyBuffer;\n\n if (!nodesToCopy.length) {\n return;\n }\n\n set({\n nodes: nodes.map((node) => ({ ...node, selected: false })),\n });\n\n const topLeftNode = nodesToCopy.reduce((acc, node) => {\n if (!acc) {\n return node;\n }\n if (\n node.position.x < acc.position.x &&\n node.position.y < acc.position.y\n ) {\n return node;\n }\n return acc;\n });\n\n const xDelta = topLeftNode.position.x - x;\n const yDelta = topLeftNode.position.y - y;\n\n const { nodes: newNodes, mapping } = nodesToCopy.reduce(\n (acc, node) => {\n const newNodeId = generateNodeId(node);\n return {\n nodes: [\n ...acc.nodes,\n {\n ...node,\n id: newNodeId,\n position: {\n x: node.position.x - xDelta,\n y: node.position.y - yDelta,\n },\n selected: true,\n },\n ],\n mapping: {\n ...acc.mapping,\n [node.id]: newNodeId,\n },\n };\n },\n { nodes: [], mapping: {} } as {\n nodes: Array<WNNode>;\n mapping: Record<WNNode[\"id\"], WNNode[\"id\"]>;\n },\n );\n createNodes(newNodes);\n\n const newEdges = edgesToCopy.map((edge) => {\n const source = mapping[edge.source] || edge.source;\n const target = mapping[edge.target] || edge.target;\n return {\n ...edge,\n id: edge.id.replace(edge.source, source).replace(edge.target, target),\n source,\n target,\n selected: true,\n };\n });\n setEdges([\n ...edges.map((edge) => ({ ...edge, selected: false })),\n ...newEdges,\n ]);\n },\n getControlPanelNode: (node) => {\n const { nodesConfiguration } = get();\n const { type } = node;\n if (!type) {\n return null;\n }\n const controlPanelNode = nodesConfiguration[type]?.controlPanelNode;\n if (!controlPanelNode) {\n console.error(`could not find node for type ${type}`);\n return null;\n }\n return controlPanelNode;\n },\n controlPanel: {\n show: true,\n nodes: [],\n size: {\n width: 200,\n height: 100,\n },\n },\n showControlPanel: () =>\n set(({ controlPanel }) => ({\n controlPanel: { ...controlPanel, show: true },\n })),\n hideControlPanel: () =>\n set(({ controlPanel }) => ({\n controlPanel: { ...controlPanel, show: false },\n })),\n addNodeToControlPanel: (node) => {\n const { nodesConfiguration } = get();\n const defaultConfig = node.type\n ? nodesConfiguration[node.type]?.defaultConfig\n : {};\n const { height } = defaultConfig?.size || {};\n const newNode = {\n id: node.id,\n ...(height\n ? { height: height / CONTROL_PANEL_GRID_CONFIG.rowHeight }\n : {}),\n };\n set(({ controlPanel }) => ({\n controlPanel: {\n ...controlPanel,\n nodes: [...controlPanel.nodes, newNode],\n },\n }));\n },\n removeNodeFromControlPanel: (node) =>\n get().removeNodesFromControlPanel([node]),\n removeNodesFromControlPanel: (nodes) => {\n const nodeIds = nodes.map(({ id }) => id);\n set(({ controlPanel }) => {\n const nodes = controlPanel.nodes.filter(\n ({ id }) => !nodeIds.includes(id),\n );\n return {\n controlPanel: {\n ...controlPanel,\n nodes,\n },\n };\n });\n },\n setControlPanelNodes: (nodes) => {\n set(({ controlPanel }) => {\n return {\n controlPanel: {\n ...controlPanel,\n nodes,\n },\n };\n });\n },\n setControlPanelSize: (size) => {\n set(({ controlPanel }) => {\n return {\n controlPanel: {\n ...controlPanel,\n size,\n },\n };\n });\n },\n\n viewport: { x: 0, y: 0, zoom: 1 },\n setViewport: (viewport) => set({ viewport }),\n };\n};\n\nconst useStore = create<StoreState>(audioPatch(history(stateCreator)));\n\nexport default useStore;\n","export const DRAG_HANDLE_CLASS = \"web-noise-drag-handle\";\nexport const DRAG_HANDLE_SELECTOR = `.${DRAG_HANDLE_CLASS}`;\n\nexport const CONTROL_PANEL_GRID_CONFIG = {\n rowHeight: 10,\n cols: 4,\n};\n\nexport enum PortType {\n Gate = \"gate\",\n Number = \"number\",\n Audio = \"audio\",\n Any = \"any\",\n}\n","import { WNNode } from \"../types\";\n\nconst generateNodeId = (node?: Partial<WNNode>): WNNode[\"id\"] => {\n const random = +new Date() + Math.floor(Math.random() * 1000);\n if (!node?.type) {\n return random.toString();\n }\n return `${node.type}-${random}`;\n};\n\nexport default generateNodeId;\n","import {\n addEdge,\n applyEdgeChanges,\n applyNodeChanges,\n OnConnect,\n OnEdgesChange,\n OnNodesChange,\n NodeTypes,\n} from \"reactflow\";\nimport { StateCreator } from \"zustand\";\nimport { DRAG_HANDLE_SELECTOR } from \"../constants\";\nimport type { WNNode, WNNodeData, WNEdge, GraphState } from \"../types\";\n\n//@TODO: rename to NodesStore\nexport interface NodesState {\n nodes: WNNode[];\n edges: WNEdge[];\n onNodesChange: OnNodesChange;\n onEdgesChange: OnEdgesChange;\n onConnect: OnConnect;\n addNode: (node: WNNode) => void;\n setNodes: (nodes: WNNode[]) => void;\n setEdges: (edges: WNEdge[]) => void;\n setNodesAndEdges: (elements: GraphState) => void;\n getNodesAndEdges: () => GraphState;\n clearElements: () => void;\n getNode: (id: string) => WNNode | null;\n updateNodeData: (id: string, data: Partial<WNNodeData>) => void;\n nodeTypes: NodeTypes;\n setNodeTypes: (nodeTypes: NodeTypes) => void;\n}\n\nconst nodesStateCreator: StateCreator<NodesState> = (set, get) => ({\n nodes: [],\n edges: [],\n onNodesChange: (changes) => {\n set(({ nodes }) => ({\n nodes: applyNodeChanges(changes, nodes).map((node) => ({\n dragHandle: DRAG_HANDLE_SELECTOR,\n ...node,\n })),\n }));\n },\n onEdgesChange: (changes) => {\n set(({ edges }) => ({\n edges: applyEdgeChanges(changes, edges),\n }));\n },\n onConnect: (connection) => {\n set(({ edges }) => ({\n edges: addEdge(connection, edges),\n }));\n },\n addNode: (node) => {\n set(({ nodes }) => ({\n nodes: nodes.concat(node),\n }));\n },\n setNodes: (nodes) => {\n set({\n nodes,\n });\n },\n setEdges: (edges) => {\n set({\n edges,\n });\n },\n setNodesAndEdges: ({ nodes, edges }) => {\n set({\n nodes,\n edges,\n });\n },\n getNodesAndEdges: () => {\n const { nodes, edges } = get();\n return { nodes, edges };\n },\n clearElements: () => {\n set({\n nodes: [],\n edges: [],\n });\n },\n getNode: (id) => {\n const { nodes } = get();\n const node = nodes.find((node) => node.id === id);\n return node || null;\n },\n updateNodeData: (id, data) => {\n set(({ nodes }) => {\n return {\n nodes: nodes.map((node) => {\n if (node.id === id) {\n return {\n ...node,\n data: {\n ...node.data,\n ...data,\n },\n };\n }\n\n return node;\n }),\n };\n });\n },\n nodeTypes: {},\n setNodeTypes: (nodeTypes) => set({ nodeTypes }),\n});\n\nexport default nodesStateCreator;\n","import type { StateCreator } from \"zustand\";\nimport type { StoreState } from \"../\";\nimport * as jsondiffpatch from \"jsondiffpatch\";\nimport type { Delta, FilterContext } from \"jsondiffpatch\";\n\nexport interface HistoryState {\n history: {\n maxHistoryLength: number;\n buffer: Array<Delta>;\n pointer: number;\n skipCollect: boolean;\n push: (changes: Delta) => void;\n back: () => void;\n forward: () => void;\n clear: () => void;\n };\n}\n\nconst cloneObject = <T = unknown>(input: T): T => {\n return JSON.parse(JSON.stringify(input));\n};\n\nexport const historyStateCreator: StateCreator<HistoryState> = (set, get) => ({\n history: {\n maxHistoryLength: 5,\n buffer: [],\n pointer: 0,\n skipCollect: false,\n push: (changes: Delta) => {\n const { history } = get();\n const { maxHistoryLength, skipCollect } = history;\n\n if (skipCollect) {\n set({\n history: {\n ...history,\n skipCollect: false,\n },\n });\n return;\n }\n\n set(({ history }) => {\n if (!history) {\n return {};\n }\n const { buffer, pointer } = history;\n\n const newBuffer = buffer.slice(\n Math.max(pointer - maxHistoryLength + 1, 0),\n pointer,\n );\n\n return {\n history: {\n ...history,\n buffer: [...newBuffer, changes],\n pointer: Math.min(pointer + 1, maxHistoryLength),\n },\n };\n });\n },\n back: () => {\n const { nodes, edges, controlPanel, history } = get() as StoreState;\n const { buffer, pointer } = history;\n\n const patchData = buffer[pointer - 1];\n if (!patchData) {\n return;\n }\n\n const reversedPatchData = jsondiffpatch.reverse(patchData);\n if (!reversedPatchData) {\n return;\n }\n\n const updates = cloneObject({\n nodes,\n edges,\n controlPanel,\n });\n\n const patch = jsondiffpatch.patch(updates, reversedPatchData);\n\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer - 1,\n skipCollect: true,\n },\n });\n },\n forward: () => {\n const { nodes, edges, controlPanel, history } = get() as StoreState;\n const { buffer, pointer } = history;\n\n const patchData = buffer[pointer];\n if (!patchData) {\n return;\n }\n\n const updates = cloneObject({\n nodes,\n edges,\n controlPanel,\n });\n\n const patch = jsondiffpatch.patch(updates, patchData);\n\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer + 1,\n skipCollect: true,\n },\n });\n },\n // @TODO: remove this method and store history per file\n clear: () => {\n const { history } = get();\n set({\n history: {\n ...history,\n buffer: [],\n pointer: 0,\n skipCollect: true,\n },\n });\n },\n },\n});\n\nconst COLLECT_CHANGES_DEBOUNCE_TIME = 500;\n\nexport const createChangesCollector = (set: any, get: () => StoreState) => {\n const jsondiffpatchInstance = jsondiffpatch.create({\n propertyFilter: (name: string, context: FilterContext) => {\n //@TODO: rework this function, find better solution\n if (context.parent?.parent?.childName === \"controlPanel\") {\n return true;\n }\n if (\n // @ts-ignore\n [\"data\", \"position\", \"controlPanel\"].includes(context.parent?.childName)\n ) {\n return true;\n }\n return [\n \"controlPanel\",\n \"size\",\n \"edges\",\n\n \"nodes\",\n \"data\",\n \"label\",\n \"config\",\n \"values\",\n\n \"position\",\n \"x\",\n \"y\",\n ].includes(name);\n },\n });\n let oldState: StoreState | null = get();\n let timer: any;\n\n return (state: StoreState, prevState: StoreState) => {\n if (state.currentFileIndex !== prevState.currentFileIndex) {\n get().history.clear();\n }\n clearTimeout(timer);\n if (!oldState) {\n oldState = prevState;\n }\n timer = setTimeout(() => {\n const changes = jsondiffpatchInstance.diff(oldState, state);\n oldState = null;\n\n if (changes) {\n get().history.push(changes);\n }\n }, COLLECT_CHANGES_DEBOUNCE_TIME);\n };\n};\n\ntype StoreStateCreator = StateCreator<StoreState>;\n\nconst history =\n (config: StoreStateCreator): StoreStateCreator =>\n (set, get, api) => {\n const collectChanges = createChangesCollector(set, get);\n api.subscribe(collectChanges);\n return config((...args) => set(...args), get, api);\n };\n\nexport default history;\n","import { createPatch, Patch } from \"@web-noise/patch\";\nimport type { StateCreator } from \"zustand\";\nimport type { StoreState } from \"../\";\nimport { compareGraphs } from \"./compareGraphs\";\n\ntype StoreStateCreator = StateCreator<StoreState>;\nexport interface AudioPatchState {\n patch: Patch;\n nodesState: Record<string, any>;\n}\n\nexport const audioPatchStateCreator: StateCreator<AudioPatchState> = (\n set,\n get,\n) => ({\n patch: createPatch(),\n nodesState: {},\n});\n\nconst audioPatch =\n (config: StoreStateCreator): StoreStateCreator =>\n (set, get, api) => {\n api.subscribe(async (state, prevState) => {});\n\n const promises = new Set<Promise<unknown>>();\n\n let currentState = {\n ...get(),\n nodes: [],\n edges: [],\n };\n\n return config(\n async (...args) => {\n const oldState = get();\n const [storeChanges] = args;\n\n //@ts-ignore\n const newState = {\n ...currentState,\n ...(typeof storeChanges === \"function\"\n ? storeChanges({ ...currentState })\n : storeChanges),\n };\n\n const nodeChanges = compareGraphs(currentState.nodes, newState.nodes);\n const edgeChanges = compareGraphs(currentState.edges, newState.edges);\n\n //@ts-ignore\n currentState = newState;\n\n const newNodes = nodeChanges.added;\n const newEdges = edgeChanges.added;\n const removedEdges = edgeChanges.removed;\n const removedNodes = nodeChanges.removed;\n\n const { patch } = oldState;\n\n if (newNodes.length) {\n const promise = patch.registerAudioNodes(\n //@ts-ignore\n newNodes,\n );\n promises.add(promise);\n await promise;\n promises.delete(promise);\n }\n\n if (!(newEdges.length || removedEdges.length || removedNodes.length)) {\n set(...args);\n return;\n }\n\n if (promises.size) {\n try {\n await Promise.all([...promises.values()]);\n } catch (e) {\n console.log(\"some error\", e);\n }\n }\n\n if (newEdges.length) {\n patch.registerAudioConnections(\n //@ts-ignore\n newEdges,\n );\n }\n\n if (removedEdges.length) {\n //@ts-ignore\n patch.unregisterAudioConnections(removedEdges);\n }\n\n if (removedNodes.length) {\n //@ts-ignore\n patch.unregisterAudioNodes(removedNodes);\n }\n\n set(...args);\n },\n get,\n api,\n );\n };\n\nexport default audioPatch;\n","import { WNEdge, WNNode } from \"../../types\";\n\nexport type GraphItems = Array<WNNode | WNEdge>;\n\nexport interface GraphComparisonResult {\n added: GraphItems;\n removed: GraphItems;\n}\n\nexport const compareGraphs = (\n left: GraphItems,\n right: GraphItems,\n): GraphComparisonResult => {\n const setLeft = new Set(left.map((item) => item.id));\n const setRight = new Set(right.map((item) => item.id));\n\n const added = right.filter((item) => !setLeft.has(item.id));\n const removed = left.filter((item) => !setRight.has(item.id));\n\n return { added, removed };\n};\n","import { StateCreator } from \"zustand\";\nimport type { EditorState, Project, ProjectFile } from \"../types\";\nimport type { StoreState } from \"./\";\nimport { isAudio } from \"../helpers/projectFile\";\n\nexport interface ProjectState {\n project: Project;\n setProject: (project: Project) => void;\n getProject: () => Project;\n\n pullEditorChanges: () => void;\n syncEditorWithCurrentFile: () => void;\n\n //@TODO: move inside project\n currentFileIndex: number;\n setCurrentFileIndex: (index: number) => void;\n\n updateFileContent: (fileIndex: number, file: ProjectFile) => void;\n updateFileName: (fileIndex: number, fileName: string) => void;\n addFile: (file: ProjectFile, name?: string) => void;\n deleteFile: (fileIndex: number) => void;\n}\n\nconst projectStateCreator: StateCreator<ProjectState> = (set, get) => ({\n project: { files: [] },\n setProject(project) {\n set({ project, currentFileIndex: 0 });\n },\n getProject() {\n return get().project;\n },\n\n pullEditorChanges() {\n const { getEditorState, currentFileIndex, updateFileContent, project } =\n get() as StoreState;\n const currentFile = project.files[currentFileIndex];\n if (isAudio(currentFile)) {\n return;\n }\n updateFileContent(currentFileIndex, {\n ...currentFile,\n file: getEditorState(),\n });\n },\n\n syncEditorWithCurrentFile: () => {\n const { currentFileIndex, setEditorState, project } = get() as StoreState;\n const currentFile = project.files[currentFileIndex];\n if (currentFile.type === \"audio\") {\n console.log(\"audio file. skipping\");\n return;\n }\n setEditorState(currentFile.file);\n },\n\n currentFileIndex: 0,\n setCurrentFileIndex(newFileIndex) {\n const { currentFileIndex } = get();\n if (newFileIndex === currentFileIndex) {\n return;\n }\n set({ currentFileIndex: newFileIndex });\n },\n\n updateFileContent(index, file) {\n const { project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i) => {\n if (i === index) {\n return {\n // @TODO check again if merging is really needed here\n ...f,\n ...file,\n };\n }\n return f;\n }),\n },\n });\n },\n updateFileName(index, fileName) {\n const { project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i) => {\n if (i === index) {\n return {\n ...f,\n name: fileName,\n };\n }\n return f;\n }),\n },\n });\n },\n addFile(file) {\n const { project } = get();\n const files = [...project.files, file];\n set({\n project: {\n ...project,\n files,\n },\n });\n },\n deleteFile: (fileIndex) => {\n const { project, currentFileIndex } = get();\n\n set({\n project: {\n ...project,\n files: project.files.filter((_, index) => fileIndex !== index),\n },\n });\n\n if (fileIndex <= currentFileIndex) {\n const newIndex = Math.max(0, currentFileIndex - 1);\n set({ currentFileIndex: newIndex });\n }\n },\n});\n\nexport default projectStateCreator;\n","import type { AudioFile, EditorFile, ProjectFile } from \"../types\";\n\nexport const isPatch = (file: ProjectFile): file is EditorFile =>\n !(\"type\" in file) || file.type === \"patch\";\n\nexport const isAudio = (file: ProjectFile): file is AudioFile =>\n file.type === \"audio\";\n","import { injectGlobal } from \"@emotion/css\";\nimport theme from \"./theme\";\n\ninjectGlobal`\n .react-flow {\n .react-flow__pane {\n /* background: rgb(106 106 106); */\n /* background: \"white\"; */\n // background: #292d39;\n background: ${theme.colors.elevation3};\n }\n\n .react-flow__background {\n /* background: #efefef; */\n stroke: white;\n }\n\n .react-flow__node-default {\n background: #292d39;\n color: white;\n border: none;\n /* background: transparent; */\n }\n\n .react-flow__node {\n padding: 0;\n width: auto;\n }\n\n .react-flow__edge-path {\n stroke: ${theme.colors.accent2};\n }\n\n .react-flow__node.selected {\n border: 1px solid ${theme.colors.accent2};\n box-shadow: 0 0 0 0.5px #${theme.colors.accent2};\n }\n\n .react-flow__node-default.selected, .react-flow__node-default.selected:hover {\n box-shadow: 0 0 0 0.5px #${theme.colors.accent2};\n }\n\n /* .react-flow__minimap-mask {\n fill: ${theme.colors.elevation1}\n }\n\n .react-flow__minimap-node {\n fill:${theme.colors.accent2}\n } */\n }\n\n`;\n","const LEVA_COLOR_ACCENT2_BLUE = \"#007bff\";\nconst COLOR_GREEN_PRIMARY = \"#14df42\";\nconst COLOR_WHITE_PRIMARY = \"#ffffff\";\n\nconst colors = <const>{\n elevation1: \"#292d39\", // bg color of the root panel (main title bar)\n elevation2: \"#181c20\", // bg color of the rows (main panel color)\n elevation3: \"#373c4b\", // bg color of the inputs\n accent1: \"#0066dc\",\n accent2: LEVA_COLOR_ACCENT2_BLUE,\n accent3: \"#3c93ff\",\n highlight1: \"#535760\",\n highlight2: \"#8c92a4\",\n highlight3: \"#fefefe\",\n vivid1: COLOR_GREEN_PRIMARY,\n whitePrimary: COLOR_WHITE_PRIMARY,\n error: \"#db5353\",\n};\n\nconst zIndex = <const>{\n modal: 9998,\n controlPanel: 9999,\n resumeContextLayout: 10003,\n};\n\nconst theme = {\n colors,\n zIndex,\n};\n\nexport type Theme = typeof theme;\n\nexport default theme;\n","import { withTheme } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport ReactFlow, {\n Background,\n BackgroundVariant,\n Controls,\n MiniMap,\n ReactFlowInstance,\n ReactFlowProvider,\n useOnViewportChange,\n} from \"reactflow\";\nimport \"reactflow/dist/style.css\";\nimport useStore from \"../../store\";\nimport type { EditorState, PluginConfig } from \"../../types\";\nimport { type Theme } from \"../../theme\";\nimport EdgeContextMenu, {\n useEdgeContextMenu,\n} from \"../contextMenu/EdgeContextMenu\";\nimport EditorContextMenu, {\n useEditorContextMenu,\n} from \"../contextMenu/EditorContextMenu\";\nimport NodeContextMenu, {\n useNodeContextMenu,\n} from \"../contextMenu/NodeContextMenu\";\nimport ControlPanel from \"../ControlPanel\";\nimport { HelpButton, HelpModal } from \"../Help\";\nimport ResumeContext from \"../ResumeContext\";\nimport ToggleMinimap from \"../ToggleMinimap\";\nimport Wire from \"../Wire\";\n\nconst StyledControls = withTheme(styled(Controls)<{ theme: Theme }>`\n &.bottom {\n right: 1rem;\n bottom: 40%;\n }\n\n svg {\n color: ${({ theme }) => theme.colors.elevation2};\n }\n`);\n\nconst onNodeDragStop = (_event: any, node: any) =>\n console.log(\"drag stop\", node);\nconst onNodeClick = (_event: any, element: any) =>\n console.log(\"click\", element);\n\nconst snapGrid: [number, number] = [20, 20];\n\ninterface EditorProps {\n editorState?: EditorState;\n plugins?: Array<PluginConfig>;\n editorContextMenu?: Array<ReactNode>;\n onChange?: ({ nodes, edges, controlPanel }: EditorState) => void;\n}\n\nexport const EditorPane = ({\n editorState,\n plugins = [],\n editorContextMenu = [],\n onChange = () => {},\n ...props\n}: EditorProps) => {\n const edgeTypes = useMemo(\n () => ({\n wire: Wire,\n }),\n [],\n );\n\n const {\n nodes,\n edges,\n controlPanel,\n onNodesChange,\n onNodesDelete,\n onEdgesChange,\n onEdgesDelete,\n onConnect,\n setPlugins,\n setViewport,\n viewport,\n } = useStore();\n\n const editorConfig = useStore(({ config }) => config);\n\n const nodeTypes = useStore(({ nodeTypes }) => nodeTypes);\n\n useEffect(() => {\n setPlugins(plugins);\n }, [plugins]);\n\n const [reactflowInstance, setReactflowInstance] =\n useState<ReactFlowInstance | null>(null);\n\n useEffect(() => {\n if (!reactflowInstance) {\n return;\n }\n onChange({\n nodes,\n edges,\n controlPanel,\n viewport,\n });\n }, [nodes, edges, controlPanel, viewport]);\n\n const onInit = useCallback(\n (rfi: ReactFlowInstance) => {\n if (!reactflowInstance) {\n setReactflowInstance(rfi);\n console.log(\"flow loaded:\", rfi);\n }\n },\n [reactflowInstance],\n );\n\n const { onContextMenu: onEditorContextMenu } = useEditorContextMenu();\n const { onContextMenu: onNodeContextMenu } = useNodeContextMenu();\n const { onContextMenu: onEdgeContextMenu } = useEdgeContextMenu();\n\n useEffect(() => {\n if (!viewport) {\n return;\n }\n reactflowInstance?.setViewport(viewport);\n }, [viewport, reactflowInstance]);\n\n useOnViewportChange({\n onEnd: setViewport,\n });\n\n return (\n <ReactFlow\n nodes={nodes}\n edges={edges}\n onNodesChange={onNodesChange}\n onNodesDelete={onNodesDelete}\n onEdgesChange={onEdgesChange}\n onConnect={onConnect}\n onNodeDragStop={onNodeDragStop}\n onEdgesDelete={onEdgesDelete}\n onInit={onInit}\n onNodeClick={onNodeClick}\n onContextMenu={onEditorContextMenu}\n onNodeContextMenu={onNodeContextMenu}\n onEdgeContextMenu={onEdgeContextMenu}\n nodeTypes={nodeTypes}\n edgeTypes={edgeTypes}\n snapGrid={snapGrid}\n defaultViewport={editorState?.viewport}\n defaultEdgeOptions={{ type: \"wire\" }}\n snapToGrid\n fitView\n disableKeyboardA11y\n >\n <Background variant={BackgroundVariant.Dots} gap={12} />\n {editorConfig.showMinimap ? <MiniMap /> : null}\n\n <StyledControls showInteractive={false} position=\"bottom-right\">\n <ToggleMinimap />\n <HelpButton />\n </StyledControls>\n\n <ResumeContext />\n <ControlPanel />\n <HelpModal />\n <EditorContextMenu editorContextMenu={editorContextMenu} />\n <NodeContextMenu />\n <EdgeContextMenu />\n </ReactFlow>\n );\n};\n\nexport const Editor = (props: EditorProps) => (\n <ReactFlowProvider>\n <EditorPane {...props} />\n </ReactFlowProvider>\n);\n\nexport default Editor;\n","import { useCallback } from \"react\";\nimport { useContextMenu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\n\nexport const MENU_ID = \"editor-edge-menu\";\n\nexport const useEdgeContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n const onContextMenu = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>, edge: unknown) => {\n event.stopPropagation();\n show(event, { props: { edge } });\n },\n [show],\n );\n\n return { onContextMenu };\n};\n\nconst EdgeContextMenu = () => {\n const theme = useTheme();\n\n const removeEdges = useStore((store) => store.removeEdges);\n\n return (\n <>\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper onClick={(event) => removeEdges([event.props.edge])}>\n Delete Edge (DEL)\n </ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default EdgeContextMenu;\n","import { useTheme as useEmotionTheme } from \"@emotion/react\";\nimport defaultTheme, { type Theme } from \"../theme\";\n\nconst useTheme = () => {\n const customTheme = useEmotionTheme() as Theme;\n const theme = { ...defaultTheme, ...customTheme };\n return theme;\n};\n\nexport default useTheme;\n","import styled from \"@emotion/styled\";\nimport { Item, Menu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { Theme } from \"../../theme\";\n\n\nexport const ItemWrapper = styled(Item)``;\n\nexport const MenuWrapper = styled(Menu)<{ colors: Theme[\"colors\"] }>`\n background: ${({ colors }) => colors.elevation2};\n padding: 0;\n border-radius: 0;\n\n .react-contexify__item__content {\n color: ${({ colors }) => colors.whitePrimary};\n }\n\n .react-contexify__separator {\n background-color: ${({ colors }) => colors.elevation1};\n margin: 0;\n }\n`;\n","import {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { Separator, useContextMenu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { useReactFlow, type XYPosition } from \"reactflow\";\nimport hotkeys from \"hotkeys-js\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport AddNode from \"../AddNode\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\nimport UploadAudio from \"../UploadAudio\";\n\ntype MousePosition = {\n x: number;\n y: number;\n};\n\nexport const MENU_ID = \"editor-menu\";\n\nexport const useEditorContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n return { onContextMenu: show };\n};\n\nconst EditorContextMenu = ({\n editorContextMenu = [],\n}: {\n editorContextMenu?: Array<ReactNode>;\n}) => {\n const theme = useTheme();\n\n const [mousePosition, setMousePosition] = useState<MousePosition>({\n x: 0,\n y: 0,\n });\n const [showAddNode, setShowAddNode] = useState(false);\n const [showUploadAudio, setShowUploadAudio] = useState(false);\n\n const addNodeHandler = useCallback(\n (x: number, y: number) => {\n setMousePosition({ x, y });\n setShowAddNode(true);\n },\n [setShowAddNode],\n );\n\n const pasteBuffer = useStore((store) => store.pasteBuffer);\n const { screenToFlowPosition } = useReactFlow();\n const pasteBufferHandler = useCallback(\n (mousePosition: XYPosition) => {\n const { x, y } = screenToFlowPosition(mousePosition);\n pasteBuffer(x, y);\n },\n [setShowAddNode, screenToFlowPosition],\n );\n\n const clearGraph = useStore(({ clearGraph }) => clearGraph);\n\n const deleteAllHandler = useCallback(() => {\n clearGraph();\n }, [clearGraph]);\n\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n const historyBack = useStore((store) => store.history.back);\n const historyForward = useStore((store) => store.history.forward);\n const historyPointer = useStore((store) => store.history.pointer);\n const historyBuffer = useStore((store) => store.history.buffer);\n\n const copySelectedItems = useStore((store) => store.copySelectedItems);\n const nodes = useStore((store) => store.nodes);\n const selectedNodes = useMemo(\n () => nodes.filter(({ selected }) => selected),\n [nodes],\n );\n const currentCopyBuffer = useStore((store) => store.copyBuffer);\n\n const reactFlowInstance = useReactFlow();\n\n useEffect(() => {\n hotkeys(\"command+shift+a\", () => {\n addNodeHandler(200, 50);\n return false;\n });\n //@TODO: find more elegant way to handle ?\n hotkeys(\"shift+/\", () => {\n toggleHelp();\n return false;\n });\n hotkeys(\"command+z\", () => {\n historyBack();\n return false;\n });\n hotkeys(\"command+shift+z\", () => {\n historyForward();\n return false;\n });\n hotkeys(\"command+c\", () => {\n copySelectedItems();\n return false;\n });\n hotkeys(\"command+v\", () => {\n pasteBufferHandler({ x: 200, y: 50 });\n return false;\n });\n return () => {\n hotkeys.unbind();\n };\n }, [addNodeHandler, pasteBufferHandler]);\n\n return (\n <>\n <AddNode\n isOpen={showAddNode}\n closeMenu={() => setShowAddNode(false)}\n mousePosition={mousePosition}\n />\n <UploadAudio\n isOpen={showUploadAudio}\n closeMenu={() => setShowUploadAudio(false)}\n />\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper\n onClick={({ triggerEvent: { clientX, clientY } }) =>\n addNodeHandler(clientX, clientY)\n }\n >\n Add Node (⌘+⇧+A)\n </ItemWrapper>\n <Separator />\n <ItemWrapper onClick={deleteAllHandler}>Delete All</ItemWrapper>\n <Separator />\n <ItemWrapper onClick={() => setShowUploadAudio(true)}>\n Upload Audio File\n </ItemWrapper>\n <Separator />\n <ItemWrapper disabled={historyPointer === 0} onClick={historyBack}>\n Undo (⌘+z)\n </ItemWrapper>\n <ItemWrapper\n disabled={historyPointer === historyBuffer.length}\n onClick={historyForward}\n >\n Redo (⌘+⇧+Z)\n </ItemWrapper>\n <Separator />\n <ItemWrapper\n disabled={!selectedNodes.length}\n onClick={copySelectedItems}\n >\n Copy Selected (⌘+c)\n </ItemWrapper>\n <ItemWrapper\n disabled={!currentCopyBuffer.nodes.length}\n onClick={({ triggerEvent: { clientX: x, clientY: y } }) =>\n pasteBufferHandler({ x, y })\n }\n >\n Paste (⌘+v)\n </ItemWrapper>\n <Separator />\n {editorContextMenu.map((item, index) =>\n item === null ? (\n <Separator key={index} />\n ) : (\n <ItemWrapper key={index}>{item}</ItemWrapper>\n ),\n )}\n <Separator />\n <ItemWrapper onClick={toggleHelp}>Help (⇧+?)</ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default EditorContextMenu;\n","import styled from \"@emotion/styled\";\nimport { MouseEvent, useCallback, useState } from \"react\";\nimport { Position, useReactFlow } from \"reactflow\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { PluginComponent } from \"../../types\";\nimport Modal from \"../Modal\";\nimport Filters, { FiltersState } from \"./Filters\";\nimport Plugins from \"./Plugins\";\n\ninterface AddNodeProps {\n isOpen: boolean;\n closeMenu: () => void;\n mousePosition: MousePosition;\n}\n\ntype MousePosition = {\n x: number;\n y: number;\n};\n\nconst AddNodeWrapper = styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n display: flex;\n gap: 1rem;\n`;\n\nconst PluginsPanel = styled.div<{ theme: Theme }>`\n flex-grow: 1;\n height: 100%;\n overflow-y: scroll;\n`;\n\nconst AddNode = ({ isOpen, closeMenu, mousePosition }: AddNodeProps) => {\n const theme = useTheme();\n const { screenToFlowPosition } = useReactFlow();\n\n const { createNode } = useStore(({ createNode }) => ({\n createNode,\n }));\n\n const [filtersState, setFiltersState] = useState<FiltersState>({});\n\n const onComponentClick = useCallback(\n ({ type }: PluginComponent) => {\n const { x, y } = screenToFlowPosition(mousePosition);\n const newNode = {\n //@TODO: generate node id in `createNode` function\n id: `${type}-${+new Date()}`,\n type,\n data: { label: type },\n position: {\n x,\n y,\n },\n targetPosition: Position.Left,\n sourcePosition: Position.Right,\n };\n createNode(newNode);\n closeMenu();\n },\n [mousePosition, screenToFlowPosition, createNode, closeMenu, mousePosition],\n );\n\n return isOpen ? (\n <Modal\n onClose={() => {\n closeMenu();\n setFiltersState({});\n }}\n >\n <AddNodeWrapper theme={theme}>\n <Filters onChange={setFiltersState} value={filtersState} />\n <PluginsPanel theme={theme}>\n <Plugins\n filters={filtersState}\n onTagClick={(tag) => {\n setFiltersState((state) => ({\n ...state,\n tags: state.tags?.includes(tag)\n ? state.tags.filter((t) => t !== tag)\n : [...(state.tags || []), tag],\n }));\n }}\n onComponentClick={(component) => {\n onComponentClick(component);\n setFiltersState({});\n }}\n />\n </PluginsPanel>\n </AddNodeWrapper>\n </Modal>\n ) : null;\n};\n\nexport default AddNode;\n","import styled from \"@emotion/styled\";\nimport { type ReactNode, useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport useTheme from \"../hooks/useTheme\";\nimport { Theme } from \"../theme\";\n\nconst ModalOuter = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: ${({ theme }) => theme.zIndex.modal};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: ${({ theme }) => theme.colors.elevation3}cc;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst ModalInner = styled.div<{ theme: Theme }>`\n background: ${({ theme }) => theme.colors.elevation2};\n box-shadow: 1px 1px 1px 1px ${({ theme }) => theme.colors.elevation1};\n color: white;\n width: 70%;\n height: 80%;\n overflow-y: scroll;\n position: relative;\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n font-weight: bold;\n unicode-bidi: isolate;\n }\n\n h1 {\n font-size: 2em;\n margin-block-start: 0.67em;\n margin-block-end: 0.67em;\n }\n\n h2 {\n font-size: 1.5em;\n margin-block-start: 0.83em;\n margin-block-end: 0.83em;\n }\n\n h3 {\n font-size: 1.17em;\n margin-block-start: 1em;\n margin-block-end: 1em;\n }\n\n ul {\n display: block;\n list-style-type: disc;\n margin-block-start: 1em;\n margin-block-end: 1em;\n padding-inline-start: 40px;\n unicode-bidi: isolate;\n }\n\n p {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n unicode-bidi: isolate;\n }\n`;\n\nconst ModalCloser = styled(CloseIcon)<{ theme: Theme }>`\n position: absolute;\n top: 0.2rem;\n right: 0.2rem;\n cursor: pointer;\n`;\n\ninterface ModalProps {\n onClose?: () => void;\n children: ReactNode;\n}\n\nexport const Modal = ({ children, onClose, ...props }: ModalProps) => {\n const theme = useTheme();\n\n useEffect(() => {\n const escHandler = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n onClose?.();\n }\n };\n document.addEventListener(\"keydown\", escHandler);\n return () => {\n document.removeEventListener(\"keydown\", escHandler);\n };\n }, [onClose]);\n\n return createPortal(\n <ModalOuter theme={theme} onClick={onClose}>\n <ModalInner\n {...props}\n onClick={(e) => {\n e.stopPropagation();\n }}\n theme={theme}\n >\n {children}\n <ModalCloser theme={theme} onClick={onClose} />\n </ModalInner>\n </ModalOuter>,\n document.body,\n );\n};\n\nexport default Modal;\n","import styled from \"@emotion/styled\";\nimport { withTheme } from \"@emotion/react\";\nimport { useEffect, useRef } from \"react\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { PluginTag, TagsList } from \"./Plugins\";\n\nconst InputWrapper = styled.div`\n display: flex;\n position: relative;\n`;\n\nconst InputInner = styled.input<{ theme: Theme }>`\n padding-right: 2rem;\n padding-left: 0.3rem;\n width: 100%;\n appearance: textfield;\n font-size: inherit;\n background: none;\n border: none;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n appearance: textfield;\n cursor: auto;\n background-color: ${({ theme }) => theme.colors.elevation3};\n border-radius: 0.1rem;\n height: 2rem;\n color: ${({ theme }) => theme.colors.highlight2};\n\n &:focus,\n &:hover {\n box-shadow: 0 0 0 var(--leva-borderWidths-focus)\n ${({ theme }) => theme.colors.accent2};\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin-right: 1rem;\n }\n`;\n\nconst FiltersWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n padding: 0.6rem;\n gap: 0.6rem;\n border-right: 1px solid ${({ theme }) => theme.colors.elevation3};\n min-width: 14rem;\n`;\n\nconst PluginName = styled.label<{ theme: Theme }>`\n user-select: none;\n input {\n display: none;\n }\n input:checked + span {\n color: ${({ theme }) => theme.colors.accent2};\n }\n &:hover {\n color: ${({ theme }) => theme.colors.accent3};\n cursor: pointer;\n }\n`;\n\nconst StyledPluginTag = withTheme(styled(PluginTag)<{ theme: Theme }>`\n font-size: 12px;\n padding: 0.2rem 0.4rem;\n &:hover {\n }\n &::after {\n content: \"×\";\n margin-left: 0.4rem;\n }\n`);\n\nexport interface FiltersState {\n search?: string;\n plugin?: string | null;\n tags?: string[];\n}\n\ninterface FiltersProps {\n value: FiltersState;\n onChange: (filters: FiltersState) => void;\n}\n\nconst Filters = ({ onChange, value }: FiltersProps) => {\n const theme = useTheme();\n const plugins = useStore(({ plugins }) => plugins);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!inputRef.current) {\n return;\n }\n inputRef.current.focus();\n }, [inputRef]);\n\n return (\n <FiltersWrapper theme={theme}>\n <InputWrapper>\n <InputInner\n ref={inputRef}\n theme={theme}\n value={value.search || \"\"}\n placeholder=\"search...\"\n onChange={(event) =>\n onChange({ ...value, search: event.target.value })\n }\n />\n </InputWrapper>\n <TagsList>\n {value.tags?.map((tag, index) => (\n <StyledPluginTag\n key={index}\n isActive\n onClick={() => {\n const newTags = value.tags?.filter((t) => t !== tag) || [];\n onChange({ ...value, tags: newTags });\n }}\n >\n {tag}\n </StyledPluginTag>\n ))}\n </TagsList>\n {plugins.map(({ name, components }, index) => {\n if (!name) {\n return null;\n }\n return (\n <PluginName theme={theme} key={index}>\n <input\n type=\"checkbox\"\n name=\"plugin\"\n value={name}\n checked={name === value.plugin}\n onChange={() => {\n onChange({\n ...value,\n plugin: name === value.plugin ? null : name,\n });\n }}\n />\n <span>{name}</span>\n </PluginName>\n );\n })}\n </FiltersWrapper>\n );\n};\n\nexport default Filters;\n","import styled from \"@emotion/styled\";\nimport { useMemo } from \"react\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { PluginComponent } from \"../../types\";\nimport { FiltersState } from \"./Filters\";\nimport { withTheme } from \"@emotion/react\";\n\nconst PluginsWrapper = withTheme(styled.div<{ theme: Theme }>`\n width: 100%;\n`);\n\nconst PluginWrapper = withTheme(styled.div<{ theme: Theme }>`\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n`);\n\nconst NodesList = withTheme(styled.ul<{ theme: Theme }>`\n list-style: none;\n margin: 0;\n padding: 0;\n padding-bottom: 10px;\n columns: 2;\n\n li {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 4px;\n overflow: hidden;\n border: 1px solid ${({ theme }) => theme.colors.elevation3};\n border-radius: 4px;\n margin-bottom: 0.5rem;\n &:hover {\n border-color: ${({ theme }) => theme.colors.accent2};\n cursor: pointer;\n }\n }\n`);\n\nconst NodeTitle = withTheme(styled.div<{ theme: Theme }>`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`);\n\nconst NodeDescription = withTheme(styled.div<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.highlight2};\n font-size: 12px;\n`);\n\nexport const TagsList = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n gap: 0.2rem;\n flex-wrap: wrap;\n`);\n\nexport const PluginTag = withTheme(styled.span<{\n theme: Theme;\n isActive?: boolean;\n}>`\n cursor: pointer;\n font-size: 10px;\n background: ${({ theme, isActive }) =>\n isActive ? theme.colors.highlight1 : theme.colors.elevation3};\n border-radius: 2px;\n padding: 0.1rem 0.2rem;\n border: 1px solid;\n border-color: ${({ theme }) => theme.colors.elevation2};\n &:hover {\n border-color: ${({ theme }) => theme.colors.accent2};\n }\n`);\n\nconst PluginHeader = withTheme(styled.div<{ theme: Theme }>``);\n\nconst PluginTitle = withTheme(styled.div<{ theme: Theme }>`\n font-size: 1.1rem;\n padding: 0.25rem 0;\n color: ${({ theme }) => theme.colors.highlight3};\n`);\n\nconst PluginDescription = withTheme(styled.div<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.highlight2};\n font-size: 12px;\n`);\n\ninterface PluginsProps {\n filters: FiltersState;\n onComponentClick: (component: PluginComponent) => void;\n onTagClick: (tag: string) => void;\n}\n\nconst Plugins = ({\n onComponentClick,\n filters: { plugin, search = \"\", tags },\n onTagClick,\n}: PluginsProps) => {\n const plugins = useStore(({ plugins }) => plugins);\n\n const pluginsGroup = useMemo(() => {\n if (!plugin) {\n return plugins;\n }\n return plugins.filter(({ name }) => name === plugin);\n }, [plugins, plugin]);\n\n const filteredPlugins = useMemo(() => {\n if (!search && !tags?.length) {\n return pluginsGroup;\n }\n const filteredByTags = pluginsGroup.map((plugin) => ({\n ...plugin,\n components: tags?.length\n ? plugin.components.filter((component) =>\n tags?.every((tag) => component.tags?.includes(tag)),\n )\n : plugin.components,\n }));\n return filteredByTags.map((plugin) => ({\n ...plugin,\n components: plugin.components.filter(\n ({ type, name }) =>\n type.toLocaleLowerCase().includes(search.toLocaleLowerCase()) ||\n name?.toLocaleLowerCase().includes(search.toLocaleLowerCase()),\n ),\n }));\n }, [pluginsGroup, search, tags]);\n\n return (\n <PluginsWrapper>\n {filteredPlugins.map(({ name, description, components }, index) => {\n if (!components.length) {\n return null;\n }\n return (\n <PluginWrapper key={index}>\n <PluginHeader>\n <PluginTitle>{name}</PluginTitle>\n <PluginDescription>{description}</PluginDescription>\n </PluginHeader>\n <NodesList>\n {components\n .sort((a, b) =>\n a.type.toLowerCase() > b.type.toLowerCase() ? 1 : -1,\n )\n .map((component, idx) => (\n <li onClick={() => onComponentClick(component)} key={idx}>\n <NodeTitle>{component.name || component.type}</NodeTitle>\n {component.description && (\n <NodeDescription>{component.description}</NodeDescription>\n )}\n <TagsList>\n {component.tags?.map((tag, tagIdx) => (\n <PluginTag\n isActive={tags?.includes(tag)}\n onClickCapture={(event) => {\n event.stopPropagation();\n onTagClick(tag);\n }}\n key={tagIdx}\n >\n {tag}\n </PluginTag>\n ))}\n </TagsList>\n </li>\n ))}\n </NodesList>\n </PluginWrapper>\n );\n })}\n </PluginsWrapper>\n );\n};\n\nexport default Plugins;\n","import styled from \"@emotion/styled\";\nimport { MouseEvent, useCallback, useState, useRef, ChangeEvent } from \"react\";\nimport { FileDrop } from \"react-file-drop\";\nimport { FaFileUpload } from \"react-icons/fa\";\nimport useTheme from \"../hooks/useTheme\";\nimport useStore from \"../store\";\nimport { Theme } from \"../theme\";\nimport Modal from \"./Modal\";\nimport { fileToBase64 } from \"../lib\";\n\ninterface UploadAudioProps {\n isOpen: boolean;\n closeMenu: () => void;\n}\n\nconst UploadAudioWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme }) => theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\n\nconst DropZoneInner = styled.div<{ theme: Theme }>`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\n\nconst FileUploadIcon = styled(FaFileUpload)`\n width: 100%;\n height: 8rem;\n`;\n\nconst FileUploadMessage = styled.div`\n font-size: 2rem;\n`;\n\nconst UploadAudio = ({ isOpen, closeMenu }: UploadAudioProps) => {\n const theme = useTheme();\n\n const setGraph = useStore(({ setGraph }) => setGraph);\n const setEditorState = useStore((store) => store.setEditorState);\n const addFile = useStore((store) => store.addFile);\n\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const uploadFile = useCallback(\n async (files: FileList | null) => {\n const [file] = files || [];\n const base64 = await fileToBase64(file);\n addFile({\n type: \"audio\",\n // @TODO: use nanoid here\n id: `audio-file-${+new Date()}`,\n name: file.name,\n file: base64,\n });\n closeMenu();\n },\n [addFile, closeMenu],\n );\n\n const onTargetClick = () => {\n fileInputRef.current?.click();\n };\n\n return isOpen ? (\n <Modal onClose={closeMenu}>\n <UploadAudioWrapper theme={theme}>\n <input\n onChange={({ target: { files } }) => uploadFile(files)}\n ref={fileInputRef}\n type=\"file\"\n className=\"hidden\"\n style={{ display: \"none\" }}\n accept=\".wav,.mp3,.ogg\"\n />\n <FileDrop\n className=\"drop-zone-wrapper\"\n targetClassName=\"drop-zone\"\n draggingOverTargetClassName=\"drop-zone-drag-over\"\n onTargetClick={onTargetClick}\n onDrop={(files) => uploadFile(files)}\n >\n <DropZoneInner theme={theme}>\n <FileUploadIcon />\n <FileUploadMessage>click or drop file here</FileUploadMessage>\n </DropZoneInner>\n </FileDrop>\n </UploadAudioWrapper>\n </Modal>\n ) : null;\n};\n\nexport default UploadAudio;\n","export { useWorker } from \"./hooks/useWorker\";\nexport { useMessageChannel } from \"./hooks/useMessageChannel\";\nexport * from \"./helpers\";\n","import { useEffect, useState } from \"react\";\n\nexport const useWorker = (url: string | URL) => {\n const [worker, setWorker] = useState<Worker | null>(null);\n\n useEffect(() => {\n const newWorker = new Worker(url);\n setWorker(newWorker);\n return () => {\n newWorker?.terminate();\n setWorker(null);\n };\n }, []);\n\n return worker;\n};\n\nexport default useWorker;\n","import { useEffect, useState } from \"react\";\n\nexport const useMessageChannel = () => {\n const [channel, setChannel] = useState<MessageChannel | null>(null);\n useEffect(() => {\n const newChannel = new MessageChannel();\n newChannel.port2.start();\n setChannel(newChannel);\n return () => {\n setChannel(null);\n newChannel.port2.close();\n };\n }, []);\n return channel;\n};\n\nexport default useMessageChannel;\n","export const setParameterValue = (\n param: AudioParam,\n value: number | undefined,\n audioContext: AudioContext,\n): void => {\n if (typeof value === \"undefined\") {\n return;\n }\n param.setValueAtTime(value, audioContext.currentTime);\n};\n\nexport const fileToBase64 = (file: File): Promise<string> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result?.toString() || \"\");\n reader.onerror = (error) => reject(error);\n });\n};\n","import { useCallback } from \"react\";\nimport { useContextMenu, PredicateParams } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { WNNode } from \"../../types\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\n\nexport const MENU_ID = \"editor-node-menu\";\n\nexport const useNodeContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n const onContextMenu = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>, node: unknown) => {\n event.stopPropagation();\n show(event, { props: { node } });\n },\n [],\n );\n\n return { onContextMenu };\n};\n\nconst NodeContextMenu = (args: unknown) => {\n const theme = useTheme();\n\n const removeNodes = useStore((store) => store.removeNodes);\n const addNodeToControlPanel = useStore(\n (store) => store.addNodeToControlPanel,\n );\n const removeNodeFromControlPanel = useStore(\n (store) => store.removeNodeFromControlPanel,\n );\n const copy = useStore((store) => store.copy);\n const nodesConfiguration = useStore((store) => store.nodesConfiguration);\n const controlPanelNodes = useStore((store) => store.controlPanel.nodes);\n\n const isOnControlPanel = useCallback(\n ({ props }: PredicateParams<{ node: WNNode }>) => {\n if (!props?.node.type) {\n return false;\n }\n return !!controlPanelNodes.find(({ id }) => id === props.node.id);\n },\n [controlPanelNodes],\n );\n\n const hasControlPanelNode = useCallback(\n ({ props }: PredicateParams<{ node: WNNode }>) => {\n if (!props?.node.type) {\n return false;\n }\n const nodeConfiguration = nodesConfiguration[props.node.type];\n return !!nodeConfiguration?.controlPanelNode;\n },\n [nodesConfiguration],\n );\n\n return (\n <>\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper onClick={(event) => removeNodes([event.props.node])}>\n Delete Node (DEL)\n </ItemWrapper>\n <ItemWrapper\n hidden={(...args) =>\n !hasControlPanelNode(...args) || isOnControlPanel(...args)\n }\n onClick={(event) => addNodeToControlPanel(event.props.node)}\n >\n Add To Control Panel\n </ItemWrapper>\n <ItemWrapper\n hidden={(...args) =>\n !hasControlPanelNode(...args) || !isOnControlPanel(...args)\n }\n onClick={(event) => removeNodeFromControlPanel(event.props.node)}\n >\n Remove From Control Panel\n </ItemWrapper>\n <ItemWrapper\n onClick={(event) => copy({ nodes: [event.props.node], edges: [] })}\n >\n Copy (⌘+c)\n </ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default NodeContextMenu;\n","import styled from \"@emotion/styled\";\nimport { Resizable } from \"re-resizable\";\nimport { useMemo, useRef, useState } from \"react\";\nimport GridLayout from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport {\n AiFillLock as LockIcon,\n AiFillUnlock as UnlockIcon,\n} from \"react-icons/ai\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport { RxDashboard as ControlPanelIcon } from \"react-icons/rx\";\nimport Drawer from \"react-modern-drawer\";\nimport \"react-modern-drawer/dist/index.css\";\nimport { CONTROL_PANEL_GRID_CONFIG } from \"../../constants\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport ControlPanelItem from \"./ControlPanelItem\";\nimport { IconsBar, IconWrapper, PanelTitle, TitleBarWrapper } from \"./styles\";\n\nconst ControlPanelIconWrapper = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: 5;\n box-shadow: 0px 1px 2px ${({ theme }) => theme.colors.elevation2};\n left: 1rem;\n top: 4rem;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background: ${({ theme }) => theme.colors.elevation1};\n color: ${({ theme }) => theme.colors.highlight1};\n\n :hover {\n color: ${({ theme }) => theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n\nconst ControlPanelIconsBar = styled(IconsBar)`\n height: 80%;\n`;\n\nconst CloseIconWrapper = styled(IconWrapper)`\n font-size: 1rem;\n display: flex;\n align-items: center;\n`;\n\nconst ControlPanelHeader = styled(TitleBarWrapper)<{ theme: Theme }>`\n grid-template-columns: 1fr auto;\n border-bottom: 1px solid ${({ theme }) => theme.colors.elevation3};\n font-size: 0.7rem;\n`;\n\nconst ControlPanelTitle = styled(PanelTitle)`\n text-align: center;\n`;\n\nconst ControlPanelWrapper = styled.div`\n height: 100%;\n width: 100%;\n padding: 0.3rem 0.4rem;\n box-sizing: border-box;\n`;\n\nconst ControlPanelBody = styled.div<{ theme: Theme }>`\n height: auto;\n padding: 0;\n max-height: 95vh;\n overflow-y: scroll;\n border: 1px solid ${({ theme }) => theme.colors.elevation3};\n`;\n\nconst ControlPanelSettings = styled.div`\n padding: 1rem 0;\n font-family: var(--leva-fonts-mono);\n font-size: 0.8rem;\n`;\n\nconst LockGridWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n gap: 0.5rem;\n cursor: pointer;\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.highlight2};\n }\n`;\n\nconst GridResizeHandle = styled.div<{ theme: Theme }>`\n position: absolute;\n height: 1rem;\n top: 0;\n bottom: 0;\n margin: auto;\n left: 0.5rem;\n border-right: 1px solid ${({ theme }) => theme.colors.whitePrimary};\n`;\n\nconst ControlPanelItemWrapper = styled.div<{ theme: Theme }>`\n box-sizing: border-box;\n overflow: hidden;\n .react-resizable-handle:after {\n border-color: ${({ theme }) => theme.colors.whitePrimary};\n border-width: 1px;\n }\n`;\n\nconst ControlPanel = () => {\n const theme = useTheme();\n const nodeRef = useRef(null);\n const nodes = useStore((store) => store.nodes);\n const {\n show,\n nodes: controlPanelNodes,\n size,\n } = useStore((store) => store.controlPanel);\n\n const { width = 200, height } = size;\n\n const filteredNodes = useMemo(() => {\n const nodeIds = controlPanelNodes.map(({ id }) => id);\n return nodes.filter(({ id }) => nodeIds.includes(id));\n }, [nodes, controlPanelNodes]);\n\n const showControlPanel = useStore((store) => store.showControlPanel);\n const hideControlPanel = useStore((store) => store.hideControlPanel);\n const setControlPanelNodes = useStore((store) => store.setControlPanelNodes);\n const setControlPanelSize = useStore((store) => store.setControlPanelSize);\n const removeNodeFromControlPanel = useStore(\n (store) => store.removeNodeFromControlPanel,\n );\n\n const [isGridLocked, setGridLocked] = useState(true);\n\n const layout = useMemo(() => {\n const fallbackY = controlPanelNodes.reduce(\n (acc, { height = CONTROL_PANEL_GRID_CONFIG.rowHeight, x, y = 0 }) => {\n const Y = y + height;\n return Y > acc ? Y : acc;\n },\n 0,\n );\n return controlPanelNodes.map(({ id: i, width, height, x, y }) => {\n return {\n i,\n w: width || CONTROL_PANEL_GRID_CONFIG.cols,\n h: height || 6,\n x: x ?? 0,\n y: y ?? fallbackY,\n };\n });\n }, [controlPanelNodes]);\n\n if (!filteredNodes.length) {\n return null;\n }\n\n return (\n <>\n <ControlPanelIconWrapper\n theme={theme}\n ref={nodeRef}\n onClick={showControlPanel}\n >\n <ControlPanelIcon />\n </ControlPanelIconWrapper>\n <Drawer\n open={show}\n onClose={hideControlPanel}\n direction=\"left\"\n className=\"\"\n size=\"auto\"\n enableOverlay={false}\n style={{\n background: theme.colors.elevation1,\n position: \"absolute\",\n }}\n >\n <ControlPanelHeader theme={theme}>\n <ControlPanelTitle>Control Panel</ControlPanelTitle>\n <ControlPanelIconsBar>\n <CloseIconWrapper onClick={hideControlPanel} theme={theme}>\n <CloseIcon />\n </CloseIconWrapper>\n </ControlPanelIconsBar>\n </ControlPanelHeader>\n\n <ControlPanelWrapper>\n <ControlPanelSettings>\n {isGridLocked ? (\n <LockGridWrapper\n theme={theme}\n onClick={() => setGridLocked(false)}\n >\n <LockIcon />\n Unlock grid\n </LockGridWrapper>\n ) : (\n <LockGridWrapper\n theme={theme}\n onClick={() => setGridLocked(true)}\n >\n <UnlockIcon />\n Lock grid\n </LockGridWrapper>\n )}\n </ControlPanelSettings>\n <Resizable\n enable={{\n top: false,\n right: !isGridLocked,\n bottom: false,\n left: false,\n topRight: false,\n bottomRight: false,\n bottomLeft: false,\n topLeft: false,\n }}\n handleComponent={{\n right: <GridResizeHandle theme={theme} />,\n }}\n minWidth={120}\n size={{ width, height: \"auto\" }}\n onResizeStop={(e, direction, ref, d) => {\n setControlPanelSize({\n width: width + d.width,\n height: height + d.height,\n });\n }}\n >\n <ControlPanelBody theme={theme}>\n {/* @ts-ignore */}\n <GridLayout\n layout={layout}\n className=\"layout\"\n cols={CONTROL_PANEL_GRID_CONFIG.cols}\n rowHeight={CONTROL_PANEL_GRID_CONFIG.rowHeight}\n width={width}\n margin={[0, 0]}\n isResizable={!isGridLocked}\n draggableHandle=\".grid-item-handle\"\n onLayoutChange={(nodes) => {\n requestAnimationFrame(() => {\n setControlPanelNodes(\n nodes.map(({ i, w, h, x, y }) => ({\n id: i,\n width: w,\n height: h,\n x,\n y,\n })),\n );\n });\n }}\n >\n {filteredNodes.map((node) => {\n return (\n <ControlPanelItemWrapper key={node.id} theme={theme}>\n <ControlPanelItem\n node={node}\n showControls={!isGridLocked}\n onDelete={removeNodeFromControlPanel}\n />\n </ControlPanelItemWrapper>\n );\n })}\n </GridLayout>\n </ControlPanelBody>\n </Resizable>\n </ControlPanelWrapper>\n </Drawer>\n </>\n );\n};\n\nexport default ControlPanel;\n","import { useMemo } from \"react\";\n\nimport styled from \"@emotion/styled\";\nimport \"react-grid-layout/css/styles.css\";\nimport { MdDragHandle as DragIcon } from \"react-icons/md\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport useAudioNode from \"../../hooks/useAudioNode\";\nimport useNode from \"../../hooks/useNode\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { WNNode, ControlPanelNodeProps } from \"../../types\";\nimport { IconsBar, IconWrapper, PanelTitle, TitleBarWrapper } from \"./styles\";\n\nconst ControlPanelNodeWrapper = styled.div<{ theme: Theme }>`\n height: 100%;\n display: grid;\n grid-template-rows: auto 1fr;\n`;\n\nconst PanelNode = (props: ControlPanelNodeProps) => {\n const { node } = props;\n\n const getControlPanelNode = useStore((store) => store.getControlPanelNode);\n\n const ControlPanelNode = useMemo(() => getControlPanelNode(node), [node]);\n\n if (!ControlPanelNode) {\n return null;\n }\n\n return <ControlPanelNode {...props} />;\n};\n\ninterface ControlPanelItemProps {\n node: WNNode;\n showControls: boolean;\n onDelete: (node: WNNode) => void;\n}\n\nconst ControlPanelItem = (props: ControlPanelItemProps) => {\n const { node, showControls, onDelete } = props;\n const theme = useTheme();\n\n const { id } = node;\n const { node: audioNode } = useAudioNode(id) || {};\n const { updateNodeValues } = useNode(id);\n\n return (\n <ControlPanelNodeWrapper theme={theme}>\n <TitleBarWrapper theme={theme}>\n <PanelTitle>{node.data.label}</PanelTitle>\n {showControls && (\n <IconsBar>\n <IconWrapper theme={theme}>\n <DragIcon className=\"grid-item-handle\" />\n </IconWrapper>\n <IconWrapper theme={theme}>\n <CloseIcon onClick={() => onDelete(node)} />\n </IconWrapper>\n </IconsBar>\n )}\n </TitleBarWrapper>\n <PanelNode\n node={node}\n audioNode={audioNode}\n updateNodeValues={updateNodeValues}\n />\n </ControlPanelNodeWrapper>\n );\n};\n\nexport default ControlPanelItem;\n","import { AudioNodeState } from \"@web-noise/patch\";\nimport useStore from \"../store\";\nimport type { WNAudioNode } from \"../types\";\n\nconst useAudioNode = <T = WNAudioNode>(id: string) => {\n const patch = useStore(({ patch }) => patch);\n return patch.audioNodes.get(id) as AudioNodeState<T> | undefined;\n};\n\nexport default useAudioNode;\n","import { useCallback } from \"react\";\nimport useStore from \"../store\";\nimport { WNNodeData } from \"../types\";\n\nconst useNode = (id: string) => {\n const updateNodeData = useStore(({ updateNodeData }) => updateNodeData);\n\n const updateNodeValues = useCallback(\n (values: WNNodeData[\"values\"]) => updateNodeData(id, { values }),\n [id, updateNodeData]\n );\n const updateNodeConfig = useCallback(\n (config: WNNodeData[\"config\"]) => updateNodeData(id, { config }),\n [id, updateNodeData]\n );\n const updateNodeLabel = useCallback(\n (label: string) => updateNodeData(id, { label }),\n [id, updateNodeData]\n );\n\n return {\n updateNodeValues,\n updateNodeConfig,\n updateNodeLabel,\n };\n};\n\nexport default useNode;\n","import styled from \"@emotion/styled\";\nimport \"react-grid-layout/css/styles.css\";\nimport { Theme } from \"../../theme\";\nimport { TitleBar } from \"../Node\";\n\nexport const PanelTitle = styled.div`\n width: 100%;\n padding: 0.4rem 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nexport const TitleBarWrapper = styled(TitleBar)<{ theme: Theme }>`\n display: flex;\n gap: 0.1rem;\n padding: 0 0.4rem;\n justify-content: start;\n font-size: 0.6rem;\n height: auto;\n min-width: 0;\n`;\n\nexport const IconsBar = styled.div`\n display: flex;\n align-items: center;\n height: 70%;\n width: auto;\n gap: 0.4rem;\n`;\n\nexport const IconWrapper = styled.span<{ theme: Theme }>`\n width: auto;\n height: 100%;\n cursor: pointer;\n svg {\n width: auto;\n height: 100%;\n }\n &:hover {\n color: ${({ theme }) => theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n","import styled from \"@emotion/styled\";\nimport { withTheme } from \"@emotion/react\";\nimport { Resizable } from \"re-resizable\";\nimport { ComponentProps, useMemo, useState } from \"react\";\nimport {\n MdSettings as SettingsIcon,\n MdInfoOutline as InfoIcon,\n} from \"react-icons/md\";\nimport { Handle, HandleProps, NodeProps, Position } from \"reactflow\";\nimport { DRAG_HANDLE_CLASS, PortType } from \"../../constants\";\nimport useAudioNode from \"../../hooks/useAudioNode\";\nimport useNode from \"../../hooks/useNode\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { AudioPort, WNNodeData } from \"../../types\";\nimport EditableLabel from \"../EditableLabel\";\nimport NodeInfoModal from \"../NodeInfoModal\";\n\nconst NodeWrapper = styled.div`\n background-color: var(--leva-colors-elevation1);\n`;\n\nconst NodeLoaderWrapper = styled(NodeWrapper)`\n padding: 2rem 5rem;\n`;\n\nconst NodeErrorWrapper = styled(NodeWrapper)`\n padding: 1rem 2rem;\n`;\n\nconst SettingsIconWrapper = styled(SettingsIcon)`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\n\nconst InfoIconWrapper = styled(InfoIcon)`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\n\nconst Section = styled.div`\n position: relative;\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n background-color: var(--leva-colors-elevation1);\n`;\n\nexport const TitleBarInner = styled(Section)`\n display: flex;\n height: var(--leva-sizes-titleBarHeight);\n touch-action: none;\n align-items: center;\n justify-content: center;\n flex: 1 1 0%;\n color: var(--leva-colors-highlight1);\n padding: 0 0.4rem;\n gap: 0.3rem;\n`;\n\nexport const PortsPanel = styled(Section)<{ theme: Theme }>(\n ({ theme }) => `\n display: grid;\n grid-template-areas: \"inputs outputs\";\n background: ${theme.colors.elevation2};\n border-bottom: 1px solid ${theme.colors.elevation1};\n color: ${theme.colors.highlight3};\n font-size: 0.6rem;\n`,\n);\n\nexport const InputPorts = styled.div`\n grid-area: inputs;\n text-align: left;\n`;\n\nexport const OutputPorts = styled.div`\n grid-area: outputs;\n text-align: right;\n`;\n\nexport const Port = styled.div`\n position: relative;\n padding: 5px 10px;\n`;\n\nconst portColors = {\n [PortType.Audio]: \"#4ade80\", // vibrant green\n [PortType.Gate]: \"#c084fc\", // rich purple\n [PortType.Number]: \"#38bdf8\", // bright blue\n [PortType.Any]: \"#ffffff\", // white\n};\n\nconst StyledHandle = withTheme(styled(Handle, {\n shouldForwardProp: (prop) => prop !== \"portType\",\n})<{ portType?: AudioPort[\"type\"]; theme: Theme }>`\n --port-color: ${(props) => {\n if (!props.portType) return props.theme.colors.highlight2;\n if (Array.isArray(props.portType)) {\n const colors = props.portType.map((type) => portColors[type]);\n return `linear-gradient(0.25turn, ${colors.join(\", \")});`;\n } else {\n return portColors[props.portType];\n }\n }};\n border-color: var(--port-color);\n background: var(--port-color);\n box-shadow: 0px 0px 0px 1px ${({ theme }) => theme.colors.elevation2} inset;\n`);\n\nconst StyledInputHandle = withTheme(styled(StyledHandle)`\n left: -3px;\n`);\n\nexport const InputHandle = ({\n ...props\n}: Partial<HandleProps & ComponentProps<typeof StyledInputHandle>>) => (\n <StyledInputHandle {...props} type=\"target\" position={Position.Left} />\n);\n\nexport const StyledOutputHandle = withTheme(styled(StyledHandle)`\n right: -3px;\n`);\n\nexport const OutputHandle = (\n props: Partial<HandleProps & ComponentProps<typeof StyledOutputHandle>>,\n) => <StyledOutputHandle {...props} type=\"source\" position={Position.Right} />;\n\nexport type WNNodeProps<T = Record<string, unknown>> = NodeProps<\n T & WNNodeData\n>;\n\nexport interface TitleBarProps {\n className?: string;\n [key: string]: unknown;\n}\n\nexport const TitleBar = ({ className, ...props }: TitleBarProps) => (\n <TitleBarInner\n {...props}\n className={[className, DRAG_HANDLE_CLASS].join(\" \")}\n />\n);\n\nexport interface WNNodeParameters extends NodeProps {\n children?: any;\n}\n\nconst useNodeManifest = (type: string) => {\n const data = useStore((store) => store.nodesConfiguration[type]);\n\n return data;\n};\n\nconst useConfigNode = (type: string) => {\n const { configNode: ConfigNode } = useNodeManifest(type);\n\n return {\n ConfigNode,\n };\n};\n\nexport const WNNode = (props: WNNodeParameters) => {\n const { id, children, selected, ...rest } = props;\n const theme = useTheme();\n const getNode = useStore(({ getNode }) => getNode);\n const nodesConfiguration = useStore((store) => store.nodesConfiguration);\n\n const [isInfoModalShown, setIsInfoModalShown] = useState(false);\n\n const { info } = useNodeManifest(props.type);\n\n const isResizeable = useMemo(\n () => nodesConfiguration[props.type].resizable ?? false,\n [nodesConfiguration, props.type],\n );\n\n const { updateNodeLabel, updateNodeConfig } = useNode(id);\n const { data } = getNode(id) || {};\n const audioNode = useAudioNode(id);\n const { ConfigNode } = useConfigNode(rest.type);\n\n const [configMode, setShowConfigMode] = useState(false);\n\n if (!audioNode) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n can't find audio node\n </NodeLoaderWrapper>\n );\n }\n\n if (audioNode.loading) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n loading\n </NodeLoaderWrapper>\n );\n }\n\n if (audioNode.error) {\n return (\n <NodeErrorWrapper className={DRAG_HANDLE_CLASS}>\n error: {audioNode.error.toString()}\n </NodeErrorWrapper>\n );\n }\n\n if (!audioNode.node) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n can't find audio node\n </NodeLoaderWrapper>\n );\n }\n\n const size = data?.config?.size as\n | { width: number; height: number }\n | undefined;\n\n const {\n node: { inputs, outputs },\n } = audioNode;\n\n return (\n <NodeWrapper>\n <TitleBar>\n {info && (\n <InfoIconWrapper onClickCapture={() => setIsInfoModalShown(true)} />\n )}\n <EditableLabel\n value={data?.label ?? \"No Name\"}\n onChange={updateNodeLabel}\n />\n {ConfigNode && (\n <SettingsIconWrapper\n onClickCapture={() => setShowConfigMode((isShown) => !isShown)}\n />\n )}\n </TitleBar>\n <PortsPanel theme={theme}>\n <InputPorts>\n {inputs\n ? Object.keys(inputs).map((key, index) => (\n <Port key={index}>\n <InputHandle id={key} portType={inputs[key].type} />\n <span>{key}</span>\n </Port>\n ))\n : null}\n </InputPorts>\n <OutputPorts>\n {outputs\n ? Object.keys(outputs).map((key, index) => (\n <Port key={index}>\n <OutputHandle id={key} portType={outputs[key].type} />\n <span>{key}</span>\n </Port>\n ))\n : null}\n </OutputPorts>\n </PortsPanel>\n {ConfigNode && configMode && selected ? (\n <ConfigNode {...props} />\n ) : isResizeable ? (\n <Resizable\n size={size}\n minWidth={180}\n minHeight={30}\n enable={{\n bottom: true,\n bottomRight: true,\n right: true,\n }}\n onResizeStop={(e, direction, ref, d) => {\n const newSize = size\n ? {\n width: size.width + d.width,\n height: size.height + d.height,\n }\n : ref.getBoundingClientRect();\n updateNodeConfig({\n ...data?.config,\n size: newSize,\n });\n }}\n >\n {children}\n </Resizable>\n ) : (\n children\n )}\n <NodeInfoModal\n isOpen={isInfoModalShown}\n type={props.type}\n onClose={() => setIsInfoModalShown(false)}\n node={audioNode.node}\n />\n </NodeWrapper>\n );\n};\n","import styled from \"@emotion/styled\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport const TitleBarLabel = styled.input`\n width: 100%;\n background: none;\n border: none;\n text-align: center;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n\n &:focus {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-within {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-vissible {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:not([readonly]):focus {\n color: #fff;\n appearance: none;\n cursor: auto;\n background-color: var(--leva-colors-elevation2);\n padding: 0.3rem;\n border-radius: 0.2rem;\n }\n`;\n\ninterface EditableLabelProps {\n onChange: (value: string) => void;\n value?: string;\n className?: string;\n}\n\nconst EditableLabel = ({\n onChange,\n value = \"\",\n className,\n}: EditableLabelProps) => {\n const labelInputRef = useRef<HTMLInputElement>(null);\n\n const [labelEditMode, setLabelEditMode] = useState(false);\n const editNodeLabel = useCallback(\n (event: React.MouseEvent) => {\n //@ts-ignore\n event.target?.select();\n setLabelEditMode(true);\n },\n [setLabelEditMode],\n );\n\n const exitEditMode = useCallback(() => {\n window.getSelection()?.collapseToEnd();\n setLabelEditMode(false);\n }, [setLabelEditMode]);\n\n const saveNodeLabel = useCallback(() => {\n exitEditMode();\n if (labelInputRef.current) {\n onChange(labelInputRef.current.value);\n }\n }, [labelInputRef, exitEditMode, onChange]);\n\n const cancelNodeLabelEdit = useCallback(() => {\n exitEditMode();\n if (labelInputRef.current && value) {\n labelInputRef.current.value = value;\n }\n }, [labelInputRef, exitEditMode, value]);\n\n useEffect(() => {\n if (!labelInputRef.current) {\n return;\n }\n labelInputRef.current.value = value;\n }, [value, labelInputRef]);\n\n return (\n <TitleBarLabel\n ref={labelInputRef}\n type=\"text\"\n readOnly={!labelEditMode}\n onDoubleClick={(event) => editNodeLabel(event)}\n onBlur={saveNodeLabel}\n onKeyDown={(event) => {\n switch (event.key) {\n case \"Escape\":\n cancelNodeLabelEdit();\n break;\n case \"Enter\":\n saveNodeLabel();\n break;\n }\n }}\n className={className}\n />\n );\n};\n\nexport default EditableLabel;\n","import styled from \"@emotion/styled\";\nimport Modal from \"./Modal\";\nimport { marked } from \"marked\";\nimport useStore from \"../store\";\nimport { withTheme } from \"@emotion/react\";\nimport { useMemo } from \"react\";\nimport { WNAudioNode } from \"../types\";\nimport { Theme } from \"../theme\";\n\ninterface NodeInfoModalProps {\n isOpen: boolean;\n onClose: () => void;\n type: string;\n node: WNAudioNode;\n}\n\nconst NodeInfoWrapper = withTheme(styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n overflow: scroll;\n padding: 0.6rem;\n box-sizing: border-box;\n\n hr {\n border: none;\n border-bottom: 1px solid ${({ theme }) => theme.colors.elevation3};\n }\n\n code {\n background-color: ${({ theme }) => theme.colors.elevation3};\n color: ${({ theme }) => theme.colors.highlight3};\n font-family:\n source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n }\n\n pre {\n background-color: ${({ theme }) => theme.colors.elevation3};\n padding: 0.2rem 0.3rem;\n border-radius: 1px;\n }\n\n a {\n color: ${({ theme }) => theme.colors.accent1};\n }\n`);\n\nconst useNodeManifest = (type: string) => {\n const data = useStore((store) => store.nodesConfiguration[type]);\n return data;\n};\n\nconst NodeInfoModal = ({\n isOpen,\n onClose,\n type: nodeType,\n node,\n}: NodeInfoModalProps) => {\n const { info, portsDescription } = useNodeManifest(nodeType);\n\n const portsInfo = useMemo(() => {\n const parts: string[] = [];\n\n const inputPorts = node.inputs;\n if (inputPorts) {\n parts.push(`## Inputs`);\n for (const portName in inputPorts) {\n const port = inputPorts[portName];\n parts.push(`### *${portName}*`);\n\n const description = portsDescription?.inputs?.[portName];\n\n if (description) {\n parts.push(description);\n }\n\n if (Array.isArray(port.type)) {\n parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n } else {\n parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n }\n\n if (port.range) {\n parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n }\n\n if (port.defaultValue !== undefined) {\n parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n }\n\n const outputPorts = node.outputs;\n if (outputPorts) {\n parts.push(`## Outputs`);\n for (const portName in outputPorts) {\n const port = outputPorts[portName];\n parts.push(`### *${portName}*`);\n\n const description = portsDescription?.outputs?.[portName];\n\n if (description) {\n parts.push(description);\n }\n\n if (Array.isArray(port.type)) {\n parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n } else {\n parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n }\n\n if (port.range) {\n parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n }\n\n if (port.defaultValue !== undefined) {\n parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n }\n return parts.join(\"\\n\\n\");\n }, [node, portsDescription]);\n\n const combinedInfo = (info || \"\") + \"\\n\\n\" + portsInfo;\n\n return isOpen ? (\n <Modal onClose={onClose}>\n <NodeInfoWrapper\n dangerouslySetInnerHTML={{ __html: marked(combinedInfo || \"\") }}\n />\n </Modal>\n ) : null;\n};\n\nexport default NodeInfoModal;\n","import { FaQuestion } from \"react-icons/fa\";\nimport { ControlButton } from \"reactflow\";\nimport useStore from \"../../store\";\nimport HelpModal from './HelpModal';\n\n\nconst HelpButton = () => {\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n return (\n <>\n <ControlButton onClick={toggleHelp}>\n <FaQuestion />\n </ControlButton>\n </>\n );\n};\n\nexport { HelpModal, HelpButton };\n\n","import { withTheme } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\n// @ts-ignore\nimport { marked } from \"marked\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport Modal from \"../Modal\";\n\n//@ts-ignore\nimport HELP from \"bundle-text:./HELP.md\";\n\nconst MdPreview = withTheme(styled.div<{ theme: Theme }>`\n font-family: var(--leva-fonts-mono);\n font-size: 0.7rem;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n overflow: scroll;\n color: ${({ theme }) => theme.colors.whitePrimary};\n padding: 0 0.5rem;\n\n code {\n color: ${({ theme }) => theme.colors.accent3};\n filter: hue-rotate(180deg);\n }\n`);\n\nconst ModalContent = withTheme(styled.div<{ theme: Theme }>`\n padding: 1rem;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n overflow: hidden;\n`);\n\nconst HelpModal = () => {\n const isHelpShown = useStore((store) => store.isHelpShown);\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n if (!isHelpShown) {\n return null;\n }\n\n return (\n <Modal\n onClose={() => {\n toggleHelp();\n }}\n >\n <ModalContent>\n <MdPreview\n dangerouslySetInnerHTML={{ __html: marked(HELP) }}\n onWheelCapture={(event) => event.stopPropagation()}\n ></MdPreview>\n </ModalContent>\n </Modal>\n );\n};\n\nexport default HelpModal;\n","module.exports = \"f1207d2537cf9ec3\";","import styled from \"@emotion/styled\";\nimport { useState } from \"react\";\nimport { FaVolumeOff as IconUnmute } from \"react-icons/fa\";\nimport useStore from \"../store\";\nimport useTheme from \"../hooks/useTheme\";\nimport { Theme } from \"../theme\";\n\n\nconst Layout = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: ${({ theme }) => theme.zIndex.resumeContextLayout};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: rgb(24 28 32 / 90%);\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n color: ${({ theme }) => theme.colors.whitePrimary};\n cursor: pointer;\n`;\n\nconst Row = styled.div`\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n`;\n\nconst Message = styled.div<{ theme: Theme }>`\n font-family: var(--leva-fonts-mono);\n font-size: 2rem;\n`;\n\nconst Icon = styled(IconUnmute)`\n width: 7rem;\n height: 7rem;\n`;\n\nconst ResumeContext = () => {\n const theme = useTheme();\n const patch = useStore(({ patch }) => patch);\n const audioContext = patch.audioContext;\n const [isContextResumed, setIsContextResumed] = useState<boolean>(\n audioContext.state === \"running\",\n );\n\n if (isContextResumed) {\n return null;\n }\n\n return (\n <Layout\n theme={theme}\n onClick={() => {\n audioContext.resume();\n setIsContextResumed(true);\n }}\n >\n <Row>\n <Message theme={theme}>Click anywhere to resume audio context</Message>\n </Row>\n <Row>\n <Icon />\n </Row>\n </Layout>\n );\n};\n\nexport default ResumeContext;\n","import { FaMap, FaRegMap } from \"react-icons/fa\";\nimport { ControlButton } from \"reactflow\";\nimport useStore from \"../store\";\n\nconst ToggleMinimap = () => {\n const setConfig = useStore(({ setConfig }) => setConfig);\n const { showMinimap } = useStore(({ config }) => config);\n\n return (\n <ControlButton onClick={() => setConfig({ showMinimap: !showMinimap })}>\n {showMinimap ? <FaMap /> : <FaRegMap />}\n </ControlButton>\n );\n};\n\nexport default ToggleMinimap;\n","import { useEffect, useMemo } from \"react\";\nimport { EdgeProps, getBezierPath, getConnectedEdges } from \"reactflow\";\nimport useTheme from \"../hooks/useTheme\";\nimport useStore from \"../store\";\n\nconst Wire = ({\n id,\n sourceX,\n sourceY,\n targetX,\n targetY,\n sourcePosition,\n targetPosition,\n style = {},\n data,\n markerStart,\n markerEnd,\n source,\n target,\n sourceHandleId,\n targetHandleId,\n selected,\n}: EdgeProps) => {\n const theme = useTheme();\n const getNode = useStore(({ getNode }) => getNode);\n const sourceNode = getNode(source);\n const targetNode = getNode(target);\n const isConnectedToSelected = sourceNode?.selected || targetNode?.selected;\n useEffect(() => {\n if (!sourceHandleId || !targetHandleId) {\n return;\n }\n console.log(`connected ${source} to ${target}`);\n return () => {\n console.log(`disconnected ${source} from ${target}`);\n };\n }, [source, sourceHandleId, target, targetHandleId]);\n\n const [edgePath] = getBezierPath({\n targetX,\n targetY,\n targetPosition,\n sourceX,\n sourceY,\n sourcePosition,\n });\n\n return (\n <>\n <path\n id={id}\n style={{\n ...style,\n stroke: selected\n ? theme.colors.accent2\n : isConnectedToSelected\n ? theme.colors.highlight3\n : theme.colors.highlight2,\n }}\n className=\"react-flow__edge-path Wire\"\n d={edgePath}\n markerEnd={markerEnd}\n />\n <path\n style={{\n ...style,\n strokeWidth: 8,\n color: \"transparent\",\n opacity: 0,\n cursor: \"pointer\",\n }}\n d={edgePath}\n markerEnd={markerEnd}\n />\n </>\n );\n};\n\nexport default Wire;\n"],"names":["config","jsx","$but2J$jsx","jsxs","$but2J$jsxs","Fragment","$but2J$Fragment","withTheme","$but2J$withTheme","ThemeProvider","$but2J$ThemeProvider","Global","$but2J$Global","css","$but2J$css","useTheme","$but2J$useTheme","$but2J$emotionstyled","nanoid","$but2J$nanoid","useState","$but2J$useState","useEffect","$but2J$useEffect","useMemo","$but2J$useMemo","useCallback","$but2J$useCallback","useRef","$but2J$useRef","FaPlus","$but2J$FaPlus","MdClose","$but2J$MdClose","MdDragHandle","$but2J$MdDragHandle","MdSettings","$but2J$MdSettings","MdInfoOutline","$but2J$MdInfoOutline","registerFetcher","$but2J$registerFetcher","$but2J$reactflow","getConnectedEdges","$but2J$getConnectedEdges","addEdge","$but2J$addEdge","applyNodeChanges","$but2J$applyNodeChanges","applyEdgeChanges","$but2J$applyEdgeChanges","Controls","$but2J$Controls","useOnViewportChange","$but2J$useOnViewportChange","Background","$but2J$Background","BackgroundVariant","$but2J$BackgroundVariant","MiniMap","$but2J$MiniMap","ReactFlowProvider","$but2J$ReactFlowProvider","useReactFlow","$but2J$useReactFlow","Position","$but2J$Position","Handle","$but2J$Handle","ControlButton","$but2J$ControlButton","getBezierPath","$but2J$getBezierPath","create","$but2J$create","setAudioNodeTypes","$but2J$setAudioNodeTypes","createPatch","$but2J$createPatch","reverse","$but2J$reverse","patch","$but2J$patch","$but2J$create1","injectGlobal","$but2J$injectGlobal","useContextMenu","$but2J$useContextMenu","Item","$but2J$Item","Menu","$but2J$Menu","Separator","$but2J$Separator","$but2J$hotkeysjs","createPortal","$but2J$createPortal","FileDrop","$but2J$FileDrop","FaFileUpload","$but2J$FaFileUpload","FaQuestion","$but2J$FaQuestion","FaVolumeOff","$but2J$FaVolumeOff","FaMap","$but2J$FaMap","FaRegMap","$but2J$FaRegMap","Resizable","$but2J$Resizable","$but2J$reactgridlayout","AiFillLock","$but2J$AiFillLock","AiFillUnlock","$but2J$AiFillUnlock","RxDashboard","$but2J$RxDashboard","$but2J$reactmoderndrawer","marked","$but2J$marked","$73e253e9a60dc018$export$956b3cf15d7c363","$73e253e9a60dc018$export$21d634b1d5d9bee3","PortType","$73e253e9a60dc018$export$b0b7b95ee465c83c","$db60a1ce8fd45a15$var$cloneObject","input","JSON","parse","stringify","$b69bc78343b7b1b2$export$e364ea0c1dfb25e5","left","right","setLeft","Set","map","item","id","setRight","added","filter","has","removed","$d6879eb00f829ebf$export$e698b79c63b74136","file","type","$d6879eb00f829ebf$export$31c2336f657dc59f","$40b3df4f7825b834$export$2e2bcd8739ae039","args","set","get","nodes","edges","onNodesChange","changes","node","dragHandle","onEdgesChange","onConnect","connection","addNode","concat","setNodes","setEdges","setNodesAndEdges","getNodesAndEdges","clearElements","getNode","find","updateNodeData","data","nodeTypes","setNodeTypes","history","maxHistoryLength","buffer","pointer","skipCollect","push","newBuffer","slice","Math","max","min","back","controlPanel","patchData","reversedPatchData","forward","clear","nodesState","project","files","setProject","currentFileIndex","getProject","pullEditorChanges","getEditorState","updateFileContent","currentFile","syncEditorWithCurrentFile","setEditorState","console","log","setCurrentFileIndex","newFileIndex","index","f","i","updateFileName","fileName","name","addFile","deleteFile","fileIndex","_","setGraph","createNodes","createEdges","activeNodes","activeEdges","clearGraph","createNode","Promise","all","nodeData","nodesConfiguration","Error","defaultConfig","removeNode","removeNodes","currentNodes","onNodesDelete","removeEdges","removeNodesFromControlPanel","parentNodeIds","resultingNodes","parentNode","includes","nodeIds","currentEdges","onEdgesDelete","edgeIds","newEdges","plugins","setPlugins","nodesConf","reduce","acc","plugin","components","subAcc","Object","keys","audioNode","showMinimap","setConfig","viewport","r","setTimeout","isHelpShown","toggleHelp","showHelp","copyBuffer","copy","elements","copySelectedItems","selected","length","pasteBuffer","x","y","nodesToCopy","edgesToCopy","topLeftNode","position","xDelta","yDelta","newNodes","mapping","random","newNodeId","Date","floor","toString","edge","source","target","replace","getControlPanelNode","controlPanelNode","error","show","size","width","height","showControlPanel","hideControlPanel","addNodeToControlPanel","newNode","removeNodeFromControlPanel","setControlPanelNodes","setControlPanelSize","zoom","setViewport","api","timer","jsondiffpatchInstance","oldState","collectChanges","propertyFilter","context","parent","childName","state","prevState","clearTimeout","diff","subscribe","promises","currentState","storeChanges","newState","nodeChanges","edgeChanges","removedEdges","removedNodes","promise","registerAudioNodes","add","delete","values","e","registerAudioConnections","unregisterAudioConnections","unregisterAudioNodes","$731cc06061de042d$export$2e2bcd8739ae039","colors","elevation1","elevation2","elevation3","accent1","accent2","accent3","highlight1","highlight2","highlight3","vivid1","whitePrimary","zIndex","modal","resumeContextLayout","$04218161d9aa484d$export$2e2bcd8739ae039","customTheme","$f3e787b52be18373$export$ef9839ae55b8ba40","$f3e787b52be18373$export$98eff9c5659394e3","$e54d25e5d65b9790$export$d4cd258d01c03112","$e54d25e5d65b9790$export$2e2bcd8739ae039","theme","store","children","animation","onClick","event","props","$628ee4b8a62b71a2$var$ModalOuter","div","$628ee4b8a62b71a2$var$ModalInner","$628ee4b8a62b71a2$var$ModalCloser","$628ee4b8a62b71a2$export$2e2bcd8739ae039","onClose","escHandler","key","document","addEventListener","removeEventListener","stopPropagation","body","$d8badf9492e6c707$var$PluginsWrapper","$d8badf9492e6c707$var$PluginWrapper","$d8badf9492e6c707$var$NodesList","ul","$d8badf9492e6c707$var$NodeTitle","$d8badf9492e6c707$var$NodeDescription","$d8badf9492e6c707$export$48f6b48a42d49a36","$d8badf9492e6c707$export$7129a6e2db131a76","span","isActive","$d8badf9492e6c707$var$PluginHeader","$d8badf9492e6c707$var$PluginTitle","$d8badf9492e6c707$var$PluginDescription","$d8badf9492e6c707$export$2e2bcd8739ae039","onComponentClick","filters","search","tags","onTagClick","pluginsGroup","filteredPlugins","filteredByTags","component","every","tag","toLocaleLowerCase","description","sort","a","b","toLowerCase","idx","tagIdx","onClickCapture","$18ae22c0cb4ff02c$var$InputWrapper","$18ae22c0cb4ff02c$var$InputInner","$18ae22c0cb4ff02c$var$FiltersWrapper","$18ae22c0cb4ff02c$var$PluginName","label","$18ae22c0cb4ff02c$var$StyledPluginTag","$18ae22c0cb4ff02c$export$2e2bcd8739ae039","onChange","value","inputRef","current","focus","ref","placeholder","newTags","t","checked","$fc033f275cd8346c$var$AddNodeWrapper","$fc033f275cd8346c$var$PluginsPanel","$fc033f275cd8346c$export$2e2bcd8739ae039","isOpen","closeMenu","mousePosition","screenToFlowPosition","filtersState","setFiltersState","targetPosition","Left","sourcePosition","Right","$459a4e08a0372e29$export$25df2e315be8e003","resolve","reject","reader","FileReader","readAsDataURL","onload","result","onerror","$a5a5b1a37c474365$var$UploadAudioWrapper","$a5a5b1a37c474365$var$DropZoneInner","$a5a5b1a37c474365$var$FileUploadIcon","$a5a5b1a37c474365$var$FileUploadMessage","$a5a5b1a37c474365$export$2e2bcd8739ae039","fileInputRef","uploadFile","base64","className","style","display","accept","targetClassName","draggingOverTargetClassName","onTargetClick","click","onDrop","$fee9f929ba5c051a$export$d4cd258d01c03112","$fee9f929ba5c051a$export$2e2bcd8739ae039","editorContextMenu","setMousePosition","showAddNode","setShowAddNode","showUploadAudio","setShowUploadAudio","addNodeHandler","pasteBufferHandler","deleteAllHandler","historyBack","historyForward","historyPointer","historyBuffer","selectedNodes","currentCopyBuffer","unbind","triggerEvent","clientX","clientY","disabled","$617fd1d922572ac4$export$d4cd258d01c03112","$617fd1d922572ac4$export$2e2bcd8739ae039","controlPanelNodes","isOnControlPanel","hasControlPanelNode","nodeConfiguration","hidden","$027dbe8e99154283$export$2e2bcd8739ae039","audioNodes","$9630f1cf400b3c5a$export$2e2bcd8739ae039","updateNodeValues","updateNodeConfig","updateNodeLabel","$cad26a5b9571a093$export$5abe11f802ebd1f2","$cad26a5b9571a093$export$2e2bcd8739ae039","labelInputRef","labelEditMode","setLabelEditMode","editNodeLabel","select","exitEditMode","window","getSelection","collapseToEnd","saveNodeLabel","cancelNodeLabelEdit","readOnly","onDoubleClick","onBlur","onKeyDown","$78270d26f6f09c4c$var$NodeInfoWrapper","$78270d26f6f09c4c$export$2e2bcd8739ae039","nodeType","info","portsDescription","portsInfo","parts","inputPorts","inputs","portName","port","Array","isArray","join","range","undefined","defaultValue","outputPorts","outputs","dangerouslySetInnerHTML","__html","combinedInfo","$5a72e86517ffe32d$var$NodeWrapper","$5a72e86517ffe32d$var$NodeLoaderWrapper","$5a72e86517ffe32d$var$NodeErrorWrapper","$5a72e86517ffe32d$var$SettingsIconWrapper","$5a72e86517ffe32d$var$InfoIconWrapper","$5a72e86517ffe32d$var$Section","$5a72e86517ffe32d$export$1bdb8f2d1fe25c22","$5a72e86517ffe32d$export$bfd3bd1fa283e3c6","$5a72e86517ffe32d$export$f1afba0ff9ea1277","$5a72e86517ffe32d$export$af4f9b41fc32ed9e","$5a72e86517ffe32d$export$a2d375858cc72119","$5a72e86517ffe32d$var$portColors","Audio","Gate","Number","Any","$5a72e86517ffe32d$var$StyledHandle","shouldForwardProp","prop","portType","$5a72e86517ffe32d$var$StyledInputHandle","$5a72e86517ffe32d$export$9ea0feffc20ee81","$5a72e86517ffe32d$export$222539e2a2fac4e0","$5a72e86517ffe32d$export$496e5e1ee1696f64","$5a72e86517ffe32d$export$7e0b3af1e60a3273","$5a72e86517ffe32d$var$useNodeManifest","$5a72e86517ffe32d$export$361064385d50ec44","rest","isInfoModalShown","setIsInfoModalShown","isResizeable","resizable","ConfigNode","$5a72e86517ffe32d$var$useConfigNode","configNode","configMode","setShowConfigMode","loading","isShown","minWidth","minHeight","enable","bottom","bottomRight","onResizeStop","direction","d","newSize","getBoundingClientRect","$99522cb4c544c0e3$export$86de09faaa70680d","$99522cb4c544c0e3$export$548ca3bae446ddc2","$99522cb4c544c0e3$export$9fb15e3cc717240","$99522cb4c544c0e3$export$be58b4326e23250f","$a9eb7fd7f79ff3fb$var$ControlPanelNodeWrapper","$a9eb7fd7f79ff3fb$var$PanelNode","ControlPanelNode","$a9eb7fd7f79ff3fb$export$2e2bcd8739ae039","showControls","onDelete","$8f357eb500334b2f$var$ControlPanelIconWrapper","$8f357eb500334b2f$var$ControlPanelIconsBar","$8f357eb500334b2f$var$CloseIconWrapper","$8f357eb500334b2f$var$ControlPanelHeader","$8f357eb500334b2f$var$ControlPanelTitle","$8f357eb500334b2f$var$ControlPanelWrapper","$8f357eb500334b2f$var$ControlPanelBody","$8f357eb500334b2f$var$ControlPanelSettings","$8f357eb500334b2f$var$LockGridWrapper","$8f357eb500334b2f$var$GridResizeHandle","$8f357eb500334b2f$var$ControlPanelItemWrapper","$8f357eb500334b2f$export$2e2bcd8739ae039","nodeRef","filteredNodes","isGridLocked","setGridLocked","layout","fallbackY","Y","w","h","open","enableOverlay","background","top","topRight","bottomLeft","topLeft","handleComponent","cols","rowHeight","margin","isResizable","draggableHandle","onLayoutChange","requestAnimationFrame","$f82470e1f8a957ac$exports","$72ce7400f28463b9$var$MdPreview","$72ce7400f28463b9$var$ModalContent","$72ce7400f28463b9$export$2e2bcd8739ae039","__esModule","default","onWheelCapture","$5acaa12be69dfa8a$export$78bddedbcf2939ac","$4379ac7ed25061a0$var$Layout","$4379ac7ed25061a0$var$Row","$4379ac7ed25061a0$var$Message","$4379ac7ed25061a0$var$Icon","$4379ac7ed25061a0$export$2e2bcd8739ae039","audioContext","isContextResumed","setIsContextResumed","resume","$5536f4f171f9bf88$export$2e2bcd8739ae039","$8b2e0523152bfd06$export$2e2bcd8739ae039","sourceX","sourceY","targetX","targetY","markerStart","markerEnd","sourceHandleId","targetHandleId","sourceNode","targetNode","isConnectedToSelected","edgePath","stroke","strokeWidth","color","opacity","cursor","$6bb27c07aa83529c$var$StyledControls","$6bb27c07aa83529c$var$onNodeDragStop","_event","$6bb27c07aa83529c$var$onNodeClick","element","$6bb27c07aa83529c$var$snapGrid","$6bb27c07aa83529c$export$72cb76f559fbafcf","editorState","edgeTypes","wire","editorConfig","reactflowInstance","setReactflowInstance","onInit","rfi","onContextMenu","onEditorContextMenu","onNodeContextMenu","onEdgeContextMenu","onEnd","onNodeDragStop","onNodeClick","snapGrid","defaultViewport","defaultEdgeOptions","snapToGrid","fitView","disableKeyboardA11y","variant","Dots","gap","showInteractive","$6bb27c07aa83529c$export$7cda8d932e2f33c0","$1729b5eaa1e6c3bc$export$d31000d36961d6c2","$1729b5eaa1e6c3bc$export$6cd5d5c1dae69a36","$1729b5eaa1e6c3bc$export$6bc5189622b1f4ec","$1729b5eaa1e6c3bc$export$8d546ef2006cd0a2","$1729b5eaa1e6c3bc$export$10efbd348f877f87","$1729b5eaa1e6c3bc$export$8c347812506d5ac9","$1729b5eaa1e6c3bc$export$b38a2fd24b22fb35","showLoader","setShowLoader","src","controls","$1729b5eaa1e6c3bc$export$2206531ad8592d57","$1729b5eaa1e6c3bc$export$3e41faf802a29e71","active","$1729b5eaa1e6c3bc$export$61e5b3c7bace77b8","$1729b5eaa1e6c3bc$export$3aef34186a092045","$1729b5eaa1e6c3bc$export$cae179f078f4b4a4","$1729b5eaa1e6c3bc$var$generateEmptyFile","$1729b5eaa1e6c3bc$export$2e2bcd8739ae039","projectState","isDragging","setIsDragging","request","Request","url","Response","fetch","status","styles","onDragOver","preventDefault","onDragLeave","from","dataTransfer","forEach","fileData","text","confirm","match","val","Editor","EDITOR_DEFAULTS","Wire","WNNode","TitleBar","PortsPanel","OutputPorts","OutputHandle","InputPorts","InputHandle","Port","Modal","EditableLabel","useAudioNode","useNode","useStore","isAudio","isPatch"],"version":3,"file":"module.js.map"}
1
+ {"mappings":"IO+LG,EC3KA,C,Q,O,C,C,Q,C,C,Y,C,K,mB,A,Q,a,C,C,iB,C,C,U,C,C,O,C,C,Y,C,K,gB,A,Q,M,iB,A,Q,U,C,K,Q,A,Q,Y,C,C,a,C,C,W,C,C,e,C,C,U,C,K,O,A,Q,U,C,K,iB,A,Q,W,C,C,gB,C,C,c,C,C,iB,C,K,gB,A,Q,mB,C,K,kB,A,Q,G,qB,C,C,W,C,C,oB,C,C,oB,C,C,Y,C,C,uB,C,C,c,C,C,qB,C,C,W,C,C,qB,C,C,gB,C,C,Y,C,C,U,C,C,iB,C,C,iB,C,K,W,A,Q,U,C,K,S,A,Q,qB,C,C,e,C,K,kB,A,Q,W,C,C,S,C,C,U,C,K,e,A,Q,gB,C,K,c,A,O,0B,A,Q,kB,C,C,Q,C,C,Q,C,C,a,C,K,iB,A,O,yC,A,Q,M,Y,A,Q,gB,C,K,W,A,Q,Y,C,K,iB,A,Q,gB,C,C,c,E,C,e,E,C,S,E,C,Y,E,K,gB,A,Q,a,E,K,c,A,Q,O,mB,A,O,kC,A,Q,c,E,C,gB,E,K,gB,A,Q,e,E,K,gB,A,Q,O,qB,A,O,oC,A,Q,U,E,K,Q,CJpBI,IAAM,GAAoB,wBACpB,GAAuB,CAAA,CAAA,EAAI,GAAA,CAAmB,IAG9C,EAKX,EADU,GAAA,IAAA,CAAA,GAAQ,CAAA,CAAA,GAClB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AgB,CAAA,SAAA,uCAAA,GAGlB,AAAA,GACU,AAAA,EAGnB,S,M,M,C,M,e,C,M,I,C,M,M,C,M,Q,C,M,U,C,M,W,C,M,Y,C,M,U,C,M,W,C,M,I,C,M,K,C,M,a,C,M,Y,C,M,O,C,M,Q,C,M,Q,C,M,K,C,M,O,C,M,O,C,M,Q","sources":["<anon>","packages/core/index.ts","packages/core/src/components/App.tsx","packages/core/src/store/index.ts","packages/core/src/constants.ts","packages/core/src/helpers/generateNodeId.ts","packages/core/src/store/nodesStore.ts","packages/core/src/store/history/index.ts","packages/core/src/store/audioPatch/index.ts","packages/core/src/store/audioPatch/compareGraphs.ts","packages/core/src/store/projectStore.ts","packages/core/src/helpers/projectFile.ts","packages/core/src/styles.ts","packages/core/src/theme.ts","packages/core/src/components/Editor/index.tsx","packages/core/src/components/contextMenu/EdgeContextMenu.tsx","packages/core/src/hooks/useTheme.ts","packages/core/src/components/contextMenu/styles.tsx","packages/core/src/components/contextMenu/EditorContextMenu.tsx","packages/core/src/components/AddNode/index.tsx","packages/core/src/components/Modal.tsx","packages/core/src/components/AddNode/Filters.tsx","packages/core/src/components/AddNode/Plugins.tsx","packages/core/src/components/UploadAudio.tsx","packages/core/src/lib/index.ts","packages/core/src/lib/hooks/useWorker.ts","packages/core/src/lib/hooks/useMessageChannel.ts","packages/core/src/lib/helpers.ts","packages/core/src/components/contextMenu/NodeContextMenu.tsx","packages/core/src/components/ControlPanel/index.tsx","packages/core/src/components/ControlPanel/ControlPanelItem.tsx","packages/core/src/hooks/useAudioNode.ts","packages/core/src/hooks/useNode.ts","packages/core/src/components/ControlPanel/styles.tsx","packages/core/src/components/Node/index.tsx","packages/core/src/components/EditableLabel.tsx","packages/core/src/components/NodeInfoModal.tsx","packages/core/src/components/Help/index.tsx","packages/core/src/components/Help/HelpModal.tsx","node_modules/@parcel/runtime-js/lib/bundles/runtime-978e9eb42c1113ef.js","packages/core/src/components/ResumeContext.tsx","packages/core/src/components/ToggleMinimap.tsx","packages/core/src/components/Wire.tsx"],"sourcesContent":["import {jsx as $but2J$jsx, jsxs as $but2J$jsxs, Fragment as $but2J$Fragment} from \"react/jsx-runtime\";\nimport {withTheme as $but2J$withTheme, ThemeProvider as $but2J$ThemeProvider, Global as $but2J$Global, css as $but2J$css, useTheme as $but2J$useTheme} from \"@emotion/react\";\nimport $but2J$emotionstyled from \"@emotion/styled\";\nimport {nanoid as $but2J$nanoid} from \"nanoid\";\nimport {useState as $but2J$useState, useEffect as $but2J$useEffect, useMemo as $but2J$useMemo, useCallback as $but2J$useCallback, useRef as $but2J$useRef} from \"react\";\nimport {FaPlus as $but2J$FaPlus} from \"react-icons/fa6\";\nimport {MdClose as $but2J$MdClose, MdDragHandle as $but2J$MdDragHandle, MdSettings as $but2J$MdSettings, MdInfoOutline as $but2J$MdInfoOutline} from \"react-icons/md\";\nimport {registerFetcher as $but2J$registerFetcher} from \"@web-noise/fetch\";\nimport $but2J$reactflow, {getConnectedEdges as $but2J$getConnectedEdges, addEdge as $but2J$addEdge, applyNodeChanges as $but2J$applyNodeChanges, applyEdgeChanges as $but2J$applyEdgeChanges, Controls as $but2J$Controls, useOnViewportChange as $but2J$useOnViewportChange, Background as $but2J$Background, BackgroundVariant as $but2J$BackgroundVariant, MiniMap as $but2J$MiniMap, ReactFlowProvider as $but2J$ReactFlowProvider, useReactFlow as $but2J$useReactFlow, Position as $but2J$Position, Handle as $but2J$Handle, ControlButton as $but2J$ControlButton, getBezierPath as $but2J$getBezierPath} from \"reactflow\";\nimport {create as $but2J$create} from \"zustand\";\nimport {setAudioNodeTypes as $but2J$setAudioNodeTypes, createPatch as $but2J$createPatch} from \"@web-noise/patch\";\nimport {reverse as $but2J$reverse, patch as $but2J$patch, create as $but2J$create1} from \"jsondiffpatch\";\nimport {injectGlobal as $but2J$injectGlobal} from \"@emotion/css\";\nimport \"reactflow/dist/style.css\";\nimport {useContextMenu as $but2J$useContextMenu, Item as $but2J$Item, Menu as $but2J$Menu, Separator as $but2J$Separator} from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport $but2J$hotkeysjs from \"hotkeys-js\";\nimport {createPortal as $but2J$createPortal} from \"react-dom\";\nimport {FileDrop as $but2J$FileDrop} from \"react-file-drop\";\nimport {FaFileUpload as $but2J$FaFileUpload, FaQuestion as $but2J$FaQuestion, FaVolumeOff as $but2J$FaVolumeOff, FaMap as $but2J$FaMap, FaRegMap as $but2J$FaRegMap} from \"react-icons/fa\";\nimport {Resizable as $but2J$Resizable} from \"re-resizable\";\nimport $but2J$reactgridlayout from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport {AiFillLock as $but2J$AiFillLock, AiFillUnlock as $but2J$AiFillUnlock} from \"react-icons/ai\";\nimport {RxDashboard as $but2J$RxDashboard} from \"react-icons/rx\";\nimport $but2J$reactmoderndrawer from \"react-modern-drawer\";\nimport \"react-modern-drawer/dist/index.css\";\nimport {marked as $but2J$marked} from \"marked\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\n\n\n\n\n\n\n\n\n\n\nconst $73e253e9a60dc018$export$956b3cf15d7c363 = \"web-noise-drag-handle\";\nconst $73e253e9a60dc018$export$21d634b1d5d9bee3 = `.${$73e253e9a60dc018$export$956b3cf15d7c363}`;\nconst $73e253e9a60dc018$export$9f05d3e6ade4c09e = {\n rowHeight: 10,\n cols: 4\n};\nvar $73e253e9a60dc018$export$b0b7b95ee465c83c;\n(function(PortType) {\n PortType[\"Gate\"] = \"gate\";\n PortType[\"Number\"] = \"number\";\n PortType[\"Audio\"] = \"audio\";\n PortType[\"Any\"] = \"any\";\n})($73e253e9a60dc018$export$b0b7b95ee465c83c || ($73e253e9a60dc018$export$b0b7b95ee465c83c = {}));\n\n\nconst $d4298e88fc7d0886$var$generateNodeId = (node)=>{\n const random = +new Date() + Math.floor(Math.random() * 1000);\n if (!node?.type) return random.toString();\n return `${node.type}-${random}`;\n};\nvar $d4298e88fc7d0886$export$2e2bcd8739ae039 = $d4298e88fc7d0886$var$generateNodeId;\n\n\n\n\nconst $44ab4fe1439b009e$var$nodesStateCreator = (set, get)=>({\n nodes: [],\n edges: [],\n onNodesChange: (changes)=>{\n set(({ nodes: nodes })=>({\n nodes: (0, $but2J$applyNodeChanges)(changes, nodes).map((node)=>({\n dragHandle: (0, $73e253e9a60dc018$export$21d634b1d5d9bee3),\n ...node\n }))\n }));\n },\n onEdgesChange: (changes)=>{\n set(({ edges: edges })=>({\n edges: (0, $but2J$applyEdgeChanges)(changes, edges)\n }));\n },\n onConnect: (connection)=>{\n set(({ edges: edges })=>({\n edges: (0, $but2J$addEdge)(connection, edges)\n }));\n },\n addNode: (node)=>{\n set(({ nodes: nodes })=>({\n nodes: nodes.concat(node)\n }));\n },\n setNodes: (nodes)=>{\n set({\n nodes: nodes\n });\n },\n setEdges: (edges)=>{\n set({\n edges: edges\n });\n },\n setNodesAndEdges: ({ nodes: nodes, edges: edges })=>{\n set({\n nodes: nodes,\n edges: edges\n });\n },\n getNodesAndEdges: ()=>{\n const { nodes: nodes, edges: edges } = get();\n return {\n nodes: nodes,\n edges: edges\n };\n },\n clearElements: ()=>{\n set({\n nodes: [],\n edges: []\n });\n },\n getNode: (id)=>{\n const { nodes: nodes } = get();\n const node = nodes.find((node)=>node.id === id);\n return node || null;\n },\n updateNodeData: (id, data)=>{\n set(({ nodes: nodes })=>{\n return {\n nodes: nodes.map((node)=>{\n if (node.id === id) return {\n ...node,\n data: {\n ...node.data,\n ...data\n }\n };\n return node;\n })\n };\n });\n },\n nodeTypes: {},\n setNodeTypes: (nodeTypes)=>set({\n nodeTypes: nodeTypes\n })\n });\nvar $44ab4fe1439b009e$export$2e2bcd8739ae039 = $44ab4fe1439b009e$var$nodesStateCreator;\n\n\n\nconst $db60a1ce8fd45a15$var$cloneObject = (input)=>{\n return JSON.parse(JSON.stringify(input));\n};\nconst $db60a1ce8fd45a15$export$b1b92d12d1c2ae0e = (set, get)=>({\n history: {\n maxHistoryLength: 5,\n buffer: [],\n pointer: 0,\n skipCollect: false,\n push: (changes)=>{\n const { history: history } = get();\n const { maxHistoryLength: maxHistoryLength, skipCollect: skipCollect } = history;\n if (skipCollect) {\n set({\n history: {\n ...history,\n skipCollect: false\n }\n });\n return;\n }\n set(({ history: history })=>{\n if (!history) return {};\n const { buffer: buffer, pointer: pointer } = history;\n const newBuffer = buffer.slice(Math.max(pointer - maxHistoryLength + 1, 0), pointer);\n return {\n history: {\n ...history,\n buffer: [\n ...newBuffer,\n changes\n ],\n pointer: Math.min(pointer + 1, maxHistoryLength)\n }\n };\n });\n },\n back: ()=>{\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, history: history } = get();\n const { buffer: buffer, pointer: pointer } = history;\n const patchData = buffer[pointer - 1];\n if (!patchData) return;\n const reversedPatchData = $but2J$reverse(patchData);\n if (!reversedPatchData) return;\n const updates = $db60a1ce8fd45a15$var$cloneObject({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel\n });\n const patch = $but2J$patch(updates, reversedPatchData);\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer - 1,\n skipCollect: true\n }\n });\n },\n forward: ()=>{\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, history: history } = get();\n const { buffer: buffer, pointer: pointer } = history;\n const patchData = buffer[pointer];\n if (!patchData) return;\n const updates = $db60a1ce8fd45a15$var$cloneObject({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel\n });\n const patch = $but2J$patch(updates, patchData);\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer + 1,\n skipCollect: true\n }\n });\n },\n // @TODO: remove this method and store history per file\n clear: ()=>{\n const { history: history } = get();\n set({\n history: {\n ...history,\n buffer: [],\n pointer: 0,\n skipCollect: true\n }\n });\n }\n }\n });\nconst $db60a1ce8fd45a15$var$COLLECT_CHANGES_DEBOUNCE_TIME = 500;\nconst $db60a1ce8fd45a15$export$4e64751394766316 = (set, get)=>{\n const jsondiffpatchInstance = $but2J$create1({\n propertyFilter: (name, context)=>{\n //@TODO: rework this function, find better solution\n if (context.parent?.parent?.childName === \"controlPanel\") return true;\n if (// @ts-ignore\n [\n \"data\",\n \"position\",\n \"controlPanel\"\n ].includes(context.parent?.childName)) return true;\n return [\n \"controlPanel\",\n \"size\",\n \"edges\",\n \"nodes\",\n \"data\",\n \"label\",\n \"config\",\n \"values\",\n \"position\",\n \"x\",\n \"y\"\n ].includes(name);\n }\n });\n let oldState = get();\n let timer;\n return (state, prevState)=>{\n if (state.currentFileIndex !== prevState.currentFileIndex) get().history.clear();\n clearTimeout(timer);\n if (!oldState) oldState = prevState;\n timer = setTimeout(()=>{\n const changes = jsondiffpatchInstance.diff(oldState, state);\n oldState = null;\n if (changes) get().history.push(changes);\n }, $db60a1ce8fd45a15$var$COLLECT_CHANGES_DEBOUNCE_TIME);\n };\n};\nconst $db60a1ce8fd45a15$var$history = (config)=>(set, get, api)=>{\n const collectChanges = $db60a1ce8fd45a15$export$4e64751394766316(set, get);\n api.subscribe(collectChanges);\n return config((...args)=>set(...args), get, api);\n };\nvar $db60a1ce8fd45a15$export$2e2bcd8739ae039 = $db60a1ce8fd45a15$var$history;\n\n\n\nconst $b69bc78343b7b1b2$export$e364ea0c1dfb25e5 = (left, right)=>{\n const setLeft = new Set(left.map((item)=>item.id));\n const setRight = new Set(right.map((item)=>item.id));\n const added = right.filter((item)=>!setLeft.has(item.id));\n const removed = left.filter((item)=>!setRight.has(item.id));\n return {\n added: added,\n removed: removed\n };\n};\n\n\nconst $91a653e423ed8b08$export$62647b40ff8aed70 = (set, get)=>({\n patch: (0, $but2J$createPatch)(),\n nodesState: {}\n });\nconst $91a653e423ed8b08$var$audioPatch = (config)=>(set, get, api)=>{\n api.subscribe(async (state, prevState)=>{});\n const promises = new Set();\n let currentState = {\n ...get(),\n nodes: [],\n edges: []\n };\n return config(async (...args)=>{\n const oldState = get();\n const [storeChanges] = args;\n //@ts-ignore\n const newState = {\n ...currentState,\n ...typeof storeChanges === \"function\" ? storeChanges({\n ...currentState\n }) : storeChanges\n };\n const nodeChanges = (0, $b69bc78343b7b1b2$export$e364ea0c1dfb25e5)(currentState.nodes, newState.nodes);\n const edgeChanges = (0, $b69bc78343b7b1b2$export$e364ea0c1dfb25e5)(currentState.edges, newState.edges);\n //@ts-ignore\n currentState = newState;\n const newNodes = nodeChanges.added;\n const newEdges = edgeChanges.added;\n const removedEdges = edgeChanges.removed;\n const removedNodes = nodeChanges.removed;\n const { patch: patch } = oldState;\n if (newNodes.length) {\n const promise = patch.registerAudioNodes(//@ts-ignore\n newNodes);\n promises.add(promise);\n await promise;\n promises.delete(promise);\n }\n if (!(newEdges.length || removedEdges.length || removedNodes.length)) {\n set(...args);\n return;\n }\n if (promises.size) try {\n await Promise.all([\n ...promises.values()\n ]);\n } catch (e) {\n console.log(\"some error\", e);\n }\n if (newEdges.length) patch.registerAudioConnections(//@ts-ignore\n newEdges);\n if (removedEdges.length) //@ts-ignore\n patch.unregisterAudioConnections(removedEdges);\n if (removedNodes.length) //@ts-ignore\n patch.unregisterAudioNodes(removedNodes);\n set(...args);\n }, get, api);\n };\nvar $91a653e423ed8b08$export$2e2bcd8739ae039 = $91a653e423ed8b08$var$audioPatch;\n\n\nconst $d6879eb00f829ebf$export$e698b79c63b74136 = (file)=>!(\"type\" in file) || file.type === \"patch\";\nconst $d6879eb00f829ebf$export$31c2336f657dc59f = (file)=>file.type === \"audio\";\n\n\nconst $fa1b05fefde68ed4$var$projectStateCreator = (set, get)=>({\n project: {\n files: []\n },\n setProject (project) {\n set({\n project: project,\n currentFileIndex: 0\n });\n },\n getProject () {\n return get().project;\n },\n pullEditorChanges () {\n const { getEditorState: getEditorState, currentFileIndex: currentFileIndex, updateFileContent: updateFileContent, project: project } = get();\n const currentFile = project.files[currentFileIndex];\n if ((0, $d6879eb00f829ebf$export$31c2336f657dc59f)(currentFile)) return;\n updateFileContent(currentFileIndex, {\n ...currentFile,\n file: getEditorState()\n });\n },\n syncEditorWithCurrentFile: ()=>{\n const { currentFileIndex: currentFileIndex, setEditorState: setEditorState, project: project } = get();\n const currentFile = project.files[currentFileIndex];\n if (currentFile.type === \"audio\") {\n console.log(\"audio file. skipping\");\n return;\n }\n setEditorState(currentFile.file);\n },\n currentFileIndex: 0,\n setCurrentFileIndex (newFileIndex) {\n const { currentFileIndex: currentFileIndex } = get();\n if (newFileIndex === currentFileIndex) return;\n set({\n currentFileIndex: newFileIndex\n });\n },\n updateFileContent (index, file) {\n const { project: project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i)=>{\n if (i === index) return {\n // @TODO check again if merging is really needed here\n ...f,\n ...file\n };\n return f;\n })\n }\n });\n },\n updateFileName (index, fileName) {\n const { project: project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i)=>{\n if (i === index) return {\n ...f,\n name: fileName\n };\n return f;\n })\n }\n });\n },\n addFile (file) {\n const { project: project } = get();\n const files = [\n ...project.files,\n file\n ];\n set({\n project: {\n ...project,\n files: files\n }\n });\n },\n deleteFile: (fileIndex)=>{\n const { project: project, currentFileIndex: currentFileIndex } = get();\n set({\n project: {\n ...project,\n files: project.files.filter((_, index)=>fileIndex !== index)\n }\n });\n if (fileIndex <= currentFileIndex) {\n const newIndex = Math.max(0, currentFileIndex - 1);\n set({\n currentFileIndex: newIndex\n });\n }\n }\n });\nvar $fa1b05fefde68ed4$export$2e2bcd8739ae039 = $fa1b05fefde68ed4$var$projectStateCreator;\n\n\nconst $40b3df4f7825b834$export$34c5bc865219488e = (...args)=>{\n const [set, get] = args;\n return {\n ...(0, $44ab4fe1439b009e$export$2e2bcd8739ae039)(...args),\n ...(0, $db60a1ce8fd45a15$export$b1b92d12d1c2ae0e)(...args),\n ...(0, $91a653e423ed8b08$export$62647b40ff8aed70)(...args),\n ...(0, $fa1b05fefde68ed4$export$2e2bcd8739ae039)(...args),\n setGraph: async ({ nodes: nodes, edges: edges })=>{\n const { patch: patch, createNodes: createNodes, createEdges: createEdges, setNodesAndEdges: setNodesAndEdges, nodes: activeNodes, edges: activeEdges } = get();\n setNodesAndEdges({\n nodes: [],\n edges: []\n });\n await createNodes(nodes);\n createEdges(edges);\n },\n clearGraph: ()=>{\n const { setGraph: setGraph } = get();\n setGraph({\n nodes: [],\n edges: []\n });\n },\n createNodes: async (nodes)=>{\n const { createNode: createNode } = get();\n await Promise.all(nodes.map((node)=>createNode(node)));\n },\n createNode: (nodeData)=>{\n const { addNode: addNode, nodesConfiguration: nodesConfiguration } = get();\n const { type: type, id: id, data: data } = nodeData;\n if (typeof type === \"undefined\") throw new Error(`node type is not defined for node: ${id}`);\n const node = {\n ...nodeData,\n data: {\n ...data,\n config: {\n ...nodesConfiguration[type]?.defaultConfig,\n ...data?.config\n }\n }\n };\n addNode(node);\n },\n removeNode: (node)=>get().removeNodes([\n node\n ]),\n removeNodes: (nodes)=>{\n const { edges: edges, nodes: currentNodes, onNodesDelete: onNodesDelete, removeEdges: removeEdges, removeNodesFromControlPanel: removeNodesFromControlPanel } = get();\n const parentNodeIds = nodes.map(({ id: id })=>id);\n const children = currentNodes.filter(({ parentNode: parentNode })=>parentNode && parentNodeIds.includes(parentNode));\n const resultingNodes = [\n ...nodes,\n ...children\n ];\n removeNodesFromControlPanel(resultingNodes);\n const connectedEdges = (0, $but2J$getConnectedEdges)(resultingNodes, edges);\n removeEdges(connectedEdges);\n onNodesDelete(resultingNodes);\n const nodeIds = resultingNodes.map(({ id: id })=>id);\n set({\n nodes: currentNodes.filter(({ id: id })=>!nodeIds.includes(id))\n });\n },\n removeEdges: (edges)=>{\n const { edges: currentEdges, onEdgesDelete: onEdgesDelete } = get();\n const edgeIds = edges.map(({ id: id })=>id);\n onEdgesDelete(edges);\n set({\n edges: currentEdges.filter(({ id: id })=>!edgeIds.includes(id))\n });\n },\n createEdges: (newEdges)=>{\n const { patch: patch, edges: edges, setEdges: setEdges } = get();\n setEdges(newEdges);\n },\n onConnect: async (connection)=>{\n const { edges: edges, createEdges: createEdges } = get();\n const newEdges = (0, $but2J$addEdge)(connection, edges);\n createEdges(newEdges);\n },\n onEdgesDelete: (edges)=>{\n const { patch: patch } = get();\n },\n onNodesDelete: async (nodes)=>{\n const { removeNodesFromControlPanel: removeNodesFromControlPanel, patch: patch } = get();\n removeNodesFromControlPanel(nodes);\n },\n plugins: [],\n setPlugins: async (plugins)=>{\n const { setNodeTypes: setNodeTypes } = get();\n set({\n plugins: plugins\n });\n const nodesConf = plugins.reduce((acc, plugin)=>{\n return {\n ...acc,\n ...plugin.components.reduce((subAcc, item)=>({\n ...subAcc,\n [item.type]: item\n }), {})\n };\n }, {});\n const nodeTypes = Object.keys(nodesConf).reduce((acc, type)=>{\n return {\n ...acc,\n [type]: nodesConf[type].node\n };\n }, {});\n const audioNodeTypes = Object.keys(nodesConf).reduce((acc, type)=>{\n return {\n ...acc,\n [type]: nodesConf[type].audioNode\n };\n }, {});\n (0, $but2J$setAudioNodeTypes)(audioNodeTypes);\n setNodeTypes(nodeTypes);\n set(({ nodesConfiguration: nodesConfiguration })=>({\n nodesConfiguration: {\n ...nodesConfiguration,\n ...nodesConf\n }\n }));\n },\n nodesConfiguration: {},\n config: {\n showMinimap: false\n },\n setConfig: (changes)=>{\n set(({ config: config })=>({\n config: {\n ...config,\n ...changes\n }\n }));\n },\n getEditorState: ()=>{\n const { getNodesAndEdges: getNodesAndEdges, controlPanel: controlPanel, viewport: viewport } = get();\n return {\n ...getNodesAndEdges(),\n controlPanel: controlPanel,\n viewport: viewport\n };\n },\n setEditorState: async ({ nodes: nodes, edges: edges, controlPanel: controlPanel, viewport: viewport })=>{\n const { setGraph: setGraph } = get();\n await setGraph({\n nodes: nodes,\n edges: edges\n });\n // @TODO: remove this line once audio patch initialisation is reworked\n await new Promise((r)=>setTimeout(r, 1000));\n set({\n controlPanel: controlPanel,\n viewport: viewport\n });\n },\n isHelpShown: false,\n toggleHelp: ()=>{\n const { isHelpShown: showHelp } = get();\n set({\n isHelpShown: !showHelp\n });\n },\n copyBuffer: {\n nodes: [],\n edges: []\n },\n copy: (elements)=>{\n set({\n copyBuffer: elements\n });\n },\n copySelectedItems: ()=>{\n const { nodes: currentNodes, edges: currentEdges, copy: copy } = get();\n const nodes = currentNodes.filter(({ selected: selected })=>selected);\n const edges = currentEdges.filter(({ selected: selected })=>selected);\n if (!nodes.length) return;\n copy({\n nodes: nodes,\n edges: edges\n });\n },\n pasteBuffer: (x = 0, y = 0)=>{\n const { copyBuffer: copyBuffer, createNodes: createNodes, setEdges: setEdges, nodes: nodes, edges: edges } = get();\n const { nodes: nodesToCopy, edges: edgesToCopy } = copyBuffer;\n if (!nodesToCopy.length) return;\n set({\n nodes: nodes.map((node)=>({\n ...node,\n selected: false\n }))\n });\n const topLeftNode = nodesToCopy.reduce((acc, node)=>{\n if (!acc) return node;\n if (node.position.x < acc.position.x && node.position.y < acc.position.y) return node;\n return acc;\n });\n const xDelta = topLeftNode.position.x - x;\n const yDelta = topLeftNode.position.y - y;\n const { nodes: newNodes, mapping: mapping } = nodesToCopy.reduce((acc, node)=>{\n const newNodeId = (0, $d4298e88fc7d0886$export$2e2bcd8739ae039)(node);\n return {\n nodes: [\n ...acc.nodes,\n {\n ...node,\n id: newNodeId,\n position: {\n x: node.position.x - xDelta,\n y: node.position.y - yDelta\n },\n selected: true\n }\n ],\n mapping: {\n ...acc.mapping,\n [node.id]: newNodeId\n }\n };\n }, {\n nodes: [],\n mapping: {}\n });\n createNodes(newNodes);\n const newEdges = edgesToCopy.map((edge)=>{\n const source = mapping[edge.source] || edge.source;\n const target = mapping[edge.target] || edge.target;\n return {\n ...edge,\n id: edge.id.replace(edge.source, source).replace(edge.target, target),\n source: source,\n target: target,\n selected: true\n };\n });\n setEdges([\n ...edges.map((edge)=>({\n ...edge,\n selected: false\n })),\n ...newEdges\n ]);\n },\n getControlPanelNode: (node)=>{\n const { nodesConfiguration: nodesConfiguration } = get();\n const { type: type } = node;\n if (!type) return null;\n const controlPanelNode = nodesConfiguration[type]?.controlPanelNode;\n if (!controlPanelNode) {\n console.error(`could not find node for type ${type}`);\n return null;\n }\n return controlPanelNode;\n },\n controlPanel: {\n show: true,\n nodes: [],\n size: {\n width: 200,\n height: 100\n }\n },\n showControlPanel: ()=>set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n show: true\n }\n })),\n hideControlPanel: ()=>set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n show: false\n }\n })),\n addNodeToControlPanel: (node)=>{\n const { nodesConfiguration: nodesConfiguration } = get();\n const defaultConfig = node.type ? nodesConfiguration[node.type]?.defaultConfig : {};\n const { height: height } = defaultConfig?.size || {};\n const newNode = {\n id: node.id,\n ...height ? {\n height: height / (0, $73e253e9a60dc018$export$9f05d3e6ade4c09e).rowHeight\n } : {}\n };\n set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n nodes: [\n ...controlPanel.nodes,\n newNode\n ]\n }\n }));\n },\n removeNodeFromControlPanel: (node)=>get().removeNodesFromControlPanel([\n node\n ]),\n removeNodesFromControlPanel: (nodes)=>{\n const nodeIds = nodes.map(({ id: id })=>id);\n set(({ controlPanel: controlPanel })=>{\n const nodes = controlPanel.nodes.filter(({ id: id })=>!nodeIds.includes(id));\n return {\n controlPanel: {\n ...controlPanel,\n nodes: nodes\n }\n };\n });\n },\n setControlPanelNodes: (nodes)=>{\n set(({ controlPanel: controlPanel })=>{\n return {\n controlPanel: {\n ...controlPanel,\n nodes: nodes\n }\n };\n });\n },\n setControlPanelSize: (size)=>{\n set(({ controlPanel: controlPanel })=>{\n return {\n controlPanel: {\n ...controlPanel,\n size: size\n }\n };\n });\n },\n viewport: {\n x: 0,\n y: 0,\n zoom: 1\n },\n setViewport: (viewport)=>set({\n viewport: viewport\n })\n };\n};\nconst $40b3df4f7825b834$var$useStore = (0, $but2J$create)((0, $91a653e423ed8b08$export$2e2bcd8739ae039)((0, $db60a1ce8fd45a15$export$2e2bcd8739ae039)($40b3df4f7825b834$export$34c5bc865219488e)));\nvar $40b3df4f7825b834$export$2e2bcd8739ae039 = $40b3df4f7825b834$var$useStore;\n\n\n\nconst $731cc06061de042d$var$LEVA_COLOR_ACCENT2_BLUE = \"#007bff\";\nconst $731cc06061de042d$var$COLOR_GREEN_PRIMARY = \"#14df42\";\nconst $731cc06061de042d$var$COLOR_WHITE_PRIMARY = \"#ffffff\";\nconst $731cc06061de042d$var$colors = {\n elevation1: \"#292d39\",\n elevation2: \"#181c20\",\n elevation3: \"#373c4b\",\n accent1: \"#0066dc\",\n accent2: $731cc06061de042d$var$LEVA_COLOR_ACCENT2_BLUE,\n accent3: \"#3c93ff\",\n highlight1: \"#535760\",\n highlight2: \"#8c92a4\",\n highlight3: \"#fefefe\",\n vivid1: $731cc06061de042d$var$COLOR_GREEN_PRIMARY,\n whitePrimary: $731cc06061de042d$var$COLOR_WHITE_PRIMARY,\n error: \"#db5353\"\n};\nconst $731cc06061de042d$var$zIndex = {\n modal: 9998,\n controlPanel: 9999,\n resumeContextLayout: 10003\n};\nconst $731cc06061de042d$var$theme = {\n colors: $731cc06061de042d$var$colors,\n zIndex: $731cc06061de042d$var$zIndex\n};\nvar $731cc06061de042d$export$2e2bcd8739ae039 = $731cc06061de042d$var$theme;\n\n\n(0, $but2J$injectGlobal)`\n .react-flow {\n .react-flow__pane {\n /* background: rgb(106 106 106); */\n /* background: \"white\"; */\n // background: #292d39;\n background: ${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.elevation3};\n }\n\n .react-flow__background {\n /* background: #efefef; */\n stroke: white;\n }\n\n .react-flow__node-default {\n background: #292d39;\n color: white;\n border: none;\n /* background: transparent; */\n }\n\n .react-flow__node {\n padding: 0;\n width: auto;\n }\n\n .react-flow__edge-path {\n stroke: ${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.accent2};\n }\n\n .react-flow__node.selected {\n border: 1px solid ${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.accent2};\n box-shadow: 0 0 0 0.5px #${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.accent2};\n }\n\n .react-flow__node-default.selected, .react-flow__node-default.selected:hover {\n box-shadow: 0 0 0 0.5px #${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.accent2};\n }\n\n /* .react-flow__minimap-mask {\n fill: ${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.elevation1}\n }\n\n .react-flow__minimap-node {\n fill:${(0, $731cc06061de042d$export$2e2bcd8739ae039).colors.accent2}\n } */\n }\n\n`;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $04218161d9aa484d$var$useTheme = ()=>{\n const customTheme = (0, $but2J$useTheme)();\n const theme = {\n ...(0, $731cc06061de042d$export$2e2bcd8739ae039),\n ...customTheme\n };\n return theme;\n};\nvar $04218161d9aa484d$export$2e2bcd8739ae039 = $04218161d9aa484d$var$useTheme;\n\n\n\n\n\n\nconst $f3e787b52be18373$export$ef9839ae55b8ba40 = (0, $but2J$emotionstyled)((0, $but2J$Item))``;\nconst $f3e787b52be18373$export$98eff9c5659394e3 = (0, $but2J$emotionstyled)((0, $but2J$Menu))`\n background: ${({ colors: colors })=>colors.elevation2};\n padding: 0;\n border-radius: 0;\n\n .react-contexify__item__content {\n color: ${({ colors: colors })=>colors.whitePrimary};\n }\n\n .react-contexify__separator {\n background-color: ${({ colors: colors })=>colors.elevation1};\n margin: 0;\n }\n`;\n\n\nconst $e54d25e5d65b9790$export$d4cd258d01c03112 = \"editor-edge-menu\";\nconst $e54d25e5d65b9790$export$8b2e4a15453bac1e = ()=>{\n const { show: show } = (0, $but2J$useContextMenu)({\n id: $e54d25e5d65b9790$export$d4cd258d01c03112\n });\n const onContextMenu = (0, $but2J$useCallback)((event, edge)=>{\n event.stopPropagation();\n show(event, {\n props: {\n edge: edge\n }\n });\n }, [\n show\n ]);\n return {\n onContextMenu: onContextMenu\n };\n};\nconst $e54d25e5d65b9790$var$EdgeContextMenu = ()=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const removeEdges = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.removeEdges);\n return (0, $but2J$jsx)((0, $but2J$Fragment), {\n children: (0, $but2J$jsx)((0, $f3e787b52be18373$export$98eff9c5659394e3), {\n id: $e54d25e5d65b9790$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: (event)=>removeEdges([\n event.props.edge\n ]),\n children: \"Delete Edge (DEL)\"\n })\n })\n });\n};\nvar $e54d25e5d65b9790$export$2e2bcd8739ae039 = $e54d25e5d65b9790$var$EdgeContextMenu;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $628ee4b8a62b71a2$var$ModalOuter = (0, $but2J$emotionstyled).div`\n position: fixed;\n z-index: ${({ theme: theme })=>theme.zIndex.modal};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: ${({ theme: theme })=>theme.colors.elevation3}cc;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\nconst $628ee4b8a62b71a2$var$ModalInner = (0, $but2J$emotionstyled).div`\n background: ${({ theme: theme })=>theme.colors.elevation2};\n box-shadow: 1px 1px 1px 1px ${({ theme: theme })=>theme.colors.elevation1};\n color: white;\n width: 70%;\n height: 80%;\n overflow-y: scroll;\n position: relative;\n`;\nconst $628ee4b8a62b71a2$var$ModalCloser = (0, $but2J$emotionstyled)((0, $but2J$MdClose))`\n position: absolute;\n top: 0.2rem;\n right: 0.2rem;\n cursor: pointer;\n`;\nconst $628ee4b8a62b71a2$export$2b77a92f1a5ad772 = ({ children: children, onClose: onClose, ...props })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n (0, $but2J$useEffect)(()=>{\n const escHandler = (event)=>{\n if (event.key === \"Escape\") onClose?.();\n };\n document.addEventListener(\"keydown\", escHandler);\n return ()=>{\n document.removeEventListener(\"keydown\", escHandler);\n };\n }, [\n onClose\n ]);\n return /*#__PURE__*/ (0, $but2J$createPortal)((0, $but2J$jsx)($628ee4b8a62b71a2$var$ModalOuter, {\n theme: theme,\n onClick: onClose,\n children: (0, $but2J$jsxs)($628ee4b8a62b71a2$var$ModalInner, {\n ...props,\n onClick: (e)=>{\n e.stopPropagation();\n },\n theme: theme,\n children: [\n children,\n (0, $but2J$jsx)($628ee4b8a62b71a2$var$ModalCloser, {\n theme: theme,\n onClick: onClose\n })\n ]\n })\n }), document.body);\n};\nvar $628ee4b8a62b71a2$export$2e2bcd8739ae039 = $628ee4b8a62b71a2$export$2b77a92f1a5ad772;\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $d8badf9492e6c707$var$PluginsWrapper = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n width: 100%;\n`);\nconst $d8badf9492e6c707$var$PluginWrapper = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n`);\nconst $d8badf9492e6c707$var$NodesList = (0, $but2J$withTheme)((0, $but2J$emotionstyled).ul`\n list-style: none;\n margin: 0;\n padding: 0;\n padding-bottom: 10px;\n columns: 2;\n\n li {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 4px;\n overflow: hidden;\n border: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n border-radius: 4px;\n margin-bottom: 0.5rem;\n &:hover {\n border-color: ${({ theme: theme })=>theme.colors.accent2};\n cursor: pointer;\n }\n }\n`);\nconst $d8badf9492e6c707$var$NodeTitle = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`);\nconst $d8badf9492e6c707$var$NodeDescription = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n color: ${({ theme: theme })=>theme.colors.highlight2};\n font-size: 12px;\n`);\nconst $d8badf9492e6c707$export$48f6b48a42d49a36 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n display: flex;\n gap: 0.2rem;\n flex-wrap: wrap;\n`);\nconst $d8badf9492e6c707$export$7129a6e2db131a76 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).span`\n cursor: pointer;\n font-size: 10px;\n background: ${({ theme: theme, isActive: isActive })=>isActive ? theme.colors.highlight1 : theme.colors.elevation3};\n border-radius: 2px;\n padding: 0.1rem 0.2rem;\n border: 1px solid;\n border-color: ${({ theme: theme })=>theme.colors.elevation2};\n &:hover {\n border-color: ${({ theme: theme })=>theme.colors.accent2};\n }\n`);\nconst $d8badf9492e6c707$var$PluginHeader = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div``);\nconst $d8badf9492e6c707$var$PluginTitle = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n font-size: 1.1rem;\n padding: 0.25rem 0;\n color: ${({ theme: theme })=>theme.colors.highlight3};\n`);\nconst $d8badf9492e6c707$var$PluginDescription = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n color: ${({ theme: theme })=>theme.colors.highlight2};\n font-size: 12px;\n`);\nconst $d8badf9492e6c707$var$Plugins = ({ onComponentClick: onComponentClick, filters: { plugin: plugin, search: search = \"\", tags: tags }, onTagClick: onTagClick })=>{\n const plugins = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ plugins: plugins })=>plugins);\n const pluginsGroup = (0, $but2J$useMemo)(()=>{\n if (!plugin) return plugins;\n return plugins.filter(({ name: name })=>name === plugin);\n }, [\n plugins,\n plugin\n ]);\n const filteredPlugins = (0, $but2J$useMemo)(()=>{\n if (!search && !tags?.length) return pluginsGroup;\n const filteredByTags = pluginsGroup.map((plugin)=>({\n ...plugin,\n components: tags?.length ? plugin.components.filter((component)=>tags?.every((tag)=>component.tags?.includes(tag))) : plugin.components\n }));\n return filteredByTags.map((plugin)=>({\n ...plugin,\n components: plugin.components.filter(({ type: type, name: name })=>type.toLocaleLowerCase().includes(search.toLocaleLowerCase()) || name?.toLocaleLowerCase().includes(search.toLocaleLowerCase()))\n }));\n }, [\n pluginsGroup,\n search,\n tags\n ]);\n return (0, $but2J$jsx)($d8badf9492e6c707$var$PluginsWrapper, {\n children: filteredPlugins.map(({ name: name, description: description, components: components }, index)=>{\n if (!components.length) return null;\n return (0, $but2J$jsxs)($d8badf9492e6c707$var$PluginWrapper, {\n children: [\n (0, $but2J$jsxs)($d8badf9492e6c707$var$PluginHeader, {\n children: [\n (0, $but2J$jsx)($d8badf9492e6c707$var$PluginTitle, {\n children: name\n }),\n (0, $but2J$jsx)($d8badf9492e6c707$var$PluginDescription, {\n children: description\n })\n ]\n }),\n (0, $but2J$jsx)($d8badf9492e6c707$var$NodesList, {\n children: components.sort((a, b)=>a.type.toLowerCase() > b.type.toLowerCase() ? 1 : -1).map((component, idx)=>(0, $but2J$jsxs)(\"li\", {\n onClick: ()=>onComponentClick(component),\n children: [\n (0, $but2J$jsx)($d8badf9492e6c707$var$NodeTitle, {\n children: component.name || component.type\n }),\n component.description && (0, $but2J$jsx)($d8badf9492e6c707$var$NodeDescription, {\n children: component.description\n }),\n (0, $but2J$jsx)($d8badf9492e6c707$export$48f6b48a42d49a36, {\n children: component.tags?.map((tag, tagIdx)=>(0, $but2J$jsx)($d8badf9492e6c707$export$7129a6e2db131a76, {\n isActive: tags?.includes(tag),\n onClickCapture: (event)=>{\n event.stopPropagation();\n onTagClick(tag);\n },\n children: tag\n }, tagIdx))\n })\n ]\n }, idx))\n })\n ]\n }, index);\n })\n });\n};\nvar $d8badf9492e6c707$export$2e2bcd8739ae039 = $d8badf9492e6c707$var$Plugins;\n\n\nconst $18ae22c0cb4ff02c$var$InputWrapper = (0, $but2J$emotionstyled).div`\n display: flex;\n position: relative;\n`;\nconst $18ae22c0cb4ff02c$var$InputInner = (0, $but2J$emotionstyled).input`\n padding-right: 2rem;\n padding-left: 0.3rem;\n width: 100%;\n appearance: textfield;\n font-size: inherit;\n background: none;\n border: none;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n appearance: textfield;\n cursor: auto;\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n border-radius: 0.1rem;\n height: 2rem;\n color: ${({ theme: theme })=>theme.colors.highlight2};\n\n &:focus,\n &:hover {\n box-shadow: 0 0 0 var(--leva-borderWidths-focus)\n ${({ theme: theme })=>theme.colors.accent2};\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin-right: 1rem;\n }\n`;\nconst $18ae22c0cb4ff02c$var$FiltersWrapper = (0, $but2J$emotionstyled).div`\n display: flex;\n flex-direction: column;\n padding: 0.6rem;\n gap: 0.6rem;\n border-right: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n min-width: 14rem;\n`;\nconst $18ae22c0cb4ff02c$var$PluginName = (0, $but2J$emotionstyled).label`\n user-select: none;\n input {\n display: none;\n }\n input:checked + span {\n color: ${({ theme: theme })=>theme.colors.accent2};\n }\n &:hover {\n color: ${({ theme: theme })=>theme.colors.accent3};\n cursor: pointer;\n }\n`;\nconst $18ae22c0cb4ff02c$var$StyledPluginTag = (0, $but2J$withTheme)((0, $but2J$emotionstyled)((0, $d8badf9492e6c707$export$7129a6e2db131a76))`\n font-size: 12px;\n padding: 0.2rem 0.4rem;\n &:hover {\n }\n &::after {\n content: \"×\";\n margin-left: 0.4rem;\n }\n`);\nconst $18ae22c0cb4ff02c$var$Filters = ({ onChange: onChange, value: value })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const plugins = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ plugins: plugins })=>plugins);\n const inputRef = (0, $but2J$useRef)(null);\n (0, $but2J$useEffect)(()=>{\n if (!inputRef.current) return;\n inputRef.current.focus();\n }, [\n inputRef\n ]);\n return (0, $but2J$jsxs)($18ae22c0cb4ff02c$var$FiltersWrapper, {\n theme: theme,\n children: [\n (0, $but2J$jsx)($18ae22c0cb4ff02c$var$InputWrapper, {\n children: (0, $but2J$jsx)($18ae22c0cb4ff02c$var$InputInner, {\n ref: inputRef,\n theme: theme,\n value: value.search || \"\",\n placeholder: \"search...\",\n onChange: (event)=>onChange({\n ...value,\n search: event.target.value\n })\n })\n }),\n (0, $but2J$jsx)((0, $d8badf9492e6c707$export$48f6b48a42d49a36), {\n children: value.tags?.map((tag, index)=>(0, $but2J$jsx)($18ae22c0cb4ff02c$var$StyledPluginTag, {\n isActive: true,\n onClick: ()=>{\n const newTags = value.tags?.filter((t)=>t !== tag) || [];\n onChange({\n ...value,\n tags: newTags\n });\n },\n children: tag\n }, index))\n }),\n plugins.map(({ name: name, components: components }, index)=>{\n if (!name) return null;\n return (0, $but2J$jsxs)($18ae22c0cb4ff02c$var$PluginName, {\n theme: theme,\n children: [\n (0, $but2J$jsx)(\"input\", {\n type: \"checkbox\",\n name: \"plugin\",\n value: name,\n checked: name === value.plugin,\n onChange: ()=>{\n onChange({\n ...value,\n plugin: name === value.plugin ? null : name\n });\n }\n }),\n (0, $but2J$jsx)(\"span\", {\n children: name\n })\n ]\n }, index);\n })\n ]\n });\n};\nvar $18ae22c0cb4ff02c$export$2e2bcd8739ae039 = $18ae22c0cb4ff02c$var$Filters;\n\n\n\nconst $fc033f275cd8346c$var$AddNodeWrapper = (0, $but2J$emotionstyled).div`\n height: 100%;\n width: 100%;\n display: flex;\n gap: 1rem;\n`;\nconst $fc033f275cd8346c$var$PluginsPanel = (0, $but2J$emotionstyled).div`\n flex-grow: 1;\n height: 100%;\n overflow-y: scroll;\n`;\nconst $fc033f275cd8346c$var$AddNode = ({ isOpen: isOpen, closeMenu: closeMenu, mousePosition: mousePosition })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const { screenToFlowPosition: screenToFlowPosition } = (0, $but2J$useReactFlow)();\n const { createNode: createNode } = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ createNode: createNode })=>({\n createNode: createNode\n }));\n const [filtersState, setFiltersState] = (0, $but2J$useState)({});\n const onComponentClick = (0, $but2J$useCallback)(({ type: type })=>{\n const { x: x, y: y } = screenToFlowPosition(mousePosition);\n const newNode = {\n //@TODO: generate node id in `createNode` function\n id: `${type}-${+new Date()}`,\n type: type,\n data: {\n label: type\n },\n position: {\n x: x,\n y: y\n },\n targetPosition: (0, $but2J$Position).Left,\n sourcePosition: (0, $but2J$Position).Right\n };\n createNode(newNode);\n closeMenu();\n }, [\n mousePosition,\n screenToFlowPosition,\n createNode,\n closeMenu,\n mousePosition\n ]);\n return isOpen ? (0, $but2J$jsx)((0, $628ee4b8a62b71a2$export$2e2bcd8739ae039), {\n onClose: ()=>{\n closeMenu();\n setFiltersState({});\n },\n children: (0, $but2J$jsxs)($fc033f275cd8346c$var$AddNodeWrapper, {\n theme: theme,\n children: [\n (0, $but2J$jsx)((0, $18ae22c0cb4ff02c$export$2e2bcd8739ae039), {\n onChange: setFiltersState,\n value: filtersState\n }),\n (0, $but2J$jsx)($fc033f275cd8346c$var$PluginsPanel, {\n theme: theme,\n children: (0, $but2J$jsx)((0, $d8badf9492e6c707$export$2e2bcd8739ae039), {\n filters: filtersState,\n onTagClick: (tag)=>{\n setFiltersState((state)=>({\n ...state,\n tags: state.tags?.includes(tag) ? state.tags.filter((t)=>t !== tag) : [\n ...state.tags || [],\n tag\n ]\n }));\n },\n onComponentClick: (component)=>{\n onComponentClick(component);\n setFiltersState({});\n }\n })\n })\n ]\n })\n }) : null;\n};\nvar $fc033f275cd8346c$export$2e2bcd8739ae039 = $fc033f275cd8346c$var$AddNode;\n\n\n\n\n\n\n\n\n\n\n\n\nconst $840c562c77aee4a1$export$3a5757a785a34769 = (url)=>{\n const [worker, setWorker] = (0, $but2J$useState)(null);\n (0, $but2J$useEffect)(()=>{\n const newWorker = new Worker(url);\n setWorker(newWorker);\n return ()=>{\n newWorker?.terminate();\n setWorker(null);\n };\n }, []);\n return worker;\n};\nvar $840c562c77aee4a1$export$2e2bcd8739ae039 = $840c562c77aee4a1$export$3a5757a785a34769;\n\n\n\nconst $069e47322ee9145a$export$1e86115ead375efc = ()=>{\n const [channel, setChannel] = (0, $but2J$useState)(null);\n (0, $but2J$useEffect)(()=>{\n const newChannel = new MessageChannel();\n newChannel.port2.start();\n setChannel(newChannel);\n return ()=>{\n setChannel(null);\n newChannel.port2.close();\n };\n }, []);\n return channel;\n};\nvar $069e47322ee9145a$export$2e2bcd8739ae039 = $069e47322ee9145a$export$1e86115ead375efc;\n\n\nconst $459a4e08a0372e29$export$cd440e094f060920 = (param, value, audioContext)=>{\n if (typeof value === \"undefined\") return;\n param.setValueAtTime(value, audioContext.currentTime);\n};\nconst $459a4e08a0372e29$export$25df2e315be8e003 = (file)=>{\n return new Promise((resolve, reject)=>{\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = ()=>resolve(reader.result?.toString() || \"\");\n reader.onerror = (error)=>reject(error);\n });\n};\n\n\n\n\nconst $a5a5b1a37c474365$var$UploadAudioWrapper = (0, $but2J$emotionstyled).div`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme: theme })=>theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\nconst $a5a5b1a37c474365$var$DropZoneInner = (0, $but2J$emotionstyled).div`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\nconst $a5a5b1a37c474365$var$FileUploadIcon = (0, $but2J$emotionstyled)((0, $but2J$FaFileUpload))`\n width: 100%;\n height: 8rem;\n`;\nconst $a5a5b1a37c474365$var$FileUploadMessage = (0, $but2J$emotionstyled).div`\n font-size: 2rem;\n`;\nconst $a5a5b1a37c474365$var$UploadAudio = ({ isOpen: isOpen, closeMenu: closeMenu })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const setGraph = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ setGraph: setGraph })=>setGraph);\n const setEditorState = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setEditorState);\n const addFile = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.addFile);\n const fileInputRef = (0, $but2J$useRef)(null);\n const uploadFile = (0, $but2J$useCallback)(async (files)=>{\n const [file] = files || [];\n const base64 = await (0, $459a4e08a0372e29$export$25df2e315be8e003)(file);\n addFile({\n type: \"audio\",\n // @TODO: use nanoid here\n id: `audio-file-${+new Date()}`,\n name: file.name,\n file: base64\n });\n closeMenu();\n }, [\n addFile,\n closeMenu\n ]);\n const onTargetClick = ()=>{\n fileInputRef.current?.click();\n };\n return isOpen ? (0, $but2J$jsx)((0, $628ee4b8a62b71a2$export$2e2bcd8739ae039), {\n onClose: closeMenu,\n children: (0, $but2J$jsxs)($a5a5b1a37c474365$var$UploadAudioWrapper, {\n theme: theme,\n children: [\n (0, $but2J$jsx)(\"input\", {\n onChange: ({ target: { files: files } })=>uploadFile(files),\n ref: fileInputRef,\n type: \"file\",\n className: \"hidden\",\n style: {\n display: \"none\"\n },\n accept: \".wav,.mp3,.ogg\"\n }),\n (0, $but2J$jsx)((0, $but2J$FileDrop), {\n className: \"drop-zone-wrapper\",\n targetClassName: \"drop-zone\",\n draggingOverTargetClassName: \"drop-zone-drag-over\",\n onTargetClick: onTargetClick,\n onDrop: (files)=>uploadFile(files),\n children: (0, $but2J$jsxs)($a5a5b1a37c474365$var$DropZoneInner, {\n theme: theme,\n children: [\n (0, $but2J$jsx)($a5a5b1a37c474365$var$FileUploadIcon, {}),\n (0, $but2J$jsx)($a5a5b1a37c474365$var$FileUploadMessage, {\n children: \"click or drop file here\"\n })\n ]\n })\n })\n ]\n })\n }) : null;\n};\nvar $a5a5b1a37c474365$export$2e2bcd8739ae039 = $a5a5b1a37c474365$var$UploadAudio;\n\n\nconst $fee9f929ba5c051a$export$d4cd258d01c03112 = \"editor-menu\";\nconst $fee9f929ba5c051a$export$59ce2a6808e35a29 = ()=>{\n const { show: show } = (0, $but2J$useContextMenu)({\n id: $fee9f929ba5c051a$export$d4cd258d01c03112\n });\n return {\n onContextMenu: show\n };\n};\nconst $fee9f929ba5c051a$var$EditorContextMenu = ({ editorContextMenu: editorContextMenu = [] })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const [mousePosition, setMousePosition] = (0, $but2J$useState)({\n x: 0,\n y: 0\n });\n const [showAddNode, setShowAddNode] = (0, $but2J$useState)(false);\n const [showUploadAudio, setShowUploadAudio] = (0, $but2J$useState)(false);\n const addNodeHandler = (0, $but2J$useCallback)((x, y)=>{\n setMousePosition({\n x: x,\n y: y\n });\n setShowAddNode(true);\n }, [\n setShowAddNode\n ]);\n const pasteBuffer = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.pasteBuffer);\n const { screenToFlowPosition: screenToFlowPosition } = (0, $but2J$useReactFlow)();\n const pasteBufferHandler = (0, $but2J$useCallback)((mousePosition)=>{\n const { x: x, y: y } = screenToFlowPosition(mousePosition);\n pasteBuffer(x, y);\n }, [\n setShowAddNode,\n screenToFlowPosition\n ]);\n const clearGraph = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ clearGraph: clearGraph })=>clearGraph);\n const deleteAllHandler = (0, $but2J$useCallback)(()=>{\n clearGraph();\n }, [\n clearGraph\n ]);\n const toggleHelp = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n const historyBack = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.history.back);\n const historyForward = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.history.forward);\n const historyPointer = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.history.pointer);\n const historyBuffer = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.history.buffer);\n const copySelectedItems = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.copySelectedItems);\n const nodes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodes);\n const selectedNodes = (0, $but2J$useMemo)(()=>nodes.filter(({ selected: selected })=>selected), [\n nodes\n ]);\n const currentCopyBuffer = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.copyBuffer);\n const reactFlowInstance = (0, $but2J$useReactFlow)();\n (0, $but2J$useEffect)(()=>{\n (0, $but2J$hotkeysjs)(\"command+shift+a\", ()=>{\n addNodeHandler(200, 50);\n return false;\n });\n //@TODO: find more elegant way to handle ?\n (0, $but2J$hotkeysjs)(\"shift+/\", ()=>{\n toggleHelp();\n return false;\n });\n (0, $but2J$hotkeysjs)(\"command+z\", ()=>{\n historyBack();\n return false;\n });\n (0, $but2J$hotkeysjs)(\"command+shift+z\", ()=>{\n historyForward();\n return false;\n });\n (0, $but2J$hotkeysjs)(\"command+c\", ()=>{\n copySelectedItems();\n return false;\n });\n (0, $but2J$hotkeysjs)(\"command+v\", ()=>{\n pasteBufferHandler({\n x: 200,\n y: 50\n });\n return false;\n });\n return ()=>{\n (0, $but2J$hotkeysjs).unbind();\n };\n }, [\n addNodeHandler,\n pasteBufferHandler\n ]);\n return (0, $but2J$jsxs)((0, $but2J$Fragment), {\n children: [\n (0, $but2J$jsx)((0, $fc033f275cd8346c$export$2e2bcd8739ae039), {\n isOpen: showAddNode,\n closeMenu: ()=>setShowAddNode(false),\n mousePosition: mousePosition\n }),\n (0, $but2J$jsx)((0, $a5a5b1a37c474365$export$2e2bcd8739ae039), {\n isOpen: showUploadAudio,\n closeMenu: ()=>setShowUploadAudio(false)\n }),\n (0, $but2J$jsxs)((0, $f3e787b52be18373$export$98eff9c5659394e3), {\n id: $fee9f929ba5c051a$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: [\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: ({ triggerEvent: { clientX: clientX, clientY: clientY } })=>addNodeHandler(clientX, clientY),\n children: \"Add Node (\\u2318+\\u21E7+A)\"\n }),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: deleteAllHandler,\n children: \"Delete All\"\n }),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: ()=>setShowUploadAudio(true),\n children: \"Upload Audio File\"\n }),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n disabled: historyPointer === 0,\n onClick: historyBack,\n children: \"Undo (\\u2318+z)\"\n }),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n disabled: historyPointer === historyBuffer.length,\n onClick: historyForward,\n children: \"Redo (\\u2318+\\u21E7+Z)\"\n }),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n disabled: !selectedNodes.length,\n onClick: copySelectedItems,\n children: \"Copy Selected (\\u2318+c)\"\n }),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n disabled: !currentCopyBuffer.nodes.length,\n onClick: ({ triggerEvent: { clientX: x, clientY: y } })=>pasteBufferHandler({\n x: x,\n y: y\n }),\n children: \"Paste (\\u2318+v)\"\n }),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n editorContextMenu.map((item, index)=>item === null ? (0, $but2J$jsx)((0, $but2J$Separator), {}, index) : (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n children: item\n }, index)),\n (0, $but2J$jsx)((0, $but2J$Separator), {}),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: toggleHelp,\n children: \"Help (\\u21E7+?)\"\n })\n ]\n })\n ]\n });\n};\nvar $fee9f929ba5c051a$export$2e2bcd8739ae039 = $fee9f929ba5c051a$var$EditorContextMenu;\n\n\n\n\n\n\n\n\n\nconst $617fd1d922572ac4$export$d4cd258d01c03112 = \"editor-node-menu\";\nconst $617fd1d922572ac4$export$cbbbfb9fb15f3780 = ()=>{\n const { show: show } = (0, $but2J$useContextMenu)({\n id: $617fd1d922572ac4$export$d4cd258d01c03112\n });\n const onContextMenu = (0, $but2J$useCallback)((event, node)=>{\n event.stopPropagation();\n show(event, {\n props: {\n node: node\n }\n });\n }, []);\n return {\n onContextMenu: onContextMenu\n };\n};\nconst $617fd1d922572ac4$var$NodeContextMenu = (args)=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const removeNodes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.removeNodes);\n const addNodeToControlPanel = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.addNodeToControlPanel);\n const removeNodeFromControlPanel = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.removeNodeFromControlPanel);\n const copy = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.copy);\n const nodesConfiguration = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration);\n const controlPanelNodes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.controlPanel.nodes);\n const isOnControlPanel = (0, $but2J$useCallback)(({ props: props })=>{\n if (!props?.node.type) return false;\n return !!controlPanelNodes.find(({ id: id })=>id === props.node.id);\n }, [\n controlPanelNodes\n ]);\n const hasControlPanelNode = (0, $but2J$useCallback)(({ props: props })=>{\n if (!props?.node.type) return false;\n const nodeConfiguration = nodesConfiguration[props.node.type];\n return !!nodeConfiguration?.controlPanelNode;\n }, [\n nodesConfiguration\n ]);\n return (0, $but2J$jsx)((0, $but2J$Fragment), {\n children: (0, $but2J$jsxs)((0, $f3e787b52be18373$export$98eff9c5659394e3), {\n id: $617fd1d922572ac4$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: [\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: (event)=>removeNodes([\n event.props.node\n ]),\n children: \"Delete Node (DEL)\"\n }),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n hidden: (...args)=>!hasControlPanelNode(...args) || isOnControlPanel(...args),\n onClick: (event)=>addNodeToControlPanel(event.props.node),\n children: \"Add To Control Panel\"\n }),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n hidden: (...args)=>!hasControlPanelNode(...args) || !isOnControlPanel(...args),\n onClick: (event)=>removeNodeFromControlPanel(event.props.node),\n children: \"Remove From Control Panel\"\n }),\n (0, $but2J$jsx)((0, $f3e787b52be18373$export$ef9839ae55b8ba40), {\n onClick: (event)=>copy({\n nodes: [\n event.props.node\n ],\n edges: []\n }),\n children: \"Copy (\\u2318+c)\"\n })\n ]\n })\n });\n};\nvar $617fd1d922572ac4$export$2e2bcd8739ae039 = $617fd1d922572ac4$var$NodeContextMenu;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $027dbe8e99154283$var$useAudioNode = (id)=>{\n const patch = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ patch: patch })=>patch);\n return patch.audioNodes.get(id);\n};\nvar $027dbe8e99154283$export$2e2bcd8739ae039 = $027dbe8e99154283$var$useAudioNode;\n\n\n\n\nconst $9630f1cf400b3c5a$var$useNode = (id)=>{\n const updateNodeData = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ updateNodeData: updateNodeData })=>updateNodeData);\n const updateNodeValues = (0, $but2J$useCallback)((values)=>updateNodeData(id, {\n values: values\n }), [\n id,\n updateNodeData\n ]);\n const updateNodeConfig = (0, $but2J$useCallback)((config)=>updateNodeData(id, {\n config: config\n }), [\n id,\n updateNodeData\n ]);\n const updateNodeLabel = (0, $but2J$useCallback)((label)=>updateNodeData(id, {\n label: label\n }), [\n id,\n updateNodeData\n ]);\n return {\n updateNodeValues: updateNodeValues,\n updateNodeConfig: updateNodeConfig,\n updateNodeLabel: updateNodeLabel\n };\n};\nvar $9630f1cf400b3c5a$export$2e2bcd8739ae039 = $9630f1cf400b3c5a$var$useNode;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $cad26a5b9571a093$export$5abe11f802ebd1f2 = (0, $but2J$emotionstyled).input`\n width: 100%;\n background: none;\n border: none;\n text-align: center;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n\n &:focus {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-within {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-vissible {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:not([readonly]):focus {\n color: #fff;\n appearance: none;\n cursor: auto;\n background-color: var(--leva-colors-elevation2);\n padding: 0.3rem;\n border-radius: 0.2rem;\n }\n`;\nconst $cad26a5b9571a093$var$EditableLabel = ({ onChange: onChange, value: value = \"\", className: className })=>{\n const labelInputRef = (0, $but2J$useRef)(null);\n const [labelEditMode, setLabelEditMode] = (0, $but2J$useState)(false);\n const editNodeLabel = (0, $but2J$useCallback)((event)=>{\n //@ts-ignore\n event.target?.select();\n setLabelEditMode(true);\n }, [\n setLabelEditMode\n ]);\n const exitEditMode = (0, $but2J$useCallback)(()=>{\n window.getSelection()?.collapseToEnd();\n setLabelEditMode(false);\n }, [\n setLabelEditMode\n ]);\n const saveNodeLabel = (0, $but2J$useCallback)(()=>{\n exitEditMode();\n if (labelInputRef.current) onChange(labelInputRef.current.value);\n }, [\n labelInputRef,\n exitEditMode,\n onChange\n ]);\n const cancelNodeLabelEdit = (0, $but2J$useCallback)(()=>{\n exitEditMode();\n if (labelInputRef.current && value) labelInputRef.current.value = value;\n }, [\n labelInputRef,\n exitEditMode,\n value\n ]);\n (0, $but2J$useEffect)(()=>{\n if (!labelInputRef.current) return;\n labelInputRef.current.value = value;\n }, [\n value,\n labelInputRef\n ]);\n return (0, $but2J$jsx)($cad26a5b9571a093$export$5abe11f802ebd1f2, {\n ref: labelInputRef,\n type: \"text\",\n readOnly: !labelEditMode,\n onDoubleClick: (event)=>editNodeLabel(event),\n onBlur: saveNodeLabel,\n onKeyDown: (event)=>{\n switch(event.key){\n case \"Escape\":\n cancelNodeLabelEdit();\n break;\n case \"Enter\":\n saveNodeLabel();\n break;\n }\n },\n className: className\n });\n};\nvar $cad26a5b9571a093$export$2e2bcd8739ae039 = $cad26a5b9571a093$var$EditableLabel;\n\n\n\n\n\n\n\n\n\nconst $78270d26f6f09c4c$var$NodeInfoWrapper = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n height: 100%;\n width: 100%;\n overflow: scroll;\n padding: 0.6rem;\n box-sizing: border-box;\n\n hr {\n border: none;\n border-bottom: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n }\n\n code {\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n color: ${({ theme: theme })=>theme.colors.highlight3};\n font-family:\n source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n }\n\n pre {\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n padding: 0.2rem 0.3rem;\n border-radius: 1px;\n }\n\n a {\n color: ${({ theme: theme })=>theme.colors.accent1};\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n font-weight: bold;\n unicode-bidi: isolate;\n }\n\n h1 {\n font-size: 2em;\n margin-block-start: 0.67em;\n margin-block-end: 0.67em;\n }\n\n h2 {\n font-size: 1.5em;\n margin-block-start: 0.83em;\n margin-block-end: 0.83em;\n }\n\n h3 {\n font-size: 1.17em;\n margin-block-start: 1em;\n margin-block-end: 1em;\n }\n\n ul {\n display: block;\n list-style-type: disc;\n margin-block-start: 1em;\n margin-block-end: 1em;\n padding-inline-start: 40px;\n unicode-bidi: isolate;\n }\n\n p {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n unicode-bidi: isolate;\n }\n`);\nconst $78270d26f6f09c4c$var$useNodeManifest = (type)=>{\n const data = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration[type]);\n return data;\n};\nconst $78270d26f6f09c4c$var$NodeInfoModal = ({ isOpen: isOpen, onClose: onClose, type: nodeType, node: node })=>{\n const { info: info, portsDescription: portsDescription } = $78270d26f6f09c4c$var$useNodeManifest(nodeType);\n const portsInfo = (0, $but2J$useMemo)(()=>{\n const parts = [];\n const inputPorts = node.inputs;\n if (inputPorts) {\n parts.push(`## Inputs`);\n for(const portName in inputPorts){\n const port = inputPorts[portName];\n parts.push(`### *${portName}*`);\n const description = portsDescription?.inputs?.[portName];\n if (description) parts.push(description);\n if (Array.isArray(port.type)) parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n else parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n if (port.range) parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n if (port.defaultValue !== undefined) parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n const outputPorts = node.outputs;\n if (outputPorts) {\n parts.push(`## Outputs`);\n for(const portName in outputPorts){\n const port = outputPorts[portName];\n parts.push(`### *${portName}*`);\n const description = portsDescription?.outputs?.[portName];\n if (description) parts.push(description);\n if (Array.isArray(port.type)) parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n else parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n if (port.range) parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n if (port.defaultValue !== undefined) parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n return parts.join(\"\\n\\n\");\n }, [\n node,\n portsDescription\n ]);\n const combinedInfo = (info || \"\") + \"\\n\\n\" + portsInfo;\n return isOpen ? (0, $but2J$jsx)((0, $628ee4b8a62b71a2$export$2e2bcd8739ae039), {\n onClose: onClose,\n children: (0, $but2J$jsx)($78270d26f6f09c4c$var$NodeInfoWrapper, {\n dangerouslySetInnerHTML: {\n __html: (0, $but2J$marked)(combinedInfo || \"\")\n }\n })\n }) : null;\n};\nvar $78270d26f6f09c4c$export$2e2bcd8739ae039 = $78270d26f6f09c4c$var$NodeInfoModal;\n\n\nconst $5a72e86517ffe32d$var$NodeWrapper = (0, $but2J$emotionstyled).div`\n background-color: var(--leva-colors-elevation1);\n`;\nconst $5a72e86517ffe32d$var$NodeLoaderWrapper = (0, $but2J$emotionstyled)($5a72e86517ffe32d$var$NodeWrapper)`\n padding: 2rem 5rem;\n`;\nconst $5a72e86517ffe32d$var$NodeErrorWrapper = (0, $but2J$emotionstyled)($5a72e86517ffe32d$var$NodeWrapper)`\n padding: 1rem 2rem;\n`;\nconst $5a72e86517ffe32d$var$SettingsIconWrapper = (0, $but2J$emotionstyled)((0, $but2J$MdSettings))`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\nconst $5a72e86517ffe32d$var$InfoIconWrapper = (0, $but2J$emotionstyled)((0, $but2J$MdInfoOutline))`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\nconst $5a72e86517ffe32d$var$Section = (0, $but2J$emotionstyled).div`\n position: relative;\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n background-color: var(--leva-colors-elevation1);\n`;\nconst $5a72e86517ffe32d$export$1bdb8f2d1fe25c22 = (0, $but2J$emotionstyled)($5a72e86517ffe32d$var$Section)`\n display: flex;\n height: var(--leva-sizes-titleBarHeight);\n touch-action: none;\n align-items: center;\n justify-content: center;\n flex: 1 1 0%;\n color: var(--leva-colors-highlight1);\n padding: 0 0.4rem;\n gap: 0.3rem;\n`;\nconst $5a72e86517ffe32d$export$bfd3bd1fa283e3c6 = (0, $but2J$emotionstyled)($5a72e86517ffe32d$var$Section)(({ theme: theme })=>`\n display: grid;\n grid-template-areas: \"inputs outputs\";\n background: ${theme.colors.elevation2};\n border-bottom: 1px solid ${theme.colors.elevation1};\n color: ${theme.colors.highlight3};\n font-size: 0.6rem;\n`);\nconst $5a72e86517ffe32d$export$f1afba0ff9ea1277 = (0, $but2J$emotionstyled).div`\n grid-area: inputs;\n text-align: left;\n`;\nconst $5a72e86517ffe32d$export$af4f9b41fc32ed9e = (0, $but2J$emotionstyled).div`\n grid-area: outputs;\n text-align: right;\n`;\nconst $5a72e86517ffe32d$export$a2d375858cc72119 = (0, $but2J$emotionstyled).div`\n position: relative;\n padding: 5px 10px;\n`;\nconst $5a72e86517ffe32d$var$portColors = {\n [(0, $73e253e9a60dc018$export$b0b7b95ee465c83c).Audio]: \"#4ade80\",\n [(0, $73e253e9a60dc018$export$b0b7b95ee465c83c).Gate]: \"#c084fc\",\n [(0, $73e253e9a60dc018$export$b0b7b95ee465c83c).Number]: \"#38bdf8\",\n [(0, $73e253e9a60dc018$export$b0b7b95ee465c83c).Any]: \"#ffffff\"\n};\nconst $5a72e86517ffe32d$var$StyledHandle = (0, $but2J$withTheme)((0, $but2J$emotionstyled)((0, $but2J$Handle), {\n shouldForwardProp: (prop)=>prop !== \"portType\"\n})`\n --port-color: ${(props)=>{\n if (!props.portType) return props.theme.colors.highlight2;\n if (Array.isArray(props.portType)) {\n const colors = props.portType.map((type)=>$5a72e86517ffe32d$var$portColors[type]);\n return `linear-gradient(0.25turn, ${colors.join(\", \")});`;\n } else return $5a72e86517ffe32d$var$portColors[props.portType];\n}};\n border-color: var(--port-color);\n background: var(--port-color);\n box-shadow: 0px 0px 0px 1px ${({ theme: theme })=>theme.colors.elevation2} inset;\n`);\nconst $5a72e86517ffe32d$var$StyledInputHandle = (0, $but2J$withTheme)((0, $but2J$emotionstyled)($5a72e86517ffe32d$var$StyledHandle)`\n left: -3px;\n`);\nconst $5a72e86517ffe32d$export$9ea0feffc20ee81 = ({ ...props })=>(0, $but2J$jsx)($5a72e86517ffe32d$var$StyledInputHandle, {\n ...props,\n type: \"target\",\n position: (0, $but2J$Position).Left\n });\nconst $5a72e86517ffe32d$export$222539e2a2fac4e0 = (0, $but2J$withTheme)((0, $but2J$emotionstyled)($5a72e86517ffe32d$var$StyledHandle)`\n right: -3px;\n`);\nconst $5a72e86517ffe32d$export$496e5e1ee1696f64 = (props)=>(0, $but2J$jsx)($5a72e86517ffe32d$export$222539e2a2fac4e0, {\n ...props,\n type: \"source\",\n position: (0, $but2J$Position).Right\n });\nconst $5a72e86517ffe32d$export$7e0b3af1e60a3273 = ({ className: className, ...props })=>(0, $but2J$jsx)($5a72e86517ffe32d$export$1bdb8f2d1fe25c22, {\n ...props,\n className: [\n className,\n (0, $73e253e9a60dc018$export$956b3cf15d7c363)\n ].join(\" \")\n });\nconst $5a72e86517ffe32d$var$useNodeManifest = (type)=>{\n const data = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration[type]);\n return data;\n};\nconst $5a72e86517ffe32d$var$useConfigNode = (type)=>{\n const { configNode: ConfigNode } = $5a72e86517ffe32d$var$useNodeManifest(type);\n return {\n ConfigNode: ConfigNode\n };\n};\nconst $5a72e86517ffe32d$export$361064385d50ec44 = (props)=>{\n const { id: id, children: children, selected: selected, ...rest } = props;\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const getNode = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ getNode: getNode })=>getNode);\n const nodesConfiguration = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration);\n const [isInfoModalShown, setIsInfoModalShown] = (0, $but2J$useState)(false);\n const { info: info } = $5a72e86517ffe32d$var$useNodeManifest(props.type);\n const isResizeable = (0, $but2J$useMemo)(()=>nodesConfiguration[props.type].resizable ?? false, [\n nodesConfiguration,\n props.type\n ]);\n const { updateNodeLabel: updateNodeLabel, updateNodeConfig: updateNodeConfig } = (0, $9630f1cf400b3c5a$export$2e2bcd8739ae039)(id);\n const { data: data } = getNode(id) || {};\n const audioNode = (0, $027dbe8e99154283$export$2e2bcd8739ae039)(id);\n const { ConfigNode: ConfigNode } = $5a72e86517ffe32d$var$useConfigNode(rest.type);\n const [configMode, setShowConfigMode] = (0, $but2J$useState)(false);\n if (!audioNode) return (0, $but2J$jsx)($5a72e86517ffe32d$var$NodeLoaderWrapper, {\n className: (0, $73e253e9a60dc018$export$956b3cf15d7c363),\n children: \"can't find audio node\"\n });\n if (audioNode.loading) return (0, $but2J$jsx)($5a72e86517ffe32d$var$NodeLoaderWrapper, {\n className: (0, $73e253e9a60dc018$export$956b3cf15d7c363),\n children: \"loading\"\n });\n if (audioNode.error) return (0, $but2J$jsxs)($5a72e86517ffe32d$var$NodeErrorWrapper, {\n className: (0, $73e253e9a60dc018$export$956b3cf15d7c363),\n children: [\n \"error: \",\n audioNode.error.toString()\n ]\n });\n if (!audioNode.node) return (0, $but2J$jsx)($5a72e86517ffe32d$var$NodeLoaderWrapper, {\n className: (0, $73e253e9a60dc018$export$956b3cf15d7c363),\n children: \"can't find audio node\"\n });\n const size = data?.config?.size;\n const { node: { inputs: inputs, outputs: outputs } } = audioNode;\n return (0, $but2J$jsxs)($5a72e86517ffe32d$var$NodeWrapper, {\n children: [\n (0, $but2J$jsxs)($5a72e86517ffe32d$export$7e0b3af1e60a3273, {\n children: [\n info && (0, $but2J$jsx)($5a72e86517ffe32d$var$InfoIconWrapper, {\n onClickCapture: ()=>setIsInfoModalShown(true)\n }),\n (0, $but2J$jsx)((0, $cad26a5b9571a093$export$2e2bcd8739ae039), {\n value: data?.label ?? \"No Name\",\n onChange: updateNodeLabel\n }),\n ConfigNode && (0, $but2J$jsx)($5a72e86517ffe32d$var$SettingsIconWrapper, {\n onClickCapture: ()=>setShowConfigMode((isShown)=>!isShown)\n })\n ]\n }),\n (0, $but2J$jsxs)($5a72e86517ffe32d$export$bfd3bd1fa283e3c6, {\n theme: theme,\n children: [\n (0, $but2J$jsx)($5a72e86517ffe32d$export$f1afba0ff9ea1277, {\n children: inputs ? Object.keys(inputs).map((key, index)=>(0, $but2J$jsxs)($5a72e86517ffe32d$export$a2d375858cc72119, {\n children: [\n (0, $but2J$jsx)($5a72e86517ffe32d$export$9ea0feffc20ee81, {\n id: key,\n portType: inputs[key].type\n }),\n (0, $but2J$jsx)(\"span\", {\n children: key\n })\n ]\n }, index)) : null\n }),\n (0, $but2J$jsx)($5a72e86517ffe32d$export$af4f9b41fc32ed9e, {\n children: outputs ? Object.keys(outputs).map((key, index)=>(0, $but2J$jsxs)($5a72e86517ffe32d$export$a2d375858cc72119, {\n children: [\n (0, $but2J$jsx)($5a72e86517ffe32d$export$496e5e1ee1696f64, {\n id: key,\n portType: outputs[key].type\n }),\n (0, $but2J$jsx)(\"span\", {\n children: key\n })\n ]\n }, index)) : null\n })\n ]\n }),\n ConfigNode && configMode && selected ? (0, $but2J$jsx)(ConfigNode, {\n ...props\n }) : isResizeable ? (0, $but2J$jsx)((0, $but2J$Resizable), {\n size: size,\n minWidth: 180,\n minHeight: 30,\n enable: {\n bottom: true,\n bottomRight: true,\n right: true\n },\n onResizeStop: (e, direction, ref, d)=>{\n const newSize = size ? {\n width: size.width + d.width,\n height: size.height + d.height\n } : ref.getBoundingClientRect();\n updateNodeConfig({\n ...data?.config,\n size: newSize\n });\n },\n children: children\n }) : children,\n (0, $but2J$jsx)((0, $78270d26f6f09c4c$export$2e2bcd8739ae039), {\n isOpen: isInfoModalShown,\n type: props.type,\n onClose: ()=>setIsInfoModalShown(false),\n node: audioNode.node\n })\n ]\n });\n};\n\n\nconst $99522cb4c544c0e3$export$86de09faaa70680d = (0, $but2J$emotionstyled).div`\n width: 100%;\n padding: 0.4rem 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\nconst $99522cb4c544c0e3$export$548ca3bae446ddc2 = (0, $but2J$emotionstyled)((0, $5a72e86517ffe32d$export$7e0b3af1e60a3273))`\n display: flex;\n gap: 0.1rem;\n padding: 0 0.4rem;\n justify-content: start;\n font-size: 0.6rem;\n height: auto;\n min-width: 0;\n`;\nconst $99522cb4c544c0e3$export$9fb15e3cc717240 = (0, $but2J$emotionstyled).div`\n display: flex;\n align-items: center;\n height: 70%;\n width: auto;\n gap: 0.4rem;\n`;\nconst $99522cb4c544c0e3$export$be58b4326e23250f = (0, $but2J$emotionstyled).span`\n width: auto;\n height: 100%;\n cursor: pointer;\n svg {\n width: auto;\n height: 100%;\n }\n &:hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n\n\nconst $a9eb7fd7f79ff3fb$var$ControlPanelNodeWrapper = (0, $but2J$emotionstyled).div`\n height: 100%;\n display: grid;\n grid-template-rows: auto 1fr;\n`;\nconst $a9eb7fd7f79ff3fb$var$PanelNode = (props)=>{\n const { node: node } = props;\n const getControlPanelNode = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.getControlPanelNode);\n const ControlPanelNode = (0, $but2J$useMemo)(()=>getControlPanelNode(node), [\n node\n ]);\n if (!ControlPanelNode) return null;\n return (0, $but2J$jsx)(ControlPanelNode, {\n ...props\n });\n};\nconst $a9eb7fd7f79ff3fb$var$ControlPanelItem = (props)=>{\n const { node: node, showControls: showControls, onDelete: onDelete } = props;\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const { id: id } = node;\n const { node: audioNode } = (0, $027dbe8e99154283$export$2e2bcd8739ae039)(id) || {};\n const { updateNodeValues: updateNodeValues } = (0, $9630f1cf400b3c5a$export$2e2bcd8739ae039)(id);\n return (0, $but2J$jsxs)($a9eb7fd7f79ff3fb$var$ControlPanelNodeWrapper, {\n theme: theme,\n children: [\n (0, $but2J$jsxs)((0, $99522cb4c544c0e3$export$548ca3bae446ddc2), {\n theme: theme,\n children: [\n (0, $but2J$jsx)((0, $99522cb4c544c0e3$export$86de09faaa70680d), {\n children: node.data.label\n }),\n showControls && (0, $but2J$jsxs)((0, $99522cb4c544c0e3$export$9fb15e3cc717240), {\n children: [\n (0, $but2J$jsx)((0, $99522cb4c544c0e3$export$be58b4326e23250f), {\n theme: theme,\n children: (0, $but2J$jsx)((0, $but2J$MdDragHandle), {\n className: \"grid-item-handle\"\n })\n }),\n (0, $but2J$jsx)((0, $99522cb4c544c0e3$export$be58b4326e23250f), {\n theme: theme,\n children: (0, $but2J$jsx)((0, $but2J$MdClose), {\n onClick: ()=>onDelete(node)\n })\n })\n ]\n })\n ]\n }),\n (0, $but2J$jsx)($a9eb7fd7f79ff3fb$var$PanelNode, {\n node: node,\n audioNode: audioNode,\n updateNodeValues: updateNodeValues\n })\n ]\n });\n};\nvar $a9eb7fd7f79ff3fb$export$2e2bcd8739ae039 = $a9eb7fd7f79ff3fb$var$ControlPanelItem;\n\n\n\nconst $8f357eb500334b2f$var$ControlPanelIconWrapper = (0, $but2J$emotionstyled).div`\n position: fixed;\n z-index: 5;\n box-shadow: 0px 1px 2px ${({ theme: theme })=>theme.colors.elevation2};\n left: 1rem;\n top: 4rem;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background: ${({ theme: theme })=>theme.colors.elevation1};\n color: ${({ theme: theme })=>theme.colors.highlight1};\n\n :hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n cursor: pointer;\n }\n`;\nconst $8f357eb500334b2f$var$ControlPanelIconsBar = (0, $but2J$emotionstyled)((0, $99522cb4c544c0e3$export$9fb15e3cc717240))`\n height: 80%;\n`;\nconst $8f357eb500334b2f$var$CloseIconWrapper = (0, $but2J$emotionstyled)((0, $99522cb4c544c0e3$export$be58b4326e23250f))`\n font-size: 1rem;\n display: flex;\n align-items: center;\n`;\nconst $8f357eb500334b2f$var$ControlPanelHeader = (0, $but2J$emotionstyled)((0, $99522cb4c544c0e3$export$548ca3bae446ddc2))`\n grid-template-columns: 1fr auto;\n border-bottom: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n font-size: 0.7rem;\n`;\nconst $8f357eb500334b2f$var$ControlPanelTitle = (0, $but2J$emotionstyled)((0, $99522cb4c544c0e3$export$86de09faaa70680d))`\n text-align: center;\n`;\nconst $8f357eb500334b2f$var$ControlPanelWrapper = (0, $but2J$emotionstyled).div`\n height: 100%;\n width: 100%;\n padding: 0.3rem 0.4rem;\n box-sizing: border-box;\n`;\nconst $8f357eb500334b2f$var$ControlPanelBody = (0, $but2J$emotionstyled).div`\n height: auto;\n padding: 0;\n max-height: 95vh;\n overflow-y: scroll;\n border: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n`;\nconst $8f357eb500334b2f$var$ControlPanelSettings = (0, $but2J$emotionstyled).div`\n padding: 1rem 0;\n font-family: var(--leva-fonts-mono);\n font-size: 0.8rem;\n`;\nconst $8f357eb500334b2f$var$LockGridWrapper = (0, $but2J$emotionstyled).div`\n display: flex;\n align-items: center;\n gap: 0.5rem;\n cursor: pointer;\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n }\n`;\nconst $8f357eb500334b2f$var$GridResizeHandle = (0, $but2J$emotionstyled).div`\n position: absolute;\n height: 1rem;\n top: 0;\n bottom: 0;\n margin: auto;\n left: 0.5rem;\n border-right: 1px solid ${({ theme: theme })=>theme.colors.whitePrimary};\n`;\nconst $8f357eb500334b2f$var$ControlPanelItemWrapper = (0, $but2J$emotionstyled).div`\n box-sizing: border-box;\n overflow: hidden;\n .react-resizable-handle:after {\n border-color: ${({ theme: theme })=>theme.colors.whitePrimary};\n border-width: 1px;\n }\n`;\nconst $8f357eb500334b2f$var$ControlPanel = ()=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const nodeRef = (0, $but2J$useRef)(null);\n const nodes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.nodes);\n const { show: show, nodes: controlPanelNodes, size: size } = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.controlPanel);\n const { width: width = 200, height: height } = size;\n const filteredNodes = (0, $but2J$useMemo)(()=>{\n const nodeIds = controlPanelNodes.map(({ id: id })=>id);\n return nodes.filter(({ id: id })=>nodeIds.includes(id));\n }, [\n nodes,\n controlPanelNodes\n ]);\n const showControlPanel = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.showControlPanel);\n const hideControlPanel = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.hideControlPanel);\n const setControlPanelNodes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setControlPanelNodes);\n const setControlPanelSize = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setControlPanelSize);\n const removeNodeFromControlPanel = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.removeNodeFromControlPanel);\n const [isGridLocked, setGridLocked] = (0, $but2J$useState)(true);\n const layout = (0, $but2J$useMemo)(()=>{\n const fallbackY = controlPanelNodes.reduce((acc, { height: height = (0, $73e253e9a60dc018$export$9f05d3e6ade4c09e).rowHeight, x: x, y: y = 0 })=>{\n const Y = y + height;\n return Y > acc ? Y : acc;\n }, 0);\n return controlPanelNodes.map(({ id: i, width: width, height: height, x: x, y: y })=>{\n return {\n i: i,\n w: width || (0, $73e253e9a60dc018$export$9f05d3e6ade4c09e).cols,\n h: height || 6,\n x: x ?? 0,\n y: y ?? fallbackY\n };\n });\n }, [\n controlPanelNodes\n ]);\n if (!filteredNodes.length) return null;\n return (0, $but2J$jsxs)((0, $but2J$Fragment), {\n children: [\n (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelIconWrapper, {\n theme: theme,\n ref: nodeRef,\n onClick: showControlPanel,\n children: (0, $but2J$jsx)((0, $but2J$RxDashboard), {})\n }),\n (0, $but2J$jsxs)((0, $but2J$reactmoderndrawer), {\n open: show,\n onClose: hideControlPanel,\n direction: \"left\",\n className: \"\",\n size: \"auto\",\n enableOverlay: false,\n style: {\n background: theme.colors.elevation1,\n position: \"absolute\"\n },\n children: [\n (0, $but2J$jsxs)($8f357eb500334b2f$var$ControlPanelHeader, {\n theme: theme,\n children: [\n (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelTitle, {\n children: \"Control Panel\"\n }),\n (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelIconsBar, {\n children: (0, $but2J$jsx)($8f357eb500334b2f$var$CloseIconWrapper, {\n onClick: hideControlPanel,\n theme: theme,\n children: (0, $but2J$jsx)((0, $but2J$MdClose), {})\n })\n })\n ]\n }),\n (0, $but2J$jsxs)($8f357eb500334b2f$var$ControlPanelWrapper, {\n children: [\n (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelSettings, {\n children: isGridLocked ? (0, $but2J$jsxs)($8f357eb500334b2f$var$LockGridWrapper, {\n theme: theme,\n onClick: ()=>setGridLocked(false),\n children: [\n (0, $but2J$jsx)((0, $but2J$AiFillLock), {}),\n \"Unlock grid\"\n ]\n }) : (0, $but2J$jsxs)($8f357eb500334b2f$var$LockGridWrapper, {\n theme: theme,\n onClick: ()=>setGridLocked(true),\n children: [\n (0, $but2J$jsx)((0, $but2J$AiFillUnlock), {}),\n \"Lock grid\"\n ]\n })\n }),\n (0, $but2J$jsx)((0, $but2J$Resizable), {\n enable: {\n top: false,\n right: !isGridLocked,\n bottom: false,\n left: false,\n topRight: false,\n bottomRight: false,\n bottomLeft: false,\n topLeft: false\n },\n handleComponent: {\n right: (0, $but2J$jsx)($8f357eb500334b2f$var$GridResizeHandle, {\n theme: theme\n })\n },\n minWidth: 120,\n size: {\n width: width,\n height: \"auto\"\n },\n onResizeStop: (e, direction, ref, d)=>{\n setControlPanelSize({\n width: width + d.width,\n height: height + d.height\n });\n },\n children: (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelBody, {\n theme: theme,\n children: (0, $but2J$jsx)((0, $but2J$reactgridlayout), {\n layout: layout,\n className: \"layout\",\n cols: (0, $73e253e9a60dc018$export$9f05d3e6ade4c09e).cols,\n rowHeight: (0, $73e253e9a60dc018$export$9f05d3e6ade4c09e).rowHeight,\n width: width,\n margin: [\n 0,\n 0\n ],\n isResizable: !isGridLocked,\n draggableHandle: \".grid-item-handle\",\n onLayoutChange: (nodes)=>{\n requestAnimationFrame(()=>{\n setControlPanelNodes(nodes.map(({ i: i, w: w, h: h, x: x, y: y })=>({\n id: i,\n width: w,\n height: h,\n x: x,\n y: y\n })));\n });\n },\n children: filteredNodes.map((node)=>{\n return (0, $but2J$jsx)($8f357eb500334b2f$var$ControlPanelItemWrapper, {\n theme: theme,\n children: (0, $but2J$jsx)((0, $a9eb7fd7f79ff3fb$export$2e2bcd8739ae039), {\n node: node,\n showControls: !isGridLocked,\n onDelete: removeNodeFromControlPanel\n })\n }, node.id);\n })\n })\n })\n })\n ]\n })\n ]\n })\n ]\n });\n};\nvar $8f357eb500334b2f$export$2e2bcd8739ae039 = $8f357eb500334b2f$var$ControlPanel;\n\n\n\n\n\n\n\n\n\n\n\n\nvar $f82470e1f8a957ac$exports = {};\n$f82470e1f8a957ac$exports = \"# Quick start\\n\\n## Add node\\n - Mouse right click\\n - Select **'Add Node'** from context menu\\n\\n ### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or\\n\\n - Press `CMD+SHIFT+A`\\n\\n<br/>\\n\\n## Connect nodes\\n - Mouse left click and hold on source port\\n - Drop on target port\\n\\n<br/>\\n\\n## Delete Node or Connection\\n - Mouse right click on node/connection\\n - Select **'Delete Node'**/**'Delete Connection'** from context menu\\n\\n ### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or\\n\\n - Mouse left click on node/connection, then press `Backspace`\\n\\n<br/>\\n\\n\\n## Move node\\n - Drag and Drop\\n\\n<br/>\\n\\n## Rename node\\n - Doubleclick the node title\\n\\n<br/>\\n\\n## Undo/Redo\\n - `CMD+Z` to Undo / `CMD+SHIFT+Z` to Redo\\n - Select **'Undo'**/**'Redo'** from the Edit menu\\n\\n<br/>\\n\\n## Upload file\\n - Drag and drop audio or patch files onto the application\\n - Uploaded file appears as a new tab in the tabs bar at the top\\n - Click on the tab to view or edit the file\\n\\n<br/>\\n\\n## Rename file in the project\\n - Doubleclick the tab title\\n\\n\\n\";\n\n\nconst $72ce7400f28463b9$var$MdPreview = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n font-family: var(--leva-fonts-mono);\n font-size: 0.7rem;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n overflow: scroll;\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n padding: 0 0.5rem;\n\n code {\n color: ${({ theme: theme })=>theme.colors.accent3};\n filter: hue-rotate(180deg);\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n font-weight: bold;\n unicode-bidi: isolate;\n }\n\n h1 {\n font-size: 2em;\n margin-block-start: 0.67em;\n margin-block-end: 0.67em;\n }\n\n h2 {\n font-size: 1.5em;\n margin-block-start: 0.83em;\n margin-block-end: 0.83em;\n }\n\n h3 {\n font-size: 1.17em;\n margin-block-start: 1em;\n margin-block-end: 1em;\n }\n\n ul {\n display: block;\n list-style-type: disc;\n margin-block-start: 1em;\n margin-block-end: 1em;\n padding-inline-start: 40px;\n unicode-bidi: isolate;\n }\n\n p {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n unicode-bidi: isolate;\n }\n`);\nconst $72ce7400f28463b9$var$ModalContent = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n padding: 1rem;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n overflow: hidden;\n`);\nconst $72ce7400f28463b9$var$HelpModal = ()=>{\n const isHelpShown = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.isHelpShown);\n const toggleHelp = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n if (!isHelpShown) return null;\n return (0, $but2J$jsx)((0, $628ee4b8a62b71a2$export$2e2bcd8739ae039), {\n onClose: ()=>{\n toggleHelp();\n },\n children: (0, $but2J$jsx)($72ce7400f28463b9$var$ModalContent, {\n children: (0, $but2J$jsx)($72ce7400f28463b9$var$MdPreview, {\n dangerouslySetInnerHTML: {\n __html: (0, $but2J$marked)((0, (/*@__PURE__*/$parcel$interopDefault($f82470e1f8a957ac$exports))))\n },\n onWheelCapture: (event)=>event.stopPropagation()\n })\n })\n });\n};\nvar $72ce7400f28463b9$export$2e2bcd8739ae039 = $72ce7400f28463b9$var$HelpModal;\n\n\nconst $5acaa12be69dfa8a$export$78bddedbcf2939ac = ()=>{\n const toggleHelp = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n return (0, $but2J$jsx)((0, $but2J$Fragment), {\n children: (0, $but2J$jsx)((0, $but2J$ControlButton), {\n onClick: toggleHelp,\n children: (0, $but2J$jsx)((0, $but2J$FaQuestion), {})\n })\n });\n};\n\n\n\n\n\n\n\n\nconst $4379ac7ed25061a0$var$Layout = (0, $but2J$emotionstyled).div`\n position: fixed;\n z-index: ${({ theme: theme })=>theme.zIndex.resumeContextLayout};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: rgb(24 28 32 / 90%);\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n cursor: pointer;\n`;\nconst $4379ac7ed25061a0$var$Row = (0, $but2J$emotionstyled).div`\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n`;\nconst $4379ac7ed25061a0$var$Message = (0, $but2J$emotionstyled).div`\n font-family: var(--leva-fonts-mono);\n font-size: 2rem;\n`;\nconst $4379ac7ed25061a0$var$Icon = (0, $but2J$emotionstyled)((0, $but2J$FaVolumeOff))`\n width: 7rem;\n height: 7rem;\n`;\nconst $4379ac7ed25061a0$var$ResumeContext = ()=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const patch = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ patch: patch })=>patch);\n const audioContext = patch.audioContext;\n const [isContextResumed, setIsContextResumed] = (0, $but2J$useState)(audioContext.state === \"running\");\n if (isContextResumed) return null;\n return (0, $but2J$jsxs)($4379ac7ed25061a0$var$Layout, {\n theme: theme,\n onClick: ()=>{\n audioContext.resume();\n setIsContextResumed(true);\n },\n children: [\n (0, $but2J$jsx)($4379ac7ed25061a0$var$Row, {\n children: (0, $but2J$jsx)($4379ac7ed25061a0$var$Message, {\n theme: theme,\n children: \"Click anywhere to resume audio context\"\n })\n }),\n (0, $but2J$jsx)($4379ac7ed25061a0$var$Row, {\n children: (0, $but2J$jsx)($4379ac7ed25061a0$var$Icon, {})\n })\n ]\n });\n};\nvar $4379ac7ed25061a0$export$2e2bcd8739ae039 = $4379ac7ed25061a0$var$ResumeContext;\n\n\n\n\n\n\nconst $5536f4f171f9bf88$var$ToggleMinimap = ()=>{\n const setConfig = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ setConfig: setConfig })=>setConfig);\n const { showMinimap: showMinimap } = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ config: config })=>config);\n return (0, $but2J$jsx)((0, $but2J$ControlButton), {\n onClick: ()=>setConfig({\n showMinimap: !showMinimap\n }),\n children: showMinimap ? (0, $but2J$jsx)((0, $but2J$FaMap), {}) : (0, $but2J$jsx)((0, $but2J$FaRegMap), {})\n });\n};\nvar $5536f4f171f9bf88$export$2e2bcd8739ae039 = $5536f4f171f9bf88$var$ToggleMinimap;\n\n\n\n\n\n\n\nconst $8b2e0523152bfd06$var$Wire = ({ id: id, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, style: style = {}, data: data, markerStart: markerStart, markerEnd: markerEnd, source: source, target: target, sourceHandleId: sourceHandleId, targetHandleId: targetHandleId, selected: selected })=>{\n const theme = (0, $04218161d9aa484d$export$2e2bcd8739ae039)();\n const getNode = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ getNode: getNode })=>getNode);\n const sourceNode = getNode(source);\n const targetNode = getNode(target);\n const isConnectedToSelected = sourceNode?.selected || targetNode?.selected;\n (0, $but2J$useEffect)(()=>{\n if (!sourceHandleId || !targetHandleId) return;\n console.log(`connected ${source} to ${target}`);\n return ()=>{\n console.log(`disconnected ${source} from ${target}`);\n };\n }, [\n source,\n sourceHandleId,\n target,\n targetHandleId\n ]);\n const [edgePath] = (0, $but2J$getBezierPath)({\n targetX: targetX,\n targetY: targetY,\n targetPosition: targetPosition,\n sourceX: sourceX,\n sourceY: sourceY,\n sourcePosition: sourcePosition\n });\n return (0, $but2J$jsxs)((0, $but2J$Fragment), {\n children: [\n (0, $but2J$jsx)(\"path\", {\n id: id,\n style: {\n ...style,\n stroke: selected ? theme.colors.accent2 : isConnectedToSelected ? theme.colors.highlight3 : theme.colors.highlight2\n },\n className: \"react-flow__edge-path Wire\",\n d: edgePath,\n markerEnd: markerEnd\n }),\n (0, $but2J$jsx)(\"path\", {\n style: {\n ...style,\n strokeWidth: 8,\n color: \"transparent\",\n opacity: 0,\n cursor: \"pointer\"\n },\n d: edgePath,\n markerEnd: markerEnd\n })\n ]\n });\n};\nvar $8b2e0523152bfd06$export$2e2bcd8739ae039 = $8b2e0523152bfd06$var$Wire;\n\n\nconst $6bb27c07aa83529c$var$StyledControls = (0, $but2J$withTheme)((0, $but2J$emotionstyled)((0, $but2J$Controls))`\n &.bottom {\n right: 1rem;\n bottom: 40%;\n }\n\n svg {\n color: ${({ theme: theme })=>theme.colors.elevation2};\n }\n`);\nconst $6bb27c07aa83529c$var$onNodeDragStop = (_event, node)=>console.log(\"drag stop\", node);\nconst $6bb27c07aa83529c$var$onNodeClick = (_event, element)=>console.log(\"click\", element);\nconst $6bb27c07aa83529c$var$snapGrid = [\n 20,\n 20\n];\nconst $6bb27c07aa83529c$export$72cb76f559fbafcf = ({ editorState: editorState, plugins: plugins = [], editorContextMenu: editorContextMenu = [], onChange: onChange = ()=>{}, ...props })=>{\n const edgeTypes = (0, $but2J$useMemo)(()=>({\n wire: (0, $8b2e0523152bfd06$export$2e2bcd8739ae039)\n }), []);\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, onNodesChange: onNodesChange, onNodesDelete: onNodesDelete, onEdgesChange: onEdgesChange, onEdgesDelete: onEdgesDelete, onConnect: onConnect, setPlugins: setPlugins, setViewport: setViewport, viewport: viewport } = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)();\n const editorConfig = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ config: config })=>config);\n const nodeTypes = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)(({ nodeTypes: nodeTypes })=>nodeTypes);\n (0, $but2J$useEffect)(()=>{\n setPlugins(plugins);\n }, [\n plugins\n ]);\n const [reactflowInstance, setReactflowInstance] = (0, $but2J$useState)(null);\n (0, $but2J$useEffect)(()=>{\n if (!reactflowInstance) return;\n onChange({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel,\n viewport: viewport\n });\n }, [\n nodes,\n edges,\n controlPanel,\n viewport\n ]);\n const onInit = (0, $but2J$useCallback)((rfi)=>{\n if (!reactflowInstance) {\n setReactflowInstance(rfi);\n console.log(\"flow loaded:\", rfi);\n }\n }, [\n reactflowInstance\n ]);\n const { onContextMenu: onEditorContextMenu } = (0, $fee9f929ba5c051a$export$59ce2a6808e35a29)();\n const { onContextMenu: onNodeContextMenu } = (0, $617fd1d922572ac4$export$cbbbfb9fb15f3780)();\n const { onContextMenu: onEdgeContextMenu } = (0, $e54d25e5d65b9790$export$8b2e4a15453bac1e)();\n (0, $but2J$useEffect)(()=>{\n if (!viewport) return;\n reactflowInstance?.setViewport(viewport);\n }, [\n viewport,\n reactflowInstance\n ]);\n (0, $but2J$useOnViewportChange)({\n onEnd: setViewport\n });\n return (0, $but2J$jsxs)((0, $but2J$reactflow), {\n nodes: nodes,\n edges: edges,\n onNodesChange: onNodesChange,\n onNodesDelete: onNodesDelete,\n onEdgesChange: onEdgesChange,\n onConnect: onConnect,\n onNodeDragStop: $6bb27c07aa83529c$var$onNodeDragStop,\n onEdgesDelete: onEdgesDelete,\n onInit: onInit,\n onNodeClick: $6bb27c07aa83529c$var$onNodeClick,\n onContextMenu: onEditorContextMenu,\n onNodeContextMenu: onNodeContextMenu,\n onEdgeContextMenu: onEdgeContextMenu,\n nodeTypes: nodeTypes,\n edgeTypes: edgeTypes,\n snapGrid: $6bb27c07aa83529c$var$snapGrid,\n defaultViewport: editorState?.viewport,\n defaultEdgeOptions: {\n type: \"wire\"\n },\n snapToGrid: true,\n fitView: true,\n disableKeyboardA11y: true,\n children: [\n (0, $but2J$jsx)((0, $but2J$Background), {\n variant: (0, $but2J$BackgroundVariant).Dots,\n gap: 12\n }),\n editorConfig.showMinimap ? (0, $but2J$jsx)((0, $but2J$MiniMap), {}) : null,\n (0, $but2J$jsxs)($6bb27c07aa83529c$var$StyledControls, {\n showInteractive: false,\n position: \"bottom-right\",\n children: [\n (0, $but2J$jsx)((0, $5536f4f171f9bf88$export$2e2bcd8739ae039), {}),\n (0, $but2J$jsx)((0, $5acaa12be69dfa8a$export$78bddedbcf2939ac), {})\n ]\n }),\n (0, $but2J$jsx)((0, $4379ac7ed25061a0$export$2e2bcd8739ae039), {}),\n (0, $but2J$jsx)((0, $8f357eb500334b2f$export$2e2bcd8739ae039), {}),\n (0, $but2J$jsx)((0, $72ce7400f28463b9$export$2e2bcd8739ae039), {}),\n (0, $but2J$jsx)((0, $fee9f929ba5c051a$export$2e2bcd8739ae039), {\n editorContextMenu: editorContextMenu\n }),\n (0, $but2J$jsx)((0, $617fd1d922572ac4$export$2e2bcd8739ae039), {}),\n (0, $but2J$jsx)((0, $e54d25e5d65b9790$export$2e2bcd8739ae039), {})\n ]\n });\n};\nconst $6bb27c07aa83529c$export$7cda8d932e2f33c0 = (props)=>(0, $but2J$jsx)((0, $but2J$ReactFlowProvider), {\n children: (0, $but2J$jsx)($6bb27c07aa83529c$export$72cb76f559fbafcf, {\n ...props\n })\n });\nvar $6bb27c07aa83529c$export$2e2bcd8739ae039 = $6bb27c07aa83529c$export$7cda8d932e2f33c0;\n\n\n\n\n\nconst $1729b5eaa1e6c3bc$export$d31000d36961d6c2 = {\n nodes: [],\n edges: [],\n controlPanel: {\n nodes: [],\n show: false,\n size: {\n width: 200,\n height: 100\n }\n },\n viewport: {\n x: 0,\n y: 0,\n zoom: 1.5\n }\n};\nconst $1729b5eaa1e6c3bc$export$6cd5d5c1dae69a36 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n`);\nconst $1729b5eaa1e6c3bc$export$6bc5189622b1f4ec = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n position: fixed;\n height: 100%;\n width: 100%;\n background: rgba(0, 0, 0, 0.7);\n color: white;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 2rem;\n`);\nconst $1729b5eaa1e6c3bc$export$8d546ef2006cd0a2 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n height: 100%;\n width: 100%;\n display: flex;\n position: relative;\n`);\nconst $1729b5eaa1e6c3bc$export$10efbd348f877f87 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n background: ${({ theme: theme })=>theme.colors.elevation3};\n`);\nconst $1729b5eaa1e6c3bc$export$8c347812506d5ac9 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n background: ${({ theme: theme })=>theme.colors.elevation2};\n opacity: 0.7;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 1;\n font-family: var(--leva-fonts-mono);\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n display: ${({ show: show })=>show ? \"flex\" : \"none\"};\n align-items: center;\n justify-content: center;\n font-size: 6rem;\n`);\nconst $1729b5eaa1e6c3bc$export$b38a2fd24b22fb35 = (props)=>{\n const pullEditorChanges = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.pullEditorChanges);\n const currentFileIndex = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.currentFileIndex);\n const project = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.project);\n const [showLoader, setShowLoader] = (0, $but2J$useState)(true);\n (0, $but2J$useEffect)(()=>{\n props.onChange?.(project);\n }, [\n project,\n props.onChange\n ]);\n (0, $but2J$useEffect)(()=>{\n setShowLoader(true);\n setTimeout(()=>{\n setShowLoader(false);\n }, 1600);\n }, [\n currentFileIndex\n ]);\n const { file: file } = props;\n if (!file) return null;\n if (file.type === \"audio\") return (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$10efbd348f877f87, {\n children: (0, $but2J$jsx)(\"audio\", {\n src: file.file,\n controls: true\n })\n });\n return (0, $but2J$jsxs)((0, $but2J$Fragment), {\n children: [\n (0, $but2J$jsx)((0, $6bb27c07aa83529c$export$7cda8d932e2f33c0), {\n ...props,\n onChange: (state)=>{\n pullEditorChanges();\n },\n editorState: file.file || $1729b5eaa1e6c3bc$export$d31000d36961d6c2\n }),\n (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$8c347812506d5ac9, {\n show: showLoader,\n children: \"Loading...\"\n })\n ]\n });\n};\nconst $1729b5eaa1e6c3bc$export$2206531ad8592d57 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n height: 2rem;\n display: flex;\n align-items: center;\n background: ${({ theme: theme })=>theme.colors.elevation2};\n`);\nconst $1729b5eaa1e6c3bc$export$3e41faf802a29e71 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 100%;\n box-sizing: border-box;\n padding: 0.3rem 0.4rem;\n\n border-right: 1px solid ${({ theme: theme })=>theme.colors.elevation1};\n\n input {\n color: ${({ theme: theme, active: active })=>active ? theme.colors.whitePrimary : theme.colors.highlight1};\n\n &:not([readonly]):focus {\n background-color: ${({ theme: theme })=>theme.colors.elevation1};\n }\n }\n`);\nconst $1729b5eaa1e6c3bc$export$61e5b3c7bace77b8 = (0, $but2J$withTheme)((0, $but2J$emotionstyled).div`\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 0.5rem;\n cursor: pointer;\n\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n`);\nconst $1729b5eaa1e6c3bc$export$3aef34186a092045 = (0, $but2J$withTheme)((0, $but2J$emotionstyled)((0, $but2J$FaPlus))`\n height: 40%;\n width: auto;\n`);\nconst $1729b5eaa1e6c3bc$export$cae179f078f4b4a4 = (0, $but2J$withTheme)((0, $but2J$emotionstyled)((0, $but2J$MdClose))`\n height: 70%;\n width: auto;\n cursor: pointer;\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n`);\nconst $1729b5eaa1e6c3bc$var$generateId = ()=>{\n return (0, $but2J$nanoid)();\n};\nconst $1729b5eaa1e6c3bc$var$generateEmptyFile = ()=>({\n file: $1729b5eaa1e6c3bc$export$d31000d36961d6c2,\n name: \"Unnamed\",\n type: \"patch\",\n id: $1729b5eaa1e6c3bc$var$generateId()\n });\nconst $1729b5eaa1e6c3bc$export$86fbec116b87613f = ({ ...props })=>{\n const { projectState: projectState, theme: theme } = props;\n const currentFileIndex = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.currentFileIndex);\n const currentFile = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.project.files[store.currentFileIndex]);\n const setCurrentFileIndex = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setCurrentFileIndex);\n const project = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.project);\n const setProject = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setProject);\n const getProject = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.getProject);\n const updateFileName = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.updateFileName);\n const addFile = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.addFile);\n const deleteFile = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.deleteFile);\n const syncEditorWithCurrentFile = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.syncEditorWithCurrentFile);\n const setEditorState = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.setEditorState);\n const pullEditorChanges = (0, $40b3df4f7825b834$export$2e2bcd8739ae039)((store)=>store.pullEditorChanges);\n const [isDragging, setIsDragging] = (0, $but2J$useState)(false);\n const handleDragLeave = (e)=>{\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n };\n const handleDragOver = (e)=>{\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(true);\n };\n const handleDrop = (e)=>{\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n const files = Array.from(e.dataTransfer.files);\n files.forEach(async (file)=>{\n if (file.type === \"application/json\") {\n const fileData = JSON.parse(await file.text());\n if (fileData.files && fileData.files.length) {\n if (!window.confirm(\"This action will replace your current project. Continue?\")) return;\n setProject(fileData);\n setCurrentFileIndex(0);\n syncEditorWithCurrentFile();\n return;\n }\n const emptyFile = $1729b5eaa1e6c3bc$var$generateEmptyFile();\n const newGraphState = {\n ...emptyFile,\n file: {\n ...fileData,\n controlPanel: {\n ...$1729b5eaa1e6c3bc$export$d31000d36961d6c2.controlPanel,\n ...fileData.controlPanel\n }\n },\n name: file.name\n };\n addFile(newGraphState, file.name);\n return;\n }\n if (file.type.match(/^audio\\//)) {\n const base64 = await (0, $459a4e08a0372e29$export$25df2e315be8e003)(file);\n addFile({\n type: \"audio\",\n // @TODO: use nanoid here\n id: `audio-file-${+new Date()}`,\n name: file.name,\n file: base64\n });\n return;\n }\n console.error(\"Unsupported file type\", file);\n });\n };\n (0, $but2J$useEffect)(()=>{\n setProject(projectState || {\n files: [\n $1729b5eaa1e6c3bc$var$generateEmptyFile()\n ]\n });\n const file = projectState?.files[0];\n file?.file && file?.type !== \"audio\" && setEditorState(file.file);\n }, [\n projectState\n ]);\n // EXPERIMENTAL CODE\n (0, $but2J$useEffect)(()=>{\n const fetcher = async (...args)=>{\n const request = new Request(...args);\n const files = getProject().files;\n const index = request.url.replace(\"project://\", \"\");\n const file = files.find(({ id: id })=>id === index);\n if (!file) return new Response(`File not found: ${request.url}`, {\n status: 404\n });\n if ((0, $d6879eb00f829ebf$export$e698b79c63b74136)(file)) return new Response(JSON.stringify(file.file ?? null));\n if ((0, $d6879eb00f829ebf$export$31c2336f657dc59f)(file)) return fetch(file.file);\n return new Response(null);\n };\n (0, $but2J$registerFetcher)(\"project://*\", fetcher);\n return ()=>{\n //unregister here\n };\n }, [\n getProject\n ]);\n (0, $but2J$useEffect)(()=>{\n syncEditorWithCurrentFile();\n }, [\n currentFileIndex,\n syncEditorWithCurrentFile\n ]);\n return (0, $but2J$jsxs)((0, $but2J$ThemeProvider), {\n theme: theme || (0, $731cc06061de042d$export$2e2bcd8739ae039),\n children: [\n (0, $but2J$jsx)((0, $but2J$Global), {\n styles: (0, $but2J$css)`\n :root {\n --leva-colors-elevation1: #292d39;\n --leva-colors-elevation2: #181c20;\n --leva-colors-elevation3: #373c4b;\n --leva-colors-accent1: #0066dc;\n --leva-colors-accent2: #007bff;\n --leva-colors-accent3: #3c93ff;\n --leva-colors-highlight1: #535760;\n --leva-colors-highlight2: #8c92a4;\n --leva-colors-highlight3: #fefefe;\n --leva-colors-vivid1: #ffcc00;\n --leva-colors-folderWidgetColor: var(--leva-colors-highlight2);\n --leva-colors-folderTextColor: var(--leva-colors-highlight3);\n --leva-colors-toolTipBackground: var(--leva-colors-highlight3);\n --leva-colors-toolTipText: var(--leva-colors-elevation2);\n --leva-radii-xs: 2px;\n --leva-radii-sm: 3px;\n --leva-radii-lg: 10px;\n --leva-space-xs: 3px;\n --leva-space-sm: 6px;\n --leva-space-md: 10px;\n --leva-space-rowGap: 7px;\n --leva-space-colGap: 7px;\n --leva-fonts-mono:\n ui-monospace, SFMono-Regular, Menlo, \"Roboto Mono\", monospace;\n --leva-fonts-sans: system-ui, sans-serif;\n --leva-fontSizes-root: 11px;\n --leva-fontSizes-toolTip: var(--leva-fontSizes-root);\n --leva-sizes-rootWidth: 280px;\n --leva-sizes-controlWidth: 160px;\n --leva-sizes-numberInputMinWidth: 38px;\n --leva-sizes-scrubberWidth: 8px;\n --leva-sizes-scrubberHeight: 16px;\n --leva-sizes-rowHeight: 24px;\n --leva-sizes-folderTitleHeight: 20px;\n --leva-sizes-checkboxSize: 16px;\n --leva-sizes-joystickWidth: 100px;\n --leva-sizes-joystickHeight: 100px;\n --leva-sizes-colorPickerWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-colorPickerHeight: 100px;\n --leva-sizes-imagePreviewWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-imagePreviewHeight: 100px;\n --leva-sizes-monitorHeight: 60px;\n --leva-sizes-titleBarHeight: 39px;\n --leva-shadows-level1: 0 0 9px 0 #00000088;\n --leva-shadows-level2: 0 4px 14px #00000033;\n --leva-borderWidths-root: 0px;\n --leva-borderWidths-input: 1px;\n --leva-borderWidths-focus: 1px;\n --leva-borderWidths-hover: 1px;\n --leva-borderWidths-active: 1px;\n --leva-borderWidths-folder: 1px;\n --leva-fontWeights-label: normal;\n --leva-fontWeights-folder: normal;\n --leva-fontWeights-button: normal;\n }\n `\n }),\n (0, $but2J$jsxs)($1729b5eaa1e6c3bc$export$6cd5d5c1dae69a36, {\n onDragOver: handleDragOver,\n onDragLeave: handleDragLeave,\n onDrop: handleDrop,\n children: [\n (0, $but2J$jsxs)($1729b5eaa1e6c3bc$export$2206531ad8592d57, {\n children: [\n project.files.map((file, index)=>(0, $but2J$jsxs)($1729b5eaa1e6c3bc$export$3e41faf802a29e71, {\n onClick: ()=>{\n setCurrentFileIndex(index);\n },\n active: index === currentFileIndex,\n children: [\n (0, $but2J$jsx)((0, $cad26a5b9571a093$export$2e2bcd8739ae039), {\n onChange: (val)=>updateFileName(index, val),\n value: file.name || \"Unnamed\"\n }),\n (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$cae179f078f4b4a4, {\n onClick: (event)=>{\n event.stopPropagation();\n if (!window.confirm(\"Do you really want to delete this file?\")) return;\n deleteFile(index);\n if (project.files.length === 1) {\n addFile($1729b5eaa1e6c3bc$var$generateEmptyFile());\n setCurrentFileIndex(0);\n syncEditorWithCurrentFile();\n }\n }\n })\n ]\n }, index)),\n (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$61e5b3c7bace77b8, {\n onClick: ()=>{\n addFile($1729b5eaa1e6c3bc$var$generateEmptyFile());\n setCurrentFileIndex(project.files.length);\n },\n children: (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$3aef34186a092045, {})\n })\n ]\n }),\n (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$8d546ef2006cd0a2, {\n children: (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$b38a2fd24b22fb35, {\n file: currentFile,\n ...props\n })\n }),\n isDragging && (0, $but2J$jsx)($1729b5eaa1e6c3bc$export$6bc5189622b1f4ec, {\n children: \"Drop file(s) to upload to the project\"\n })\n ]\n })\n ]\n });\n};\nvar $1729b5eaa1e6c3bc$export$2e2bcd8739ae039 = $1729b5eaa1e6c3bc$export$86fbec116b87613f;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nexport {$1729b5eaa1e6c3bc$export$2e2bcd8739ae039 as Editor, $1729b5eaa1e6c3bc$export$d31000d36961d6c2 as EDITOR_DEFAULTS, $8b2e0523152bfd06$export$2e2bcd8739ae039 as Wire, $5a72e86517ffe32d$export$361064385d50ec44 as WNNode, $5a72e86517ffe32d$export$7e0b3af1e60a3273 as TitleBar, $5a72e86517ffe32d$export$bfd3bd1fa283e3c6 as PortsPanel, $5a72e86517ffe32d$export$af4f9b41fc32ed9e as OutputPorts, $5a72e86517ffe32d$export$496e5e1ee1696f64 as OutputHandle, $5a72e86517ffe32d$export$f1afba0ff9ea1277 as InputPorts, $5a72e86517ffe32d$export$9ea0feffc20ee81 as InputHandle, $5a72e86517ffe32d$export$a2d375858cc72119 as Port, $628ee4b8a62b71a2$export$2e2bcd8739ae039 as Modal, $cad26a5b9571a093$export$2e2bcd8739ae039 as EditableLabel, $027dbe8e99154283$export$2e2bcd8739ae039 as useAudioNode, $9630f1cf400b3c5a$export$2e2bcd8739ae039 as useNode, $04218161d9aa484d$export$2e2bcd8739ae039 as useTheme, $40b3df4f7825b834$export$2e2bcd8739ae039 as useStore, $731cc06061de042d$export$2e2bcd8739ae039 as theme, $d6879eb00f829ebf$export$31c2336f657dc59f as isAudio, $d6879eb00f829ebf$export$e698b79c63b74136 as isPatch, $73e253e9a60dc018$export$b0b7b95ee465c83c as PortType};\n//# sourceMappingURL=module.js.map\n","export { default as Editor, EDITOR_DEFAULTS } from \"./src/components/App\";\nexport { default as Wire } from \"./src/components/Wire\";\nexport {\n WNNode,\n TitleBar,\n type WNNodeProps,\n PortsPanel,\n OutputPorts,\n OutputHandle,\n InputPorts,\n InputHandle,\n Port,\n} from \"./src/components/Node\";\nexport { default as Modal } from \"./src/components/Modal\";\nexport { default as EditableLabel } from \"./src/components/EditableLabel\";\nexport { default as useAudioNode } from \"./src/hooks/useAudioNode\";\nexport { default as useNode } from \"./src/hooks/useNode\";\nexport { default as useTheme } from \"./src/hooks/useTheme\";\nexport { default as useStore } from \"./src/store\";\nexport { default as theme } from \"./src/theme\";\nexport { isAudio, isPatch } from \"./src/helpers/projectFile\";\n\nexport { PortType } from \"./src/constants\";\n\nexport type {\n WNAudioNode,\n CreateWNAudioNode,\n ControlPanelNodeProps,\n PluginConfig,\n PluginComponent,\n ControlPanelNode,\n WNNodeData,\n WNNode as TWNNode,\n InputPort,\n OutputPort,\n EditorState,\n Project,\n WNEdge as TWNEdge,\n EditorStoreState,\n} from \"./src/types\";\n\nexport type { Theme } from \"./src/theme\";\n","import { css, Global, ThemeProvider, withTheme } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\nimport { nanoid } from \"nanoid\";\nimport { ComponentProps, ReactNode, useEffect, useMemo, useState } from \"react\";\nimport { FaPlus as IconAdd } from \"react-icons/fa6\";\nimport { MdClose } from \"react-icons/md\";\nimport { registerFetcher } from \"@web-noise/fetch\";\nimport useStore from \"../store\";\nimport \"../styles\";\nimport defaultTheme, { Theme } from \"../theme\";\nimport type {\n EditorFile,\n EditorState,\n PluginConfig,\n Project,\n ProjectFile,\n} from \"../types\";\nimport { Editor } from \"./Editor\";\nimport EditableLabel from \"./EditableLabel\";\nimport { isAudio, isPatch } from \"../helpers/projectFile\";\nimport { fileToBase64 } from \"../lib\";\nimport { ProjectState } from \"../store/projectStore\";\n\n// @TODO: move default state to editor\nexport const EDITOR_DEFAULTS = {\n nodes: [],\n edges: [],\n controlPanel: {\n nodes: [],\n show: false,\n size: {\n width: 200,\n height: 100,\n },\n },\n viewport: { x: 0, y: 0, zoom: 1.5 },\n};\n\nexport const AppWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n`);\n\nexport const FileUploadLayout = withTheme(styled.div<{ theme: Theme }>`\n position: fixed;\n height: 100%;\n width: 100%;\n background: rgba(0, 0, 0, 0.7);\n color: white;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 2rem;\n`);\n\nexport const EditorContainerWrapper = withTheme(styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n display: flex;\n position: relative;\n`);\n\nexport const AudioTabWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n background: ${({ theme }) => theme.colors.elevation3};\n`);\n\nexport const EditorLoadingOverlay = withTheme(styled.div<{\n theme: Theme;\n show: boolean;\n}>`\n background: ${({ theme }) => theme.colors.elevation2};\n opacity: 0.7;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 1;\n font-family: var(--leva-fonts-mono);\n color: ${({ theme }) => theme.colors.whitePrimary};\n display: ${({ show }) => (show ? \"flex\" : \"none\")};\n align-items: center;\n justify-content: center;\n font-size: 6rem;\n`);\n\ntype EditorContainerProps = AppProps & {\n file: ProjectFile;\n};\n\nexport const EditorContainer = (props: EditorContainerProps) => {\n const pullEditorChanges = useStore((store) => store.pullEditorChanges);\n const currentFileIndex = useStore((store) => store.currentFileIndex);\n const project = useStore((store) => store.project);\n\n const [showLoader, setShowLoader] = useState(true);\n\n useEffect(() => {\n props.onChange?.(project);\n }, [project, props.onChange]);\n\n useEffect(() => {\n setShowLoader(true);\n setTimeout(() => {\n setShowLoader(false);\n }, 1600);\n }, [currentFileIndex]);\n\n const { file } = props;\n if (!file) return null;\n\n if (file.type === \"audio\") {\n return (\n <AudioTabWrapper>\n <audio src={file.file} controls />\n </AudioTabWrapper>\n );\n }\n\n return (\n <>\n <Editor\n {...props}\n onChange={(state) => {\n pullEditorChanges();\n }}\n editorState={(file as EditorFile).file || EDITOR_DEFAULTS}\n />\n\n <EditorLoadingOverlay show={showLoader}>Loading...</EditorLoadingOverlay>\n </>\n );\n};\n\nexport const TabsContainer = withTheme(styled.div<{ theme: Theme }>`\n height: 2rem;\n display: flex;\n align-items: center;\n background: ${({ theme }) => theme.colors.elevation2};\n`);\n\nexport const Tab = withTheme(styled.div<{ theme: Theme; active?: boolean }>`\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 100%;\n box-sizing: border-box;\n padding: 0.3rem 0.4rem;\n\n border-right: 1px solid ${({ theme }) => theme.colors.elevation1};\n\n input {\n color: ${({ theme, active }) =>\n active ? theme.colors.whitePrimary : theme.colors.highlight1};\n\n &:not([readonly]):focus {\n background-color: ${({ theme }) => theme.colors.elevation1};\n }\n }\n`);\n\nexport const TabIconWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 0.5rem;\n cursor: pointer;\n\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n`);\n\nexport const AddFileIcon = withTheme(styled(IconAdd)<{ theme: Theme }>`\n height: 40%;\n width: auto;\n`);\n\nexport const CloseIcon = withTheme(styled(MdClose)<{ theme: Theme }>`\n height: 70%;\n width: auto;\n cursor: pointer;\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n`);\n\nconst generateId = (): string => {\n return nanoid();\n};\n\nconst generateEmptyFile = (): ProjectFile => ({\n file: EDITOR_DEFAULTS,\n name: \"Unnamed\",\n type: \"patch\",\n id: generateId(),\n});\n\ninterface AppProps {\n projectState?: Project;\n plugins?: Array<PluginConfig>;\n editorContextMenu?: Array<ReactNode>;\n onChange?: (project: Project) => void;\n theme?: Theme;\n}\n\nexport const App = ({ ...props }: AppProps) => {\n const { projectState, theme } = props;\n const currentFileIndex = useStore((store) => store.currentFileIndex);\n const currentFile = useStore(\n (store) => store.project.files[store.currentFileIndex],\n );\n const setCurrentFileIndex = useStore((store) => store.setCurrentFileIndex);\n\n const project = useStore((store) => store.project);\n const setProject = useStore((store) => store.setProject);\n const getProject = useStore((store) => store.getProject);\n const updateFileName = useStore((store) => store.updateFileName);\n\n const addFile = useStore((store) => store.addFile);\n const deleteFile = useStore((store) => store.deleteFile);\n const syncEditorWithCurrentFile = useStore(\n (store) => store.syncEditorWithCurrentFile,\n );\n\n const setEditorState = useStore((store) => store.setEditorState);\n const pullEditorChanges = useStore((store) => store.pullEditorChanges);\n\n const [isDragging, setIsDragging] = useState(false);\n\n const handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n };\n\n const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(true);\n };\n\n const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n\n setIsDragging(false);\n\n const files = Array.from(e.dataTransfer.files);\n files.forEach(async (file) => {\n if (file.type === \"application/json\") {\n const fileData = JSON.parse(await file.text());\n if (fileData.files && fileData.files.length) {\n if (\n !window.confirm(\n \"This action will replace your current project. Continue?\",\n )\n ) {\n return;\n }\n setProject(fileData);\n setCurrentFileIndex(0);\n syncEditorWithCurrentFile();\n return;\n }\n const emptyFile = generateEmptyFile();\n const newGraphState = {\n ...emptyFile,\n file: {\n ...fileData,\n controlPanel: {\n ...EDITOR_DEFAULTS.controlPanel,\n ...fileData.controlPanel,\n },\n },\n name: file.name,\n };\n addFile(newGraphState, file.name);\n return;\n }\n if (file.type.match(/^audio\\//)) {\n const base64 = await fileToBase64(file);\n addFile({\n type: \"audio\",\n // @TODO: use nanoid here\n id: `audio-file-${+new Date()}`,\n name: file.name,\n file: base64,\n });\n return;\n }\n console.error(\"Unsupported file type\", file);\n });\n };\n\n useEffect(() => {\n setProject(\n projectState || {\n files: [generateEmptyFile()],\n },\n );\n const file = projectState?.files[0];\n file?.file && file?.type !== \"audio\" && setEditorState(file.file);\n }, [projectState]);\n\n // EXPERIMENTAL CODE\n useEffect(() => {\n const fetcher: typeof fetch = async (...args) => {\n const request = new Request(...args);\n const files = getProject().files;\n const index = request.url.replace(\"project://\", \"\");\n const file = files.find(({ id }) => id === index);\n\n if (!file) {\n return new Response(`File not found: ${request.url}`, { status: 404 });\n }\n\n if (isPatch(file)) {\n return new Response(JSON.stringify(file.file ?? null));\n }\n\n if (isAudio(file)) {\n return fetch(file.file);\n }\n\n return new Response(null);\n };\n registerFetcher(\"project://*\", fetcher);\n return () => {\n //unregister here\n };\n }, [getProject]);\n\n useEffect(() => {\n syncEditorWithCurrentFile();\n }, [currentFileIndex, syncEditorWithCurrentFile]);\n\n return (\n <ThemeProvider theme={theme || defaultTheme}>\n <Global\n styles={css`\n :root {\n --leva-colors-elevation1: #292d39;\n --leva-colors-elevation2: #181c20;\n --leva-colors-elevation3: #373c4b;\n --leva-colors-accent1: #0066dc;\n --leva-colors-accent2: #007bff;\n --leva-colors-accent3: #3c93ff;\n --leva-colors-highlight1: #535760;\n --leva-colors-highlight2: #8c92a4;\n --leva-colors-highlight3: #fefefe;\n --leva-colors-vivid1: #ffcc00;\n --leva-colors-folderWidgetColor: var(--leva-colors-highlight2);\n --leva-colors-folderTextColor: var(--leva-colors-highlight3);\n --leva-colors-toolTipBackground: var(--leva-colors-highlight3);\n --leva-colors-toolTipText: var(--leva-colors-elevation2);\n --leva-radii-xs: 2px;\n --leva-radii-sm: 3px;\n --leva-radii-lg: 10px;\n --leva-space-xs: 3px;\n --leva-space-sm: 6px;\n --leva-space-md: 10px;\n --leva-space-rowGap: 7px;\n --leva-space-colGap: 7px;\n --leva-fonts-mono:\n ui-monospace, SFMono-Regular, Menlo, \"Roboto Mono\", monospace;\n --leva-fonts-sans: system-ui, sans-serif;\n --leva-fontSizes-root: 11px;\n --leva-fontSizes-toolTip: var(--leva-fontSizes-root);\n --leva-sizes-rootWidth: 280px;\n --leva-sizes-controlWidth: 160px;\n --leva-sizes-numberInputMinWidth: 38px;\n --leva-sizes-scrubberWidth: 8px;\n --leva-sizes-scrubberHeight: 16px;\n --leva-sizes-rowHeight: 24px;\n --leva-sizes-folderTitleHeight: 20px;\n --leva-sizes-checkboxSize: 16px;\n --leva-sizes-joystickWidth: 100px;\n --leva-sizes-joystickHeight: 100px;\n --leva-sizes-colorPickerWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-colorPickerHeight: 100px;\n --leva-sizes-imagePreviewWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-imagePreviewHeight: 100px;\n --leva-sizes-monitorHeight: 60px;\n --leva-sizes-titleBarHeight: 39px;\n --leva-shadows-level1: 0 0 9px 0 #00000088;\n --leva-shadows-level2: 0 4px 14px #00000033;\n --leva-borderWidths-root: 0px;\n --leva-borderWidths-input: 1px;\n --leva-borderWidths-focus: 1px;\n --leva-borderWidths-hover: 1px;\n --leva-borderWidths-active: 1px;\n --leva-borderWidths-folder: 1px;\n --leva-fontWeights-label: normal;\n --leva-fontWeights-folder: normal;\n --leva-fontWeights-button: normal;\n }\n `}\n />\n <AppWrapper\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n >\n <TabsContainer>\n {project.files.map((file, index) => (\n <Tab\n onClick={() => {\n setCurrentFileIndex(index);\n }}\n key={index}\n active={index === currentFileIndex}\n >\n <EditableLabel\n onChange={(val) => updateFileName(index, val)}\n value={file.name || \"Unnamed\"}\n />\n <CloseIcon\n onClick={(event) => {\n event.stopPropagation();\n if (\n !window.confirm(\"Do you really want to delete this file?\")\n ) {\n return;\n }\n deleteFile(index);\n if (project.files.length === 1) {\n addFile(generateEmptyFile());\n setCurrentFileIndex(0);\n syncEditorWithCurrentFile();\n }\n }}\n />\n </Tab>\n ))}\n <TabIconWrapper\n onClick={() => {\n addFile(generateEmptyFile());\n setCurrentFileIndex(project.files.length);\n }}\n >\n <AddFileIcon />\n </TabIconWrapper>\n </TabsContainer>\n <EditorContainerWrapper>\n <EditorContainer file={currentFile!} {...props} />\n </EditorContainerWrapper>\n {isDragging && (\n <FileUploadLayout>\n Drop file(s) to upload to the project\n </FileUploadLayout>\n )}\n </AppWrapper>\n </ThemeProvider>\n );\n};\n\nexport default App;\n","import {\n addEdge,\n getConnectedEdges,\n NodeTypes,\n OnConnect,\n Viewport,\n} from \"reactflow\";\nimport { create, StateCreator } from \"zustand\";\nimport { setAudioNodeTypes, AudioNodeTypes } from \"@web-noise/patch\";\nimport { CONTROL_PANEL_GRID_CONFIG } from \"../constants\";\nimport generateNodeId from \"../helpers/generateNodeId\";\nimport {\n ControlPanelNode,\n ControlPanelNodes,\n PluginComponent,\n PluginConfig,\n WNEdge,\n WNNode,\n GraphState,\n EditorState,\n ControlPanelState,\n EditorStoreState,\n} from \"../types\";\nimport nodesStateCreator, { NodesState } from \"./nodesStore\";\nimport history, { historyStateCreator, HistoryState } from \"./history\";\nimport audioPatch, {\n AudioPatchState,\n audioPatchStateCreator,\n} from \"./audioPatch\";\nimport projectStateCreator, { ProjectState } from \"./projectStore\";\n\nexport type { AudioNodeTypes, NodesState, GraphState };\n\ninterface EditorConfig {\n showMinimap: boolean;\n}\n\ntype NodesConfiguration = Record<string, PluginComponent>;\n\nexport type StoreState = NodesState &\n HistoryState &\n ProjectState &\n AudioPatchState & {\n setGraph: (elements: { nodes: WNNode[]; edges: WNEdge[] }) => Promise<void>;\n clearGraph: () => void;\n createNode: (node: WNNode) => void;\n createNodes: (node: WNNode[]) => Promise<void>;\n removeNode: (node: WNNode) => void;\n removeNodes: (nodes: WNNode[]) => void;\n removeEdges: (nodes: WNEdge[]) => void;\n onConnect: OnConnect;\n createEdges: (edge: WNEdge[]) => void;\n onEdgesDelete: (edges: WNEdge[]) => void;\n onNodesDelete: (nodes: WNNode[]) => Promise<void>;\n plugins: Array<PluginConfig>;\n setPlugins: (plugins: Array<PluginConfig>) => void;\n nodesConfiguration: NodesConfiguration;\n config: EditorConfig;\n setConfig: (config: Partial<EditorConfig>) => void;\n getEditorState: () => EditorState;\n setEditorState: (state: EditorState) => Promise<void>;\n isHelpShown: boolean;\n toggleHelp: () => void;\n copyBuffer: { nodes: WNNode[]; edges: WNEdge[] };\n copy: (elements: { nodes: WNNode[]; edges: WNEdge[] }) => void;\n copySelectedItems: () => void;\n pasteBuffer: (x: number, y: number) => void;\n /* move to control panel store */\n getControlPanelNode: (node: WNNode) => ControlPanelNode | null;\n controlPanel: ControlPanelState;\n setControlPanelNodes: (nodes: ControlPanelNodes) => void;\n showControlPanel: () => void;\n hideControlPanel: () => void;\n setControlPanelSize: (width: { width: number; height: number }) => void;\n addNodeToControlPanel: (node: WNNode) => void;\n removeNodeFromControlPanel: (node: WNNode) => void;\n removeNodesFromControlPanel: (nodes: WNNode[]) => void;\n /* / move to control panel store */\n viewport: Viewport;\n setViewport: (viewport: Viewport) => void;\n };\n\nexport const stateCreator: StateCreator<StoreState> = (...args) => {\n const [set, get] = args;\n return {\n ...nodesStateCreator(...args),\n ...historyStateCreator(...args),\n ...audioPatchStateCreator(...args),\n ...projectStateCreator(...args),\n\n setGraph: async ({ nodes, edges }) => {\n const {\n patch,\n createNodes,\n createEdges,\n setNodesAndEdges,\n nodes: activeNodes,\n edges: activeEdges,\n } = get();\n setNodesAndEdges({ nodes: [], edges: [] });\n\n await createNodes(nodes);\n createEdges(edges);\n },\n clearGraph: () => {\n const { setGraph } = get();\n setGraph({ nodes: [], edges: [] });\n },\n createNodes: async (nodes) => {\n const { createNode } = get();\n await Promise.all(nodes.map((node) => createNode(node)));\n },\n createNode: (nodeData) => {\n const { addNode, nodesConfiguration } = get();\n\n const { type, id, data } = nodeData;\n\n if (typeof type === \"undefined\") {\n throw new Error(`node type is not defined for node: ${id}`);\n }\n\n const node = {\n ...nodeData,\n data: {\n ...data,\n config: {\n ...nodesConfiguration[type]?.defaultConfig,\n ...data?.config,\n },\n },\n };\n\n addNode(node);\n },\n removeNode: (node) => get().removeNodes([node]),\n removeNodes: (nodes) => {\n const {\n edges,\n nodes: currentNodes,\n onNodesDelete,\n removeEdges,\n removeNodesFromControlPanel,\n } = get();\n const parentNodeIds = nodes.map(({ id }) => id);\n const children = currentNodes.filter(\n ({ parentNode }) => parentNode && parentNodeIds.includes(parentNode),\n );\n const resultingNodes = [...nodes, ...children];\n removeNodesFromControlPanel(resultingNodes);\n const connectedEdges = getConnectedEdges(resultingNodes, edges);\n removeEdges(connectedEdges);\n onNodesDelete(resultingNodes);\n const nodeIds = resultingNodes.map(({ id }) => id);\n set({\n nodes: currentNodes.filter(({ id }) => !nodeIds.includes(id)),\n });\n },\n removeEdges: (edges) => {\n const { edges: currentEdges, onEdgesDelete } = get();\n const edgeIds = edges.map(({ id }) => id);\n onEdgesDelete(edges);\n set({\n edges: currentEdges.filter(({ id }) => !edgeIds.includes(id)),\n });\n },\n createEdges: (newEdges) => {\n const { patch, edges, setEdges } = get();\n setEdges(newEdges);\n },\n onConnect: async (connection) => {\n const { edges, createEdges } = get();\n const newEdges = addEdge(connection, edges);\n createEdges(newEdges);\n },\n onEdgesDelete: (edges) => {\n const { patch } = get();\n },\n onNodesDelete: async (nodes) => {\n const { removeNodesFromControlPanel, patch } = get();\n removeNodesFromControlPanel(nodes);\n },\n plugins: [],\n setPlugins: async (plugins) => {\n const { setNodeTypes } = get();\n set({ plugins });\n\n const nodesConf: NodesConfiguration = plugins.reduce((acc, plugin) => {\n return {\n ...acc,\n ...plugin.components.reduce(\n (subAcc, item) => ({\n ...subAcc,\n [item.type]: item,\n }),\n {},\n ),\n };\n }, {});\n\n const nodeTypes: NodeTypes = Object.keys(nodesConf).reduce(\n (acc, type) => {\n return {\n ...acc,\n [type]: nodesConf[type].node,\n };\n },\n {},\n );\n\n const audioNodeTypes: AudioNodeTypes = Object.keys(nodesConf).reduce(\n (acc, type) => {\n return {\n ...acc,\n [type]: nodesConf[type].audioNode,\n };\n },\n {},\n );\n\n setAudioNodeTypes(audioNodeTypes);\n setNodeTypes(nodeTypes);\n\n set(({ nodesConfiguration }) => ({\n nodesConfiguration: { ...nodesConfiguration, ...nodesConf },\n }));\n },\n nodesConfiguration: {},\n config: { showMinimap: false },\n setConfig: (changes) => {\n set(({ config }) => ({ config: { ...config, ...changes } }));\n },\n getEditorState: () => {\n const { getNodesAndEdges, controlPanel, viewport } = get();\n return {\n ...getNodesAndEdges(),\n controlPanel,\n viewport,\n };\n },\n setEditorState: async ({ nodes, edges, controlPanel, viewport }) => {\n const { setGraph } = get();\n await setGraph({ nodes, edges });\n // @TODO: remove this line once audio patch initialisation is reworked\n await new Promise((r) => setTimeout(r, 1000));\n set({\n controlPanel,\n viewport,\n });\n },\n isHelpShown: false,\n toggleHelp: () => {\n const { isHelpShown: showHelp } = get();\n set({ isHelpShown: !showHelp });\n },\n copyBuffer: { nodes: [], edges: [] },\n copy: (elements) => {\n set({ copyBuffer: elements });\n },\n copySelectedItems: () => {\n const { nodes: currentNodes, edges: currentEdges, copy } = get();\n const nodes = currentNodes.filter(({ selected }) => selected);\n const edges = currentEdges.filter(({ selected }) => selected);\n if (!nodes.length) {\n return;\n }\n copy({ nodes, edges });\n },\n pasteBuffer: (x = 0, y = 0) => {\n const { copyBuffer, createNodes, setEdges, nodes, edges } = get();\n const { nodes: nodesToCopy, edges: edgesToCopy } = copyBuffer;\n\n if (!nodesToCopy.length) {\n return;\n }\n\n set({\n nodes: nodes.map((node) => ({ ...node, selected: false })),\n });\n\n const topLeftNode = nodesToCopy.reduce((acc, node) => {\n if (!acc) {\n return node;\n }\n if (\n node.position.x < acc.position.x &&\n node.position.y < acc.position.y\n ) {\n return node;\n }\n return acc;\n });\n\n const xDelta = topLeftNode.position.x - x;\n const yDelta = topLeftNode.position.y - y;\n\n const { nodes: newNodes, mapping } = nodesToCopy.reduce(\n (acc, node) => {\n const newNodeId = generateNodeId(node);\n return {\n nodes: [\n ...acc.nodes,\n {\n ...node,\n id: newNodeId,\n position: {\n x: node.position.x - xDelta,\n y: node.position.y - yDelta,\n },\n selected: true,\n },\n ],\n mapping: {\n ...acc.mapping,\n [node.id]: newNodeId,\n },\n };\n },\n { nodes: [], mapping: {} } as {\n nodes: Array<WNNode>;\n mapping: Record<WNNode[\"id\"], WNNode[\"id\"]>;\n },\n );\n createNodes(newNodes);\n\n const newEdges = edgesToCopy.map((edge) => {\n const source = mapping[edge.source] || edge.source;\n const target = mapping[edge.target] || edge.target;\n return {\n ...edge,\n id: edge.id.replace(edge.source, source).replace(edge.target, target),\n source,\n target,\n selected: true,\n };\n });\n setEdges([\n ...edges.map((edge) => ({ ...edge, selected: false })),\n ...newEdges,\n ]);\n },\n getControlPanelNode: (node) => {\n const { nodesConfiguration } = get();\n const { type } = node;\n if (!type) {\n return null;\n }\n const controlPanelNode = nodesConfiguration[type]?.controlPanelNode;\n if (!controlPanelNode) {\n console.error(`could not find node for type ${type}`);\n return null;\n }\n return controlPanelNode;\n },\n controlPanel: {\n show: true,\n nodes: [],\n size: {\n width: 200,\n height: 100,\n },\n },\n showControlPanel: () =>\n set(({ controlPanel }) => ({\n controlPanel: { ...controlPanel, show: true },\n })),\n hideControlPanel: () =>\n set(({ controlPanel }) => ({\n controlPanel: { ...controlPanel, show: false },\n })),\n addNodeToControlPanel: (node) => {\n const { nodesConfiguration } = get();\n const defaultConfig = node.type\n ? nodesConfiguration[node.type]?.defaultConfig\n : {};\n const { height } = defaultConfig?.size || {};\n const newNode = {\n id: node.id,\n ...(height\n ? { height: height / CONTROL_PANEL_GRID_CONFIG.rowHeight }\n : {}),\n };\n set(({ controlPanel }) => ({\n controlPanel: {\n ...controlPanel,\n nodes: [...controlPanel.nodes, newNode],\n },\n }));\n },\n removeNodeFromControlPanel: (node) =>\n get().removeNodesFromControlPanel([node]),\n removeNodesFromControlPanel: (nodes) => {\n const nodeIds = nodes.map(({ id }) => id);\n set(({ controlPanel }) => {\n const nodes = controlPanel.nodes.filter(\n ({ id }) => !nodeIds.includes(id),\n );\n return {\n controlPanel: {\n ...controlPanel,\n nodes,\n },\n };\n });\n },\n setControlPanelNodes: (nodes) => {\n set(({ controlPanel }) => {\n return {\n controlPanel: {\n ...controlPanel,\n nodes,\n },\n };\n });\n },\n setControlPanelSize: (size) => {\n set(({ controlPanel }) => {\n return {\n controlPanel: {\n ...controlPanel,\n size,\n },\n };\n });\n },\n\n viewport: { x: 0, y: 0, zoom: 1 },\n setViewport: (viewport) => set({ viewport }),\n };\n};\n\nconst useStore = create<StoreState>(audioPatch(history(stateCreator)));\n\nexport default useStore;\n","export const DRAG_HANDLE_CLASS = \"web-noise-drag-handle\";\nexport const DRAG_HANDLE_SELECTOR = `.${DRAG_HANDLE_CLASS}`;\n\nexport const CONTROL_PANEL_GRID_CONFIG = {\n rowHeight: 10,\n cols: 4,\n};\n\nexport enum PortType {\n Gate = \"gate\",\n Number = \"number\",\n Audio = \"audio\",\n Any = \"any\",\n}\n","import { WNNode } from \"../types\";\n\nconst generateNodeId = (node?: Partial<WNNode>): WNNode[\"id\"] => {\n const random = +new Date() + Math.floor(Math.random() * 1000);\n if (!node?.type) {\n return random.toString();\n }\n return `${node.type}-${random}`;\n};\n\nexport default generateNodeId;\n","import {\n addEdge,\n applyEdgeChanges,\n applyNodeChanges,\n OnConnect,\n OnEdgesChange,\n OnNodesChange,\n NodeTypes,\n} from \"reactflow\";\nimport { StateCreator } from \"zustand\";\nimport { DRAG_HANDLE_SELECTOR } from \"../constants\";\nimport type { WNNode, WNNodeData, WNEdge, GraphState } from \"../types\";\n\n//@TODO: rename to NodesStore\nexport interface NodesState {\n nodes: WNNode[];\n edges: WNEdge[];\n onNodesChange: OnNodesChange;\n onEdgesChange: OnEdgesChange;\n onConnect: OnConnect;\n addNode: (node: WNNode) => void;\n setNodes: (nodes: WNNode[]) => void;\n setEdges: (edges: WNEdge[]) => void;\n setNodesAndEdges: (elements: GraphState) => void;\n getNodesAndEdges: () => GraphState;\n clearElements: () => void;\n getNode: (id: string) => WNNode | null;\n updateNodeData: (id: string, data: Partial<WNNodeData>) => void;\n nodeTypes: NodeTypes;\n setNodeTypes: (nodeTypes: NodeTypes) => void;\n}\n\nconst nodesStateCreator: StateCreator<NodesState> = (set, get) => ({\n nodes: [],\n edges: [],\n onNodesChange: (changes) => {\n set(({ nodes }) => ({\n nodes: applyNodeChanges(changes, nodes).map((node) => ({\n dragHandle: DRAG_HANDLE_SELECTOR,\n ...node,\n })),\n }));\n },\n onEdgesChange: (changes) => {\n set(({ edges }) => ({\n edges: applyEdgeChanges(changes, edges),\n }));\n },\n onConnect: (connection) => {\n set(({ edges }) => ({\n edges: addEdge(connection, edges),\n }));\n },\n addNode: (node) => {\n set(({ nodes }) => ({\n nodes: nodes.concat(node),\n }));\n },\n setNodes: (nodes) => {\n set({\n nodes,\n });\n },\n setEdges: (edges) => {\n set({\n edges,\n });\n },\n setNodesAndEdges: ({ nodes, edges }) => {\n set({\n nodes,\n edges,\n });\n },\n getNodesAndEdges: () => {\n const { nodes, edges } = get();\n return { nodes, edges };\n },\n clearElements: () => {\n set({\n nodes: [],\n edges: [],\n });\n },\n getNode: (id) => {\n const { nodes } = get();\n const node = nodes.find((node) => node.id === id);\n return node || null;\n },\n updateNodeData: (id, data) => {\n set(({ nodes }) => {\n return {\n nodes: nodes.map((node) => {\n if (node.id === id) {\n return {\n ...node,\n data: {\n ...node.data,\n ...data,\n },\n };\n }\n\n return node;\n }),\n };\n });\n },\n nodeTypes: {},\n setNodeTypes: (nodeTypes) => set({ nodeTypes }),\n});\n\nexport default nodesStateCreator;\n","import type { StateCreator } from \"zustand\";\nimport type { StoreState } from \"../\";\nimport * as jsondiffpatch from \"jsondiffpatch\";\nimport type { Delta, FilterContext } from \"jsondiffpatch\";\n\nexport interface HistoryState {\n history: {\n maxHistoryLength: number;\n buffer: Array<Delta>;\n pointer: number;\n skipCollect: boolean;\n push: (changes: Delta) => void;\n back: () => void;\n forward: () => void;\n clear: () => void;\n };\n}\n\nconst cloneObject = <T = unknown>(input: T): T => {\n return JSON.parse(JSON.stringify(input));\n};\n\nexport const historyStateCreator: StateCreator<HistoryState> = (set, get) => ({\n history: {\n maxHistoryLength: 5,\n buffer: [],\n pointer: 0,\n skipCollect: false,\n push: (changes: Delta) => {\n const { history } = get();\n const { maxHistoryLength, skipCollect } = history;\n\n if (skipCollect) {\n set({\n history: {\n ...history,\n skipCollect: false,\n },\n });\n return;\n }\n\n set(({ history }) => {\n if (!history) {\n return {};\n }\n const { buffer, pointer } = history;\n\n const newBuffer = buffer.slice(\n Math.max(pointer - maxHistoryLength + 1, 0),\n pointer,\n );\n\n return {\n history: {\n ...history,\n buffer: [...newBuffer, changes],\n pointer: Math.min(pointer + 1, maxHistoryLength),\n },\n };\n });\n },\n back: () => {\n const { nodes, edges, controlPanel, history } = get() as StoreState;\n const { buffer, pointer } = history;\n\n const patchData = buffer[pointer - 1];\n if (!patchData) {\n return;\n }\n\n const reversedPatchData = jsondiffpatch.reverse(patchData);\n if (!reversedPatchData) {\n return;\n }\n\n const updates = cloneObject({\n nodes,\n edges,\n controlPanel,\n });\n\n const patch = jsondiffpatch.patch(updates, reversedPatchData);\n\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer - 1,\n skipCollect: true,\n },\n });\n },\n forward: () => {\n const { nodes, edges, controlPanel, history } = get() as StoreState;\n const { buffer, pointer } = history;\n\n const patchData = buffer[pointer];\n if (!patchData) {\n return;\n }\n\n const updates = cloneObject({\n nodes,\n edges,\n controlPanel,\n });\n\n const patch = jsondiffpatch.patch(updates, patchData);\n\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer + 1,\n skipCollect: true,\n },\n });\n },\n // @TODO: remove this method and store history per file\n clear: () => {\n const { history } = get();\n set({\n history: {\n ...history,\n buffer: [],\n pointer: 0,\n skipCollect: true,\n },\n });\n },\n },\n});\n\nconst COLLECT_CHANGES_DEBOUNCE_TIME = 500;\n\nexport const createChangesCollector = (set: any, get: () => StoreState) => {\n const jsondiffpatchInstance = jsondiffpatch.create({\n propertyFilter: (name: string, context: FilterContext) => {\n //@TODO: rework this function, find better solution\n if (context.parent?.parent?.childName === \"controlPanel\") {\n return true;\n }\n if (\n // @ts-ignore\n [\"data\", \"position\", \"controlPanel\"].includes(context.parent?.childName)\n ) {\n return true;\n }\n return [\n \"controlPanel\",\n \"size\",\n \"edges\",\n\n \"nodes\",\n \"data\",\n \"label\",\n \"config\",\n \"values\",\n\n \"position\",\n \"x\",\n \"y\",\n ].includes(name);\n },\n });\n let oldState: StoreState | null = get();\n let timer: any;\n\n return (state: StoreState, prevState: StoreState) => {\n if (state.currentFileIndex !== prevState.currentFileIndex) {\n get().history.clear();\n }\n clearTimeout(timer);\n if (!oldState) {\n oldState = prevState;\n }\n timer = setTimeout(() => {\n const changes = jsondiffpatchInstance.diff(oldState, state);\n oldState = null;\n\n if (changes) {\n get().history.push(changes);\n }\n }, COLLECT_CHANGES_DEBOUNCE_TIME);\n };\n};\n\ntype StoreStateCreator = StateCreator<StoreState>;\n\nconst history =\n (config: StoreStateCreator): StoreStateCreator =>\n (set, get, api) => {\n const collectChanges = createChangesCollector(set, get);\n api.subscribe(collectChanges);\n return config((...args) => set(...args), get, api);\n };\n\nexport default history;\n","import { createPatch, Patch } from \"@web-noise/patch\";\nimport type { StateCreator } from \"zustand\";\nimport type { StoreState } from \"../\";\nimport { compareGraphs } from \"./compareGraphs\";\n\ntype StoreStateCreator = StateCreator<StoreState>;\nexport interface AudioPatchState {\n patch: Patch;\n nodesState: Record<string, any>;\n}\n\nexport const audioPatchStateCreator: StateCreator<AudioPatchState> = (\n set,\n get,\n) => ({\n patch: createPatch(),\n nodesState: {},\n});\n\nconst audioPatch =\n (config: StoreStateCreator): StoreStateCreator =>\n (set, get, api) => {\n api.subscribe(async (state, prevState) => {});\n\n const promises = new Set<Promise<unknown>>();\n\n let currentState = {\n ...get(),\n nodes: [],\n edges: [],\n };\n\n return config(\n async (...args) => {\n const oldState = get();\n const [storeChanges] = args;\n\n //@ts-ignore\n const newState = {\n ...currentState,\n ...(typeof storeChanges === \"function\"\n ? storeChanges({ ...currentState })\n : storeChanges),\n };\n\n const nodeChanges = compareGraphs(currentState.nodes, newState.nodes);\n const edgeChanges = compareGraphs(currentState.edges, newState.edges);\n\n //@ts-ignore\n currentState = newState;\n\n const newNodes = nodeChanges.added;\n const newEdges = edgeChanges.added;\n const removedEdges = edgeChanges.removed;\n const removedNodes = nodeChanges.removed;\n\n const { patch } = oldState;\n\n if (newNodes.length) {\n const promise = patch.registerAudioNodes(\n //@ts-ignore\n newNodes,\n );\n promises.add(promise);\n await promise;\n promises.delete(promise);\n }\n\n if (!(newEdges.length || removedEdges.length || removedNodes.length)) {\n set(...args);\n return;\n }\n\n if (promises.size) {\n try {\n await Promise.all([...promises.values()]);\n } catch (e) {\n console.log(\"some error\", e);\n }\n }\n\n if (newEdges.length) {\n patch.registerAudioConnections(\n //@ts-ignore\n newEdges,\n );\n }\n\n if (removedEdges.length) {\n //@ts-ignore\n patch.unregisterAudioConnections(removedEdges);\n }\n\n if (removedNodes.length) {\n //@ts-ignore\n patch.unregisterAudioNodes(removedNodes);\n }\n\n set(...args);\n },\n get,\n api,\n );\n };\n\nexport default audioPatch;\n","import { WNEdge, WNNode } from \"../../types\";\n\nexport type GraphItems = Array<WNNode | WNEdge>;\n\nexport interface GraphComparisonResult {\n added: GraphItems;\n removed: GraphItems;\n}\n\nexport const compareGraphs = (\n left: GraphItems,\n right: GraphItems,\n): GraphComparisonResult => {\n const setLeft = new Set(left.map((item) => item.id));\n const setRight = new Set(right.map((item) => item.id));\n\n const added = right.filter((item) => !setLeft.has(item.id));\n const removed = left.filter((item) => !setRight.has(item.id));\n\n return { added, removed };\n};\n","import { StateCreator } from \"zustand\";\nimport type { EditorState, Project, ProjectFile } from \"../types\";\nimport type { StoreState } from \"./\";\nimport { isAudio } from \"../helpers/projectFile\";\n\nexport interface ProjectState {\n project: Project;\n setProject: (project: Project) => void;\n getProject: () => Project;\n\n pullEditorChanges: () => void;\n syncEditorWithCurrentFile: () => void;\n\n //@TODO: move inside project\n currentFileIndex: number;\n setCurrentFileIndex: (index: number) => void;\n\n updateFileContent: (fileIndex: number, file: ProjectFile) => void;\n updateFileName: (fileIndex: number, fileName: string) => void;\n addFile: (file: ProjectFile, name?: string) => void;\n deleteFile: (fileIndex: number) => void;\n}\n\nconst projectStateCreator: StateCreator<ProjectState> = (set, get) => ({\n project: { files: [] },\n setProject(project) {\n set({ project, currentFileIndex: 0 });\n },\n getProject() {\n return get().project;\n },\n\n pullEditorChanges() {\n const { getEditorState, currentFileIndex, updateFileContent, project } =\n get() as StoreState;\n const currentFile = project.files[currentFileIndex];\n if (isAudio(currentFile)) {\n return;\n }\n updateFileContent(currentFileIndex, {\n ...currentFile,\n file: getEditorState(),\n });\n },\n\n syncEditorWithCurrentFile: () => {\n const { currentFileIndex, setEditorState, project } = get() as StoreState;\n const currentFile = project.files[currentFileIndex];\n if (currentFile.type === \"audio\") {\n console.log(\"audio file. skipping\");\n return;\n }\n setEditorState(currentFile.file);\n },\n\n currentFileIndex: 0,\n setCurrentFileIndex(newFileIndex) {\n const { currentFileIndex } = get();\n if (newFileIndex === currentFileIndex) {\n return;\n }\n set({ currentFileIndex: newFileIndex });\n },\n\n updateFileContent(index, file) {\n const { project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i) => {\n if (i === index) {\n return {\n // @TODO check again if merging is really needed here\n ...f,\n ...file,\n };\n }\n return f;\n }),\n },\n });\n },\n updateFileName(index, fileName) {\n const { project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i) => {\n if (i === index) {\n return {\n ...f,\n name: fileName,\n };\n }\n return f;\n }),\n },\n });\n },\n addFile(file) {\n const { project } = get();\n const files = [...project.files, file];\n set({\n project: {\n ...project,\n files,\n },\n });\n },\n deleteFile: (fileIndex) => {\n const { project, currentFileIndex } = get();\n\n set({\n project: {\n ...project,\n files: project.files.filter((_, index) => fileIndex !== index),\n },\n });\n\n if (fileIndex <= currentFileIndex) {\n const newIndex = Math.max(0, currentFileIndex - 1);\n set({ currentFileIndex: newIndex });\n }\n },\n});\n\nexport default projectStateCreator;\n","import type { AudioFile, EditorFile, ProjectFile } from \"../types\";\n\nexport const isPatch = (file: ProjectFile): file is EditorFile =>\n !(\"type\" in file) || file.type === \"patch\";\n\nexport const isAudio = (file: ProjectFile): file is AudioFile =>\n file.type === \"audio\";\n","import { injectGlobal } from \"@emotion/css\";\nimport theme from \"./theme\";\n\ninjectGlobal`\n .react-flow {\n .react-flow__pane {\n /* background: rgb(106 106 106); */\n /* background: \"white\"; */\n // background: #292d39;\n background: ${theme.colors.elevation3};\n }\n\n .react-flow__background {\n /* background: #efefef; */\n stroke: white;\n }\n\n .react-flow__node-default {\n background: #292d39;\n color: white;\n border: none;\n /* background: transparent; */\n }\n\n .react-flow__node {\n padding: 0;\n width: auto;\n }\n\n .react-flow__edge-path {\n stroke: ${theme.colors.accent2};\n }\n\n .react-flow__node.selected {\n border: 1px solid ${theme.colors.accent2};\n box-shadow: 0 0 0 0.5px #${theme.colors.accent2};\n }\n\n .react-flow__node-default.selected, .react-flow__node-default.selected:hover {\n box-shadow: 0 0 0 0.5px #${theme.colors.accent2};\n }\n\n /* .react-flow__minimap-mask {\n fill: ${theme.colors.elevation1}\n }\n\n .react-flow__minimap-node {\n fill:${theme.colors.accent2}\n } */\n }\n\n`;\n","const LEVA_COLOR_ACCENT2_BLUE = \"#007bff\";\nconst COLOR_GREEN_PRIMARY = \"#14df42\";\nconst COLOR_WHITE_PRIMARY = \"#ffffff\";\n\nconst colors = <const>{\n elevation1: \"#292d39\", // bg color of the root panel (main title bar)\n elevation2: \"#181c20\", // bg color of the rows (main panel color)\n elevation3: \"#373c4b\", // bg color of the inputs\n accent1: \"#0066dc\",\n accent2: LEVA_COLOR_ACCENT2_BLUE,\n accent3: \"#3c93ff\",\n highlight1: \"#535760\",\n highlight2: \"#8c92a4\",\n highlight3: \"#fefefe\",\n vivid1: COLOR_GREEN_PRIMARY,\n whitePrimary: COLOR_WHITE_PRIMARY,\n error: \"#db5353\",\n};\n\nconst zIndex = <const>{\n modal: 9998,\n controlPanel: 9999,\n resumeContextLayout: 10003,\n};\n\nconst theme = {\n colors,\n zIndex,\n};\n\nexport type Theme = typeof theme;\n\nexport default theme;\n","import { withTheme } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport ReactFlow, {\n Background,\n BackgroundVariant,\n Controls,\n MiniMap,\n ReactFlowInstance,\n ReactFlowProvider,\n useOnViewportChange,\n} from \"reactflow\";\nimport \"reactflow/dist/style.css\";\nimport useStore from \"../../store\";\nimport type { EditorState, PluginConfig } from \"../../types\";\nimport { type Theme } from \"../../theme\";\nimport EdgeContextMenu, {\n useEdgeContextMenu,\n} from \"../contextMenu/EdgeContextMenu\";\nimport EditorContextMenu, {\n useEditorContextMenu,\n} from \"../contextMenu/EditorContextMenu\";\nimport NodeContextMenu, {\n useNodeContextMenu,\n} from \"../contextMenu/NodeContextMenu\";\nimport ControlPanel from \"../ControlPanel\";\nimport { HelpButton, HelpModal } from \"../Help\";\nimport ResumeContext from \"../ResumeContext\";\nimport ToggleMinimap from \"../ToggleMinimap\";\nimport Wire from \"../Wire\";\n\nconst StyledControls = withTheme(styled(Controls)<{ theme: Theme }>`\n &.bottom {\n right: 1rem;\n bottom: 40%;\n }\n\n svg {\n color: ${({ theme }) => theme.colors.elevation2};\n }\n`);\n\nconst onNodeDragStop = (_event: any, node: any) =>\n console.log(\"drag stop\", node);\nconst onNodeClick = (_event: any, element: any) =>\n console.log(\"click\", element);\n\nconst snapGrid: [number, number] = [20, 20];\n\ninterface EditorProps {\n editorState?: EditorState;\n plugins?: Array<PluginConfig>;\n editorContextMenu?: Array<ReactNode>;\n onChange?: ({ nodes, edges, controlPanel }: EditorState) => void;\n}\n\nexport const EditorPane = ({\n editorState,\n plugins = [],\n editorContextMenu = [],\n onChange = () => {},\n ...props\n}: EditorProps) => {\n const edgeTypes = useMemo(\n () => ({\n wire: Wire,\n }),\n [],\n );\n\n const {\n nodes,\n edges,\n controlPanel,\n onNodesChange,\n onNodesDelete,\n onEdgesChange,\n onEdgesDelete,\n onConnect,\n setPlugins,\n setViewport,\n viewport,\n } = useStore();\n\n const editorConfig = useStore(({ config }) => config);\n\n const nodeTypes = useStore(({ nodeTypes }) => nodeTypes);\n\n useEffect(() => {\n setPlugins(plugins);\n }, [plugins]);\n\n const [reactflowInstance, setReactflowInstance] =\n useState<ReactFlowInstance | null>(null);\n\n useEffect(() => {\n if (!reactflowInstance) {\n return;\n }\n onChange({\n nodes,\n edges,\n controlPanel,\n viewport,\n });\n }, [nodes, edges, controlPanel, viewport]);\n\n const onInit = useCallback(\n (rfi: ReactFlowInstance) => {\n if (!reactflowInstance) {\n setReactflowInstance(rfi);\n console.log(\"flow loaded:\", rfi);\n }\n },\n [reactflowInstance],\n );\n\n const { onContextMenu: onEditorContextMenu } = useEditorContextMenu();\n const { onContextMenu: onNodeContextMenu } = useNodeContextMenu();\n const { onContextMenu: onEdgeContextMenu } = useEdgeContextMenu();\n\n useEffect(() => {\n if (!viewport) {\n return;\n }\n reactflowInstance?.setViewport(viewport);\n }, [viewport, reactflowInstance]);\n\n useOnViewportChange({\n onEnd: setViewport,\n });\n\n return (\n <ReactFlow\n nodes={nodes}\n edges={edges}\n onNodesChange={onNodesChange}\n onNodesDelete={onNodesDelete}\n onEdgesChange={onEdgesChange}\n onConnect={onConnect}\n onNodeDragStop={onNodeDragStop}\n onEdgesDelete={onEdgesDelete}\n onInit={onInit}\n onNodeClick={onNodeClick}\n onContextMenu={onEditorContextMenu}\n onNodeContextMenu={onNodeContextMenu}\n onEdgeContextMenu={onEdgeContextMenu}\n nodeTypes={nodeTypes}\n edgeTypes={edgeTypes}\n snapGrid={snapGrid}\n defaultViewport={editorState?.viewport}\n defaultEdgeOptions={{ type: \"wire\" }}\n snapToGrid\n fitView\n disableKeyboardA11y\n >\n <Background variant={BackgroundVariant.Dots} gap={12} />\n {editorConfig.showMinimap ? <MiniMap /> : null}\n\n <StyledControls showInteractive={false} position=\"bottom-right\">\n <ToggleMinimap />\n <HelpButton />\n </StyledControls>\n\n <ResumeContext />\n <ControlPanel />\n <HelpModal />\n <EditorContextMenu editorContextMenu={editorContextMenu} />\n <NodeContextMenu />\n <EdgeContextMenu />\n </ReactFlow>\n );\n};\n\nexport const Editor = (props: EditorProps) => (\n <ReactFlowProvider>\n <EditorPane {...props} />\n </ReactFlowProvider>\n);\n\nexport default Editor;\n","import { useCallback } from \"react\";\nimport { useContextMenu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\n\nexport const MENU_ID = \"editor-edge-menu\";\n\nexport const useEdgeContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n const onContextMenu = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>, edge: unknown) => {\n event.stopPropagation();\n show(event, { props: { edge } });\n },\n [show],\n );\n\n return { onContextMenu };\n};\n\nconst EdgeContextMenu = () => {\n const theme = useTheme();\n\n const removeEdges = useStore((store) => store.removeEdges);\n\n return (\n <>\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper onClick={(event) => removeEdges([event.props.edge])}>\n Delete Edge (DEL)\n </ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default EdgeContextMenu;\n","import { useTheme as useEmotionTheme } from \"@emotion/react\";\nimport defaultTheme, { type Theme } from \"../theme\";\n\nconst useTheme = () => {\n const customTheme = useEmotionTheme() as Theme;\n const theme = { ...defaultTheme, ...customTheme };\n return theme;\n};\n\nexport default useTheme;\n","import styled from \"@emotion/styled\";\nimport { Item, Menu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { Theme } from \"../../theme\";\n\n\nexport const ItemWrapper = styled(Item)``;\n\nexport const MenuWrapper = styled(Menu)<{ colors: Theme[\"colors\"] }>`\n background: ${({ colors }) => colors.elevation2};\n padding: 0;\n border-radius: 0;\n\n .react-contexify__item__content {\n color: ${({ colors }) => colors.whitePrimary};\n }\n\n .react-contexify__separator {\n background-color: ${({ colors }) => colors.elevation1};\n margin: 0;\n }\n`;\n","import {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { Separator, useContextMenu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { useReactFlow, type XYPosition } from \"reactflow\";\nimport hotkeys from \"hotkeys-js\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport AddNode from \"../AddNode\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\nimport UploadAudio from \"../UploadAudio\";\n\ntype MousePosition = {\n x: number;\n y: number;\n};\n\nexport const MENU_ID = \"editor-menu\";\n\nexport const useEditorContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n return { onContextMenu: show };\n};\n\nconst EditorContextMenu = ({\n editorContextMenu = [],\n}: {\n editorContextMenu?: Array<ReactNode>;\n}) => {\n const theme = useTheme();\n\n const [mousePosition, setMousePosition] = useState<MousePosition>({\n x: 0,\n y: 0,\n });\n const [showAddNode, setShowAddNode] = useState(false);\n const [showUploadAudio, setShowUploadAudio] = useState(false);\n\n const addNodeHandler = useCallback(\n (x: number, y: number) => {\n setMousePosition({ x, y });\n setShowAddNode(true);\n },\n [setShowAddNode],\n );\n\n const pasteBuffer = useStore((store) => store.pasteBuffer);\n const { screenToFlowPosition } = useReactFlow();\n const pasteBufferHandler = useCallback(\n (mousePosition: XYPosition) => {\n const { x, y } = screenToFlowPosition(mousePosition);\n pasteBuffer(x, y);\n },\n [setShowAddNode, screenToFlowPosition],\n );\n\n const clearGraph = useStore(({ clearGraph }) => clearGraph);\n\n const deleteAllHandler = useCallback(() => {\n clearGraph();\n }, [clearGraph]);\n\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n const historyBack = useStore((store) => store.history.back);\n const historyForward = useStore((store) => store.history.forward);\n const historyPointer = useStore((store) => store.history.pointer);\n const historyBuffer = useStore((store) => store.history.buffer);\n\n const copySelectedItems = useStore((store) => store.copySelectedItems);\n const nodes = useStore((store) => store.nodes);\n const selectedNodes = useMemo(\n () => nodes.filter(({ selected }) => selected),\n [nodes],\n );\n const currentCopyBuffer = useStore((store) => store.copyBuffer);\n\n const reactFlowInstance = useReactFlow();\n\n useEffect(() => {\n hotkeys(\"command+shift+a\", () => {\n addNodeHandler(200, 50);\n return false;\n });\n //@TODO: find more elegant way to handle ?\n hotkeys(\"shift+/\", () => {\n toggleHelp();\n return false;\n });\n hotkeys(\"command+z\", () => {\n historyBack();\n return false;\n });\n hotkeys(\"command+shift+z\", () => {\n historyForward();\n return false;\n });\n hotkeys(\"command+c\", () => {\n copySelectedItems();\n return false;\n });\n hotkeys(\"command+v\", () => {\n pasteBufferHandler({ x: 200, y: 50 });\n return false;\n });\n return () => {\n hotkeys.unbind();\n };\n }, [addNodeHandler, pasteBufferHandler]);\n\n return (\n <>\n <AddNode\n isOpen={showAddNode}\n closeMenu={() => setShowAddNode(false)}\n mousePosition={mousePosition}\n />\n <UploadAudio\n isOpen={showUploadAudio}\n closeMenu={() => setShowUploadAudio(false)}\n />\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper\n onClick={({ triggerEvent: { clientX, clientY } }) =>\n addNodeHandler(clientX, clientY)\n }\n >\n Add Node (⌘+⇧+A)\n </ItemWrapper>\n <Separator />\n <ItemWrapper onClick={deleteAllHandler}>Delete All</ItemWrapper>\n <Separator />\n <ItemWrapper onClick={() => setShowUploadAudio(true)}>\n Upload Audio File\n </ItemWrapper>\n <Separator />\n <ItemWrapper disabled={historyPointer === 0} onClick={historyBack}>\n Undo (⌘+z)\n </ItemWrapper>\n <ItemWrapper\n disabled={historyPointer === historyBuffer.length}\n onClick={historyForward}\n >\n Redo (⌘+⇧+Z)\n </ItemWrapper>\n <Separator />\n <ItemWrapper\n disabled={!selectedNodes.length}\n onClick={copySelectedItems}\n >\n Copy Selected (⌘+c)\n </ItemWrapper>\n <ItemWrapper\n disabled={!currentCopyBuffer.nodes.length}\n onClick={({ triggerEvent: { clientX: x, clientY: y } }) =>\n pasteBufferHandler({ x, y })\n }\n >\n Paste (⌘+v)\n </ItemWrapper>\n <Separator />\n {editorContextMenu.map((item, index) =>\n item === null ? (\n <Separator key={index} />\n ) : (\n <ItemWrapper key={index}>{item}</ItemWrapper>\n ),\n )}\n <Separator />\n <ItemWrapper onClick={toggleHelp}>Help (⇧+?)</ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default EditorContextMenu;\n","import styled from \"@emotion/styled\";\nimport { MouseEvent, useCallback, useState } from \"react\";\nimport { Position, useReactFlow } from \"reactflow\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { PluginComponent } from \"../../types\";\nimport Modal from \"../Modal\";\nimport Filters, { FiltersState } from \"./Filters\";\nimport Plugins from \"./Plugins\";\n\ninterface AddNodeProps {\n isOpen: boolean;\n closeMenu: () => void;\n mousePosition: MousePosition;\n}\n\ntype MousePosition = {\n x: number;\n y: number;\n};\n\nconst AddNodeWrapper = styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n display: flex;\n gap: 1rem;\n`;\n\nconst PluginsPanel = styled.div<{ theme: Theme }>`\n flex-grow: 1;\n height: 100%;\n overflow-y: scroll;\n`;\n\nconst AddNode = ({ isOpen, closeMenu, mousePosition }: AddNodeProps) => {\n const theme = useTheme();\n const { screenToFlowPosition } = useReactFlow();\n\n const { createNode } = useStore(({ createNode }) => ({\n createNode,\n }));\n\n const [filtersState, setFiltersState] = useState<FiltersState>({});\n\n const onComponentClick = useCallback(\n ({ type }: PluginComponent) => {\n const { x, y } = screenToFlowPosition(mousePosition);\n const newNode = {\n //@TODO: generate node id in `createNode` function\n id: `${type}-${+new Date()}`,\n type,\n data: { label: type },\n position: {\n x,\n y,\n },\n targetPosition: Position.Left,\n sourcePosition: Position.Right,\n };\n createNode(newNode);\n closeMenu();\n },\n [mousePosition, screenToFlowPosition, createNode, closeMenu, mousePosition],\n );\n\n return isOpen ? (\n <Modal\n onClose={() => {\n closeMenu();\n setFiltersState({});\n }}\n >\n <AddNodeWrapper theme={theme}>\n <Filters onChange={setFiltersState} value={filtersState} />\n <PluginsPanel theme={theme}>\n <Plugins\n filters={filtersState}\n onTagClick={(tag) => {\n setFiltersState((state) => ({\n ...state,\n tags: state.tags?.includes(tag)\n ? state.tags.filter((t) => t !== tag)\n : [...(state.tags || []), tag],\n }));\n }}\n onComponentClick={(component) => {\n onComponentClick(component);\n setFiltersState({});\n }}\n />\n </PluginsPanel>\n </AddNodeWrapper>\n </Modal>\n ) : null;\n};\n\nexport default AddNode;\n","import styled from \"@emotion/styled\";\nimport { type ReactNode, useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport useTheme from \"../hooks/useTheme\";\nimport { Theme } from \"../theme\";\n\nconst ModalOuter = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: ${({ theme }) => theme.zIndex.modal};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: ${({ theme }) => theme.colors.elevation3}cc;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst ModalInner = styled.div<{ theme: Theme }>`\n background: ${({ theme }) => theme.colors.elevation2};\n box-shadow: 1px 1px 1px 1px ${({ theme }) => theme.colors.elevation1};\n color: white;\n width: 70%;\n height: 80%;\n overflow-y: scroll;\n position: relative;\n`;\n\nconst ModalCloser = styled(CloseIcon)<{ theme: Theme }>`\n position: absolute;\n top: 0.2rem;\n right: 0.2rem;\n cursor: pointer;\n`;\n\ninterface ModalProps {\n onClose?: () => void;\n children: ReactNode;\n}\n\nexport const Modal = ({ children, onClose, ...props }: ModalProps) => {\n const theme = useTheme();\n\n useEffect(() => {\n const escHandler = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n onClose?.();\n }\n };\n document.addEventListener(\"keydown\", escHandler);\n return () => {\n document.removeEventListener(\"keydown\", escHandler);\n };\n }, [onClose]);\n\n return createPortal(\n <ModalOuter theme={theme} onClick={onClose}>\n <ModalInner\n {...props}\n onClick={(e) => {\n e.stopPropagation();\n }}\n theme={theme}\n >\n {children}\n <ModalCloser theme={theme} onClick={onClose} />\n </ModalInner>\n </ModalOuter>,\n document.body,\n );\n};\n\nexport default Modal;\n","import styled from \"@emotion/styled\";\nimport { withTheme } from \"@emotion/react\";\nimport { useEffect, useRef } from \"react\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { PluginTag, TagsList } from \"./Plugins\";\n\nconst InputWrapper = styled.div`\n display: flex;\n position: relative;\n`;\n\nconst InputInner = styled.input<{ theme: Theme }>`\n padding-right: 2rem;\n padding-left: 0.3rem;\n width: 100%;\n appearance: textfield;\n font-size: inherit;\n background: none;\n border: none;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n appearance: textfield;\n cursor: auto;\n background-color: ${({ theme }) => theme.colors.elevation3};\n border-radius: 0.1rem;\n height: 2rem;\n color: ${({ theme }) => theme.colors.highlight2};\n\n &:focus,\n &:hover {\n box-shadow: 0 0 0 var(--leva-borderWidths-focus)\n ${({ theme }) => theme.colors.accent2};\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin-right: 1rem;\n }\n`;\n\nconst FiltersWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n padding: 0.6rem;\n gap: 0.6rem;\n border-right: 1px solid ${({ theme }) => theme.colors.elevation3};\n min-width: 14rem;\n`;\n\nconst PluginName = styled.label<{ theme: Theme }>`\n user-select: none;\n input {\n display: none;\n }\n input:checked + span {\n color: ${({ theme }) => theme.colors.accent2};\n }\n &:hover {\n color: ${({ theme }) => theme.colors.accent3};\n cursor: pointer;\n }\n`;\n\nconst StyledPluginTag = withTheme(styled(PluginTag)<{ theme: Theme }>`\n font-size: 12px;\n padding: 0.2rem 0.4rem;\n &:hover {\n }\n &::after {\n content: \"×\";\n margin-left: 0.4rem;\n }\n`);\n\nexport interface FiltersState {\n search?: string;\n plugin?: string | null;\n tags?: string[];\n}\n\ninterface FiltersProps {\n value: FiltersState;\n onChange: (filters: FiltersState) => void;\n}\n\nconst Filters = ({ onChange, value }: FiltersProps) => {\n const theme = useTheme();\n const plugins = useStore(({ plugins }) => plugins);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!inputRef.current) {\n return;\n }\n inputRef.current.focus();\n }, [inputRef]);\n\n return (\n <FiltersWrapper theme={theme}>\n <InputWrapper>\n <InputInner\n ref={inputRef}\n theme={theme}\n value={value.search || \"\"}\n placeholder=\"search...\"\n onChange={(event) =>\n onChange({ ...value, search: event.target.value })\n }\n />\n </InputWrapper>\n <TagsList>\n {value.tags?.map((tag, index) => (\n <StyledPluginTag\n key={index}\n isActive\n onClick={() => {\n const newTags = value.tags?.filter((t) => t !== tag) || [];\n onChange({ ...value, tags: newTags });\n }}\n >\n {tag}\n </StyledPluginTag>\n ))}\n </TagsList>\n {plugins.map(({ name, components }, index) => {\n if (!name) {\n return null;\n }\n return (\n <PluginName theme={theme} key={index}>\n <input\n type=\"checkbox\"\n name=\"plugin\"\n value={name}\n checked={name === value.plugin}\n onChange={() => {\n onChange({\n ...value,\n plugin: name === value.plugin ? null : name,\n });\n }}\n />\n <span>{name}</span>\n </PluginName>\n );\n })}\n </FiltersWrapper>\n );\n};\n\nexport default Filters;\n","import styled from \"@emotion/styled\";\nimport { useMemo } from \"react\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { PluginComponent } from \"../../types\";\nimport { FiltersState } from \"./Filters\";\nimport { withTheme } from \"@emotion/react\";\n\nconst PluginsWrapper = withTheme(styled.div<{ theme: Theme }>`\n width: 100%;\n`);\n\nconst PluginWrapper = withTheme(styled.div<{ theme: Theme }>`\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n`);\n\nconst NodesList = withTheme(styled.ul<{ theme: Theme }>`\n list-style: none;\n margin: 0;\n padding: 0;\n padding-bottom: 10px;\n columns: 2;\n\n li {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 4px;\n overflow: hidden;\n border: 1px solid ${({ theme }) => theme.colors.elevation3};\n border-radius: 4px;\n margin-bottom: 0.5rem;\n &:hover {\n border-color: ${({ theme }) => theme.colors.accent2};\n cursor: pointer;\n }\n }\n`);\n\nconst NodeTitle = withTheme(styled.div<{ theme: Theme }>`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`);\n\nconst NodeDescription = withTheme(styled.div<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.highlight2};\n font-size: 12px;\n`);\n\nexport const TagsList = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n gap: 0.2rem;\n flex-wrap: wrap;\n`);\n\nexport const PluginTag = withTheme(styled.span<{\n theme: Theme;\n isActive?: boolean;\n}>`\n cursor: pointer;\n font-size: 10px;\n background: ${({ theme, isActive }) =>\n isActive ? theme.colors.highlight1 : theme.colors.elevation3};\n border-radius: 2px;\n padding: 0.1rem 0.2rem;\n border: 1px solid;\n border-color: ${({ theme }) => theme.colors.elevation2};\n &:hover {\n border-color: ${({ theme }) => theme.colors.accent2};\n }\n`);\n\nconst PluginHeader = withTheme(styled.div<{ theme: Theme }>``);\n\nconst PluginTitle = withTheme(styled.div<{ theme: Theme }>`\n font-size: 1.1rem;\n padding: 0.25rem 0;\n color: ${({ theme }) => theme.colors.highlight3};\n`);\n\nconst PluginDescription = withTheme(styled.div<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.highlight2};\n font-size: 12px;\n`);\n\ninterface PluginsProps {\n filters: FiltersState;\n onComponentClick: (component: PluginComponent) => void;\n onTagClick: (tag: string) => void;\n}\n\nconst Plugins = ({\n onComponentClick,\n filters: { plugin, search = \"\", tags },\n onTagClick,\n}: PluginsProps) => {\n const plugins = useStore(({ plugins }) => plugins);\n\n const pluginsGroup = useMemo(() => {\n if (!plugin) {\n return plugins;\n }\n return plugins.filter(({ name }) => name === plugin);\n }, [plugins, plugin]);\n\n const filteredPlugins = useMemo(() => {\n if (!search && !tags?.length) {\n return pluginsGroup;\n }\n const filteredByTags = pluginsGroup.map((plugin) => ({\n ...plugin,\n components: tags?.length\n ? plugin.components.filter((component) =>\n tags?.every((tag) => component.tags?.includes(tag)),\n )\n : plugin.components,\n }));\n return filteredByTags.map((plugin) => ({\n ...plugin,\n components: plugin.components.filter(\n ({ type, name }) =>\n type.toLocaleLowerCase().includes(search.toLocaleLowerCase()) ||\n name?.toLocaleLowerCase().includes(search.toLocaleLowerCase()),\n ),\n }));\n }, [pluginsGroup, search, tags]);\n\n return (\n <PluginsWrapper>\n {filteredPlugins.map(({ name, description, components }, index) => {\n if (!components.length) {\n return null;\n }\n return (\n <PluginWrapper key={index}>\n <PluginHeader>\n <PluginTitle>{name}</PluginTitle>\n <PluginDescription>{description}</PluginDescription>\n </PluginHeader>\n <NodesList>\n {components\n .sort((a, b) =>\n a.type.toLowerCase() > b.type.toLowerCase() ? 1 : -1,\n )\n .map((component, idx) => (\n <li onClick={() => onComponentClick(component)} key={idx}>\n <NodeTitle>{component.name || component.type}</NodeTitle>\n {component.description && (\n <NodeDescription>{component.description}</NodeDescription>\n )}\n <TagsList>\n {component.tags?.map((tag, tagIdx) => (\n <PluginTag\n isActive={tags?.includes(tag)}\n onClickCapture={(event) => {\n event.stopPropagation();\n onTagClick(tag);\n }}\n key={tagIdx}\n >\n {tag}\n </PluginTag>\n ))}\n </TagsList>\n </li>\n ))}\n </NodesList>\n </PluginWrapper>\n );\n })}\n </PluginsWrapper>\n );\n};\n\nexport default Plugins;\n","import styled from \"@emotion/styled\";\nimport { MouseEvent, useCallback, useState, useRef, ChangeEvent } from \"react\";\nimport { FileDrop } from \"react-file-drop\";\nimport { FaFileUpload } from \"react-icons/fa\";\nimport useTheme from \"../hooks/useTheme\";\nimport useStore from \"../store\";\nimport { Theme } from \"../theme\";\nimport Modal from \"./Modal\";\nimport { fileToBase64 } from \"../lib\";\n\ninterface UploadAudioProps {\n isOpen: boolean;\n closeMenu: () => void;\n}\n\nconst UploadAudioWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme }) => theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\n\nconst DropZoneInner = styled.div<{ theme: Theme }>`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\n\nconst FileUploadIcon = styled(FaFileUpload)`\n width: 100%;\n height: 8rem;\n`;\n\nconst FileUploadMessage = styled.div`\n font-size: 2rem;\n`;\n\nconst UploadAudio = ({ isOpen, closeMenu }: UploadAudioProps) => {\n const theme = useTheme();\n\n const setGraph = useStore(({ setGraph }) => setGraph);\n const setEditorState = useStore((store) => store.setEditorState);\n const addFile = useStore((store) => store.addFile);\n\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const uploadFile = useCallback(\n async (files: FileList | null) => {\n const [file] = files || [];\n const base64 = await fileToBase64(file);\n addFile({\n type: \"audio\",\n // @TODO: use nanoid here\n id: `audio-file-${+new Date()}`,\n name: file.name,\n file: base64,\n });\n closeMenu();\n },\n [addFile, closeMenu],\n );\n\n const onTargetClick = () => {\n fileInputRef.current?.click();\n };\n\n return isOpen ? (\n <Modal onClose={closeMenu}>\n <UploadAudioWrapper theme={theme}>\n <input\n onChange={({ target: { files } }) => uploadFile(files)}\n ref={fileInputRef}\n type=\"file\"\n className=\"hidden\"\n style={{ display: \"none\" }}\n accept=\".wav,.mp3,.ogg\"\n />\n <FileDrop\n className=\"drop-zone-wrapper\"\n targetClassName=\"drop-zone\"\n draggingOverTargetClassName=\"drop-zone-drag-over\"\n onTargetClick={onTargetClick}\n onDrop={(files) => uploadFile(files)}\n >\n <DropZoneInner theme={theme}>\n <FileUploadIcon />\n <FileUploadMessage>click or drop file here</FileUploadMessage>\n </DropZoneInner>\n </FileDrop>\n </UploadAudioWrapper>\n </Modal>\n ) : null;\n};\n\nexport default UploadAudio;\n","export { useWorker } from \"./hooks/useWorker\";\nexport { useMessageChannel } from \"./hooks/useMessageChannel\";\nexport * from \"./helpers\";\n","import { useEffect, useState } from \"react\";\n\nexport const useWorker = (url: string | URL) => {\n const [worker, setWorker] = useState<Worker | null>(null);\n\n useEffect(() => {\n const newWorker = new Worker(url);\n setWorker(newWorker);\n return () => {\n newWorker?.terminate();\n setWorker(null);\n };\n }, []);\n\n return worker;\n};\n\nexport default useWorker;\n","import { useEffect, useState } from \"react\";\n\nexport const useMessageChannel = () => {\n const [channel, setChannel] = useState<MessageChannel | null>(null);\n useEffect(() => {\n const newChannel = new MessageChannel();\n newChannel.port2.start();\n setChannel(newChannel);\n return () => {\n setChannel(null);\n newChannel.port2.close();\n };\n }, []);\n return channel;\n};\n\nexport default useMessageChannel;\n","export const setParameterValue = (\n param: AudioParam,\n value: number | undefined,\n audioContext: AudioContext,\n): void => {\n if (typeof value === \"undefined\") {\n return;\n }\n param.setValueAtTime(value, audioContext.currentTime);\n};\n\nexport const fileToBase64 = (file: File): Promise<string> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result?.toString() || \"\");\n reader.onerror = (error) => reject(error);\n });\n};\n","import { useCallback } from \"react\";\nimport { useContextMenu, PredicateParams } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { WNNode } from \"../../types\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\n\nexport const MENU_ID = \"editor-node-menu\";\n\nexport const useNodeContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n const onContextMenu = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>, node: unknown) => {\n event.stopPropagation();\n show(event, { props: { node } });\n },\n [],\n );\n\n return { onContextMenu };\n};\n\nconst NodeContextMenu = (args: unknown) => {\n const theme = useTheme();\n\n const removeNodes = useStore((store) => store.removeNodes);\n const addNodeToControlPanel = useStore(\n (store) => store.addNodeToControlPanel,\n );\n const removeNodeFromControlPanel = useStore(\n (store) => store.removeNodeFromControlPanel,\n );\n const copy = useStore((store) => store.copy);\n const nodesConfiguration = useStore((store) => store.nodesConfiguration);\n const controlPanelNodes = useStore((store) => store.controlPanel.nodes);\n\n const isOnControlPanel = useCallback(\n ({ props }: PredicateParams<{ node: WNNode }>) => {\n if (!props?.node.type) {\n return false;\n }\n return !!controlPanelNodes.find(({ id }) => id === props.node.id);\n },\n [controlPanelNodes],\n );\n\n const hasControlPanelNode = useCallback(\n ({ props }: PredicateParams<{ node: WNNode }>) => {\n if (!props?.node.type) {\n return false;\n }\n const nodeConfiguration = nodesConfiguration[props.node.type];\n return !!nodeConfiguration?.controlPanelNode;\n },\n [nodesConfiguration],\n );\n\n return (\n <>\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper onClick={(event) => removeNodes([event.props.node])}>\n Delete Node (DEL)\n </ItemWrapper>\n <ItemWrapper\n hidden={(...args) =>\n !hasControlPanelNode(...args) || isOnControlPanel(...args)\n }\n onClick={(event) => addNodeToControlPanel(event.props.node)}\n >\n Add To Control Panel\n </ItemWrapper>\n <ItemWrapper\n hidden={(...args) =>\n !hasControlPanelNode(...args) || !isOnControlPanel(...args)\n }\n onClick={(event) => removeNodeFromControlPanel(event.props.node)}\n >\n Remove From Control Panel\n </ItemWrapper>\n <ItemWrapper\n onClick={(event) => copy({ nodes: [event.props.node], edges: [] })}\n >\n Copy (⌘+c)\n </ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default NodeContextMenu;\n","import styled from \"@emotion/styled\";\nimport { Resizable } from \"re-resizable\";\nimport { useMemo, useRef, useState } from \"react\";\nimport GridLayout from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport {\n AiFillLock as LockIcon,\n AiFillUnlock as UnlockIcon,\n} from \"react-icons/ai\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport { RxDashboard as ControlPanelIcon } from \"react-icons/rx\";\nimport Drawer from \"react-modern-drawer\";\nimport \"react-modern-drawer/dist/index.css\";\nimport { CONTROL_PANEL_GRID_CONFIG } from \"../../constants\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport ControlPanelItem from \"./ControlPanelItem\";\nimport { IconsBar, IconWrapper, PanelTitle, TitleBarWrapper } from \"./styles\";\n\nconst ControlPanelIconWrapper = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: 5;\n box-shadow: 0px 1px 2px ${({ theme }) => theme.colors.elevation2};\n left: 1rem;\n top: 4rem;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background: ${({ theme }) => theme.colors.elevation1};\n color: ${({ theme }) => theme.colors.highlight1};\n\n :hover {\n color: ${({ theme }) => theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n\nconst ControlPanelIconsBar = styled(IconsBar)`\n height: 80%;\n`;\n\nconst CloseIconWrapper = styled(IconWrapper)`\n font-size: 1rem;\n display: flex;\n align-items: center;\n`;\n\nconst ControlPanelHeader = styled(TitleBarWrapper)<{ theme: Theme }>`\n grid-template-columns: 1fr auto;\n border-bottom: 1px solid ${({ theme }) => theme.colors.elevation3};\n font-size: 0.7rem;\n`;\n\nconst ControlPanelTitle = styled(PanelTitle)`\n text-align: center;\n`;\n\nconst ControlPanelWrapper = styled.div`\n height: 100%;\n width: 100%;\n padding: 0.3rem 0.4rem;\n box-sizing: border-box;\n`;\n\nconst ControlPanelBody = styled.div<{ theme: Theme }>`\n height: auto;\n padding: 0;\n max-height: 95vh;\n overflow-y: scroll;\n border: 1px solid ${({ theme }) => theme.colors.elevation3};\n`;\n\nconst ControlPanelSettings = styled.div`\n padding: 1rem 0;\n font-family: var(--leva-fonts-mono);\n font-size: 0.8rem;\n`;\n\nconst LockGridWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n gap: 0.5rem;\n cursor: pointer;\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.highlight2};\n }\n`;\n\nconst GridResizeHandle = styled.div<{ theme: Theme }>`\n position: absolute;\n height: 1rem;\n top: 0;\n bottom: 0;\n margin: auto;\n left: 0.5rem;\n border-right: 1px solid ${({ theme }) => theme.colors.whitePrimary};\n`;\n\nconst ControlPanelItemWrapper = styled.div<{ theme: Theme }>`\n box-sizing: border-box;\n overflow: hidden;\n .react-resizable-handle:after {\n border-color: ${({ theme }) => theme.colors.whitePrimary};\n border-width: 1px;\n }\n`;\n\nconst ControlPanel = () => {\n const theme = useTheme();\n const nodeRef = useRef(null);\n const nodes = useStore((store) => store.nodes);\n const {\n show,\n nodes: controlPanelNodes,\n size,\n } = useStore((store) => store.controlPanel);\n\n const { width = 200, height } = size;\n\n const filteredNodes = useMemo(() => {\n const nodeIds = controlPanelNodes.map(({ id }) => id);\n return nodes.filter(({ id }) => nodeIds.includes(id));\n }, [nodes, controlPanelNodes]);\n\n const showControlPanel = useStore((store) => store.showControlPanel);\n const hideControlPanel = useStore((store) => store.hideControlPanel);\n const setControlPanelNodes = useStore((store) => store.setControlPanelNodes);\n const setControlPanelSize = useStore((store) => store.setControlPanelSize);\n const removeNodeFromControlPanel = useStore(\n (store) => store.removeNodeFromControlPanel,\n );\n\n const [isGridLocked, setGridLocked] = useState(true);\n\n const layout = useMemo(() => {\n const fallbackY = controlPanelNodes.reduce(\n (acc, { height = CONTROL_PANEL_GRID_CONFIG.rowHeight, x, y = 0 }) => {\n const Y = y + height;\n return Y > acc ? Y : acc;\n },\n 0,\n );\n return controlPanelNodes.map(({ id: i, width, height, x, y }) => {\n return {\n i,\n w: width || CONTROL_PANEL_GRID_CONFIG.cols,\n h: height || 6,\n x: x ?? 0,\n y: y ?? fallbackY,\n };\n });\n }, [controlPanelNodes]);\n\n if (!filteredNodes.length) {\n return null;\n }\n\n return (\n <>\n <ControlPanelIconWrapper\n theme={theme}\n ref={nodeRef}\n onClick={showControlPanel}\n >\n <ControlPanelIcon />\n </ControlPanelIconWrapper>\n <Drawer\n open={show}\n onClose={hideControlPanel}\n direction=\"left\"\n className=\"\"\n size=\"auto\"\n enableOverlay={false}\n style={{\n background: theme.colors.elevation1,\n position: \"absolute\",\n }}\n >\n <ControlPanelHeader theme={theme}>\n <ControlPanelTitle>Control Panel</ControlPanelTitle>\n <ControlPanelIconsBar>\n <CloseIconWrapper onClick={hideControlPanel} theme={theme}>\n <CloseIcon />\n </CloseIconWrapper>\n </ControlPanelIconsBar>\n </ControlPanelHeader>\n\n <ControlPanelWrapper>\n <ControlPanelSettings>\n {isGridLocked ? (\n <LockGridWrapper\n theme={theme}\n onClick={() => setGridLocked(false)}\n >\n <LockIcon />\n Unlock grid\n </LockGridWrapper>\n ) : (\n <LockGridWrapper\n theme={theme}\n onClick={() => setGridLocked(true)}\n >\n <UnlockIcon />\n Lock grid\n </LockGridWrapper>\n )}\n </ControlPanelSettings>\n <Resizable\n enable={{\n top: false,\n right: !isGridLocked,\n bottom: false,\n left: false,\n topRight: false,\n bottomRight: false,\n bottomLeft: false,\n topLeft: false,\n }}\n handleComponent={{\n right: <GridResizeHandle theme={theme} />,\n }}\n minWidth={120}\n size={{ width, height: \"auto\" }}\n onResizeStop={(e, direction, ref, d) => {\n setControlPanelSize({\n width: width + d.width,\n height: height + d.height,\n });\n }}\n >\n <ControlPanelBody theme={theme}>\n {/* @ts-ignore */}\n <GridLayout\n layout={layout}\n className=\"layout\"\n cols={CONTROL_PANEL_GRID_CONFIG.cols}\n rowHeight={CONTROL_PANEL_GRID_CONFIG.rowHeight}\n width={width}\n margin={[0, 0]}\n isResizable={!isGridLocked}\n draggableHandle=\".grid-item-handle\"\n onLayoutChange={(nodes) => {\n requestAnimationFrame(() => {\n setControlPanelNodes(\n nodes.map(({ i, w, h, x, y }) => ({\n id: i,\n width: w,\n height: h,\n x,\n y,\n })),\n );\n });\n }}\n >\n {filteredNodes.map((node) => {\n return (\n <ControlPanelItemWrapper key={node.id} theme={theme}>\n <ControlPanelItem\n node={node}\n showControls={!isGridLocked}\n onDelete={removeNodeFromControlPanel}\n />\n </ControlPanelItemWrapper>\n );\n })}\n </GridLayout>\n </ControlPanelBody>\n </Resizable>\n </ControlPanelWrapper>\n </Drawer>\n </>\n );\n};\n\nexport default ControlPanel;\n","import { useMemo } from \"react\";\n\nimport styled from \"@emotion/styled\";\nimport \"react-grid-layout/css/styles.css\";\nimport { MdDragHandle as DragIcon } from \"react-icons/md\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport useAudioNode from \"../../hooks/useAudioNode\";\nimport useNode from \"../../hooks/useNode\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { WNNode, ControlPanelNodeProps } from \"../../types\";\nimport { IconsBar, IconWrapper, PanelTitle, TitleBarWrapper } from \"./styles\";\n\nconst ControlPanelNodeWrapper = styled.div<{ theme: Theme }>`\n height: 100%;\n display: grid;\n grid-template-rows: auto 1fr;\n`;\n\nconst PanelNode = (props: ControlPanelNodeProps) => {\n const { node } = props;\n\n const getControlPanelNode = useStore((store) => store.getControlPanelNode);\n\n const ControlPanelNode = useMemo(() => getControlPanelNode(node), [node]);\n\n if (!ControlPanelNode) {\n return null;\n }\n\n return <ControlPanelNode {...props} />;\n};\n\ninterface ControlPanelItemProps {\n node: WNNode;\n showControls: boolean;\n onDelete: (node: WNNode) => void;\n}\n\nconst ControlPanelItem = (props: ControlPanelItemProps) => {\n const { node, showControls, onDelete } = props;\n const theme = useTheme();\n\n const { id } = node;\n const { node: audioNode } = useAudioNode(id) || {};\n const { updateNodeValues } = useNode(id);\n\n return (\n <ControlPanelNodeWrapper theme={theme}>\n <TitleBarWrapper theme={theme}>\n <PanelTitle>{node.data.label}</PanelTitle>\n {showControls && (\n <IconsBar>\n <IconWrapper theme={theme}>\n <DragIcon className=\"grid-item-handle\" />\n </IconWrapper>\n <IconWrapper theme={theme}>\n <CloseIcon onClick={() => onDelete(node)} />\n </IconWrapper>\n </IconsBar>\n )}\n </TitleBarWrapper>\n <PanelNode\n node={node}\n audioNode={audioNode}\n updateNodeValues={updateNodeValues}\n />\n </ControlPanelNodeWrapper>\n );\n};\n\nexport default ControlPanelItem;\n","import { AudioNodeState } from \"@web-noise/patch\";\nimport useStore from \"../store\";\nimport type { WNAudioNode } from \"../types\";\n\nconst useAudioNode = <T = WNAudioNode>(id: string) => {\n const patch = useStore(({ patch }) => patch);\n return patch.audioNodes.get(id) as AudioNodeState<T> | undefined;\n};\n\nexport default useAudioNode;\n","import { useCallback } from \"react\";\nimport useStore from \"../store\";\nimport { WNNodeData } from \"../types\";\n\nconst useNode = (id: string) => {\n const updateNodeData = useStore(({ updateNodeData }) => updateNodeData);\n\n const updateNodeValues = useCallback(\n (values: WNNodeData[\"values\"]) => updateNodeData(id, { values }),\n [id, updateNodeData]\n );\n const updateNodeConfig = useCallback(\n (config: WNNodeData[\"config\"]) => updateNodeData(id, { config }),\n [id, updateNodeData]\n );\n const updateNodeLabel = useCallback(\n (label: string) => updateNodeData(id, { label }),\n [id, updateNodeData]\n );\n\n return {\n updateNodeValues,\n updateNodeConfig,\n updateNodeLabel,\n };\n};\n\nexport default useNode;\n","import styled from \"@emotion/styled\";\nimport \"react-grid-layout/css/styles.css\";\nimport { Theme } from \"../../theme\";\nimport { TitleBar } from \"../Node\";\n\nexport const PanelTitle = styled.div`\n width: 100%;\n padding: 0.4rem 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nexport const TitleBarWrapper = styled(TitleBar)<{ theme: Theme }>`\n display: flex;\n gap: 0.1rem;\n padding: 0 0.4rem;\n justify-content: start;\n font-size: 0.6rem;\n height: auto;\n min-width: 0;\n`;\n\nexport const IconsBar = styled.div`\n display: flex;\n align-items: center;\n height: 70%;\n width: auto;\n gap: 0.4rem;\n`;\n\nexport const IconWrapper = styled.span<{ theme: Theme }>`\n width: auto;\n height: 100%;\n cursor: pointer;\n svg {\n width: auto;\n height: 100%;\n }\n &:hover {\n color: ${({ theme }) => theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n","import styled from \"@emotion/styled\";\nimport { withTheme } from \"@emotion/react\";\nimport { Resizable } from \"re-resizable\";\nimport { ComponentProps, useMemo, useState } from \"react\";\nimport {\n MdSettings as SettingsIcon,\n MdInfoOutline as InfoIcon,\n} from \"react-icons/md\";\nimport { Handle, HandleProps, NodeProps, Position } from \"reactflow\";\nimport { DRAG_HANDLE_CLASS, PortType } from \"../../constants\";\nimport useAudioNode from \"../../hooks/useAudioNode\";\nimport useNode from \"../../hooks/useNode\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { AudioPort, WNNodeData } from \"../../types\";\nimport EditableLabel from \"../EditableLabel\";\nimport NodeInfoModal from \"../NodeInfoModal\";\n\nconst NodeWrapper = styled.div`\n background-color: var(--leva-colors-elevation1);\n`;\n\nconst NodeLoaderWrapper = styled(NodeWrapper)`\n padding: 2rem 5rem;\n`;\n\nconst NodeErrorWrapper = styled(NodeWrapper)`\n padding: 1rem 2rem;\n`;\n\nconst SettingsIconWrapper = styled(SettingsIcon)`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\n\nconst InfoIconWrapper = styled(InfoIcon)`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\n\nconst Section = styled.div`\n position: relative;\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n background-color: var(--leva-colors-elevation1);\n`;\n\nexport const TitleBarInner = styled(Section)`\n display: flex;\n height: var(--leva-sizes-titleBarHeight);\n touch-action: none;\n align-items: center;\n justify-content: center;\n flex: 1 1 0%;\n color: var(--leva-colors-highlight1);\n padding: 0 0.4rem;\n gap: 0.3rem;\n`;\n\nexport const PortsPanel = styled(Section)<{ theme: Theme }>(\n ({ theme }) => `\n display: grid;\n grid-template-areas: \"inputs outputs\";\n background: ${theme.colors.elevation2};\n border-bottom: 1px solid ${theme.colors.elevation1};\n color: ${theme.colors.highlight3};\n font-size: 0.6rem;\n`,\n);\n\nexport const InputPorts = styled.div`\n grid-area: inputs;\n text-align: left;\n`;\n\nexport const OutputPorts = styled.div`\n grid-area: outputs;\n text-align: right;\n`;\n\nexport const Port = styled.div`\n position: relative;\n padding: 5px 10px;\n`;\n\nconst portColors = {\n [PortType.Audio]: \"#4ade80\", // vibrant green\n [PortType.Gate]: \"#c084fc\", // rich purple\n [PortType.Number]: \"#38bdf8\", // bright blue\n [PortType.Any]: \"#ffffff\", // white\n};\n\nconst StyledHandle = withTheme(styled(Handle, {\n shouldForwardProp: (prop) => prop !== \"portType\",\n})<{ portType?: AudioPort[\"type\"]; theme: Theme }>`\n --port-color: ${(props) => {\n if (!props.portType) return props.theme.colors.highlight2;\n if (Array.isArray(props.portType)) {\n const colors = props.portType.map((type) => portColors[type]);\n return `linear-gradient(0.25turn, ${colors.join(\", \")});`;\n } else {\n return portColors[props.portType];\n }\n }};\n border-color: var(--port-color);\n background: var(--port-color);\n box-shadow: 0px 0px 0px 1px ${({ theme }) => theme.colors.elevation2} inset;\n`);\n\nconst StyledInputHandle = withTheme(styled(StyledHandle)`\n left: -3px;\n`);\n\nexport const InputHandle = ({\n ...props\n}: Partial<HandleProps & ComponentProps<typeof StyledInputHandle>>) => (\n <StyledInputHandle {...props} type=\"target\" position={Position.Left} />\n);\n\nexport const StyledOutputHandle = withTheme(styled(StyledHandle)`\n right: -3px;\n`);\n\nexport const OutputHandle = (\n props: Partial<HandleProps & ComponentProps<typeof StyledOutputHandle>>,\n) => <StyledOutputHandle {...props} type=\"source\" position={Position.Right} />;\n\nexport type WNNodeProps<T = Record<string, unknown>> = NodeProps<\n T & WNNodeData\n>;\n\nexport interface TitleBarProps {\n className?: string;\n [key: string]: unknown;\n}\n\nexport const TitleBar = ({ className, ...props }: TitleBarProps) => (\n <TitleBarInner\n {...props}\n className={[className, DRAG_HANDLE_CLASS].join(\" \")}\n />\n);\n\nexport interface WNNodeParameters extends NodeProps {\n children?: any;\n}\n\nconst useNodeManifest = (type: string) => {\n const data = useStore((store) => store.nodesConfiguration[type]);\n\n return data;\n};\n\nconst useConfigNode = (type: string) => {\n const { configNode: ConfigNode } = useNodeManifest(type);\n\n return {\n ConfigNode,\n };\n};\n\nexport const WNNode = (props: WNNodeParameters) => {\n const { id, children, selected, ...rest } = props;\n const theme = useTheme();\n const getNode = useStore(({ getNode }) => getNode);\n const nodesConfiguration = useStore((store) => store.nodesConfiguration);\n\n const [isInfoModalShown, setIsInfoModalShown] = useState(false);\n\n const { info } = useNodeManifest(props.type);\n\n const isResizeable = useMemo(\n () => nodesConfiguration[props.type].resizable ?? false,\n [nodesConfiguration, props.type],\n );\n\n const { updateNodeLabel, updateNodeConfig } = useNode(id);\n const { data } = getNode(id) || {};\n const audioNode = useAudioNode(id);\n const { ConfigNode } = useConfigNode(rest.type);\n\n const [configMode, setShowConfigMode] = useState(false);\n\n if (!audioNode) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n can't find audio node\n </NodeLoaderWrapper>\n );\n }\n\n if (audioNode.loading) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n loading\n </NodeLoaderWrapper>\n );\n }\n\n if (audioNode.error) {\n return (\n <NodeErrorWrapper className={DRAG_HANDLE_CLASS}>\n error: {audioNode.error.toString()}\n </NodeErrorWrapper>\n );\n }\n\n if (!audioNode.node) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n can't find audio node\n </NodeLoaderWrapper>\n );\n }\n\n const size = data?.config?.size as\n | { width: number; height: number }\n | undefined;\n\n const {\n node: { inputs, outputs },\n } = audioNode;\n\n return (\n <NodeWrapper>\n <TitleBar>\n {info && (\n <InfoIconWrapper onClickCapture={() => setIsInfoModalShown(true)} />\n )}\n <EditableLabel\n value={data?.label ?? \"No Name\"}\n onChange={updateNodeLabel}\n />\n {ConfigNode && (\n <SettingsIconWrapper\n onClickCapture={() => setShowConfigMode((isShown) => !isShown)}\n />\n )}\n </TitleBar>\n <PortsPanel theme={theme}>\n <InputPorts>\n {inputs\n ? Object.keys(inputs).map((key, index) => (\n <Port key={index}>\n <InputHandle id={key} portType={inputs[key].type} />\n <span>{key}</span>\n </Port>\n ))\n : null}\n </InputPorts>\n <OutputPorts>\n {outputs\n ? Object.keys(outputs).map((key, index) => (\n <Port key={index}>\n <OutputHandle id={key} portType={outputs[key].type} />\n <span>{key}</span>\n </Port>\n ))\n : null}\n </OutputPorts>\n </PortsPanel>\n {ConfigNode && configMode && selected ? (\n <ConfigNode {...props} />\n ) : isResizeable ? (\n <Resizable\n size={size}\n minWidth={180}\n minHeight={30}\n enable={{\n bottom: true,\n bottomRight: true,\n right: true,\n }}\n onResizeStop={(e, direction, ref, d) => {\n const newSize = size\n ? {\n width: size.width + d.width,\n height: size.height + d.height,\n }\n : ref.getBoundingClientRect();\n updateNodeConfig({\n ...data?.config,\n size: newSize,\n });\n }}\n >\n {children}\n </Resizable>\n ) : (\n children\n )}\n <NodeInfoModal\n isOpen={isInfoModalShown}\n type={props.type}\n onClose={() => setIsInfoModalShown(false)}\n node={audioNode.node}\n />\n </NodeWrapper>\n );\n};\n","import styled from \"@emotion/styled\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport const TitleBarLabel = styled.input`\n width: 100%;\n background: none;\n border: none;\n text-align: center;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n\n &:focus {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-within {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-vissible {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:not([readonly]):focus {\n color: #fff;\n appearance: none;\n cursor: auto;\n background-color: var(--leva-colors-elevation2);\n padding: 0.3rem;\n border-radius: 0.2rem;\n }\n`;\n\ninterface EditableLabelProps {\n onChange: (value: string) => void;\n value?: string;\n className?: string;\n}\n\nconst EditableLabel = ({\n onChange,\n value = \"\",\n className,\n}: EditableLabelProps) => {\n const labelInputRef = useRef<HTMLInputElement>(null);\n\n const [labelEditMode, setLabelEditMode] = useState(false);\n const editNodeLabel = useCallback(\n (event: React.MouseEvent) => {\n //@ts-ignore\n event.target?.select();\n setLabelEditMode(true);\n },\n [setLabelEditMode],\n );\n\n const exitEditMode = useCallback(() => {\n window.getSelection()?.collapseToEnd();\n setLabelEditMode(false);\n }, [setLabelEditMode]);\n\n const saveNodeLabel = useCallback(() => {\n exitEditMode();\n if (labelInputRef.current) {\n onChange(labelInputRef.current.value);\n }\n }, [labelInputRef, exitEditMode, onChange]);\n\n const cancelNodeLabelEdit = useCallback(() => {\n exitEditMode();\n if (labelInputRef.current && value) {\n labelInputRef.current.value = value;\n }\n }, [labelInputRef, exitEditMode, value]);\n\n useEffect(() => {\n if (!labelInputRef.current) {\n return;\n }\n labelInputRef.current.value = value;\n }, [value, labelInputRef]);\n\n return (\n <TitleBarLabel\n ref={labelInputRef}\n type=\"text\"\n readOnly={!labelEditMode}\n onDoubleClick={(event) => editNodeLabel(event)}\n onBlur={saveNodeLabel}\n onKeyDown={(event) => {\n switch (event.key) {\n case \"Escape\":\n cancelNodeLabelEdit();\n break;\n case \"Enter\":\n saveNodeLabel();\n break;\n }\n }}\n className={className}\n />\n );\n};\n\nexport default EditableLabel;\n","import styled from \"@emotion/styled\";\nimport Modal from \"./Modal\";\nimport { marked } from \"marked\";\nimport useStore from \"../store\";\nimport { withTheme } from \"@emotion/react\";\nimport { useMemo } from \"react\";\nimport { WNAudioNode } from \"../types\";\nimport { Theme } from \"../theme\";\n\ninterface NodeInfoModalProps {\n isOpen: boolean;\n onClose: () => void;\n type: string;\n node: WNAudioNode;\n}\n\nconst NodeInfoWrapper = withTheme(styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n overflow: scroll;\n padding: 0.6rem;\n box-sizing: border-box;\n\n hr {\n border: none;\n border-bottom: 1px solid ${({ theme }) => theme.colors.elevation3};\n }\n\n code {\n background-color: ${({ theme }) => theme.colors.elevation3};\n color: ${({ theme }) => theme.colors.highlight3};\n font-family:\n source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n }\n\n pre {\n background-color: ${({ theme }) => theme.colors.elevation3};\n padding: 0.2rem 0.3rem;\n border-radius: 1px;\n }\n\n a {\n color: ${({ theme }) => theme.colors.accent1};\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n font-weight: bold;\n unicode-bidi: isolate;\n }\n\n h1 {\n font-size: 2em;\n margin-block-start: 0.67em;\n margin-block-end: 0.67em;\n }\n\n h2 {\n font-size: 1.5em;\n margin-block-start: 0.83em;\n margin-block-end: 0.83em;\n }\n\n h3 {\n font-size: 1.17em;\n margin-block-start: 1em;\n margin-block-end: 1em;\n }\n\n ul {\n display: block;\n list-style-type: disc;\n margin-block-start: 1em;\n margin-block-end: 1em;\n padding-inline-start: 40px;\n unicode-bidi: isolate;\n }\n\n p {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n unicode-bidi: isolate;\n }\n`);\n\nconst useNodeManifest = (type: string) => {\n const data = useStore((store) => store.nodesConfiguration[type]);\n return data;\n};\n\nconst NodeInfoModal = ({\n isOpen,\n onClose,\n type: nodeType,\n node,\n}: NodeInfoModalProps) => {\n const { info, portsDescription } = useNodeManifest(nodeType);\n\n const portsInfo = useMemo(() => {\n const parts: string[] = [];\n\n const inputPorts = node.inputs;\n if (inputPorts) {\n parts.push(`## Inputs`);\n for (const portName in inputPorts) {\n const port = inputPorts[portName];\n parts.push(`### *${portName}*`);\n\n const description = portsDescription?.inputs?.[portName];\n\n if (description) {\n parts.push(description);\n }\n\n if (Array.isArray(port.type)) {\n parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n } else {\n parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n }\n\n if (port.range) {\n parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n }\n\n if (port.defaultValue !== undefined) {\n parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n }\n\n const outputPorts = node.outputs;\n if (outputPorts) {\n parts.push(`## Outputs`);\n for (const portName in outputPorts) {\n const port = outputPorts[portName];\n parts.push(`### *${portName}*`);\n\n const description = portsDescription?.outputs?.[portName];\n\n if (description) {\n parts.push(description);\n }\n\n if (Array.isArray(port.type)) {\n parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n } else {\n parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n }\n\n if (port.range) {\n parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n }\n\n if (port.defaultValue !== undefined) {\n parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n }\n return parts.join(\"\\n\\n\");\n }, [node, portsDescription]);\n\n const combinedInfo = (info || \"\") + \"\\n\\n\" + portsInfo;\n\n return isOpen ? (\n <Modal onClose={onClose}>\n <NodeInfoWrapper\n dangerouslySetInnerHTML={{ __html: marked(combinedInfo || \"\") }}\n />\n </Modal>\n ) : null;\n};\n\nexport default NodeInfoModal;\n","import { FaQuestion } from \"react-icons/fa\";\nimport { ControlButton } from \"reactflow\";\nimport useStore from \"../../store\";\nimport HelpModal from './HelpModal';\n\n\nconst HelpButton = () => {\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n return (\n <>\n <ControlButton onClick={toggleHelp}>\n <FaQuestion />\n </ControlButton>\n </>\n );\n};\n\nexport { HelpModal, HelpButton };\n\n","import { withTheme } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\n// @ts-ignore\nimport { marked } from \"marked\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport Modal from \"../Modal\";\n\n//@ts-ignore\nimport HELP from \"bundle-text:./HELP.md\";\n\nconst MdPreview = withTheme(styled.div<{ theme: Theme }>`\n font-family: var(--leva-fonts-mono);\n font-size: 0.7rem;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n overflow: scroll;\n color: ${({ theme }) => theme.colors.whitePrimary};\n padding: 0 0.5rem;\n\n code {\n color: ${({ theme }) => theme.colors.accent3};\n filter: hue-rotate(180deg);\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n font-weight: bold;\n unicode-bidi: isolate;\n }\n\n h1 {\n font-size: 2em;\n margin-block-start: 0.67em;\n margin-block-end: 0.67em;\n }\n\n h2 {\n font-size: 1.5em;\n margin-block-start: 0.83em;\n margin-block-end: 0.83em;\n }\n\n h3 {\n font-size: 1.17em;\n margin-block-start: 1em;\n margin-block-end: 1em;\n }\n\n ul {\n display: block;\n list-style-type: disc;\n margin-block-start: 1em;\n margin-block-end: 1em;\n padding-inline-start: 40px;\n unicode-bidi: isolate;\n }\n\n p {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n unicode-bidi: isolate;\n }\n`);\n\nconst ModalContent = withTheme(styled.div<{ theme: Theme }>`\n padding: 1rem;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n overflow: hidden;\n`);\n\nconst HelpModal = () => {\n const isHelpShown = useStore((store) => store.isHelpShown);\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n if (!isHelpShown) {\n return null;\n }\n\n return (\n <Modal\n onClose={() => {\n toggleHelp();\n }}\n >\n <ModalContent>\n <MdPreview\n dangerouslySetInnerHTML={{ __html: marked(HELP) }}\n onWheelCapture={(event) => event.stopPropagation()}\n ></MdPreview>\n </ModalContent>\n </Modal>\n );\n};\n\nexport default HelpModal;\n","module.exports = \"f1207d2537cf9ec3\";","import styled from \"@emotion/styled\";\nimport { useState } from \"react\";\nimport { FaVolumeOff as IconUnmute } from \"react-icons/fa\";\nimport useStore from \"../store\";\nimport useTheme from \"../hooks/useTheme\";\nimport { Theme } from \"../theme\";\n\n\nconst Layout = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: ${({ theme }) => theme.zIndex.resumeContextLayout};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: rgb(24 28 32 / 90%);\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n color: ${({ theme }) => theme.colors.whitePrimary};\n cursor: pointer;\n`;\n\nconst Row = styled.div`\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n`;\n\nconst Message = styled.div<{ theme: Theme }>`\n font-family: var(--leva-fonts-mono);\n font-size: 2rem;\n`;\n\nconst Icon = styled(IconUnmute)`\n width: 7rem;\n height: 7rem;\n`;\n\nconst ResumeContext = () => {\n const theme = useTheme();\n const patch = useStore(({ patch }) => patch);\n const audioContext = patch.audioContext;\n const [isContextResumed, setIsContextResumed] = useState<boolean>(\n audioContext.state === \"running\",\n );\n\n if (isContextResumed) {\n return null;\n }\n\n return (\n <Layout\n theme={theme}\n onClick={() => {\n audioContext.resume();\n setIsContextResumed(true);\n }}\n >\n <Row>\n <Message theme={theme}>Click anywhere to resume audio context</Message>\n </Row>\n <Row>\n <Icon />\n </Row>\n </Layout>\n );\n};\n\nexport default ResumeContext;\n","import { FaMap, FaRegMap } from \"react-icons/fa\";\nimport { ControlButton } from \"reactflow\";\nimport useStore from \"../store\";\n\nconst ToggleMinimap = () => {\n const setConfig = useStore(({ setConfig }) => setConfig);\n const { showMinimap } = useStore(({ config }) => config);\n\n return (\n <ControlButton onClick={() => setConfig({ showMinimap: !showMinimap })}>\n {showMinimap ? <FaMap /> : <FaRegMap />}\n </ControlButton>\n );\n};\n\nexport default ToggleMinimap;\n","import { useEffect, useMemo } from \"react\";\nimport { EdgeProps, getBezierPath, getConnectedEdges } from \"reactflow\";\nimport useTheme from \"../hooks/useTheme\";\nimport useStore from \"../store\";\n\nconst Wire = ({\n id,\n sourceX,\n sourceY,\n targetX,\n targetY,\n sourcePosition,\n targetPosition,\n style = {},\n data,\n markerStart,\n markerEnd,\n source,\n target,\n sourceHandleId,\n targetHandleId,\n selected,\n}: EdgeProps) => {\n const theme = useTheme();\n const getNode = useStore(({ getNode }) => getNode);\n const sourceNode = getNode(source);\n const targetNode = getNode(target);\n const isConnectedToSelected = sourceNode?.selected || targetNode?.selected;\n useEffect(() => {\n if (!sourceHandleId || !targetHandleId) {\n return;\n }\n console.log(`connected ${source} to ${target}`);\n return () => {\n console.log(`disconnected ${source} from ${target}`);\n };\n }, [source, sourceHandleId, target, targetHandleId]);\n\n const [edgePath] = getBezierPath({\n targetX,\n targetY,\n targetPosition,\n sourceX,\n sourceY,\n sourcePosition,\n });\n\n return (\n <>\n <path\n id={id}\n style={{\n ...style,\n stroke: selected\n ? theme.colors.accent2\n : isConnectedToSelected\n ? theme.colors.highlight3\n : theme.colors.highlight2,\n }}\n className=\"react-flow__edge-path Wire\"\n d={edgePath}\n markerEnd={markerEnd}\n />\n <path\n style={{\n ...style,\n strokeWidth: 8,\n color: \"transparent\",\n opacity: 0,\n cursor: \"pointer\",\n }}\n d={edgePath}\n markerEnd={markerEnd}\n />\n </>\n );\n};\n\nexport default Wire;\n"],"names":["config","jsx","$but2J$jsx","jsxs","$but2J$jsxs","Fragment","$but2J$Fragment","withTheme","$but2J$withTheme","ThemeProvider","$but2J$ThemeProvider","Global","$but2J$Global","css","$but2J$css","useTheme","$but2J$useTheme","$but2J$emotionstyled","nanoid","$but2J$nanoid","useState","$but2J$useState","useEffect","$but2J$useEffect","useMemo","$but2J$useMemo","useCallback","$but2J$useCallback","useRef","$but2J$useRef","FaPlus","$but2J$FaPlus","MdClose","$but2J$MdClose","MdDragHandle","$but2J$MdDragHandle","MdSettings","$but2J$MdSettings","MdInfoOutline","$but2J$MdInfoOutline","registerFetcher","$but2J$registerFetcher","$but2J$reactflow","getConnectedEdges","$but2J$getConnectedEdges","addEdge","$but2J$addEdge","applyNodeChanges","$but2J$applyNodeChanges","applyEdgeChanges","$but2J$applyEdgeChanges","Controls","$but2J$Controls","useOnViewportChange","$but2J$useOnViewportChange","Background","$but2J$Background","BackgroundVariant","$but2J$BackgroundVariant","MiniMap","$but2J$MiniMap","ReactFlowProvider","$but2J$ReactFlowProvider","useReactFlow","$but2J$useReactFlow","Position","$but2J$Position","Handle","$but2J$Handle","ControlButton","$but2J$ControlButton","getBezierPath","$but2J$getBezierPath","create","$but2J$create","setAudioNodeTypes","$but2J$setAudioNodeTypes","createPatch","$but2J$createPatch","reverse","$but2J$reverse","patch","$but2J$patch","$but2J$create1","injectGlobal","$but2J$injectGlobal","useContextMenu","$but2J$useContextMenu","Item","$but2J$Item","Menu","$but2J$Menu","Separator","$but2J$Separator","$but2J$hotkeysjs","createPortal","$but2J$createPortal","FileDrop","$but2J$FileDrop","FaFileUpload","$but2J$FaFileUpload","FaQuestion","$but2J$FaQuestion","FaVolumeOff","$but2J$FaVolumeOff","FaMap","$but2J$FaMap","FaRegMap","$but2J$FaRegMap","Resizable","$but2J$Resizable","$but2J$reactgridlayout","AiFillLock","$but2J$AiFillLock","AiFillUnlock","$but2J$AiFillUnlock","RxDashboard","$but2J$RxDashboard","$but2J$reactmoderndrawer","marked","$but2J$marked","$73e253e9a60dc018$export$956b3cf15d7c363","$73e253e9a60dc018$export$21d634b1d5d9bee3","PortType","$73e253e9a60dc018$export$b0b7b95ee465c83c","$db60a1ce8fd45a15$var$cloneObject","input","JSON","parse","stringify","$b69bc78343b7b1b2$export$e364ea0c1dfb25e5","left","right","setLeft","Set","map","item","id","setRight","added","filter","has","removed","$d6879eb00f829ebf$export$e698b79c63b74136","file","type","$d6879eb00f829ebf$export$31c2336f657dc59f","$40b3df4f7825b834$export$2e2bcd8739ae039","args","set","get","nodes","edges","onNodesChange","changes","node","dragHandle","onEdgesChange","onConnect","connection","addNode","concat","setNodes","setEdges","setNodesAndEdges","getNodesAndEdges","clearElements","getNode","find","updateNodeData","data","nodeTypes","setNodeTypes","history","maxHistoryLength","buffer","pointer","skipCollect","push","newBuffer","slice","Math","max","min","back","controlPanel","patchData","reversedPatchData","forward","clear","nodesState","project","files","setProject","currentFileIndex","getProject","pullEditorChanges","getEditorState","updateFileContent","currentFile","syncEditorWithCurrentFile","setEditorState","console","log","setCurrentFileIndex","newFileIndex","index","f","i","updateFileName","fileName","name","addFile","deleteFile","fileIndex","_","setGraph","createNodes","createEdges","activeNodes","activeEdges","clearGraph","createNode","Promise","all","nodeData","nodesConfiguration","Error","defaultConfig","removeNode","removeNodes","currentNodes","onNodesDelete","removeEdges","removeNodesFromControlPanel","parentNodeIds","resultingNodes","parentNode","includes","nodeIds","currentEdges","onEdgesDelete","edgeIds","newEdges","plugins","setPlugins","nodesConf","reduce","acc","plugin","components","subAcc","Object","keys","audioNode","showMinimap","setConfig","viewport","r","setTimeout","isHelpShown","toggleHelp","showHelp","copyBuffer","copy","elements","copySelectedItems","selected","length","pasteBuffer","x","y","nodesToCopy","edgesToCopy","topLeftNode","position","xDelta","yDelta","newNodes","mapping","random","newNodeId","Date","floor","toString","edge","source","target","replace","getControlPanelNode","controlPanelNode","error","show","size","width","height","showControlPanel","hideControlPanel","addNodeToControlPanel","newNode","removeNodeFromControlPanel","setControlPanelNodes","setControlPanelSize","zoom","setViewport","api","timer","jsondiffpatchInstance","oldState","collectChanges","propertyFilter","context","parent","childName","state","prevState","clearTimeout","diff","subscribe","promises","currentState","storeChanges","newState","nodeChanges","edgeChanges","removedEdges","removedNodes","promise","registerAudioNodes","add","delete","values","e","registerAudioConnections","unregisterAudioConnections","unregisterAudioNodes","$731cc06061de042d$export$2e2bcd8739ae039","colors","elevation1","elevation2","elevation3","accent1","accent2","accent3","highlight1","highlight2","highlight3","vivid1","whitePrimary","zIndex","modal","resumeContextLayout","$04218161d9aa484d$export$2e2bcd8739ae039","customTheme","$f3e787b52be18373$export$ef9839ae55b8ba40","$f3e787b52be18373$export$98eff9c5659394e3","$e54d25e5d65b9790$export$d4cd258d01c03112","$e54d25e5d65b9790$export$2e2bcd8739ae039","theme","store","children","animation","onClick","event","props","$628ee4b8a62b71a2$var$ModalOuter","div","$628ee4b8a62b71a2$var$ModalInner","$628ee4b8a62b71a2$var$ModalCloser","$628ee4b8a62b71a2$export$2e2bcd8739ae039","onClose","escHandler","key","document","addEventListener","removeEventListener","stopPropagation","body","$d8badf9492e6c707$var$PluginsWrapper","$d8badf9492e6c707$var$PluginWrapper","$d8badf9492e6c707$var$NodesList","ul","$d8badf9492e6c707$var$NodeTitle","$d8badf9492e6c707$var$NodeDescription","$d8badf9492e6c707$export$48f6b48a42d49a36","$d8badf9492e6c707$export$7129a6e2db131a76","span","isActive","$d8badf9492e6c707$var$PluginHeader","$d8badf9492e6c707$var$PluginTitle","$d8badf9492e6c707$var$PluginDescription","$d8badf9492e6c707$export$2e2bcd8739ae039","onComponentClick","filters","search","tags","onTagClick","pluginsGroup","filteredPlugins","filteredByTags","component","every","tag","toLocaleLowerCase","description","sort","a","b","toLowerCase","idx","tagIdx","onClickCapture","$18ae22c0cb4ff02c$var$InputWrapper","$18ae22c0cb4ff02c$var$InputInner","$18ae22c0cb4ff02c$var$FiltersWrapper","$18ae22c0cb4ff02c$var$PluginName","label","$18ae22c0cb4ff02c$var$StyledPluginTag","$18ae22c0cb4ff02c$export$2e2bcd8739ae039","onChange","value","inputRef","current","focus","ref","placeholder","newTags","t","checked","$fc033f275cd8346c$var$AddNodeWrapper","$fc033f275cd8346c$var$PluginsPanel","$fc033f275cd8346c$export$2e2bcd8739ae039","isOpen","closeMenu","mousePosition","screenToFlowPosition","filtersState","setFiltersState","targetPosition","Left","sourcePosition","Right","$459a4e08a0372e29$export$25df2e315be8e003","resolve","reject","reader","FileReader","readAsDataURL","onload","result","onerror","$a5a5b1a37c474365$var$UploadAudioWrapper","$a5a5b1a37c474365$var$DropZoneInner","$a5a5b1a37c474365$var$FileUploadIcon","$a5a5b1a37c474365$var$FileUploadMessage","$a5a5b1a37c474365$export$2e2bcd8739ae039","fileInputRef","uploadFile","base64","className","style","display","accept","targetClassName","draggingOverTargetClassName","onTargetClick","click","onDrop","$fee9f929ba5c051a$export$d4cd258d01c03112","$fee9f929ba5c051a$export$2e2bcd8739ae039","editorContextMenu","setMousePosition","showAddNode","setShowAddNode","showUploadAudio","setShowUploadAudio","addNodeHandler","pasteBufferHandler","deleteAllHandler","historyBack","historyForward","historyPointer","historyBuffer","selectedNodes","currentCopyBuffer","unbind","triggerEvent","clientX","clientY","disabled","$617fd1d922572ac4$export$d4cd258d01c03112","$617fd1d922572ac4$export$2e2bcd8739ae039","controlPanelNodes","isOnControlPanel","hasControlPanelNode","nodeConfiguration","hidden","$027dbe8e99154283$export$2e2bcd8739ae039","audioNodes","$9630f1cf400b3c5a$export$2e2bcd8739ae039","updateNodeValues","updateNodeConfig","updateNodeLabel","$cad26a5b9571a093$export$5abe11f802ebd1f2","$cad26a5b9571a093$export$2e2bcd8739ae039","labelInputRef","labelEditMode","setLabelEditMode","editNodeLabel","select","exitEditMode","window","getSelection","collapseToEnd","saveNodeLabel","cancelNodeLabelEdit","readOnly","onDoubleClick","onBlur","onKeyDown","$78270d26f6f09c4c$var$NodeInfoWrapper","$78270d26f6f09c4c$export$2e2bcd8739ae039","nodeType","info","portsDescription","portsInfo","parts","inputPorts","inputs","portName","port","Array","isArray","join","range","undefined","defaultValue","outputPorts","outputs","dangerouslySetInnerHTML","__html","combinedInfo","$5a72e86517ffe32d$var$NodeWrapper","$5a72e86517ffe32d$var$NodeLoaderWrapper","$5a72e86517ffe32d$var$NodeErrorWrapper","$5a72e86517ffe32d$var$SettingsIconWrapper","$5a72e86517ffe32d$var$InfoIconWrapper","$5a72e86517ffe32d$var$Section","$5a72e86517ffe32d$export$1bdb8f2d1fe25c22","$5a72e86517ffe32d$export$bfd3bd1fa283e3c6","$5a72e86517ffe32d$export$f1afba0ff9ea1277","$5a72e86517ffe32d$export$af4f9b41fc32ed9e","$5a72e86517ffe32d$export$a2d375858cc72119","$5a72e86517ffe32d$var$portColors","Audio","Gate","Number","Any","$5a72e86517ffe32d$var$StyledHandle","shouldForwardProp","prop","portType","$5a72e86517ffe32d$var$StyledInputHandle","$5a72e86517ffe32d$export$9ea0feffc20ee81","$5a72e86517ffe32d$export$222539e2a2fac4e0","$5a72e86517ffe32d$export$496e5e1ee1696f64","$5a72e86517ffe32d$export$7e0b3af1e60a3273","$5a72e86517ffe32d$var$useNodeManifest","$5a72e86517ffe32d$export$361064385d50ec44","rest","isInfoModalShown","setIsInfoModalShown","isResizeable","resizable","ConfigNode","$5a72e86517ffe32d$var$useConfigNode","configNode","configMode","setShowConfigMode","loading","isShown","minWidth","minHeight","enable","bottom","bottomRight","onResizeStop","direction","d","newSize","getBoundingClientRect","$99522cb4c544c0e3$export$86de09faaa70680d","$99522cb4c544c0e3$export$548ca3bae446ddc2","$99522cb4c544c0e3$export$9fb15e3cc717240","$99522cb4c544c0e3$export$be58b4326e23250f","$a9eb7fd7f79ff3fb$var$ControlPanelNodeWrapper","$a9eb7fd7f79ff3fb$var$PanelNode","ControlPanelNode","$a9eb7fd7f79ff3fb$export$2e2bcd8739ae039","showControls","onDelete","$8f357eb500334b2f$var$ControlPanelIconWrapper","$8f357eb500334b2f$var$ControlPanelIconsBar","$8f357eb500334b2f$var$CloseIconWrapper","$8f357eb500334b2f$var$ControlPanelHeader","$8f357eb500334b2f$var$ControlPanelTitle","$8f357eb500334b2f$var$ControlPanelWrapper","$8f357eb500334b2f$var$ControlPanelBody","$8f357eb500334b2f$var$ControlPanelSettings","$8f357eb500334b2f$var$LockGridWrapper","$8f357eb500334b2f$var$GridResizeHandle","$8f357eb500334b2f$var$ControlPanelItemWrapper","$8f357eb500334b2f$export$2e2bcd8739ae039","nodeRef","filteredNodes","isGridLocked","setGridLocked","layout","fallbackY","Y","w","h","open","enableOverlay","background","top","topRight","bottomLeft","topLeft","handleComponent","cols","rowHeight","margin","isResizable","draggableHandle","onLayoutChange","requestAnimationFrame","$f82470e1f8a957ac$exports","$72ce7400f28463b9$var$MdPreview","$72ce7400f28463b9$var$ModalContent","$72ce7400f28463b9$export$2e2bcd8739ae039","__esModule","default","onWheelCapture","$5acaa12be69dfa8a$export$78bddedbcf2939ac","$4379ac7ed25061a0$var$Layout","$4379ac7ed25061a0$var$Row","$4379ac7ed25061a0$var$Message","$4379ac7ed25061a0$var$Icon","$4379ac7ed25061a0$export$2e2bcd8739ae039","audioContext","isContextResumed","setIsContextResumed","resume","$5536f4f171f9bf88$export$2e2bcd8739ae039","$8b2e0523152bfd06$export$2e2bcd8739ae039","sourceX","sourceY","targetX","targetY","markerStart","markerEnd","sourceHandleId","targetHandleId","sourceNode","targetNode","isConnectedToSelected","edgePath","stroke","strokeWidth","color","opacity","cursor","$6bb27c07aa83529c$var$StyledControls","$6bb27c07aa83529c$var$onNodeDragStop","_event","$6bb27c07aa83529c$var$onNodeClick","element","$6bb27c07aa83529c$var$snapGrid","$6bb27c07aa83529c$export$72cb76f559fbafcf","editorState","edgeTypes","wire","editorConfig","reactflowInstance","setReactflowInstance","onInit","rfi","onContextMenu","onEditorContextMenu","onNodeContextMenu","onEdgeContextMenu","onEnd","onNodeDragStop","onNodeClick","snapGrid","defaultViewport","defaultEdgeOptions","snapToGrid","fitView","disableKeyboardA11y","variant","Dots","gap","showInteractive","$6bb27c07aa83529c$export$7cda8d932e2f33c0","$1729b5eaa1e6c3bc$export$d31000d36961d6c2","$1729b5eaa1e6c3bc$export$6cd5d5c1dae69a36","$1729b5eaa1e6c3bc$export$6bc5189622b1f4ec","$1729b5eaa1e6c3bc$export$8d546ef2006cd0a2","$1729b5eaa1e6c3bc$export$10efbd348f877f87","$1729b5eaa1e6c3bc$export$8c347812506d5ac9","$1729b5eaa1e6c3bc$export$b38a2fd24b22fb35","showLoader","setShowLoader","src","controls","$1729b5eaa1e6c3bc$export$2206531ad8592d57","$1729b5eaa1e6c3bc$export$3e41faf802a29e71","active","$1729b5eaa1e6c3bc$export$61e5b3c7bace77b8","$1729b5eaa1e6c3bc$export$3aef34186a092045","$1729b5eaa1e6c3bc$export$cae179f078f4b4a4","$1729b5eaa1e6c3bc$var$generateEmptyFile","$1729b5eaa1e6c3bc$export$2e2bcd8739ae039","projectState","isDragging","setIsDragging","request","Request","url","Response","fetch","status","styles","onDragOver","preventDefault","onDragLeave","from","dataTransfer","forEach","fileData","text","confirm","match","val","Editor","EDITOR_DEFAULTS","Wire","WNNode","TitleBar","PortsPanel","OutputPorts","OutputHandle","InputPorts","InputHandle","Port","Modal","EditableLabel","useAudioNode","useNode","useStore","isAudio","isPatch"],"version":3,"file":"module.js.map"}