"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunkfrontend"] = self["webpackChunkfrontend"] || []).push([["src_nodes_FileUploadNode_tsx"],{

/***/ "./src/nodes/FileUploadNode.tsx":
/*!**************************************!*\
  !*** ./src/nodes/FileUploadNode.tsx ***!
  \**************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! styled-components */ \"./node_modules/.pnpm/styled-components@5.3.10_7i5myeigehqah43i5u7wbekgba/node_modules/styled-components/dist/styled-components.browser.esm.js\");\n/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd */ \"./node_modules/.pnpm/antd@5.4.6_biqbaboplfbrettd7655fr4n2y/node_modules/antd/es/upload/index.js\");\n/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! antd */ \"./node_modules/.pnpm/antd@5.4.6_biqbaboplfbrettd7655fr4n2y/node_modules/antd/es/button/index.js\");\n/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd */ \"./node_modules/.pnpm/antd@5.4.6_biqbaboplfbrettd7655fr4n2y/node_modules/antd/es/typography/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"webpack/sharing/consume/default/react/react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! zod */ \"./node_modules/.pnpm/zod@3.21.4/node_modules/zod/lib/index.mjs\");\n/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ant-design/icons */ \"./node_modules/.pnpm/@ant-design+icons@5.0.1_biqbaboplfbrettd7655fr4n2y/node_modules/@ant-design/icons/es/icons/UploadOutlined.js\");\n/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ant-design/icons */ \"./node_modules/.pnpm/@ant-design+icons@5.0.1_biqbaboplfbrettd7655fr4n2y/node_modules/@ant-design/icons/es/icons/DownloadOutlined.js\");\n\n\n\n\n\nconst dataSchema = zod__WEBPACK_IMPORTED_MODULE_1__.z.any();\nfunction RemoteUI({\n  outputs,\n  setOutputs\n}) {\n  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n    className: \"w-full flex flex-col space-y-2\"\n  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, outputs ? outputs[0].name : \"No file uploaded\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(antd__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n    customRequest: ({\n      file,\n      onSuccess\n    }) => {\n      const f = file;\n      setOutputs([f]);\n      if (onSuccess) onSuccess({});\n    }\n  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(antd__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ant_design_icons__WEBPACK_IMPORTED_MODULE_4__[\"default\"], null)\n  }, \"Upload File\")));\n}\nfunction DownloadFile({\n  outputs,\n  download\n}) {\n  const f = zod__WEBPACK_IMPORTED_MODULE_1__.z.object({\n    reserved: zod__WEBPACK_IMPORTED_MODULE_1__.z.literal(\"file\"),\n    url: zod__WEBPACK_IMPORTED_MODULE_1__.z.string().url()\n  }).parse(outputs[0]);\n  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(antd__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ant_design_icons__WEBPACK_IMPORTED_MODULE_5__[\"default\"], null),\n    onClick: () => {\n      if (download) download(f.url);\n    }\n  }, \"Download File\");\n}\nfunction FileUploadNode({\n  callAfterUpdateInpOuts = () => {},\n  node,\n  setNode\n}) {\n  const data = dataSchema.parse(node.data);\n  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n    setNode(nd => ({\n      ...nd,\n      data: {},\n      operator: \"ui\",\n      num_inputs: 0,\n      num_outputs: 1,\n      subcomponents: {\n        ui: RemoteUI,\n        output: DownloadFile\n      }\n    }));\n    callAfterUpdateInpOuts();\n  }, []);\n  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_StyledDiv, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(antd__WEBPACK_IMPORTED_MODULE_6__[\"default\"].Text, null, \"Base Node\"));\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FileUploadNode);\nvar _StyledDiv = (0,styled_components__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(\"div\").withConfig({\n  displayName: \"FileUploadNode___StyledDiv\",\n  componentId: \"sc-1lpeezp-0\"\n})({\n  \"display\": \"flex\",\n  \"flexDirection\": \"column\",\n  \"> :not([hidden]) ~ :not([hidden])\": {\n    \"--tw-space-y-reverse\": \"0\",\n    \"marginTop\": \"calc(0.5rem * calc(1 - var(--tw-space-y-reverse)))\",\n    \"marginBottom\": \"calc(0.5rem * var(--tw-space-y-reverse))\"\n  }\n});\n\n//# sourceURL=webpack://frontend/./src/nodes/FileUploadNode.tsx?");

/***/ })

}]);