mage-ai 0.8.97__py3-none-any.whl → 0.8.99__py3-none-any.whl
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.
Potentially problematic release.
This version of mage-ai might be problematic. Click here for more details.
- mage_ai/api/policies/AutocompleteItemPolicy.py +2 -1
- mage_ai/api/policies/BasePolicy.py +2 -2
- mage_ai/api/policies/BlockTemplatePolicy.py +2 -1
- mage_ai/api/policies/ClusterPolicy.py +2 -1
- mage_ai/api/policies/DataProviderPolicy.py +2 -1
- mage_ai/api/policies/EventRulePolicy.py +2 -1
- mage_ai/api/policies/ExtensionOptionPolicy.py +2 -1
- mage_ai/api/policies/FileVersionPolicy.py +2 -1
- mage_ai/api/policies/GitBranchPolicy.py +9 -0
- mage_ai/api/policies/KernelPolicy.py +2 -1
- mage_ai/api/policies/LogPolicy.py +2 -2
- mage_ai/api/policies/OauthPolicy.py +15 -0
- mage_ai/api/policies/OutputPolicy.py +2 -2
- mage_ai/api/policies/PipelinePolicy.py +2 -2
- mage_ai/api/policies/PipelineRunPolicy.py +2 -2
- mage_ai/api/policies/PipelineSchedulePolicy.py +2 -2
- mage_ai/api/policies/PullRequestPolicy.py +64 -0
- mage_ai/api/policies/SessionPolicy.py +4 -1
- mage_ai/api/policies/VariablePolicy.py +2 -2
- mage_ai/api/policies/WidgetPolicy.py +2 -2
- mage_ai/api/policies/WorkspacePolicy.py +3 -3
- mage_ai/api/presenters/PipelinePresenter.py +1 -0
- mage_ai/api/presenters/PullRequestPresenter.py +16 -0
- mage_ai/api/presenters/StatusPresenter.py +2 -0
- mage_ai/api/presenters/SyncPresenter.py +1 -0
- mage_ai/api/presenters/WorkspacePresenter.py +2 -0
- mage_ai/api/resources/GitBranchResource.py +81 -26
- mage_ai/api/resources/OauthResource.py +31 -4
- mage_ai/api/resources/PipelineResource.py +8 -1
- mage_ai/api/resources/PullRequestResource.py +87 -0
- mage_ai/api/resources/RoleResource.py +6 -3
- mage_ai/api/resources/SecretResource.py +2 -5
- mage_ai/api/resources/SessionResource.py +18 -0
- mage_ai/api/resources/StatusResource.py +7 -3
- mage_ai/api/resources/UserResource.py +11 -16
- mage_ai/api/resources/WorkspaceResource.py +83 -53
- mage_ai/authentication/oauth/active_directory.py +17 -0
- mage_ai/authentication/oauth/constants.py +9 -0
- mage_ai/authentication/oauth/utils.py +2 -1
- mage_ai/authentication/oauth2.py +9 -3
- mage_ai/cli/main.py +94 -51
- mage_ai/cluster_manager/kubernetes/workload_manager.py +141 -45
- mage_ai/data_preparation/git/__init__.py +86 -16
- mage_ai/data_preparation/git/api.py +175 -0
- mage_ai/data_preparation/models/block/dbt/utils/__init__.py +49 -14
- mage_ai/data_preparation/models/block/sql/__init__.py +3 -2
- mage_ai/data_preparation/models/pipeline.py +4 -1
- mage_ai/data_preparation/models/pipelines/integration_pipeline.py +7 -3
- mage_ai/data_preparation/preferences.py +4 -2
- mage_ai/data_preparation/repo_manager.py +41 -10
- mage_ai/data_preparation/shared/secrets.py +5 -6
- mage_ai/data_preparation/sync/__init__.py +2 -1
- mage_ai/data_preparation/sync/git_sync.py +2 -5
- mage_ai/data_preparation/templates/utils.py +2 -0
- mage_ai/orchestration/db/models/oauth.py +22 -4
- mage_ai/orchestration/pipeline_scheduler.py +19 -8
- mage_ai/orchestration/queue/process_queue.py +15 -12
- mage_ai/server/api/clusters.py +21 -11
- mage_ai/server/constants.py +1 -1
- mage_ai/server/frontend_dist/404.html +2 -2
- mage_ai/server/frontend_dist/404.html.html +2 -2
- mage_ai/server/frontend_dist/_next/static/WRxCTOtmZhTqQws_7OJZD/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{1286-993725c925c56a98.js → 1286-b90bd4b7f8abfc3a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{1424-f475cae42f8a7fca.js → 1424-90c0f66ba2f86b88.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3883-c95563b9f60ae526.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/6694-c8f2a68074420906.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{9350-1ff50f1d7b9ee754.js → 9350-5191c83a8d0cf454.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{_app-3527178abd99bc87.js → _app-171846e16d26855a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-e4e778f8f5e1bf2e.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/settings-c788c1b127999825.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/[user]-b4650224a19e8fe6.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/new-931eb719e3fae29c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users-d3724bde0b186dd9.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-af11f9cf94024ac0.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/{[...slug]-3ec5eb9562e4bff4.js → [...slug]-34326db259f922d1.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-503ecb7a72257b79.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs/{[run]-7667080098731e30.js → [run]-2994b8ab7862c07b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs-7b31b851e2544b42.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/{[...slug]-e18058e13882b20d.js → [...slug]-4445619d4eabe065.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{triggers-6854c10d5589d394.js → triggers-b7db0b682fadb840.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/account/profile-ee0931af3abb55b3.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-f8a59d718751be9a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/sync-data-90f8830890036eb2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/users-9f82673fc438ea83.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/sign-in-a1871b8a537d823c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-48859b4e9c846212.js +1 -0
- mage_ai/server/frontend_dist/files.html +2 -2
- mage_ai/server/frontend_dist/index.html +2 -2
- mage_ai/server/frontend_dist/manage/settings.html +24 -0
- mage_ai/server/frontend_dist/manage/users/[user].html +2 -2
- mage_ai/server/frontend_dist/manage/users/new.html +24 -0
- mage_ai/server/frontend_dist/manage/users.html +2 -2
- mage_ai/server/frontend_dist/manage.html +2 -2
- mage_ai/server/frontend_dist/pipeline-runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills/[...slug].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/edit.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/logs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runtime.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs/[run].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/settings.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/syncs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers/[...slug].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline].html +2 -2
- mage_ai/server/frontend_dist/pipelines.html +2 -2
- mage_ai/server/frontend_dist/settings/account/profile.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/preferences.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/sync-data.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/users.html +2 -2
- mage_ai/server/frontend_dist/settings.html +2 -2
- mage_ai/server/frontend_dist/sign-in.html +2 -2
- mage_ai/server/frontend_dist/terminal.html +2 -2
- mage_ai/server/frontend_dist/test.html +2 -2
- mage_ai/server/frontend_dist/triggers.html +2 -2
- mage_ai/server/frontend_dist/version-control.html +2 -2
- mage_ai/server/scheduler_manager.py +7 -2
- mage_ai/server/server.py +37 -3
- mage_ai/server/terminal_server.py +2 -2
- mage_ai/server/websocket_server.py +6 -2
- mage_ai/services/newrelic/__init__.py +21 -0
- mage_ai/settings/__init__.py +32 -0
- mage_ai/shared/hash.py +2 -0
- mage_ai/tests/api/test_utils.py +29 -2
- mage_ai/tests/data_preparation/models/test_pipeline.py +5 -0
- {mage_ai-0.8.97.dist-info → mage_ai-0.8.99.dist-info}/METADATA +8 -3
- {mage_ai-0.8.97.dist-info → mage_ai-0.8.99.dist-info}/RECORD +136 -127
- mage_ai/data_preparation/templates/main/projects/__init__.py +0 -0
- mage_ai/server/frontend_dist/_next/static/YLZRSrQ0aqtl-GGePfsMB/_buildManifest.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3077-d58f18ed770e5137.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3714-b676173cd4d8d86c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-82b5409dac9564f4.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/[user]-bb6aaa23e92a5add.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users-c91ee702a4cd7a6f.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-7961010cb0fb9abd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-7b8ce89f0d717465.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs-5bd17a8f3f3d57ef.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/account/profile-7d75e42d5f4936bb.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-8220c1200472bf70.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/sync-data-b602fa9b6ffabd12.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/users-3f9d5800f268a263.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/sign-in-2925c2c1b0c5559a.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-5ffc663cfb0ec81e.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{YLZRSrQ0aqtl-GGePfsMB → WRxCTOtmZhTqQws_7OJZD}/_middlewareManifest.js +0 -0
- /mage_ai/server/frontend_dist/_next/static/{YLZRSrQ0aqtl-GGePfsMB → WRxCTOtmZhTqQws_7OJZD}/_ssgManifest.js +0 -0
- {mage_ai-0.8.97.dist-info → mage_ai-0.8.99.dist-info}/LICENSE +0 -0
- {mage_ai-0.8.97.dist-info → mage_ai-0.8.99.dist-info}/WHEEL +0 -0
- {mage_ai-0.8.97.dist-info → mage_ai-0.8.99.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.8.97.dist-info → mage_ai-0.8.99.dist-info}/top_level.txt +0 -0
mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-7b8ce89f0d717465.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2551],{85307:function(e,n,t){"use strict";t.d(n,{$W:function(){return a},cl:function(){return s},cv:function(){return d},dE:function(){return u}});var i=t(38626),r=t(23831),o=t(73942),l=t(49125),c=t(37391),u=i.default.div.withConfig({displayName:"indexstyle__SectionStyle",componentId:"sc-7a1uhf-0"})(["border-radius:","px;padding:","px;",""],o.n_,l.cd*l.iI,(function(e){return"\n background-color: ".concat((e.theme.background||r.Z.background).popup,";\n ")})),a=i.default.div.withConfig({displayName:"indexstyle__CodeEditorStyle",componentId:"sc-7a1uhf-1"})(["padding-top:","px;",""],l.cd*l.iI,(function(e){return"\n background-color: ".concat((e.theme.background||r.Z.background).codeTextarea,";\n ")})),s=i.default.div.withConfig({displayName:"indexstyle__TableContainerStyle",componentId:"sc-7a1uhf-2"})(["overflow:auto;max-height:90vh;width:100%;"," "," "," "," ",""],c.w5,(function(e){return e.hideHorizontalScrollbar&&"\n overflow-x: hidden;\n "}),(function(e){return e.width&&"\n width: ".concat(e.width,";\n ")}),(function(e){return e.height&&"\n height: ".concat(e.height,";\n ")}),(function(e){return e.maxHeight&&"\n max-height: ".concat(e.maxHeight,";\n ")})),d=i.default.div.withConfig({displayName:"indexstyle__HeaderRowStyle",componentId:"sc-7a1uhf-3"})(["padding:","px;"," "," ",""],2*l.iI,(function(e){return"\n background-color: ".concat((e.theme||r.Z).interactive.defaultBackground,";\n border-bottom: ").concat(o.YF,"px ").concat(o.M8," ").concat((e.theme||r.Z).borders.medium,";\n ")}),(function(e){return e.padding&&"\n padding: ".concat(e.padding,"px;\n ")}),(function(e){return e.rounded&&"\n border-top-left-radius: ".concat(o.n_,"px;\n border-top-right-radius: ").concat(o.n_,"px;\n ")}))},70543:function(e,n,t){"use strict";t.d(n,{IY:function(){return o},Jf:function(){return r},NR:function(){return l},b7:function(){return i}});var i="edit",r={uuid:"All files"},o={uuid:"Files in pipeline"},l=[r,o]},43482:function(e,n,t){"use strict";t.d(n,{Dp:function(){return p},OF:function(){return h},Q9:function(){return v},Rt:function(){return s},h8:function(){return m},k1:function(){return d},uS:function(){return b}});var i=t(21831),r=t(82394),o=t(91427),l=t(24224),c=t(90211);function u(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?u(Object(t),!0).forEach((function(n){(0,r.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e){var n={},t={};return null===e||void 0===e||e.forEach((function(e){var i=e.content,r=e.outputs,o=e.type,l=e.uuid;(null===r||void 0===r?void 0:r.length)>=1&&(n[l]=r.map((function(e){var n=e||{},t=n.sample_data,i=n.shape,r=n.text_data,o=n.type;return t?{data:a({shape:i},t),type:o}:r&&(0,c.Pb)(r)?JSON.parse(r):r}))),t[o]||(t[o]={}),t[o][l]=i})),{content:t,messages:n}}function d(e,n,t){e.forEach((function(e){(0,o.t8)("".concat(t,"/").concat(e.uuid,"/codeCollapsed"),(0,o.Od)("".concat(n,"/").concat(e.uuid,"/codeCollapsed"))),(0,o.t8)("".concat(t,"/").concat(e.uuid,"/outputCollapsed"),(0,o.Od)("".concat(n,"/").concat(e.uuid,"/outputCollapsed")))}))}function f(e){return"".concat(e,"/").concat(o.kP)}function p(e){return(0,o.U2)(f(e),[])}function h(e,n){var t=p(e);t.includes(n)||(0,o.t8)(f(e),[].concat((0,i.Z)(t),[n]))}function m(e,n){var t=p(e).filter((function(e){return e!==n}));(0,o.t8)(f(e),t)}function v(e,n){var t=(0,l.HK)(n,(function(e){return e.uuid}));return e.map((function(e){return t[e]})).filter((function(e){return!!e}))}var b=function(e,n){var t=window.URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=n,document.body.appendChild(i),i.click(),i.remove()}},59920:function(e,n,t){"use strict";var i;t.d(n,{M:function(){return i}}),function(e){e.BACKFILLS="backfills",e.BLOCK_RUNS="block_runs",e.EDIT="edit",e.MONITOR="monitor",e.PIPELINE_LOGS="pipeline_logs",e.PIPELINE_RUNS="pipeline_runs",e.RUNS="runs",e.SETTINGS="settings",e.SYNCS="syncs",e.TRIGGERS="triggers"}(i||(i={}))},36405:function(e,n,t){"use strict";t.d(n,{H:function(){return c}});var i=t(98781),r=t(10503),o=t(59920),l=t(9736);function c(e,n,t){var c=(n||{}).uuid||t,u=[{Icon:r.Bf,id:o.M.TRIGGERS,isSelected:function(){return o.M.TRIGGERS===e},label:function(){return"Triggers"},linkProps:{as:"/pipelines/".concat(c,"/triggers"),href:"/pipelines/[pipeline]/triggers"}},{Icon:r.Pf,id:o.M.RUNS,isSelected:function(){return o.M.RUNS===e},label:function(){return"Runs"},linkProps:{as:"/pipelines/".concat(c,"/runs"),href:"/pipelines/[pipeline]/runs"}},{Icon:r.dE,id:o.M.BACKFILLS,isSelected:function(){return o.M.BACKFILLS===e},label:function(){return"Backfills"},linkProps:{as:"/pipelines/".concat(c,"/backfills"),href:"/pipelines/[pipeline]/backfills"}},{Icon:r.UL,id:o.M.PIPELINE_LOGS,isSelected:function(){return o.M.PIPELINE_LOGS===e},label:function(){return"Logs"},linkProps:{as:"/pipelines/".concat(c,"/logs"),href:"/pipelines/[pipeline]/logs"}},{Icon:r.ug,id:o.M.MONITOR,isSelected:function(){return o.M.MONITOR===e},label:function(){return"Monitor"},linkProps:{as:"/pipelines/".concat(c,"/monitors"),href:"/pipelines/[pipeline]/monitors"}}];return i.qL.INTEGRATION===(null===n||void 0===n?void 0:n.type)&&u.unshift({Icon:r.Nt,id:o.M.SYNCS,isSelected:function(){return o.M.SYNCS===e},label:function(){return"Syncs"},linkProps:{as:"/pipelines/".concat(c,"/syncs"),href:"/pipelines/[pipeline]/syncs"}}),(0,l.Ct)()||(u.unshift({Icon:r.EK,disabled:!c,id:o.M.EDIT,isSelected:function(){return o.M.EDIT===e},label:function(){return"Edit pipeline"},linkProps:{as:"/pipelines/".concat(c,"/edit"),href:"/pipelines/[pipeline]/edit"}}),u.push({Icon:r.Zr,id:o.M.SETTINGS,isSelected:function(){return o.M.SETTINGS===e},label:function(){return"Pipeline settings"},linkProps:{as:"/pipelines/".concat(c,"/settings"),href:"/pipelines/[pipeline]/settings"}})),u}},64155:function(e,n,t){"use strict";t.d(n,{Eh:function(){return a},ht:function(){return d},t0:function(){return s}});var i=t(38626),r=t(82386),o=t(1286),l=t(31012),c=t(37391),u=t(49125),a=(u.iI,o.O$+3*u.iI+l.dN),s=i.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-15ofupc-0"})([""," overflow:auto;position:absolute;width:100%;",""],c.w5,(function(e){return"\n height: calc(100vh - ".concat(r.uX,"px - ").concat(e.heightOffset,"px);\n ")})),d=i.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-15ofupc-1"})(["padding:","px;",""],2*u.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "}))},58122:function(e,n,t){"use strict";t.d(n,{CL:function(){return p},FS:function(){return h},JZ:function(){return v},e7:function(){return b},v0:function(){return f},wx:function(){return m}});var i=t(75582),r=t(82394),o=t(43313),l=t(93348),c=t(1286),u=t(90211),a=t(84779);function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function d(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){(0,r.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function f(e){var n=e.statistics,t=Object.keys(n),i=Array(o.Dy.length).fill(0);return 0===t.length?null:(t.forEach((function(e){if(o.Dy.includes(e)){var t=o.CC[e],r=n[e],l=r,c=!1,u=[2,3],s=o.Ub[e],d=o.oH[e],f=o.OD[e];if(o.y_.includes(e))c=!0,u=[2,1,2];else if(e in o.Sq){r=(0,a.Jw)(r,0);var p=o.Sq[e];l=n[p]}var h={columnFlexNumbers:u,name:t,progress:c,rate:l,successDirection:d,warning:f};o.y_.includes(e)||(h.value=r),i[s]=h}})),i)}function p(e){var n=e.columnTypes,t=void 0===n?{}:n,i=e.statistics,r=Object.keys(i);if(0===r.length)return null;var l=Object.values(t),a=l.length,s=[];s.push({name:"Column count",successDirection:o.oH.column_count,value:(0,u.x6)(a)}),r.forEach((function(e){if(o.Zu.includes(e)){var n=o.CC[e],t=i[e],r=o.OD[e];s.push({name:n,successDirection:o.oH[e],value:(0,u.x6)(t),warning:r})}}));var d=(0,c.QO)(l),f=d.countCategory,p=d.countDatetime,h=d.countNumerical;return s.push({name:"Categorical Features",rate:f/a,value:(0,u.x6)(f)},{name:"Numerical Features",rate:h/a,value:(0,u.x6)(h)},{name:"Datetime Features",rate:p/a,value:(0,u.x6)(p)}),s}function h(e){return"string"===typeof e?e:JSON.stringify(e)}function m(e,n){var t,i;return null===e||void 0===e||null===(t=e.find((function(e){var t=e.block;return n(t)})))||void 0===t||null===(i=t.variables)||void 0===i?void 0:i.map((function(e){var n=e.value;return d(d({},e),{},{value:h(n)})}))}function v(e,n){return n===l.Xm.TIME?e.push({uuid:"execution_date",value:"<run datetime>"}):n===l.Xm.EVENT&&e.push({uuid:"event",value:"<trigger event>"}),e}function b(e){return e?Object.entries(e).reduce((function(e,n){var t=(0,i.Z)(n,2),o=t[0],l=t[1],c=l;try{c=JSON.parse(l)}catch(u){}return d(d({},e),{},(0,r.Z)({},o,c))}),{}):e}},76096:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(33591)),l=t(28598),c=["children","fullHeight","gutter","style"];function u(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?u(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.fullHeight,i=e.gutter,u=e.style,s=void 0===u?{}:u,d=(0,r.Z)(e,c),f=a({},s);return i&&(f.paddingLeft=i,f.paddingRight=f.paddingLeft),t&&(f.height="100%"),(0,l.jsx)(o.Col,a(a({},d),{},{style:f,children:n}))}},97361:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=t(82684),l=t(33591),c=t(28598),u=["children","fullHeight","gutter","justifyContent","style"];function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.fullHeight,i=e.gutter,a=e.justifyContent,d=e.style,f=void 0===d?{}:d,p=(0,r.Z)(e,u),h=s({},f);return i&&(h.marginLeft=-1*i,h.marginRight=h.marginLeft),t&&(h.height="100%"),(0,c.jsx)(l.Row,s(s({},p),{},{justifyContent:a,style:h,children:o.Children.map(n,(function(e,n){return e&&o.cloneElement(e,{gutter:i,key:n})}))}))}},93348:function(e,n,t){"use strict";t.d(n,{TR:function(){return d},U5:function(){return u},Xm:function(){return o},Z4:function(){return s},fq:function(){return c},kJ:function(){return a}});var i,r,o,l=t(82394);!function(e){e.API="api",e.EVENT="event",e.TIME="time"}(o||(o={}));var c,u,a,s=(i={},(0,l.Z)(i,o.API,(function(){return"API"})),(0,l.Z)(i,o.EVENT,(function(){return"event"})),(0,l.Z)(i,o.TIME,(function(){return"schedule"})),i);!function(e){e.ACTIVE="active",e.INACTIVE="inactive"}(c||(c={})),function(e){e.ONCE="@once",e.HOURLY="@hourly",e.DAILY="@daily",e.WEEKLY="@weekly",e.MONTHLY="@monthly"}(u||(u={})),function(e){e.CREATED_AT="created_at",e.NAME="name",e.PIPELINE="pipeline_uuid",e.STATUS="status",e.TYPE="schedule_type"}(a||(a={}));var d=(r={},(0,l.Z)(r,a.CREATED_AT,"Created at"),(0,l.Z)(r,a.NAME,"Name"),(0,l.Z)(r,a.PIPELINE,"Pipeline"),(0,l.Z)(r,a.STATUS,"Status"),(0,l.Z)(r,a.TYPE,"Type"),r)},52769:function(e,n,t){"use strict";t.d(n,{C:function(){return i}});var i="global"},79891:function(e,n,t){"use strict";var i=t(38626),r=t(60328),o=t(67971),l=t(86673),c=t(19711),u=t(23831),a=t(10503),s=t(49125),d=t(31012),f=t(28598),p=i.default.div.withConfig({displayName:"Chip__ChipStyle",componentId:"sc-1ok73g-0"})(["display:inline-block;"," "," "," "," ",""],(function(e){return!e.primary&&"\n background-color: ".concat((e.theme.background||u.Z.background).popup,";\n ")}),(function(e){return e.primary&&"\n background-color: ".concat((e.theme.chart||u.Z.chart).primary,";\n ")}),(function(e){return!e.small&&"\n border-radius: ".concat((s.iI+d.Al)/2,"px;\n height: ").concat(1.5*s.iI+d.Al,"px;\n padding: ").concat(s.iI/1.5,"px ").concat(1.25*s.iI,"px;\n ")}),(function(e){return e.small&&"\n border-radius: ".concat((s.iI/2+d.Al)/2,"px;\n height: ").concat(d.Al+s.iI/2+2,"px;\n padding: ").concat(s.iI/4,"px ").concat(s.iI,"px;\n ")}),(function(e){return e.border&&"\n border: 1px solid ".concat((e.theme.content||u.Z.content).muted,";\n ")}));n.Z=function(e){var n=e.border,t=e.children,i=e.disabled,u=e.label,d=e.onClick,h=e.primary,m=e.small;return(0,f.jsx)(p,{border:n,primary:h,small:m,children:(0,f.jsx)(r.Z,{basic:!0,disabled:i,noBackground:!0,noPadding:!0,onClick:d,transparent:!0,children:(0,f.jsxs)(o.Z,{alignItems:"center",children:[t,u&&(0,f.jsx)(c.ZP,{small:m,children:u}),!i&&(0,f.jsx)(l.Z,{ml:1,children:(0,f.jsx)(a.x8,{default:h,muted:!h,size:m?s.iI:1.25*s.iI})})]})})})}},22673:function(e,n,t){"use strict";var i=t(82684),r=t(68792),o=t(31811),l=t(38626),c=t(65292),u=t(23831),a=t(2005),s=t(49125),d=t(28598);n.Z=function(e){var n=e.language,t=e.maxWidth,f=e.showLineNumbers,p=e.small,h=e.source,m=e.wrapLines,v=(0,i.useContext)(l.ThemeContext);function b(e){var i=e.value;return(0,d.jsx)(o.Z,{customStyle:{backgroundColor:(v.background||u.Z.background).popup,border:"none",borderRadius:"none",boxShadow:"none",fontFamily:a.Vp,fontSize:p?12:14,marginBottom:0,marginTop:0,maxWidth:t,paddingBottom:2*s.iI,paddingTop:2*s.iI},language:n,lineNumberStyle:{color:(v.content||u.Z.content).muted},showLineNumbers:f,style:c._4,useInlineStyles:!0,wrapLines:m,children:i})}return(0,d.jsx)(r.D,{components:{code:function(e){var n=e.children;return(0,d.jsx)(b,{value:n})}},children:h})}},65730:function(e,n,t){"use strict";var i,r=t(82394),o=(t(82684),t(64866)),l=t(21764),c=t(67971),u=t(10919),a=t(86673),s=t(19711),d=t(46261),f=t(10503),p=t(49125),h=t(28598);function m(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function v(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?m(Object(t),!0).forEach((function(n){(0,r.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}!function(e){e.LEFT="left",e.RIGHT="right"}(i||(i={})),n.Z=function(e){var n,t=e.children,r=e.copiedText,m=e.iconPosition,b=void 0===m?i.LEFT:m,g=e.inverted,x=e.linkProps,j=e.linkText,y=e.monospace,k=e.muted,Z=e.small,O=e.toastMessage,_=e.withCopyIcon;return t?n=(0,h.jsx)("span",{children:t}):_&&(n=(0,h.jsx)(u.Z,v(v({href:"#",inline:!0,muted:k,preventDefault:!0,sameColorAsText:!0,small:Z},x),{},{children:(0,h.jsxs)(c.Z,{alignItems:"center",children:[b===i.LEFT&&(0,h.jsx)(a.Z,{mr:j?1:0,children:(0,h.jsx)(c.Z,{alignItems:"center",children:(0,h.jsx)(f.CK,{inverted:g,muted:k,size:2*p.iI})})}),j&&(0,h.jsx)(s.ZP,{inverted:g,monospace:y,muted:k,small:Z,children:j}),b===i.RIGHT&&(0,h.jsx)(a.Z,{ml:j?1:0,children:(0,h.jsx)(c.Z,{alignItems:"center",children:(0,h.jsx)(f.CK,{inverted:g,muted:k})})})]})}))),(0,h.jsx)(d.Z,{block:!0,label:"Copy",size:null,widthFitContent:!0,children:(0,h.jsx)(o.CopyToClipboard,{onCopy:function(){return l.Am.success(O||"Successfully copied to clipboard.",{position:l.Am.POSITION.BOTTOM_RIGHT,toastId:r})},text:r,children:n})})}},30264:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(47999)),l=t(62084),c=t(28598),u=["children","items","open","onClickCallback","onClickOutside","parentRef","uuid"];function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.items,i=e.open,a=e.onClickCallback,d=e.onClickOutside,f=e.parentRef,p=e.uuid,h=(0,r.Z)(e,u),m=(0,c.jsxs)("div",{style:{position:"relative",zIndex:d?3:2},children:[(0,c.jsx)("div",{ref:f,children:n}),(0,c.jsx)(l.Z,s(s({},h),{},{items:t,onClickCallback:a,open:i,parentRef:f,uuid:p}))]});return d?(0,c.jsx)(o.Z,{onClickOutside:d,open:!0,children:m}):m}},40369:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Nc}});var i=t(77837),r=t(21831),o=t(82394),l=t(75582),c=t(38860),u=t.n(c),a=t(56085),s=t(82684),d=t(83455),f=t(34376),p=t(48591),h=t(35490),m=t(86422),v=t(38626),b=t(38341),g=t(16634),x=t(34744),j=t(93461),y=t(67971),k=t(10919),Z=t(86673),O=t(19711),_=t(49125),C=t(44162),S=t(28598);function E(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function P(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?E(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):E(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var w=function(e){var n=e.blockRefs,t=e.hiddenBlocks,i=e.pipeline,r=e.setHiddenBlocks,l=(0,s.useContext)(v.ThemeContext),c=(0,s.useMemo)((function(){return(null===i||void 0===i?void 0:i.blocks)||[]}),[i]),u=(0,s.useMemo)((function(){var e=[],n=[];return c.forEach((function(i){var r=i.uuid;null!==t&&void 0!==t&&t[r]?e.push(i):n.push(i)})),{blocksHidden:e,blocksVisible:n}}),[c,t]),a=u.blocksHidden,d=u.blocksVisible,f=(0,s.useMemo)((function(){return(null===c||void 0===c?void 0:c.length)>=1&&0===d.length}),[c,d]),p=(0,s.useMemo)((function(){return(null===c||void 0===c?void 0:c.length)>=1&&0===a.length}),[c,a]),h=(0,s.useCallback)((function(e){var t=e.type,i=e.uuid;if(null!==n&&void 0!==n&&n.current){var r,o=n.current["".concat(t,"s/").concat(i,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}}),[n]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{p:1,children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(j.Z,{flex:1,justifyContent:"center",children:(0,S.jsx)(b.Z,{checked:p,label:"Show all",onClick:function(){return r((function(){return{}}))}})}),(0,S.jsx)(j.Z,{flex:1,justifyContent:"center",children:(0,S.jsx)(b.Z,{checked:f,label:"Hide all",onClick:function(){return r((function(){return c.reduce((function(e,n){var t=n.uuid;return P(P({},e),{},(0,o.Z)({},t,!0))}),{})}))}})})]})}),(0,S.jsx)(x.Z,{medium:!0}),null===c||void 0===c?void 0:c.map((function(e){var n=e.uuid,i=(0,C.qn)(e.type,{blockColor:e.color,theme:l}).accent,c=!(null!==t&&void 0!==t&&t[n]);return(0,S.jsx)(k.Z,{block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){r((function(e){return P(P({},e),{},(0,o.Z)({},n,c))})),c||setTimeout((function(){return h(e)}),1)},preventDefault:!0,children:(0,S.jsx)(Z.Z,{mt:1,px:1,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(Z.Z,{pr:1,children:(0,S.jsx)(b.Z,{checked:c})}),(0,S.jsxs)(j.Z,{alignItems:"center",children:[(0,S.jsx)(g.Z,{color:i,size:1.5*_.iI,square:!0}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(O.ZP,{default:!0,monospace:!0,noWrapping:!0,small:!0,children:n})]})]})})},n)}))]})},I=t(60328),T=t(32316),A=t(11135),D=t(29237),R=t(98781),M=t(82944),B=t(16115),N=t(11366),L=t(91427),F=t(51504);var U=function(e){var n=e.block,t=e.defaultName,i=e.onClose,r=e.onSave,o=e.pipeline,l=(0,s.useRef)(null),c=(0,s.useState)(t),u=c[0],a=c[1],d=(0,s.useState)(!!(0,L.U2)(N.kY)),f=d[0],p=d[1];(0,s.useEffect)((function(){var e;null===l||void 0===l||null===(e=l.current)||void 0===e||e.focus()}),[]);var h=(0,s.useMemo)((function(){return R.qL.INTEGRATION===(null===o||void 0===o?void 0:o.type)}),[o]),v=(0,s.useMemo)((function(){var e=null===n||void 0===n?void 0:n.type;if(h){if(m.tf.DATA_LOADER===e)return"Source";if(m.tf.DATA_EXPORTER===e)return"Destination"}return m.V4[e]}),[n,h]);return(0,S.jsxs)(D.Z,{children:[(0,S.jsxs)(O.ZP,{bold:!0,children:[v," block name"]}),(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsx)(M.Z,{monospace:!0,onChange:function(e){return a(e.target.value)},ref:l,value:u})}),(0,S.jsx)(Z.Z,{mt:2,children:(0,S.jsx)(y.Z,{alignItems:"center",children:(0,S.jsx)(b.Z,{checked:f,label:(0,S.jsxs)(O.ZP,{muted:!0,small:!0,children:["Automatically use randomly generated name",(0,S.jsx)("br",{}),"for blocks created in the future"]}),onClick:function(){p(!f),(0,L.t8)(N.kY,!f)}})})}),(0,S.jsx)(Z.Z,{mt:3,children:(0,S.jsxs)(y.Z,{children:[(0,S.jsx)(A.ZP,{bold:!0,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,F.y)([B.Uq],n)},onClick:function(){return r({name:u||t})},primary:!0,tabIndex:0,uuid:"ConfigureBlock/SaveAndAddBlock",children:"Save and add block"}),(0,S.jsx)(Z.Z,{ml:1,children:(0,S.jsx)(I.Z,{onClick:i,tabIndex:0,children:"Cancel"})})]})})]})},H=t(46299),G=t(91207),z=t(47999),K=t(62084),q=t(64318),Q=t(54405),W=t(90211),V=t(41150);function Y(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function X(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Y(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Y(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var J,$,ee=function(e){var n=e.cancelPipeline,t=e.children,i=e.createPipeline,r=e.executePipeline,l=e.interruptKernel,c=e.isPipelineExecuting,u=e.pipeline,a=e.restartKernel,d=e.savePipelineContent,f=(e.setActiveSidekickView,e.setMessages),p=(0,s.useState)(null),h=p[0],m=p[1],v=(0,s.useRef)(null),b=(0,s.useRef)(null),g=(0,s.useRef)(null),x=[{label:function(){return"New standard pipeline"},onClick:function(){return i({pipeline:{name:(0,W.Y6)()}})},uuid:"new_standard_pipeline"},{label:function(){return"New streaming pipeline"},onClick:function(){return i({pipeline:{name:(0,W.Y6)(),type:R.qL.STREAMING}})},uuid:"new_streaming_pipeline"},{keyTextGroups:[[(0,Q.V5)()?B.RJ:B.hE,B.SS]],label:function(){return"Save pipeline"},onClick:function(){return d()},uuid:"save_pipeline"}],j=(0,s.useMemo)((function(){var e=[{label:function(){return"Interrupt kernel"},keyTextGroups:[[B.kA],[B.kA]],onClick:function(){return l()},uuid:"Interrupt kernel"},{label:function(){return"Restart kernel"},keyTextGroups:[[B.t_[B.OC]],[B.t_[B.OC]]],onClick:function(){return a()},uuid:"Restart kernel"},{label:function(){return"Clear all outputs"},onClick:function(){return f((function(e){return Object.keys(e).reduce((function(e,n){return X(X({},e),{},(0,o.Z)({},n,[]))}),{})}))},uuid:"Clear all outputs"}];return c?e.push({label:function(){return"Cancel pipeline"},onClick:function(){return n()},uuid:"Cancel pipeline"}):e.push({label:function(){return"Execute pipeline"},onClick:function(){return r()},uuid:"Execute pipeline"}),e}),[n,r,l,c,a,f]),k=(0,s.useMemo)((function(){return[{label:function(){return"Pipeline settings"},linkProps:{as:"/pipelines/".concat(null===u||void 0===u?void 0:u.uuid,"/settings"),href:"/pipelines/[pipeline]/settings"},uuid:"Pipeline settings"}]}),[u]),Z="FileHeaderMenu/index",_=(0,V.y)(),C=_.registerOnKeyDown,E=_.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){E(Z)}}),[E,Z]),C(Z,(function(e,n,t){null!==h&&(n[B.QK]?m((function(e){return 0===e?2:e-1})):n[B.DY]&&m((function(e){return 2===e?0:e+1})))}),[h,m]),(0,S.jsx)(z.Z,{onClickOutside:function(){return m(null)},open:!0,style:{position:"relative"},children:(0,S.jsxs)(y.Z,{children:[(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(q.u,{highlighted:0===h,onClick:function(){return m((function(e){return 0===e?null:0}))},onMouseEnter:function(){return m((function(e){return null!==e?0:null}))},ref:v,children:(0,S.jsx)(O.ZP,{children:"File"})}),(0,S.jsx)(K.Z,{items:x,onClickCallback:function(){return m(null)},open:0===h,parentRef:v,uuid:"FileHeaderMenu/file_items"})]}),(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(q.u,{highlighted:1===h,onClick:function(){return m((function(e){return 1===e?null:1}))},onMouseEnter:function(){return m((function(e){return null!==e?1:null}))},ref:b,children:(0,S.jsx)(O.ZP,{children:"Run"})}),(0,S.jsx)(K.Z,{items:j,onClickCallback:function(){return m(null)},open:1===h,parentRef:b,uuid:"FileHeaderMenu/run_items"})]}),(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(q.u,{highlighted:2===h,onClick:function(){return m((function(e){return 2===e?null:2}))},onMouseEnter:function(){return m((function(e){return null!==e?2:null}))},ref:g,children:(0,S.jsx)(O.ZP,{children:"Edit"})}),(0,S.jsx)(K.Z,{items:k,onClickCallback:function(){return m(null)},open:2===h,parentRef:g,uuid:"FileHeaderMenu/edit_items"})]}),t]})})},ne=t(38488),te=t(57384);!function(e){e.CREATE_NEW_CLUSTER="create_new_cluster",e.SET_ACTIVE_CLUSTER="set_active_cluster"}(J||(J={})),function(e){e.BOOTSTRAPPING="BOOTSTRAPPING",e.STARTING="STARTING",e.WAITING="WAITING"}($||($={}));var ie,re=t(90686),oe=t(62609),le=t(46261),ce=t(82531),ue=t(23831),ae=t(66166),se=t(10503);!function(e){e.EMR="emr"}(ie||(ie={}));var de=t(28347),fe=t(42305),pe=t(24224),he=t(33766),me=t(96510),ve=t(99497);var be=function(e){var n,t=e.children,i=(e.filePaths,e.filesTouched,e.isBusy),o=e.isPipelineUpdating,c=e.kernel,u=e.pipeline,a=e.pipelineContentTouched,f=e.pipelineLastSaved,p=(e.restartKernel,e.savePipelineContent,e.selectedFilePath),h=e.setErrors,m=e.setRunningBlocks,b=e.updatePipelineMetadata,x=(0,s.useContext)(v.ThemeContext),C=c||{},E=C.alive,P=C.usage,w=(0,s.useState)(!1),I=w[0],T=w[1],D=(0,s.useState)(""),M=D[0],N=D[1],F=(0,s.useState)(ie.EMR),U=F[0],H=(F[1],(0,s.useState)(!1)),G=H[0],q=H[1],W=(0,s.useState)(!1),Y=W[0],X=W[1],J=(0,s.useRef)(null),ee=ce.ZP.clusters.detail(U,{},{revalidateOnFocus:!1}),ne=ee.data,te=ee.mutate,be=(0,s.useMemo)((function(){var e;return(null===ne||void 0===ne||null===(e=ne.cluster)||void 0===e?void 0:e.clusters)||[]}),[ne]),ge=(0,s.useMemo)((function(){return(0,pe.sE)(be,(function(e){return e.is_active}))}),[be]),xe=(0,d.Db)(ce.ZP.clusters.useUpdate(U),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){te()},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),je=(0,l.Z)(xe,1)[0];(0,s.useEffect)((function(){null!==u&&void 0!==u&&u.uuid&&N(u.uuid)}),[null===u||void 0===u?void 0:u.uuid]),n=a?"Unsaved changes":o?"Saving changes...":f?"Last saved ".concat((0,fe.JX)(Number(f)/1e3)):"All changes saved";var ye="KernelStatus",ke=(0,V.y)(),Ze=ke.registerOnKeyDown,Oe=ke.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){Oe(ye)}}),[Oe,ye]),Ze(ye,(function(e,n,t){I&&String(t[0])===String(B.Uq)&&String(t[1])!==String(B.zX)&&((null===u||void 0===u?void 0:u.uuid)===M?e.target.blur():(b(M),T(!1)))}),[I,M,T,b]);var _e=(0,s.useMemo)((function(){return null===P||void 0===P?void 0:P.pid}),[null===P||void 0===P?void 0:P.pid]),Ce=(0,ae.Z)(_e),Se=(0,s.useMemo)((function(){if(null!==P&&void 0!==P&&P.kernel_memory){var e=P.kernel_memory,n=Math.floor(Math.log(e)/Math.log(1024));return"".concat(parseFloat((e/Math.pow(1024,n)).toFixed(2))).concat(["B","KB","MB","GB","TB","PB","EB","ZB","YB"][n])}}),[null===P||void 0===P?void 0:P.kernel_memory]),Ee=(0,ve.dd)((function(){return(0,S.jsx)(oe.Z,{cancelText:"Close",centerOnScreen:!0,confirmText:"Don't show again",neutral:!0,onCancel:Ie,onClick:function(){(0,L.t8)(L.DU,1),Ie()},subtitle:"You may need to refresh your page to continue using the notebook. Unexpected kernel restarts may be caused by your kernel running out of memory.",title:"The kernel has restarted",width:34*_.iI})}),{},[],{background:!0,uuid:"restart_kernel_warning"}),Pe=(0,l.Z)(Ee,2),we=Pe[0],Ie=Pe[1];(0,s.useEffect)((function(){var e=(0,L.U2)(L.DU,0);_e!==Ce&&i&&!e&&(we(),m([]))}),[i,_e,Ce,m]);var Te=(0,s.useMemo)((function(){return(0,S.jsx)("div",{ref:J,style:{position:"relative"},children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(null===u||void 0===u?void 0:u.type)===R.qL.PYSPARK&&(0,S.jsxs)(Z.Z,{mr:1,children:[(0,S.jsxs)(k.Z,{muted:!!ge,onClick:function(){return q(!0)},preventDefault:!0,sameColorAsText:!ge,underline:!ge,children:[ge&&ge.id,!ge&&"Select cluster"]}),(0,S.jsx)(z.Z,{disableEscape:!0,onClickOutside:function(){return q(!1)},open:G,children:(0,S.jsx)(K.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select cluster"},uuid:"select_cluster"}].concat((0,r.Z)(be.map((function(e){var n=e.id,t=e.is_active,i=e.status;return{label:function(){return(0,S.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,S.jsx)(j.Z,{flex:1,children:(0,S.jsx)(O.ZP,{muted:!t&&$.WAITING!==i,children:n})}),t&&(0,S.jsx)(se.Jr,{size:2*_.iI,success:!0}),!t&&(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,children:i})]})},onClick:t||$.WAITING!==i?null:function(){return je({cluster:{id:n,is_active:!0}})},uuid:n}})))),onClickCallback:function(){return q(!1)},open:G,parentRef:J,uuid:"KernelStatus/select_cluster",width:40*_.iI})})]}),(0,S.jsx)(A.ZP,{beforeElement:(0,S.jsx)(g.Z,{color:i?(x||ue.Z).borders.info:E?(x||ue.Z).borders.success:(x||ue.Z).borders.danger,size:_.iI}),blackBorder:!0,compact:!0,inline:!0,onClick:function(){return X(!0)},uuid:"Pipeline/KernelStatus/kernel",children:(null===u||void 0===u?void 0:u.type)||R.qL.PYTHON}),(0,S.jsx)(z.Z,{disableEscape:!0,onClickOutside:function(){return X(!1)},open:Y,children:(0,S.jsx)(K.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select kernel"},uuid:"select_kernel"}].concat((0,r.Z)(Object.keys(R.a_).filter((function(e){return(null===u||void 0===u?void 0:u.type)!=e})).map((function(e){return{label:function(){return e},onClick:function(){return b(null===u||void 0===u?void 0:u.name,e)},uuid:e}})))),onClickCallback:function(){return X(!1)},open:Y,parentRef:J,uuid:"KernelStatus/select_kernel",width:25*_.iI})})]})})}),[E,be,i,u,ge,q,X,G,Y,x,je]);return(0,S.jsx)(de.rK,{relativePosition:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"space-between",children:[(0,S.jsxs)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"flex-start",children:[(0,S.jsxs)(Z.Z,{px:_.cd,children:[p&&(0,S.jsx)(k.Z,{noHoverUnderline:!0,noOutline:!0,onClick:p?function(){return(0,he.u7)({file_path:null})}:null,preventDefault:!0,children:t}),!p&&(0,S.jsxs)(y.Z,{alignItems:"center",children:[t,I&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{ml:1}),(0,S.jsx)(k.Z,{onClick:function(){b(M),T(!1)},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]})]}),P&&(0,S.jsx)(Z.Z,{mr:_.cd,children:(0,S.jsxs)(j.Z,{flexDirection:"column",children:[(0,S.jsxs)(O.ZP,{monospace:!0,muted:!0,xsmall:!0,children:["CPU: ",null===P||void 0===P?void 0:P.kernel_cpu,"undefined"!==typeof(null===P||void 0===P?void 0:P.kernel_cpu)&&"%"]}),(0,S.jsxs)(O.ZP,{monospace:!0,muted:!0,xsmall:!0,children:["Memory: ",Se]})]})})]}),(0,S.jsx)(Z.Z,{px:_.cd,children:(0,S.jsxs)(j.Z,{alignItems:"center",children:[(0,S.jsx)(le.Z,{appearBefore:!0,block:!0,description:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{default:!0,inline:!0,children:"Press"}),"\xa0",(0,S.jsx)(re.Z,{inline:!0,keyText:(0,Q.V5)()?B.RJ:B.hE}),"\xa0",(0,S.jsx)(O.ZP,{default:!0,inline:!0,children:"+"}),"\xa0",(0,S.jsx)(re.Z,{inline:!0,keyText:B.SS}),"\xa0",(0,S.jsx)(O.ZP,{default:!0,inline:!0,children:"to save changes."}),(0,S.jsx)("br",{})]}),(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["Or, go to ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:"File"})," \u203a ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:"Save pipeline"}),"."]})})]}),size:null,widthFitContent:!0,children:(0,S.jsx)(O.ZP,{muted:!0,children:n})}),(0,S.jsx)(Z.Z,{ml:2}),Te]})})]})})},ge=t(82635),xe=t(17717),je=t(16910),ye=t(65701),ke=t(1254);var Ze,Oe,_e,Ce,Se,Ee,Pe=function(e){var n=e.size;return(0,S.jsx)("svg",{fill:"none",height:n,preserveAspectRatio:"xMidYMid",viewBox:"0 0 256 256",width:n,xmlns:"http://www.w3.org/2000/svg",children:(0,S.jsx)("path",{d:"M245.121138,10.6473813 C251.139129,16.4340053 255.074133,24.0723342 256,32.4050489 C256,35.8769778 255.074133,38.1917867 252.990862,42.5895822 C250.907876,46.9873778 225.215147,91.4286933 217.57696,103.696213 C213.179164,110.871609 210.864356,119.435947 210.864356,127.768462 C210.864356,136.3328 213.179164,144.6656 217.57696,151.840996 C225.215147,164.108516 250.907876,208.781084 252.990862,213.179164 C255.074133,217.57696 256,219.659947 256,223.131876 C255.074133,231.464676 251.370667,239.103147 245.352676,244.658347 C239.565938,250.676338 231.927751,254.611342 223.826489,255.305671 C220.35456,255.305671 218.039751,254.379804 213.873493,252.296533 C209.706951,250.213262 164.340053,225.215147 152.072249,217.57696 C151.146382,217.113884 150.220516,216.419556 149.063396,215.95648 L88.4195556,180.079502 C89.8082133,191.652693 94.9006222,202.763093 103.233138,210.864356 C104.853618,212.484551 106.473813,213.873493 108.325547,215.262151 C106.936604,215.95648 105.316409,216.651093 103.927751,217.57696 C91.6599467,225.215147 46.9873778,250.907876 42.5895822,252.990862 C38.1917867,255.074133 36.1085156,256 32.4050489,256 C24.0723342,255.074133 16.4340053,251.370667 10.8788338,245.352676 C4.86075733,239.565938 0.925858133,231.927751 0,223.594951 C0.231464676,220.123022 1.1573248,216.651093 3.00905244,213.641956 C5.09223822,209.24416 30.7848533,164.571307 38.42304,152.303787 C42.82112,145.128391 45.1356444,136.795591 45.1356444,128.231538 C45.1356444,119.6672 42.82112,111.3344 38.42304,104.159004 C30.7848533,91.4286933 4.86075733,46.75584 3.00905244,42.3580444 C1.1573248,39.3489067 0.231464676,35.8769778 0,32.4050489 C0.925858133,24.0723342 4.62930489,16.4340053 10.6473813,10.6473813 C16.4340053,4.62930489 24.0723342,0.925858133 32.4050489,0 C35.8769778,0.231464676 39.3489067,1.1573248 42.5895822,3.00905244 C46.2930489,4.62930489 78.9293511,23.6094009 96.28928,33.7939911 L100.224284,36.1085156 C101.612942,37.0343822 102.770347,37.7287111 103.696213,38.1917867 L105.547947,39.3489067 L167.348907,75.9204978 C165.960249,62.0324978 158.784853,49.3019022 147.674453,40.7378489 C149.063396,40.04352 150.683591,39.3489067 152.072249,38.42304 C164.340053,30.7848533 209.012622,4.86075733 213.410418,3.00905244 C216.419556,1.1573248 219.891484,0.231464676 223.594951,0 C231.696213,0.925858133 239.334684,4.62930489 245.121138,10.6473813 Z M131.240391,144.434062 L144.434062,131.240391 C146.285796,129.388658 146.285796,126.611342 144.434062,124.759609 L131.240391,111.565938 C129.388658,109.714204 126.611342,109.714204 124.759609,111.565938 L111.565938,124.759609 C109.714204,126.611342 109.714204,129.388658 111.565938,131.240391 L124.759609,144.434062 C126.379804,146.054258 129.388658,146.054258 131.240391,144.434062 Z",fill:"#FF694A"})})},we=t(30264),Ie=t(80906),Te=t(73942),Ae=_.cd*_.iI,De=v.default.div.withConfig({displayName:"indexstyle__IconContainerStyle",componentId:"sc-oyfjzc-0"})(["align-items:center;border-radius:","px;border:1px solid transparent;display:flex;justify-content:center;"," "," "," "," "," "," "," "," "," ",""],Te.BG,(function(e){return e.border&&"\n border: 1px dotted ".concat((e.theme.content||ue.Z.content).active,";\n ")}),(function(e){return e.grey&&"\n background-color: ".concat((0,C.qn)(m.tf.SCRATCHPAD,e).accent,";\n ")}),(function(e){return e.blue&&"\n background-color: ".concat((0,C.qn)(m.tf.DATA_LOADER,e).accent,";\n ")}),(function(e){return e.purple&&"\n background-color: ".concat((0,C.qn)(m.tf.TRANSFORMER,e).accent,";\n ")}),(function(e){return e.sky&&"\n background-color: ".concat((0,C.qn)(m.tf.MARKDOWN,e).accent,";\n ")}),(function(e){return e.teal&&"\n background-color: ".concat((0,C.qn)(m.tf.EXTENSION,e).accent,";\n ")}),(function(e){return e.rose&&"\n background-color: ".concat((0,C.qn)(m.tf.CALLBACK,e).accent,";\n ")}),(function(e){return e.yellow&&"\n background-color: ".concat((0,C.qn)(m.tf.DATA_EXPORTER,e).accent,";\n ")}),(function(e){return!e.compact&&"\n height: ".concat(Ae+_.iI/2,"px;\n width: ").concat(Ae+_.iI/2,"px;\n ")}),(function(e){return e.compact&&"\n height: ".concat(Ae/2+_.iI,"px;\n width: ").concat(Ae/2+_.iI,"px;\n ")})),Re=v.default.div.withConfig({displayName:"indexstyle__ButtonWrapper",componentId:"sc-oyfjzc-1"})(["position:relative;margin-bottom:","px;margin-right:","px;",""],_.iI,_.iI,(function(e){return e.increasedZIndex&&"\n z-index: 3;\n "})),Me=(Ie.Q0.AVERAGE,Ie.Q0.CLEAN_COLUMN_NAME,Ie.Q0.COUNT,Ie.Q0.COUNT_DISTINCT,Ie.Q0.CUSTOM,Ie.Q0.DIFF,Ie.Q0.FIRST,Ie.Q0.FIX_SYNTAX_ERRORS,Ie.Q0.IMPUTE,Ie.Q0.LAST,Ie.Q0.MAX,Ie.Q0.MEDIAN,Ie.Q0.MIN,Ie.Q0.NORMALIZE,Ie.Q0.REFORMAT,Ie.Q0.REMOVE,Ie.Q0.REMOVE_OUTLIERS,Ie.Q0.SELECT,Ie.Q0.SHIFT_DOWN,Ie.Q0.SHIFT_UP,Ie.Q0.STANDARDIZE,Ie.Q0.SUM,[Ie.Q0.DROP_DUPLICATE,Ie.Q0.FILTER,Ie.Q0.SORT,Ie.Q0.REMOVE]);!function(e){e.AGGREGATE="Aggregate",e.FORMATTING="Formatting",e.COLUMN_REMOVAL="Column removal",e.SHIFT_ROWS="Shift rows in a column",e.MISC="Miscellaneous",e.FEATURE_SCALING="Feature Scaling"}(Ee||(Ee={}));var Be,Ne,Le,Fe=(Oe={},(0,o.Z)(Oe,Ie.qs.COLUMN,(Ze={},(0,o.Z)(Ze,Ee.AGGREGATE,[Ie.Q0.AVERAGE,Ie.Q0.COUNT,Ie.Q0.COUNT_DISTINCT,Ie.Q0.FIRST,Ie.Q0.LAST,Ie.Q0.MAX,Ie.Q0.MEDIAN,Ie.Q0.MIN,Ie.Q0.SUM]),(0,o.Z)(Ze,Ee.FORMATTING,[Ie.Q0.CLEAN_COLUMN_NAME,Ie.Q0.FIX_SYNTAX_ERRORS,Ie.Q0.REFORMAT]),(0,o.Z)(Ze,Ee.COLUMN_REMOVAL,[Ie.Q0.REMOVE,Ie.Q0.SELECT]),(0,o.Z)(Ze,Ee.SHIFT_ROWS,[Ie.Q0.SHIFT_DOWN,Ie.Q0.SHIFT_UP]),(0,o.Z)(Ze,Ee.MISC,[Ie.Q0.DIFF,Ie.Q0.IMPUTE,Ie.Q0.REMOVE_OUTLIERS]),(0,o.Z)(Ze,Ee.FEATURE_SCALING,[Ie.Q0.NORMALIZE,Ie.Q0.STANDARDIZE]),Ze)),(0,o.Z)(Oe,Ie.qs.ROW,(0,o.Z)({},Ee.MISC,[].concat(Me))),Oe),Ue=Object.keys(Fe[Ie.qs.COLUMN]),He=[Ee.MISC],Ge=(Se={},(0,o.Z)(Se,Ie.qs.COLUMN,(_e={},(0,o.Z)(_e,Ie.Q0.ADD,"Add column"),(0,o.Z)(_e,Ie.Q0.AVERAGE,"Aggregate by average value"),(0,o.Z)(_e,Ie.Q0.CLEAN_COLUMN_NAME,"Clean column name"),(0,o.Z)(_e,Ie.Q0.COUNT_DISTINCT,"Aggregate by distinct count"),(0,o.Z)(_e,Ie.Q0.COUNT,"Aggregate by total count"),(0,o.Z)(_e,Ie.Q0.DIFF,"Difference"),(0,o.Z)(_e,Ie.Q0.FIRST,"Aggregate by first value"),(0,o.Z)(_e,Ie.Q0.FIX_SYNTAX_ERRORS,"Fix syntax errors"),(0,o.Z)(_e,Ie.Q0.IMPUTE,"Fill in missing values"),(0,o.Z)(_e,Ie.Q0.NORMALIZE,"Normalize Data"),(0,o.Z)(_e,Ie.Q0.STANDARDIZE,"Standardize Data"),(0,o.Z)(_e,Ie.Q0.LAST,"Aggregate by last value"),(0,o.Z)(_e,Ie.Q0.MAX,"Aggregate by maximum value"),(0,o.Z)(_e,Ie.Q0.MEDIAN,"Aggregate by median value"),(0,o.Z)(_e,Ie.Q0.MIN,"Aggregate by mininum value"),(0,o.Z)(_e,Ie.Q0.REFORMAT,"Reformat"),(0,o.Z)(_e,Ie.Q0.REMOVE_OUTLIERS,"Remove outliers"),(0,o.Z)(_e,Ie.Q0.REMOVE,"Remove column(s)"),(0,o.Z)(_e,Ie.Q0.SELECT,"Keep columns"),(0,o.Z)(_e,Ie.Q0.SHIFT_DOWN,"Shift rows down in a column"),(0,o.Z)(_e,Ie.Q0.SHIFT_UP,"Shift rows up in a column"),(0,o.Z)(_e,Ie.Q0.SUM,"Aggregate by sum of values"),_e)),(0,o.Z)(Se,Ie.qs.ROW,(Ce={},(0,o.Z)(Ce,Ie.Q0.DROP_DUPLICATE,"Drop duplicates"),(0,o.Z)(Ce,Ie.Q0.FILTER,"Filter"),(0,o.Z)(Ce,Ie.Q0.SORT,"Sort"),(0,o.Z)(Ce,Ie.Q0.REMOVE,"Remove rows"),Ce)),Se);!function(e){e.AMAZON_SQS="amazon_sqs",e.API="api",e.AZURE_BLOB_STORAGE="azure_blob_storage",e.AZURE_EVENT_HUB="azure_event_hub",e.BIGQUERY="bigquery",e.DRUID="druid",e.DUMMY="dummy",e.FILE="file",e.GENERIC="generic",e.GOOGLE_CLOUD_PUBSUB="google_cloud_pubsub",e.GOOGLE_CLOUD_STORAGE="google_cloud_storage",e.KAFKA="kafka",e.KINESIS="kinesis",e.MONGODB="mongodb",e.MYSQL="mysql",e.OPENSEARCH="opensearch",e.ORACLEDB="oracledb",e.POSTGRES="postgres",e.RABBITMQ="rabbitmq",e.REDSHIFT="redshift",e.S3="s3",e.SNOWFLAKE="snowflake"}(Le||(Le={}));var ze=(Be={},(0,o.Z)(Be,Le.AMAZON_SQS,"Amazon SQS"),(0,o.Z)(Be,Le.API,"API"),(0,o.Z)(Be,Le.AZURE_BLOB_STORAGE,"Azure Blob Storage"),(0,o.Z)(Be,Le.AZURE_EVENT_HUB,"Azure Event Hub"),(0,o.Z)(Be,Le.BIGQUERY,"Google BigQuery"),(0,o.Z)(Be,Le.DRUID,"Druid"),(0,o.Z)(Be,Le.DUMMY,"Dummy"),(0,o.Z)(Be,Le.FILE,"Local file"),(0,o.Z)(Be,Le.GENERIC,"Generic (no template)"),(0,o.Z)(Be,Le.GOOGLE_CLOUD_PUBSUB,"Google Cloud PubSub"),(0,o.Z)(Be,Le.GOOGLE_CLOUD_STORAGE,"Google Cloud Storage"),(0,o.Z)(Be,Le.KAFKA,"Kafka"),(0,o.Z)(Be,Le.KINESIS,"Kinesis"),(0,o.Z)(Be,Le.MONGODB,"MongoDB"),(0,o.Z)(Be,Le.MYSQL,"MySQL"),(0,o.Z)(Be,Le.OPENSEARCH,"OpenSearch"),(0,o.Z)(Be,Le.ORACLEDB,"OracleDB"),(0,o.Z)(Be,Le.POSTGRES,"PostgreSQL"),(0,o.Z)(Be,Le.RABBITMQ,"RabbitMQ"),(0,o.Z)(Be,Le.REDSHIFT,"Amazon Redshift"),(0,o.Z)(Be,Le.S3,"Amazon S3"),(0,o.Z)(Be,Le.SNOWFLAKE,"Snowflake"),Be),Ke=(Ne={},(0,o.Z)(Ne,m.tf.DATA_LOADER,[Le.GENERIC,Le.FILE,Le.API,Le.AZURE_BLOB_STORAGE,Le.BIGQUERY,Le.DRUID,Le.GOOGLE_CLOUD_STORAGE,Le.MYSQL,Le.ORACLEDB,Le.POSTGRES,Le.REDSHIFT,Le.S3,Le.SNOWFLAKE]),(0,o.Z)(Ne,m.tf.DATA_EXPORTER,[Le.GENERIC,Le.FILE,Le.AZURE_BLOB_STORAGE,Le.BIGQUERY,Le.GOOGLE_CLOUD_STORAGE,Le.MYSQL,Le.POSTGRES,Le.REDSHIFT,Le.S3,Le.SNOWFLAKE]),(0,o.Z)(Ne,m.tf.TRANSFORMER,[Le.BIGQUERY,Le.POSTGRES,Le.REDSHIFT,Le.SNOWFLAKE]),(0,o.Z)(Ne,m.tf.SENSOR,[Le.GENERIC,Le.BIGQUERY,Le.MYSQL,Le.POSTGRES,Le.REDSHIFT,Le.S3,Le.SNOWFLAKE]),Ne),qe=Le;function Qe(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}var We=function(e,n,t){var i=t===R.qL.STREAMING&&(e===m.tf.DATA_LOADER||e===m.tf.DATA_EXPORTER);return(function(e){var n;return e===R.qL.STREAMING?(n={},(0,o.Z)(n,m.tf.DATA_LOADER,[qe.AMAZON_SQS,qe.AZURE_EVENT_HUB,qe.GOOGLE_CLOUD_PUBSUB,qe.KAFKA,qe.KINESIS,qe.RABBITMQ]),(0,o.Z)(n,m.tf.DATA_EXPORTER,[qe.DUMMY,qe.S3,qe.KAFKA,qe.KINESIS,qe.MONGODB,qe.OPENSEARCH]),(0,o.Z)(n,m.tf.TRANSFORMER,[qe.GENERIC]),n):Ke}(t)[e]||[]).map((function(t){return{indent:e===m.tf.TRANSFORMER,label:function(){return ze[t]},onClick:function(){n({config:{data_source:t===qe.GENERIC?null:t},language:i?m.t6.YAML:m.t6.PYTHON,type:e})},uuid:"".concat(e,"/").concat(t)}}))};function Ve(e,n){return{label:function(){return"SQL"},onClick:function(){return e({language:m.t6.SQL,type:n})},uuid:"".concat(n,"/sql")}}function Ye(e,n){return{label:function(){return"R"},onClick:function(){return e({language:m.t6.R,type:n})},uuid:"".concat(n,"/r")}}var Xe=function(e,n){return[Ve(e,n),Ye(e,n)]};function Je(e,n){var t={};return null===e||void 0===e||e.forEach((function(e){var i=e.block_type,r=e.description,l=e.groups,c=e.language,u=e.name,a=e.path;t[i]||(t[i]={}),t[i][c]||(t[i][c]={items:[],label:function(){return c},uuid:"".concat(i,"/").concat(c)});var s={label:function(){return u},onClick:function(){return n({config:{template_path:a},language:c,type:i})},tooltip:function(){return r},uuid:a};if((null===l||void 0===l?void 0:l.length)>=1){var d=function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Qe(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Qe(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},t[i][c]),f=[null],p=[d];l.forEach((function(e,n){var t="".concat(i,"/").concat(c,"/").concat(l.slice(0,n+1).join("/")),r=p[n],o=r.items.findIndex((function(e){var n=e.uuid;return t===n})),u=o>=0?r.items[o]:null;u||(u={items:[],label:function(){return e},uuid:t}),f.push(o),p.push(u)})),f.push(-1),p.push(s);var h=p.length;t[i][c]=p.reduce((function(e,n,t){var i=h-t,r=p[i-2],o=p[i-1],l=f[i-1];return r?(l>=0?r.items[l]=o:r.items.push(o),r):o}),{})}else t[i][c].items.push(s)})),t}var $e=function(e,n,t,i){var r=i||{},o=r.blockTemplatesByBlockType,l=r.languages,c=Object.fromEntries(m.Ut.map((function(n){return[n,We(n,e,t)]})));if(t===R.qL.PYSPARK||t===R.qL.PYTHON&&n===m.tf.TRANSFORMER||t===R.qL.STREAMING||n===m.tf.SENSOR)return c[n];var u,a,s=(null===o||void 0===o||null===(u=o[n])||void 0===u||null===(a=u[m.t6.PYTHON])||void 0===a?void 0:a.items)||[],d=[{items:(c[n]||[]).concat(s),label:function(){return"Python"},uuid:"".concat(n,"/").concat(m.t6.PYTHON)}];return(!l||null!==l&&void 0!==l&&l.includes(m.t6.SQL))&&d.push(Ve(e,n)),(!l||null!==l&&void 0!==l&&l.includes(m.t6.R))&&d.push(Ye(e,n)),d};function en(e,n,t){return e.map((function(e){return{indent:!0,label:function(){return Ge[n][e]},onClick:function(){t({config:{action_type:e,axis:n},language:m.t6.PYTHON,type:m.tf.TRANSFORMER})},uuid:"".concat(n,"_").concat(e)}})).sort((function(e,n){return e.label().localeCompare(n.label())}))}function nn(e,n,t){var i=[];return e.forEach((function(e){if(e!==Ee.MISC)i.push({indent:!0,items:en(Fe[n][e],n,t),label:function(){return e},uuid:"".concat(n,"_grouping_").concat((0,W.RA)(e))});else{var o=en(Fe[n][e],n,t);i.push.apply(i,(0,r.Z)(o))}})),i}var tn=function(e,n,t){return Object.values(m.Lq).map((function(i){return{label:function(){return(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(se.mm,{fill:(0,C.qn)(m.tf.CUSTOM,{blockColor:i}).accent,size:16}),"\xa0",(0,S.jsx)(O.ZP,{children:(0,W.kC)(i)})]})},leftAligned:!0,onClick:function(){e({color:i,language:t,type:n})},uuid:"".concat(t,"_").concat(i)}}))},rn=function(e){return"-- Docs: https://docs.mage.ai/guides/sql-blocks\n"+(e||"")};function on(e,n){var t=n;return m.tf.SCRATCHPAD===e.type&&(t='"""\nNOTE: Scratchpad blocks are used only for experimentation and testing out code.\nThe code written here will not be executed as part of the pipeline.\n"""\n'+(n||"")),t}function ln(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function cn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ln(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ln(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var un=function(e){var n=e.addNewBlock,t=e.blockIdx,i=e.blockTemplates,o=e.compact,l=e.hideCustom,c=e.hideDataExporter,u=(e.hideDataLoader,e.hideDbt),a=e.hideMarkdown,d=e.hideScratchpad,f=e.hideSensor,p=e.hideTransformer,h=e.hideTransformerDataSources,v=e.onClickAddSingleDBTModel,b=e.pipeline,g=e.setAddNewBlockMenuOpenIdx,x=e.setCreatingNewDBTModel,j=(0,s.useState)(null),k=j[0],Z=j[1],O=(0,s.useRef)(null),C=(0,s.useRef)(null),E=(0,s.useRef)(null),P=(0,s.useRef)(null),w=(0,s.useRef)(null),I=(0,s.useRef)(null),T={compact:o,inline:!0},D=null===b||void 0===b?void 0:b.type,M=D===R.qL.STREAMING,B=o?Ae/2:Ae,N=25*_.iI,L=nn(Ue,Ie.qs.COLUMN,n),F=[{label:function(){return"Generic (no template)"},onClick:function(){n({language:m.t6.PYTHON,type:m.tf.TRANSFORMER})},uuid:"generic_transformer_action"},{bold:!0,items:nn(He,Ie.qs.ROW,n),label:function(){return"Row actions"},uuid:"row_actions_grouping"},{isGroupingTitle:!0,label:function(){return"Column actions"},uuid:"column_actions_grouping"}].concat((0,r.Z)(L));h||F.splice(1,0,{bold:!0,items:$e(n,m.tf.TRANSFORMER,D),label:function(){return"Data sources"},uuid:"data_sources_grouping"});var U=(0,s.useCallback)((function(){return Z(null)}),[]),H=(0,s.useCallback)((function(e){return null===g||void 0===g?void 0:g((function(n){return null===n||k!==e?t:null}))}),[t,k,g]),G=R.qL.PYSPARK===D,K=(0,s.useMemo)((function(){return Je(i,n)}),[n,i]),q=(0,s.useMemo)((function(){return $e(n,m.tf.DATA_LOADER,D,{blockTemplatesByBlockType:K})}),[n,K,D]),Q=(0,s.useMemo)((function(){return $e(n,m.tf.DATA_EXPORTER,D,{blockTemplatesByBlockType:K})}),[n,K,D]);return(0,S.jsx)(y.Z,{flexWrap:"wrap",inline:!0,children:(0,S.jsx)(z.Z,{onClickOutside:U,open:!0,children:(0,S.jsxs)(y.Z,{flexWrap:"wrap",children:[!c&&(0,S.jsx)(Re,{increasedZIndex:0===k,children:(0,S.jsx)(we.Z,{disableKeyboardShortcuts:!0,items:q,onClickCallback:U,open:0===k,parentRef:O,uuid:"data_loader_button",children:(0,S.jsx)(A.ZP,cn(cn({},T),{},{beforeElement:(0,S.jsx)(De,{blue:!0,compact:o,children:(0,S.jsx)(se.mm,{size:B})}),onClick:function(e){e.preventDefault(),Z((function(e){return 0===e?null:0})),H(0)},uuid:"AddNewBlocks/Data_loader",children:"Data loader"}))})}),!p&&(0,S.jsx)(Re,{increasedZIndex:1===k,children:(0,S.jsx)(we.Z,{disableKeyboardShortcuts:!0,items:G||R.qL.INTEGRATION===D?F:M?[{items:$e(n,m.tf.TRANSFORMER,D),label:function(){return"Python"},uuid:"transformers/python"}]:[{items:F,label:function(){return"Python"},uuid:"transformers/python_all"}].concat((0,r.Z)(Xe(n,m.tf.TRANSFORMER))),onClickCallback:U,open:1===k,parentRef:C,uuid:"transformer_button",children:(0,S.jsx)(A.ZP,cn(cn({},T),{},{beforeElement:(0,S.jsx)(De,{compact:o,purple:!0,children:(0,S.jsx)(se.mm,{size:B})}),onClick:function(e){e.preventDefault(),Z((function(e){return 1===e?null:1})),H(1)},uuid:"AddNewBlocks/Transformer",children:"Transformer"}))})}),!c&&(0,S.jsx)(Re,{increasedZIndex:2===k,children:(0,S.jsx)(we.Z,{disableKeyboardShortcuts:!0,items:Q,onClickCallback:U,open:2===k,parentRef:E,uuid:"data_exporter_button",children:(0,S.jsx)(A.ZP,cn(cn({},T),{},{beforeElement:(0,S.jsx)(De,{compact:o,yellow:!0,children:(0,S.jsx)(se.mm,{inverted:!0,size:B})}),onClick:function(e){e.preventDefault(),Z((function(e){return 2===e?null:2})),H(2)},uuid:"AddNewBlocks/Data_exporter",children:"Data exporter"}))})}),!u&&(0,S.jsx)(Re,{increasedZIndex:3===k,children:(0,S.jsx)(we.Z,{disableKeyboardShortcuts:!0,items:[{label:function(){return"New model"},onClick:function(){null===x||void 0===x||x(!0),null===v||void 0===v||v(t)},uuid:"dbt/new_model"},{label:function(){return"Single model or snapshot (from file)"},onClick:function(){return null===v||void 0===v?void 0:v(t)},uuid:"dbt/single_model"},{label:function(){return"All models (w/ optional exclusion)"},onClick:function(){return n({language:m.t6.YAML,type:m.tf.DBT})},uuid:"dbt/all_models"}],onClickCallback:U,open:3===k,parentRef:P,uuid:"dbt_button",children:(0,S.jsx)(A.ZP,cn(cn({},T),{},{beforeElement:(0,S.jsx)(Pe,{size:Ae*(o?.75:1.25)}),onClick:function(e){e.preventDefault(),Z((function(e){return 3===e?null:3})),H(3)},uuid:"AddNewBlocks/DBT",children:"DBT model"}))})}),!l&&(0,S.jsx)(Re,{increasedZIndex:4===k,children:(0,S.jsx)(we.Z,{disableKeyboardShortcuts:!0,items:[{items:tn(n,m.tf.CUSTOM,m.t6.PYTHON),label:function(){return"Python"},uuid:"custom_block_python"},{items:tn(n,m.tf.CUSTOM,m.t6.SQL),label:function(){return"SQL"},uuid:"custom_block_sql"}],onClickCallback:U,open:4===k,parentRef:w,uuid:"custom_block_button",children:(0,S.jsx)(le.Z,{block:!0,label:"Add a custom code block with a designated color.",maxWidth:N,size:null,children:(0,S.jsx)(A.ZP,cn(cn({},T),{},{beforeElement:(0,S.jsx)(De,{compact:o,grey:!0,children:(0,S.jsx)(se.mm,{inverted:!0,size:B})}),onClick:function(e){e.preventDefault(),Z((function(e){return 4===e?null:4})),H(4)},uuid:"AddNewBlocks/Scratchpad",children:"Custom"}))})})}),!d&&(0,S.jsx)(Re,{children:(0,S.jsx)(le.Z,{block:!0,label:"Write experimental code that doesn\u2019t get executed when you run your pipeline.",maxWidth:N,size:null,children:(0,S.jsx)(A.ZP,cn(cn({},T),{},{beforeElement:(0,S.jsx)(De,{border:!0,compact:o,children:(0,S.jsx)(se.mm,{size:B})}),onClick:function(e){e.preventDefault(),n({type:m.tf.SCRATCHPAD})},uuid:"AddNewBlocks/Scratchpad",children:"Scratchpad"}))})}),!M&&!f&&(0,S.jsx)(Re,{increasedZIndex:6===k,children:(0,S.jsx)(we.Z,{disableKeyboardShortcuts:!0,items:$e(n,m.tf.SENSOR,D),onClickCallback:U,open:6===k,parentRef:I,uuid:"sensor_button",children:(0,S.jsx)(A.ZP,cn(cn({},T),{},{beforeElement:(0,S.jsx)(De,{compact:o,children:(0,S.jsx)(se.LM,{pink:!0,size:Ae*(o?.75:1.25)})}),onClick:function(e){e.preventDefault(),Z((function(e){return 6===e?null:6})),H(6)},uuid:"AddNewBlocks/Sensor",children:"Sensor"}))})}),!a&&(0,S.jsx)(Re,{children:(0,S.jsx)(A.ZP,cn(cn({},T),{},{beforeElement:(0,S.jsx)(De,{compact:o,sky:!0,children:(0,S.jsx)(se.mm,{inverted:!0,size:B})}),onClick:function(e){e.preventDefault(),n({language:m.t6.MARKDOWN,type:m.tf.MARKDOWN})},uuid:"AddNewBlocks/Markdown",children:"Markdown"}))})]})})})},an=t(10975),sn=t(14567),dn=t(18283);var fn,pn=function(e){var n=e.blocks,t=e.onClick,i=(0,s.useContext)(v.ThemeContext);return(0,S.jsx)(y.Z,{alignItems:"center",children:null===n||void 0===n?void 0:n.map((function(e){var n=e.color,r=e.type,o=e.uuid,l=(0,C.qn)(r,{blockColor:n,theme:i}).accentLight;return(0,S.jsx)(Z.Z,{ml:1,mt:1,children:(0,S.jsx)(I.Z,{backgroundColor:l,compact:!0,onClick:function(){return t(e)},small:!0,children:(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:o})})},o)}))})};!function(e){e.CALLBACK="callbacks",e.CONDITIONAL="conditionals"}(fn||(fn={}));var hn=t(60701);var mn=function(e){var n=e.block,t=e.blocks,i=e.openSidekickView,r=(0,s.useMemo)((function(){return(0,pe.HK)(t,(function(e){return e.uuid}))}),[t]),o=(0,s.useMemo)((function(){var e;return null===n||void 0===n||null===(e=n.callback_blocks)||void 0===e?void 0:e.reduce((function(e,n){var t=null===r||void 0===r?void 0:r[n];return t?e.concat(t):e}),[])}),[n,r]),l=(0,s.useMemo)((function(){var e;return null===n||void 0===n||null===(e=n.conditional_blocks)||void 0===e?void 0:e.reduce((function(e,n){var t=null===r||void 0===r?void 0:r[n];return t?e.concat(t):e}),[])}),[n,r]);return(0,S.jsxs)(S.Fragment,{children:[(null===l||void 0===l?void 0:l.length)>=1&&(0,S.jsxs)(j.Z,{flexDirection:"column",children:[(0,S.jsx)(Z.Z,{px:1,children:(0,S.jsx)(O.ZP,{bold:!0,muted:!0,children:"Conditionals"})}),(0,S.jsx)(pn,{blocks:l,onClick:function(e){var n=e.uuid;return i(hn.cH.ADDON_BLOCKS,!0,{addon:fn.CONDITIONAL,blockUUID:n})}})]}),(0,S.jsx)(Z.Z,{mb:1}),(null===o||void 0===o?void 0:o.length)>=1&&(0,S.jsxs)(j.Z,{flexDirection:"column",children:[(0,S.jsx)(Z.Z,{px:1,children:(0,S.jsx)(O.ZP,{bold:!0,muted:!0,children:"Callbacks"})}),(0,S.jsx)(pn,{blocks:o,onClick:function(e){var n=e.uuid;return i(hn.cH.ADDON_BLOCKS,!0,{addon:fn.CALLBACK,blockUUID:n})}})]})]})},vn=t(57722),bn=t(89565),gn=t.n(bn),xn=t(62976),jn=t(73752),yn=t(66176),kn=v.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-n38rkq-0"})([""," border-left-style:solid;border-left-width:2px;border-right-style:solid;border-right-width:2px;overflow:hidden;"," "," ",""],C.Kf,(function(e){return e.addBottomPadding&&"\n padding-bottom: ".concat(2*_.tr,"px;\n ")}),(function(e){return"\n background-color: ".concat((e.theme.background||ue.Z.background).table,";\n ")}),(function(e){return!e.executedAndIdle&&"\n border-bottom-left-radius: ".concat(Te.n_,"px;\n border-bottom-right-radius: ").concat(Te.n_,"px;\n border-bottom-style: solid;\n border-bottom-width: 2px;\n ")})),Zn=v.default.div.withConfig({displayName:"indexstyle__OutputRowStyle",componentId:"sc-n38rkq-1"})([""," "," ",""],(function(e){return e.first&&"\n padding-top: ".concat(_.iI*_.cd,"px;\n ")}),(function(e){return e.last&&"\n padding-bottom: ".concat(_.iI*_.cd,"px;\n ")}),(function(e){return e.contained&&"\n padding-left: ".concat(C.oh,"px;\n padding-right: ").concat(_.iI*_.cd,"px;\n ")})),On=v.default.div.withConfig({displayName:"indexstyle__HTMLOutputStyle",componentId:"sc-n38rkq-2"})(["table{"," border-left-style:solid;border-left-width:2px;border-right-style:solid;border-right-width:2px;}td,th{padding:0 8px;}a{","}"],C.Kf,(function(e){return"\n color: ".concat((e.theme.interactive||ue.Z.interactive).linkPrimary,";\n ")})),_n=v.default.div.withConfig({displayName:"indexstyle__ExtraInfoStyle",componentId:"sc-n38rkq-3"})([""," border-bottom-style:solid;border-bottom-width:2px;border-left-style:solid;border-left-width:2px;border-right-style:solid;border-right-width:2px;",""],C.Kf,(function(e){return"\n background-color: ".concat((e.theme.borders||ue.Z.borders).light,";\n border-bottom-left-radius: ").concat(Te.n_,"px;\n border-bottom-right-radius: ").concat(Te.n_,"px;\n ")})),Cn=v.default.div.withConfig({displayName:"indexstyle__ExtraInfoContentStyle",componentId:"sc-n38rkq-4"})(["padding-bottom:","px;padding-left:","px;padding-right:","px;padding-top:","px;"],_.iI,C.oh,_.iI*_.cd,_.iI),Sn=v.default.div.withConfig({displayName:"indexstyle__ExtraInfoBorderStyle",componentId:"sc-n38rkq-5"})(["height:1px;width:100%;",""],(function(e){return"\n border-top: 1px solid ".concat((e.theme.borders||ue.Z.borders).medium,";\n ")})),En=t(73828),Pn=/\[__internal_output__\]/,wn=/\[__internal_test__\]/,In=t(94353),Tn=t(37391),An={uuid:"Preview results"},Dn={uuid:"Logs"},Rn={uuid:"SQL"},Mn={uuid:"Lineage"},Bn=function(e){var n,t,i=e.metadata,r=[Dn,Rn];return(null===i||void 0===i||null===(n=i.dbt)||void 0===n||null===(t=n.block)||void 0===t?void 0:t.snapshot)||(r.unshift(An),r.push(Mn)),r},Nn=2.5*_.iI,Ln="CodeBlock_HiddenBlock",Fn=t(43482);function Un(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Hn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Un(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Un(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Gn={appearAbove:!0,appearBefore:!0,block:!0,size:null,widthFitContent:!0},zn={basic:!0,iconOnly:!0,noPadding:!0,transparent:!0};var Kn,qn=function(e){var n=e.block,t=e.blockMetadata,i=e.buttonTabs,o=e.collapsed,c=e.contained,u=void 0===c||c,a=e.dynamicBlock,f=e.dynamicChildBlock,p=e.hasError,v=e.hasOutput,b=e.hideExtraInfo,k=e.isInProgress,C=e.mainContainerWidth,E=e.messages,P=e.openSidekickView,w=e.pipeline,T=e.runCount,A=e.runEndTime,D=e.runStartTime,M=e.selected,B=e.selectedTab,N=e.setCollapsed,L=e.setErrors,F=e.setOutputBlocks,U=e.setSelectedOutputBlock,H=e.setSelectedTab,G=n||{},z=G.status,K=G.type,q=G.uuid,Q=(0,s.useMemo)((function(){return(null===E||void 0===E?void 0:E.length)||0}),[E]),V=m.DA.EXECUTED===z||!k&&0===T&&Q>=1||!k&&T>=1&&A>=D,Y=(0,s.useState)(),X=Y[0],J=Y[1],$=(0,s.useState)(),ee=$[0],ne=$[1],te=(0,s.useState)(null),ie=te[0],re=te[1],oe=(0,s.useMemo)((function(){var e,n;return null===(e=new h.Z)||void 0===e||null===(n=e.decodedToken)||void 0===n?void 0:n.token}),[]),ue=(0,d.Db)((function(){return ce.ZP.block_outputs.pipelines.downloads.detailAsync(null===w||void 0===w?void 0:w.uuid,q,{token:oe},{onDownloadProgress:function(e){return re((Number((null===e||void 0===e?void 0:e.loaded)||0)/1e6).toFixed(3))},responseType:In.E.BLOB})}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){(0,Fn.uS)(e,"".concat(q,".").concat(En.Lu.CSV))},onErrorCallback:function(e,n){return null===L||void 0===L?void 0:L({errors:n,response:e})}})}}),de=(0,l.Z)(ue,2),fe=de[0],pe=de[1].isLoading;(0,s.useEffect)((function(){k||ne(100)}),[k]);var he=function(e){return Array.isArray(e)?e.join("\n"):e},ve=(0,s.useMemo)((function(){return E.reduce((function(e,n){var t=e.at(-1);if(ge.jU.includes(null===t||void 0===t?void 0:t.type)&&(null===t||void 0===t?void 0:t.type)===n.type&&!he(null===n||void 0===n?void 0:n.data).match(Pn)){if(Array.isArray(t.data))t.data.concat(n.data);else if("string"===typeof t.data){var i=he(n.data)||"";t.data=[t.data,i].join("\n")}}else ge.jU.includes(null===n||void 0===n?void 0:n.type)&&!he(null===n||void 0===n?void 0:n.data).match(Pn)?e.push(Hn(Hn({},n),{},{data:he(n.data)})):e.push(Hn({},n));return e}),[])}),[E]),be=(0,s.useMemo)((function(){return(0,S.jsx)(yn.Z,{progress:ee})}),[ee]),xe=m.tf.DBT===(null===n||void 0===n?void 0:n.type),je=(0,ae.Z)(p);(0,s.useEffect)((function(){xe&&!je&&p&&H(Dn)}),[p,je,xe,H]);var ye=(0,s.useMemo)((function(){var e=function(e,n){var t=e.columns,i=e.index,r=e.rows,o=e.shape,l=n.borderTop,c=n.selected;return o&&J(o),r.length>=1&&(0,S.jsx)(xn.Z,{columns:t,disableScrolling:!c,index:i,maxHeight:60*_.iI,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!l,rows:r,width:C-(2+_.cd*_.iI*2+2+Tn.nn)},"data-table-".concat(i))},n=[],t=[],i=[];return null===ve||void 0===ve||ve.forEach((function(o,l){var c=o.data,a=o.type;if(c&&0!==(null===c||void 0===c?void 0:c.length)){var s=[];s=(s=Array.isArray(c)?c:[c]).filter((function(e){return e}));var d=[];s.forEach((function(e){if(e&&"string"===typeof e){var n=e.split("\n");d.push.apply(d,(0,r.Z)(n))}else"object"===typeof d&&d.push(e)}));var f=d.length,p=[];d.forEach((function(n,r){var o,c={contained:u,first:0===l&&0===r,last:l===ve.length-1&&r===f-1},s=l>=1;if("string"===typeof n&&n.match(wn)){var d=n.split("\n"),h=[];d.forEach((function(e){if(e.match(wn)){var t=e.split("[__internal_test__]"),r=t[t.length-1];(0,W.Pb)(r)&&i.push(JSON.parse(r))}else h.push(e);n=h.length>=1?h.join("\n"):null}))}if(null!==n){if("string"===typeof n&&n.match(Pn)){var m=n.split("[__internal_output__]"),v=m[m.length-1],b=v.split("FloatProgress");if(m.length>=2&&(v=b[0]),(0,W.Pb)(v)){var g=JSON.parse(v),x=g.data,j=g.type;if(ge.Gi.TABLE===j){!0;var y=e(x,{borderTop:s,selected:M});t.push(y),xe||(o=y)}}}else if(a===ge.Gi.TABLE){!0;var k=e((0,W.Pb)(n)?JSON.parse(n):n,{borderTop:s,selected:M});t.push(k),xe||(o=k)}else if(ge.jU.includes(a)){var Z,_=null===(Z=n)||void 0===Z?void 0:Z.split("\\n");o=(0,S.jsx)(Zn,Hn(Hn({},c),{},{children:_.map((function(e){return(0,S.jsx)(O.ZP,{monospace:!0,preWrap:!0,children:(0,S.jsx)(gn(),{children:e})},e)}))}))}else if(a===ge.Gi.TEXT_HTML)o=(0,S.jsx)(Zn,Hn(Hn({},c),{},{children:(0,S.jsx)(On,{children:(0,S.jsx)(O.ZP,{dangerouslySetInnerHTML:{__html:n},monospace:!0})})}));else if(a===ge.Gi.IMAGE_PNG)o=(0,S.jsx)("div",{style:{backgroundColor:"white"},children:(0,S.jsx)("img",{alt:"Image ".concat(l," from code output"),src:"data:image/png;base64, ".concat(n)})});else if(a===ge.Gi.PROGRESS){var C=parseInt(n);ne(C>90?90:C)}o&&p.push((0,S.jsx)("div",{children:o},"code-output-".concat(l,"-").concat(r)))}})),p.length>=1&&n.push(p)}})),k&&(null===w||void 0===w?void 0:w.type)===R.qL.PYSPARK&&n.unshift([(0,S.jsx)(Zn,{contained:!0,children:(0,S.jsx)(Z.Z,{mt:1,children:be})},"progress_bar")]),{content:n,tableContent:t,testContent:i}}),[ve,u,xe,k,C,w,be,M]),ke=ye.content,Ze=ye.tableContent,Oe=ye.testContent,_e=(null===X||void 0===X?void 0:X[1])||0,Ce=_e>30?" (30 out of ".concat(_e," columns displayed)"):"",Se=(0,s.useMemo)((function(){var e;if(xe&&B){var n=B.uuid;if(An.uuid===n)(null===Ze||void 0===Ze?void 0:Ze.length)>=1?e=Ze:k||(e=(0,S.jsx)(Z.Z,{px:2,py:1,children:(0,S.jsx)(O.ZP,{muted:!0,children:p?"Error, check logs.":"No preview to display yet, try running the block."})}));else if(Dn.uuid===n)(null===ke||void 0===ke?void 0:ke.length)>=1?e=ke:k||(e=(0,S.jsx)(Z.Z,{px:2,py:1,children:(0,S.jsx)(O.ZP,{muted:!0,children:p?"Error, check logs.":"No logs to display yet, try running the block."})}));else if(Rn.uuid===n){var r,o=null===t||void 0===t||null===(r=t.dbt)||void 0===r?void 0:r.sql;e=o?(0,S.jsx)(vn.Z,{autoHeight:!0,language:En.Lu.SQL,padding:!0,readOnly:!0,value:o,width:"100%"}):null}else if(Mn.uuid===n){var l,c=null===t||void 0===t||null===(l=t.dbt)||void 0===l?void 0:l.lineage;e=c?(0,S.jsx)(jn.Z,{disabled:!0,enablePorts:!1,height:55*_.iI,pannable:M,pipeline:Hn(Hn({},w),{},{blocks:c}),zoomable:M}):null}}else e=ke;return(0,S.jsxs)(S.Fragment,{children:[i,e]})}),[t,i,ke,p,xe,k,w,M,B,Ze]);return i||p||v?(0,S.jsxs)(S.Fragment,{children:[u&&(0,S.jsxs)(kn,{addBottomPadding:k&&(null===w||void 0===w?void 0:w.type)===R.qL.PYSPARK,blockType:K,dynamicBlock:a,dynamicChildBlock:f,executedAndIdle:V,hasError:p,selected:M,children:[!o&&(null===Oe||void 0===Oe?void 0:Oe.length)>=1&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{py:2,children:(0,S.jsx)(Zn,{contained:!0,children:Oe.map((function(e,n){var t=e.error,i=e.message,r=e.stacktrace;return(0,S.jsxs)(Z.Z,{mt:n>=1?3:0,children:[(0,S.jsx)(O.ZP,{monospace:!0,preWrap:!0,children:(0,S.jsx)(gn(),{children:"".concat(i).concat(t?" "+t:"")})}),null===r||void 0===r?void 0:r.map((function(e){return(0,S.jsx)(O.ZP,{default:!0,monospace:!0,preWrap:!0,small:!0,children:(0,S.jsx)(gn(),{children:e})},e)}))]},i)}))})}),(0,S.jsx)(Z.Z,{mb:p?2:0,children:(0,S.jsx)(x.Z,{medium:!0})})]}),!o&&Se]}),!u&&Se,V&&!b&&(0,S.jsxs)(_n,{blockType:K,dynamicBlock:a,dynamicChildBlock:f,hasError:p,selected:M,children:[(0,S.jsx)(Sn,{}),(0,S.jsxs)(y.Z,{justifyContent:"space-between",children:[N&&(0,S.jsx)(j.Z,{alignItems:"center",px:1,children:(0,S.jsx)(I.Z,Hn(Hn({},zn),{},{onClick:function(){return N(!o)},children:o?(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(se._M,{muted:!0,size:2*_.iI}),"\xa0",(0,S.jsx)(O.ZP,{default:!0,children:"Expand output"})]}):(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(se.Kh,{muted:!0,size:2*_.iI}),X&&(0,S.jsx)(Z.Z,{ml:2,children:(0,S.jsx)(O.ZP,{children:"".concat(X[0]," rows x ").concat(X[1]," columns").concat(Ce)})})]})}))}),(0,S.jsx)(Cn,{children:(0,S.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,justifyContent:"flex-end",children:[(0,S.jsx)(le.Z,Hn(Hn({},Gn),{},{label:T>=1&&D?"Last run at ".concat(new Date(D.valueOf()).toLocaleString()):p?"Block executed with errors":"Block executed successfully",children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[T>=1&&Number(A)>Number(D)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(O.ZP,{small:!0,children:[(Number(A)-Number(D))/1e3,"s"]}),(0,S.jsx)(Z.Z,{mr:1})]}),!p&&(0,S.jsx)(se.Jr,{size:2*_.iI,success:!0}),p&&(0,S.jsx)(g.Z,{danger:!0,size:2*_.iI,children:(0,S.jsx)(O.ZP,{bold:!0,monospace:!0,small:!0,children:"!"})})]})})),!p&&!m.Qj.includes(K)&&(0,S.jsx)(Z.Z,{pl:2,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(le.Z,Hn(Hn({},Gn),{},{label:"Expand table",children:(0,S.jsx)(I.Z,Hn(Hn({},zn),{},{onClick:function(){(0,Fn.OF)(null===w||void 0===w?void 0:w.uuid,q),null===P||void 0===P||P(hn.cH.DATA),null===F||void 0===F||F((function(e){return e.find((function(e){return e.uuid===q}))?e:(null===U||void 0===U||U(n),e.concat(n))}))},children:(0,S.jsx)(se.M0,{muted:!0,size:1.75*_.iI})}))})),(0,S.jsx)(Z.Z,{pl:2}),(0,S.jsx)(le.Z,Hn(Hn({},Gn),{},{forceVisible:pe,label:pe?"".concat(ie||0,"mb downloaded..."):"Save output as CSV file",children:(0,S.jsx)(I.Z,Hn(Hn({},zn),{},{compact:!0,loading:pe,onClick:function(){re(null),fe()},children:(0,S.jsx)(se.vc,{muted:!0,size:1.75*_.iI})}))}))]})})]})})]})]})]}):null},Qn="buckets",Wn="chart_style",Vn="group_by",Yn="height",Xn="index",Jn="legend_labels",$n="limit",et="metrics",nt="time_interval",tt="width_percentage",it="x",rt="y",ot="y_sort_order",lt="data_provider",ct="data_provider_database",ut="data_provider_profile",at="data_provider_schema",st="data_provider_table",dt="dbt_profile_target",ft="dbt_project_name",pt="export_write_policy",ht="limit",mt="unique_upstream_table_name",vt="upstream_block_configuration",bt="table_name",gt="use_raw_sql",xt=[it,rt];!function(e){e.BAR_CHART="bar chart",e.HISTOGRAM="histogram",e.LINE_CHART="line chart",e.PIE_CHART="pie chart",e.TABLE="table",e.TIME_SERIES_BAR_CHART="time series bar chart",e.TIME_SERIES_LINE_CHART="time series line chart"}(Kn||(Kn={}));var jt,yt,kt=[Kn.BAR_CHART,Kn.HISTOGRAM,Kn.LINE_CHART,Kn.PIE_CHART,Kn.TABLE,Kn.TIME_SERIES_BAR_CHART,Kn.TIME_SERIES_LINE_CHART];!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(jt||(jt={})),function(e){e.AVERAGE="average",e.COUNT="count",e.COUNT_DISTINCT="count_distinct",e.MAX="max",e.MEDIAN="median",e.MIN="min",e.MODE="mode",e.SUM="sum"}(yt||(yt={}));var Zt,Ot,_t,Ct,St,Et,Pt,wt,It,Tt=[yt.AVERAGE,yt.COUNT,yt.COUNT_DISTINCT,yt.MAX,yt.MEDIAN,yt.MIN,yt.MODE,yt.SUM];!function(e){e.ASCENDING="ascending",e.DESCENDING="descending"}(Zt||(Zt={})),function(e){e.DAY="day",e.HOUR="hour",e.MINUTE="minute",e.MONTH="month",e.ORIGINAL="original",e.SECOND="second",e.WEEK="week",e.YEAR="year"}(Ot||(Ot={})),function(e){e.COLUMNS="columns",e.METRICS="metrics",e.NUMBER="number"}(It||(It={}));var At={noCode:[{label:function(){return"time column"},settings:{maxValues:1},type:It.COLUMNS,uuid:Vn},{label:function(){return"time interval"},options:[Ot.ORIGINAL,Ot.SECOND,Ot.MINUTE,Ot.HOUR,Ot.DAY,Ot.WEEK,Ot.MONTH,Ot.YEAR],uuid:nt},{label:function(){return"metrics"},type:It.METRICS,uuid:et}]},Dt=(_t={},(0,o.Z)(_t,Kn.BAR_CHART,{noCode:[{label:function(){return"group by columns"},type:It.COLUMNS,uuid:Vn},{label:function(){return"metrics"},type:It.METRICS,uuid:et},{autoRun:!0,label:function(){return"chart style"},options:[jt.HORIZONTAL,jt.VERTICAL],uuid:Wn},{autoRun:!0,label:function(){return"sort direction"},options:[null,Zt.ASCENDING,Zt.DESCENDING],uuid:ot}],code:[{label:function(){return"variable name of x-axis values"},monospace:!0,uuid:it},{label:function(){return"variable name of y-axis values"},monospace:!0,uuid:rt}]}),(0,o.Z)(_t,Kn.HISTOGRAM,{noCode:[{label:function(){return"number column for chart"},settings:{maxValues:1},type:It.COLUMNS,uuid:Vn},{autoRun:!0,label:function(){return"Number of buckets"},type:It.NUMBER,uuid:Qn}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:it}]}),(0,o.Z)(_t,Kn.LINE_CHART,{noCode:[{label:function(){return"group by columns"},settings:{maxValues:1},type:It.COLUMNS,uuid:Vn},{label:function(){return"metrics"},type:It.METRICS,uuid:et}],code:[{label:function(){return"variable name of x-axis values"},monospace:!0,uuid:it},{label:function(){return"variable name of y-axis values"},monospace:!0,uuid:rt},{label:function(){return"labels of lines in chart (comma separated)"},uuid:Jn}]}),(0,o.Z)(_t,Kn.PIE_CHART,{noCode:[{label:function(){return"column for chart"},settings:{maxValues:1},type:It.COLUMNS,uuid:Vn},{autoRun:!0,label:function(){return"Number of slices"},type:It.NUMBER,uuid:Qn}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:it}]}),(0,o.Z)(_t,Kn.TABLE,{noCode:[{label:function(){return"columns"},type:It.COLUMNS,uuid:Vn},{label:function(){return"max number of rows"},type:It.NUMBER,uuid:$n}],code:[{label:function(){return"variable name of columns"},monospace:!0,uuid:it},{label:function(){return"variable name of rows"},monospace:!0,uuid:rt}]}),(0,o.Z)(_t,Kn.TIME_SERIES_BAR_CHART,At),(0,o.Z)(_t,Kn.TIME_SERIES_LINE_CHART,At),_t),Rt=(Ct={},(0,o.Z)(Ct,Kn.BAR_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,it,"x"),(0,o.Z)(n,rt,"y"),(0,o.Z)(n,Wn,jt.VERTICAL),n},content:function(e){return"columns = df_1.columns\nx = df_1.columns[:7]\ny = [[v] for v in [len(df_1[col].unique()) for col in x]]\n"}}),(0,o.Z)(Ct,Kn.HISTOGRAM,{configuration:function(e){var n;return n={},(0,o.Z)(n,Qn,10),(0,o.Z)(n,it,"x"),n},content:function(e){return"columns = df_1.columns\ncol = list(filter(lambda x: df_1[x].dtype == float or df_1[x].dtype == int, columns))[0]\nx = df_1[col]\n"}}),(0,o.Z)(Ct,Kn.LINE_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,it,"x"),(0,o.Z)(n,rt,"y"),n},content:function(e){return"columns = df_1.columns\ncols = list(filter(lambda x: df_1[x].dtype == float or df_1[x].dtype == int, columns))\nx = df_1[cols[0]]\ny = [df_1[cols[1]]]\n"}}),(0,o.Z)(Ct,Kn.PIE_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,Qn,7),(0,o.Z)(n,it,"x"),n},content:function(e){return"x = df_1[df_1.columns[0]]"}}),(0,o.Z)(Ct,Kn.TABLE,{configuration:function(e){var n;return n={},(0,o.Z)(n,$n,10),(0,o.Z)(n,it,"x"),(0,o.Z)(n,rt,"y"),n},content:function(e){return"x = df_1.columns\ny = df_1.to_numpy()"}}),(0,o.Z)(Ct,Kn.TIME_SERIES_BAR_CHART,{configuration:function(e){return(0,o.Z)({},nt,Ot.ORIGINAL)}}),(0,o.Z)(Ct,Kn.TIME_SERIES_LINE_CHART,{configuration:function(e){return(0,o.Z)({},nt,Ot.ORIGINAL)}}),Ct),Mt=(wt={},(0,o.Z)(wt,Kn.BAR_CHART,(St={},(0,o.Z)(St,it,(function(){return"must be a list of booleans, dates, integers, floats, or strings."})),(0,o.Z)(St,rt,(function(){return"must be a list of lists containing integers or floats."})),St)),(0,o.Z)(wt,Kn.HISTOGRAM,(0,o.Z)({},it,(function(){return"must be a list of integers or floats."}))),(0,o.Z)(wt,Kn.LINE_CHART,(Et={},(0,o.Z)(Et,it,(function(){return"must be a list of integers or floats."})),(0,o.Z)(Et,rt,(function(){return"must be a list of lists containing integers or floats. Each list is a single line in the chart."})),Et)),(0,o.Z)(wt,Kn.PIE_CHART,(0,o.Z)({},it,(function(){return"must be a list of booleans, dates, integers, floats, or strings."}))),(0,o.Z)(wt,Kn.TABLE,(Pt={},(0,o.Z)(Pt,it,(function(){return"must be a list of strings."})),(0,o.Z)(Pt,rt,(function(){return"must be a list of lists containing booleans, dates, integers, floats, or strings."})),Pt)),wt),Bt=[{label:function(){return"% of missing values"},widgetTemplate:function(e){var n,t=e.block;return{name:"missing values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,it,"columns_with_mising_values"),(0,o.Z)(n,rt,"percentage_of_missing_values"),(0,o.Z)(n,Wn,jt.HORIZONTAL),(0,o.Z)(n,ot,Zt.DESCENDING),(0,o.Z)(n,"chart_type",Kn.BAR_CHART),n),content:"number_of_rows = len(df_1.index)\ncolumns_with_mising_values = []\npercentage_of_missing_values = []\nfor col in df_1.columns:\n missing = df_1[col].isna().sum()\n if missing > 0:\n columns_with_mising_values.append(col)\n percentage_of_missing_values.append(100 * missing / number_of_rows)\n"}}},{label:function(){return"Unique values"},widgetTemplate:function(e){var n,t=e.block;return{name:"unique values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,it,"columns"),(0,o.Z)(n,rt,"number_of_unique_values"),(0,o.Z)(n,Wn,jt.HORIZONTAL),(0,o.Z)(n,ot,Zt.DESCENDING),(0,o.Z)(n,"chart_type",Kn.BAR_CHART),n),content:"columns = df_1.columns\nnumber_of_unique_values = [df_1[col].nunique() for col in columns]\n"}}},{label:function(){return"Most frequent values"},widgetTemplate:function(e){var n,t=e.block;return{name:"most frequent values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,Yn,3e3),(0,o.Z)(n,Xn,"column_index"),(0,o.Z)(n,it,"columns"),(0,o.Z)(n,rt,"rows"),(0,o.Z)(n,"chart_type",Kn.TABLE),n),content:"columns = ['mode value', 'frequency', '% of values']\n\ncolumn_index = []\nrows = []\nfor col in df_1.columns:\n value_counts = df_1[col].value_counts()\n if len(value_counts.index) == 0:\n continue\n column_value = value_counts.index[0]\n value = value_counts[column_value]\n number_of_rows = df_1[col].count()\n column_index.append(col)\n rows.append([\n column_value,\n f'{round(100 * value / number_of_rows, 2)}%',\n value,\n ])\n"}}},{label:function(){return"Summary overview"},widgetTemplate:function(e){var n,t=e.block;return{name:"summary overview for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,Yn,3e3),(0,o.Z)(n,Xn,"stats"),(0,o.Z)(n,it,"headers"),(0,o.Z)(n,rt,"rows"),(0,o.Z)(n,"chart_type",Kn.TABLE),n),content:"from mage_ai.data_cleaner.column_types.column_type_detector import infer_column_types\n\n\nheaders = ['value']\nstats = ['Columns', 'Rows']\nrows = [[len(df_1.columns)], [len(df_1.index)]]\n\ncol_counts = {}\nfor col, col_type in infer_column_types(df_1).items():\n col_type_name = col_type.value\n if not col_counts.get(col_type_name):\n col_counts[col_type_name] = 0\n col_counts[col_type_name] += 1\n\nfor col_type, count in sorted(col_counts.items()):\n stats.append(f'# of {col_type}')\n rows.append([count])\n"}}},{label:function(){return"Feature profiles"},widgetTemplate:function(e){var n,t=e.block;return{name:"feature profiles for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,Yn,3e3),(0,o.Z)(n,Xn,"stats"),(0,o.Z)(n,it,"columns"),(0,o.Z)(n,rt,"rows"),(0,o.Z)(n,"chart_type",Kn.TABLE),n),content:"from mage_ai.data_cleaner.column_types.column_type_detector import infer_column_types\nimport statistics\n\n\ncolumns_and_types = infer_column_types(df_1).items()\ncolumns = [t[0] for t in columns_and_types]\nstats = ['Type', 'Missing values', 'Unique values', 'Min', 'Max', 'Mean', 'Median', 'Mode']\nrows = [[] for _ in stats]\n\nfor col, col_type in columns_and_types:\n series = df_1[col]\n min_value = None\n max_value = None\n mean = None\n median = None\n\n not_null = series[series.notnull()]\n\n if col_type.value in ['number', 'number_with_decimals']:\n count = len(not_null.index)\n if count >= 1:\n mean = round(not_null.sum() / count, 2)\n median = sorted(not_null)[int(count / 2)]\n min_value = round(series.min(), 2)\n max_value = round(series.max(), 2)\n else:\n min_value = not_null.astype(str).min()\n max_value = not_null.astype(str).max()\n\n _, mode = sorted(\n [(v, k) for k, v in not_null.value_counts().items()],\n reverse=True,\n )[0]\n\n for idx, value in enumerate([\n col_type.value,\n len(series[series.isna()].index),\n len(series.unique()),\n min_value,\n max_value,\n mean,\n median,\n mode,\n ]):\n rows[idx].append(value)\n"}}}];function Nt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Lt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Nt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Nt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ft=function(e){var n=e.addWidget,t=e.block,i=e.left,o=e.rightOffset,l=e.onClickCallback,c=e.open,u=e.parentRef,a=e.runBlock,d=e.topOffset,f=(0,s.useMemo)((function(){return kt.map((function(e){var i,r,o={configuration:{chart_type:e},language:t.language,type:m.tf.CHART,upstream_blocks:t?[t.uuid]:null},l=Rt[e],c=(null===l||void 0===l||null===(i=l.configuration)||void 0===i?void 0:i.call(l,o))||{},u=m.t6.SQL===(null===t||void 0===t?void 0:t.language)?null:(null===l||void 0===l||null===(r=l.content)||void 0===r?void 0:r.call(l,o))||null,s=e;return t&&(s="".concat(s," for ").concat(t.uuid)),{label:function(){return(0,W.vg)(e)},onClick:function(){return n(Lt(Lt({},o),{},{name:"".concat(s," ").concat((0,W.Mp)()),configuration:Lt(Lt({},o.configuration),c),content:u}),{onCreateCallback:function(e){t&&m.t6.SQL!==t.language&&([m.DA.EXECUTED,m.DA.UPDATED].includes(t.status)?null===a||void 0===a||a({block:e,code:u,disableReset:!0}):null===a||void 0===a||a({block:t,runDownstream:!0}))}})},uuid:e}}))}),[kt,t,a]),p=(0,s.useMemo)((function(){return Bt.map((function(e){var i=e.label,r=Lt(Lt({},(0,e.widgetTemplate)({block:t})),{},{language:t.language,type:m.tf.CHART,upstream_blocks:t?[t.uuid]:null});return{label:i,onClick:function(){return n(r,{onCreateCallback:function(e){t&&m.t6.SQL!==t.language&&([m.DA.EXECUTED,m.DA.UPDATED].includes(t.status)?null===a||void 0===a||a({block:e,code:e.content,disableReset:!0}):null===a||void 0===a||a({block:t,runDownstream:!0}))}})},uuid:i()}}))}),[Bt,n,t,a]),h=[{isGroupingTitle:!0,label:function(){return"Custom charts"},uuid:"custom_charts"}].concat((0,r.Z)(f));return m.t6.SQL!==t.language&&h.push.apply(h,[{isGroupingTitle:!0,label:function(){return"Templates"},uuid:"chart_templates"}].concat((0,r.Z)(p))),(0,S.jsx)(K.Z,{items:h,left:i,onClickCallback:l,open:c,parentRef:u,rightOffset:o,topOffset:d,uuid:"CommandButtons/add_charts",width:25*_.iI})},Ut=t(40656),Ht=v.default.svg.withConfig({displayName:"Convert__SVGStyle",componentId:"sc-fmw0vr-0"})([""]),Gt=function(e){var n=e.fill,t=e.opacity,i=e.size,r=void 0===i?Ut.C:i,o=e.style,l=e.viewBox,c=void 0===l?"0 0 12 12":l;return(0,S.jsxs)(Ht,{fill:n,height:r,opacity:t,style:o,viewBox:c,width:r,children:[(0,S.jsx)("path",{clipRule:"evenodd",d:"M2.5 1C1.67157 1 1 1.67157 1 2.5v.0625c0 .27614-.223858.5-.5.5s-.5-.22386-.5-.5V2.5C0 1.11929 1.11929 0 2.5 0h7C10.8807 0 12 1.11929 12 2.5v7c0 1.3807-1.1193 2.5-2.5 2.5h-7C1.11929 12 0 10.8807 0 9.5v-.0625c0-.27614.223858-.5.5-.5s.5.22386.5.5V9.5c0 .8284.67157 1.5 1.5 1.5h7c.8284 0 1.5-.6716 1.5-1.5v-7c0-.82843-.6716-1.5-1.5-1.5h-7z",fill:"url(#paint0_linear_1332_60037)",fillRule:"evenodd"}),(0,S.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.05806 3.55806c.24408-.24408.6398-.24408.88388 0l2 2c.24408.24408.24408.6398 0 .88388l-2 2c-.24408.24408-.6398.24408-.88388 0-.24408-.24408-.24408-.6398 0-.88388l.93306-.93306H1C.654822 6.625.375 6.34518.375 6s.279822-.625.625-.625h5.99112l-.93306-.93306c-.24408-.24408-.24408-.6398 0-.88388z",fill:"#fff"}),(0,S.jsx)("defs",{children:(0,S.jsxs)("linearGradient",{id:"paint0_linear_1332_60037",x1:"-.618557",y1:"-.000001",x2:"10.5709",y2:".83113",gradientUnits:"userSpaceOnUse",children:[(0,S.jsx)("stop",{stopColor:"#FFCC19"}),(0,S.jsx)("stop",{offset:".585938",stopColor:"#2ECDF7"}),(0,S.jsx)("stop",{offset:"1",stopColor:"#9E7BFF"})]})})]})},zt=t(79749),Kt=t(54283),qt=t(75968);function Qt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Wt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Qt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Qt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Vt,Yt=function(e){var n,t,i=e.addNewBlock,r=e.addWidget,o=e.block,c=e.blocks,u=e.deleteBlock,a=e.executionState,f=e.fetchFileTree,p=e.fetchPipeline,h=e.interruptKernel,b=e.isEditingBlock,x=e.pipeline,j=e.runBlock,k=e.setIsEditingBlock,E=e.savePipelineContent,P=e.setErrors,w=e.setOutputCollapsed,T=o.all_upstream_blocks_executed,A=void 0===T||T,D=o.color,M=o.metadata,N=o.type,L=o.uuid,F=(0,s.useRef)(null),U=(0,s.useRef)(null),H=(0,s.useRef)(null),G=(0,s.useRef)(null),q=null===x||void 0===x?void 0:x.type,W=(0,s.useState)(!1),V=W[0],Y=W[1],X=(0,s.useState)(!1),J=X[0],$=X[1],ee=(0,s.useState)(!1),ne=ee[0],te=ee[1],ie=(0,s.useState)(!1),re=ie[0],oe=ie[1],ae=(0,s.useContext)(v.ThemeContext),de=ge.uF.IDLE!==a,fe=(0,C.qn)(N,{blockColor:D,theme:ae}).accent,he=(0,s.useMemo)((function(){return q===R.qL.STREAMING}),[q]),ve=(0,s.useMemo)((function(){return q===R.qL.INTEGRATION}),[q]),be=(0,s.useMemo)((function(){return(0,qt.Ts)(o,c,"CommandButtons",i).map((function(e){return Wt(Wt({},e),{},{onClick:function(){return E().then((function(){return e.onClick()}))}})}))}),[i,o,c,E]),xe=(0,s.useMemo)((function(){return(0,pe.HK)(c,(function(e){return e.uuid}))}),[c]),je=(0,s.useMemo)((function(){return m.tf.DBT===(null===o||void 0===o?void 0:o.type)}),[o]),ye=(0,s.useMemo)((function(){return m.tf.MARKDOWN===(null===o||void 0===o?void 0:o.type)}),[o]),ke=(0,d.Db)(ce.ZP.pipelines.useUpdate(null===x||void 0===x?void 0:x.uuid),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){p()},onErrorCallback:function(e,n){return P({errors:n,response:e})}})}}),Ze=(0,l.Z)(ke,2),Oe=Ze[0];return Ze[1].isLoading,(0,S.jsxs)(y.Z,{alignItems:"center",children:[ge.uF.QUEUED===a&&(0,S.jsx)(Kt.Z,{color:(ae||ue.Z).content.active,type:"cylon"}),ge.uF.BUSY===a&&(0,S.jsx)(Kt.Z,{color:(ae||ue.Z).content.active}),j&&!de&&!he&&(0,S.jsxs)(S.Fragment,{children:[!je&&(0,S.jsx)(le.Z,{appearBefore:!0,default:!0,label:(0,S.jsxs)(O.ZP,{children:["Run block \xa0 \xa0",(0,S.jsx)(zt.Z,{inline:!0,keyTextGroups:[[(0,Q.V5)()?B.RJ:B.hE,B.Lz]],monospace:!0,uuidForKey:L})]}),size:3*_.iI,widthFitContent:!0,children:(0,S.jsx)(I.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){A?j({block:o}):te(!0)},children:(0,S.jsx)(g.Z,{color:fe,size:3*_.iI,children:(0,S.jsx)(se.Py,{black:!0,size:1.5*_.iI})})})}),je&&(0,S.jsx)(I.Z,{backgroundColor:fe,beforeIcon:(0,S.jsx)(se.Py,{size:1.5*_.iI}),compact:!0,onClick:function(){A?j({block:o}):te(!0)},small:!0,children:null!==M&&void 0!==M&&null!==(n=M.dbt)&&void 0!==n&&null!==(t=n.block)&&void 0!==t&&t.snapshot?"Run snapshot":"Compile & preview"}),(0,S.jsx)(z.Z,{disableEscape:!0,onClickOutside:function(){return te(!1)},open:ne,children:(0,S.jsx)(K.Z,{items:[{label:function(){return"Execute block"},onClick:function(){return j({block:o})},uuid:"execute_block"},{label:function(){return"Execute with upstream blocks"},onClick:function(){return j({block:o,runUpstream:!0})},uuid:"execute_upstream"}],onClickCallback:function(){return te(!1)},open:ne,parentRef:H,rightOffset:13.25*_.iI,topOffset:4.5*_.iI,uuid:"execute_actions",width:25*_.iI})})]}),de&&(0,S.jsx)(Z.Z,{ml:_.cd,children:(0,S.jsx)(le.Z,{appearBefore:!0,default:!0,label:(0,S.jsxs)(O.ZP,{children:["Interrupt kernel \xa0 \xa0",(0,S.jsx)(zt.Z,{inline:!0,keyTextGroups:[[B.kA],[B.kA]],monospace:!0,uuidForKey:L})]}),size:Nn,widthFitContent:!0,children:(0,S.jsx)(I.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return h()},children:(0,S.jsx)(g.Z,{borderSize:1.5,size:Nn,children:(0,S.jsx)(se.x8,{size:1*_.iI})})})})}),m.tf.SCRATCHPAD===o.type&&!he&&(0,S.jsx)(Z.Z,{ml:_.cd,children:(0,S.jsx)(we.Z,{items:be,onClickCallback:function(){return $(!1)},onClickOutside:function(){return $(!1)},open:J,parentRef:U,rightOffset:0,topOffset:4,uuid:"CommandButtons/convert_block",children:(0,S.jsx)(le.Z,{appearBefore:!0,default:!0,label:(0,S.jsx)(O.ZP,{children:"Convert block"}),size:Nn,widthFitContent:!0,children:(0,S.jsx)(I.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return $(!J)},ref:U,children:(0,S.jsx)(Gt,{size:Nn})})})})}),[m.tf.DATA_LOADER,m.tf.TRANSFORMER].includes(o.type)&&!he&&!ve&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{ml:_.cd,ref:F,children:(0,S.jsx)(le.Z,{appearBefore:!0,default:!0,label:"Add chart",size:2.25*_.iI,widthFitContent:!0,children:(0,S.jsx)(I.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return Y((function(e){return!e}))},children:(0,S.jsx)(se.GQ,{size:2.25*_.iI})})})}),r&&(0,S.jsx)(z.Z,{disableEscape:!0,onClickOutside:function(){return Y(!1)},open:V,children:(0,S.jsx)(Ft,{addWidget:r,block:o,onClickCallback:function(){return Y(!1)},open:V,parentRef:F,rightOffset:9*_.iI,runBlock:j,topOffset:2*_.iI})})]}),ye&&(0,S.jsx)(Z.Z,{ml:_.cd,children:(0,S.jsx)(le.Z,{appearBefore:!0,default:!0,label:b?"Close editor":"Edit",size:Nn,widthFitContent:!0,children:(0,S.jsx)(I.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return k((function(e){return!e}))},children:b?(0,S.jsx)(se.Jr,{size:Nn,success:!0}):(0,S.jsx)(se.I8,{size:Nn})})})}),(0,S.jsx)("div",{ref:G,children:(0,S.jsx)(Z.Z,{ml:_.cd,children:(0,S.jsx)(le.Z,{appearBefore:!0,default:!0,label:(0,S.jsx)(O.ZP,{children:"More actions"}),size:Nn,widthFitContent:!0,children:(0,S.jsx)(I.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return oe((function(e){return!e}))},children:(0,S.jsx)(g.Z,{borderSize:1.5,size:Nn,children:(0,S.jsx)(se.mH,{size:_.iI})})})})})}),(0,S.jsx)(z.Z,{disableEscape:!0,onClickOutside:function(){return oe(!1)},open:re,children:(0,S.jsx)(K.Z,{items:(0,qt.J8)(o,j,u,w,he||ve,{addNewBlock:i,blocksMapping:xe,fetchFileTree:f,fetchPipeline:p,savePipelineContent:E,updatePipeline:Oe}),onClickCallback:function(){return oe(!1)},open:re,parentRef:G,rightOffset:4.75*_.iI,topOffset:2*_.iI,uuid:"FileHeaderMenu/file_items"})})]})};!function(e){e.APPEND="append",e.FAIL="fail",e.REPLACE="replace"}(Vt||(Vt={}));var Xt,Jt=[Vt.APPEND,Vt.FAIL,Vt.REPLACE];!function(e){e.BIGQUERY="bigquery",e.CLICKHOUSE="clickhouse",e.DRUID="druid",e.MYSQL="mysql",e.POSTGRES="postgres",e.REDSHIFT="redshift",e.SNOWFLAKE="snowflake",e.TRINO="trino"}(Xt||(Xt={}));var $t=t(26304),ei=["bold","defaultColor","description","disableWordBreak","fullWidth","inputValue","inputWidth","invertedTheme","label","labelColor","menuOpen","monospace","muted","onClick","notRequired","selectedTextProps","small","stacked","suffixValue","tooltipProps","value"];function ni(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ti(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ni(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ni(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ii=v.default.div.withConfig({displayName:"LabelWithValueClicker__LabelStyle",componentId:"sc-1hzpn4h-0"})(["margin-bottom:","px;"],.25*_.iI),ri=v.default.div.withConfig({displayName:"LabelWithValueClicker__DescriptionStyle",componentId:"sc-1hzpn4h-1"})([""]);var oi=function(e){var n=e.bold,t=void 0===n||n,i=e.defaultColor,r=e.description,o=e.disableWordBreak,l=e.fullWidth,c=e.inputValue,u=e.inputWidth,a=e.invertedTheme,d=e.label,f=e.labelColor,p=e.menuOpen,h=void 0!==p&&p,m=e.monospace,v=e.muted,b=e.onClick,g=e.notRequired,x=e.selectedTextProps,_=e.small,C=e.stacked,E=e.suffixValue,P=e.tooltipProps,w=e.value,I=(0,$t.Z)(e,ei),T=(0,s.useRef)(null),A=(0,s.useState)(!1),D=A[0],R=A[1],B=(0,s.useState)(!1),N=B[0],L=B[1],F=d&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.ZP,{bold:t,color:f,inverted:a,lineHeight:20,monospace:m,muted:v,small:_,children:d}),P&&(0,S.jsx)(Z.Z,{ml:1,children:(0,S.jsx)(le.Z,ti({muted:!0},P))})]}),U=(0,S.jsxs)(j.Z,{flex:l?"1":"none",children:[w&&(0,S.jsx)(k.Z,{block:!0,danger:null===x||void 0===x?void 0:x.danger,fullWidth:!0,muted:v,onClick:function(){b(),T.current&&T.current.focus(),R(!0)},preventDefault:!0,sameColorAsText:v||!(null!==x&&void 0!==x&&x.primary)&&!(null!==x&&void 0!==x&&x.danger)&&!(null!==x&&void 0!==x&&x.warning),underline:null===x||void 0===x?void 0:x.underline,warning:null===x||void 0===x?void 0:x.warning,children:(0,S.jsx)(O.ZP,ti(ti({inverted:a,muted:v},x),{},{disableWordBreak:o,monospace:m,small:_,width:u,children:w}))}),(0,S.jsx)(M.Z,ti(ti({},I),{},{basic:!0,defaultColor:i,fullWidth:l,invertedTheme:a,monospace:m,onBlur:function(e){R(!1),I.onBlur&&I.onBlur(e),N||L(!0)},onFocus:function(e){R(!0),I.onFocus&&I.onFocus(e)},ref:T,small:_,value:c,visible:!w}))]}),H=r&&(0,S.jsx)(ri,{children:(0,S.jsx)(O.ZP,{dangerouslySetInnerHTML:{__html:r},monospace:m,muted:!0,small:_})}),G=(0,s.useMemo)((function(){return(0,S.jsx)(O.ZP,{default:!0,small:_,children:E})}),[_,E]);return(0,S.jsxs)(S.Fragment,{children:[C&&(0,S.jsxs)(S.Fragment,{children:[F&&(0,S.jsxs)(ii,{children:[(0,S.jsx)(y.Z,{alignItems:"center",fullHeight:!1,fullWidth:!0,children:F}),H]}),(0,S.jsxs)(y.Z,{fullWidth:l,children:[U,E&&G]})]}),!C&&(0,S.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,children:[F&&(0,S.jsxs)(S.Fragment,{children:[F,(0,S.jsx)(Z.Z,{ml:1})]}),U,E&&G]}),N&&!D&&!w&&!h&&!g&&(0,S.jsx)(O.ZP,{danger:!0,small:_,children:"This field is required."})]})},li=t(68792),ci=t(5882),ui=t(87372),ai=t(2005),si=t(31012),di="0.75em",fi=v.default.div.withConfig({displayName:"indexstyle__MarkdownContainer",componentId:"sc-j72mol-0"})(["font-family:",";margin:0 ","px;overflow:auto;"," "," p{margin:0.5em 0;}blockquote{margin:"," 0;padding:","px 0;","}blockquote:before{content:'';font-size:","px;line-height:0.1em;margin-right:0.25em;vertical-align:-0.4em;}blockquote p{display:inline;}pre{border-radius:","px;white-space:pre;margin:"," 0;padding:","px;overflow-x:auto;"," "," span{padding:0;}}ul,ol{margin-bottom:",";padding-left:","px;}li{","}li > input[type='checkbox']{pointer-events:none;}table{"," margin:",";thead{font-family:",";","}th,td{padding:","px ","px;","}}"],ai.ry,_.iI,Tn.w5,(function(e){return"\n color: ".concat((e.theme||ue.Z).content.active,";\n ")}),di,_.iI,(function(e){return"\n border-left: ".concat(.5*_.iI,"px solid ").concat((e.theme||ue.Z).content.active,";\n ")}),3*_.l4,Te.BG,di,_.iI,Tn.w5,(function(e){return"\n background-color: ".concat((e.theme||ue.Z).interactive.defaultBorder,";\n ")}),di,3*_.iI,si.iD,si.iD,di,ai.nF,(function(e){return"\n border-bottom: ".concat(Te.YF,"px solid ").concat((e.theme||ue.Z).content.active,";\n ")}),.5*_.iI,.75*_.iI,(function(e){return"\n border: ".concat(Te.YF,"px solid ").concat((e.theme||ue.Z).content.muted,";\n ")}));var pi=function(e){var n=e.children;return(0,S.jsx)(fi,{children:(0,S.jsx)(li.D,{components:{a:function(e){var n=e.children,t=e.href;return(0,S.jsx)(k.Z,{href:t,inline:!0,openNewWindow:!0,primary:!0,children:n})},code:function(e){var n=e.children;return(0,S.jsx)(O.ZP,{backgroundColor:ue.Z.interactive.defaultBorder,inline:!0,monospace:!0,pre:!0,style:{fontSize:"13px"},children:n})},em:function(e){var n=e.children;return(0,S.jsx)(O.ZP,{inline:!0,italic:!0,children:n})},h1:function(e){var n=e.children;return(0,S.jsx)(ui.Z,{level:1,children:n})},h2:function(e){var n=e.children;return(0,S.jsx)(ui.Z,{level:2,children:n})},h3:function(e){var n=e.children;return(0,S.jsx)(ui.Z,{level:3,children:n})},h4:function(e){var n=e.children;return(0,S.jsx)(ui.Z,{level:4,children:n})},h5:function(e){var n=e.children;return(0,S.jsx)(ui.Z,{level:5,children:n})},p:function(e){var n=e.children;return(0,S.jsx)(O.ZP,{children:n})},strong:function(e){var n=e.children;return(0,S.jsx)(O.ZP,{bold:!0,inline:!0,children:n})}},remarkPlugins:[ci.Z],children:n})})},hi=t(55378),mi=t(87815),vi=t(66653);function bi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function gi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?bi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):bi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var xi,ji=function(e){var n=e.block,t=e.blockConfiguration,i=e.blockRefs,r=e.blocks,l=e.updateBlockConfiguration,c=(0,s.useContext)(v.ThemeContext),u=m.t6.R===(null===n||void 0===n?void 0:n.language),a=m.t6.SQL===(null===n||void 0===n?void 0:n.language),d=null===r||void 0===r?void 0:r.find((function(e){var n=e.language;return m.t6.PYTHON===n})),f=(0,s.useMemo)((function(){var e=[null];return a&&d?e.push.apply(e,[null,1]):e.push(1),e}),[d,a]),p=(0,s.useMemo)((function(){var e=[{tooltipMessage:null,uuid:"Variable"},{tooltipMessage:null,uuid:"Block"}];return a&&d&&e.push({tooltipMessage:"Customize the full table name that this block gets created in. Include database, schema, and table name where applicable.",uuid:"Table name"}),e}),[d,a]),h=(0,s.useMemo)((function(){return null===r||void 0===r?void 0:r.map((function(e,n){var r,s=e.color,f=e.language,p=e.type,h=e.uuid,v=(0,C.qn)(p,{blockColor:s,theme:c}).accent,b=m.t6.PYTHON===f;r=a?"{{ df_".concat(n+1," }}"):u?"df".concat(n+1):"data".concat(n>=1?"_".concat(n+1):null);var g=[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:r},"variable-".concat(h)),(0,S.jsx)(k.Z,{color:v,onClick:function(){var e,n,t=null===i||void 0===i||null===(e=i.current)||void 0===e?void 0:e["".concat(p,"s/").concat(h,".py")];null===t||void 0===t||null===(n=t.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,S.jsx)(O.ZP,{color:v,monospace:!0,small:!0,children:h})},"block-".concat(h))];if(a){var x="table-name-input-".concat(h),j=(null===t||void 0===t?void 0:t.upstream_block_configuration)||{},y=(null===j||void 0===j?void 0:j[h])||{};b?g.push((0,S.jsx)(M.Z,{borderless:!0,compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;l((0,o.Z)({},vt,gi(gi({},j),{},(0,o.Z)({},h,gi(gi({},y),{},(0,o.Z)({},bt,n))))))},onClick:vi.j,placeholder:"[database_optional].[schema_optional].[table]",small:!0,value:(null===y||void 0===y?void 0:y.table_name)||""},x)):d&&g.push((0,S.jsx)(O.ZP,{italic:!0,muted:!0,small:!0,children:"Table name is defined in upstream block."},x))}return g}))}),[d,t,i,r,u,a,c,l]);return(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(mi.Z,{columnFlex:f,columns:p,compact:!0,noBorder:!0,rows:h,uuid:"CodeBlock/UpstreamBlockSettings/".concat(null===n||void 0===n?void 0:n.uuid)})})};!function(e){e.DATA_EXPORTER="data_exporter",e.DATA_LOADER="data_loader",e.MAGE_LIBRARY="mage_library",e.TRANSFORMER="transformer",e.USER_LIBRARY="user_library"}(xi||(xi={}));var yi=t(5677);function ki(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Zi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ki(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ki(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Oi(e,n){var t=e;t.includes("__init__")||t.push("__init__");var i,r=t.length;return(0,pe.w6)(r).forEach((function(e,o){if(i)return i;var l=t.slice(0,r-o).join(xe.sep);i=n["".concat(l,".py")]})),i}function _i(e,n,t){var i,r,o;return((null===(i=t.outputs)||void 0===i||null===(r=i[0])||void 0===r||null===(o=r.sample_data)||void 0===o?void 0:o.columns)||[]).map((function(t){return{label:"".concat(t," column"),kind:e.languages.CompletionItemKind.Variable,insertText:"'".concat(t,"'"),range:n}}))}function Ci(e,n){var t=e.word.split(""),i=new RegExp(t.reduce((function(e,n,i){var r=t[i+1],o=r?"^".concat(r):"";return e+"".concat(n,"[w ").concat(o,"]*")}),""));return n.reduce((function(e,n){return n.label.match(i)?e.concat(n):e}),[])}function Si(e){var n=e.autocompleteItems,t=e.block,i=e.blocks,o=e.pipeline,c=t.type,u=t.upstream_blocks,a=(0,pe.HK)(n,(function(e){return e.id}));return function(t){return function(s,d){var f=[],p=s.getValueInRange({endColumn:d.column,endLineNumber:d.lineNumber,startColumn:1,startLineNumber:1}),h=s.getWordUntilPosition(d),v=h.endColumn,b=h.startColumn,g={endColumn:v,endLineNumber:d.lineNumber,startColumn:b,startLineNumber:d.lineNumber},x=function(e,n,t){var i=(0,yi.Yn)(e),r=(0,yi.M4)(e,n),o=i.find((function(e){var n=e.variableName;return r.match(new RegExp(n))}));if(o){var l=o.assignmentValue,c=(0,yi.S0)(e)[l];if(c){var u,a=Oi(c.split(" as ")[0].replace("from ","").replace("import ","").split(" ").reduce((function(e,n){return n.trim()?e.concat(n):e}),[]).join(".").split("."),t),s=(0,yi.rW)(c,l);return null===a||void 0===a||null===(u=a.methods_for_class)||void 0===u?void 0:u[s]}}return[]}(p,g,a);if((null===x||void 0===x?void 0:x.length)>=1){var j=Ci(h,x.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Method,label:e,range:g}})));if(j.length>=1)return{suggestions:j}}var y=function(e,n,t){var i=(0,yi.M4)(e,n);if(i=i.match(/([\w_]+)./)){var r=(0,yi.S0)(e)[i[1]];if(r){var o=Oi(r.split(" as ")[0].replace("from ","").replace("import ","").split(" ").reduce((function(e,n){return n.trim()?e.concat(n):e}),[]).join(".").split("."),t);if(null!==o&&void 0!==o&&o.functions)return null===o||void 0===o?void 0:o.functions}}return[]}(p,g,a);if((null===y||void 0===y?void 0:y.length)>=1){var k=Ci(h,y.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Function,label:e,range:g}})));if(k.length>=1)return{suggestions:k}}if((null===u||void 0===u?void 0:u.length)>=1){var Z=new RegExp("\n@".concat(c));p.match(Z)&&f.push.apply(f,(0,r.Z)(Ci(h,function(e,n,t){var i=t.block,r=t.blocks,o=i.upstream_blocks,l=(0,pe.HK)(r,(function(e){return e.uuid}));return o.map((function(t,i){var r=l[t].type,o=0===i?"output_0":"args[".concat(i-1,"]");return{label:"df ".concat(t," ").concat(r," block"),kind:e.languages.CompletionItemKind.Variable,documentation:"Variable for ".concat(r," ").concat(t," data."),insertText:o,range:n}}))}(t,g,e))))}if(h.word.match(/i|f/)){var O=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,t=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,o=(arguments.length>2?arguments[2]:void 0).word,c=new Set,u={};e.forEach((function(e){var n=e.group,t=e.id,i=e.imports;if([xi.MAGE_LIBRARY,xi.USER_LIBRARY].includes(n)){var r=t;r.match(/__init__.py/)&&(r=r.replace(/\/__init__.py/,"")),r=r.split(".py")[0].replaceAll(xe.sep,"."),u[r]=e}var o=t.replace(".py","").replace("/__init__","").split(xe.sep);if(1===o.length)c.add("import ".concat(o[0]));else if(o.length>=2){var l=o.slice(0,o.length-1).join(".");c.add("from ".concat(l," import ").concat(o[o.length-1]))}i.forEach((function(e){return c.add(e)}))}));var a,s="i"===o,d="f"===o,f=s?"import":d?"from":"",p=(0,yi.M4)(n,i);if(s&&p.match(/from/)&&(a=p.match(/from ([A-Za-z0-9_.]+) /)[1]),a&&u[a]){var h=u[a],m=h.classes,v=h.constants,b=h.files,g=h.functions,x=[];return[[v,t.languages.CompletionItemKind.Constant],[m,t.languages.CompletionItemKind.Class],[g,t.languages.CompletionItemKind.Function]].forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],r=n[1];t.forEach((function(e){x.push({filterText:"import ".concat(e),insertText:"import ".concat(e),kind:r,label:e,range:i})}))})),b.forEach((function(e){var n=e.split(xe.sep),r=n[n.length-1].split(".py")[0];x.push({filterText:"import ".concat(r),insertText:"import ".concat(r),kind:t.languages.CompletionItemKind.Variable,label:r,range:i})})),x}return(0,r.Z)(c).map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.File,label:e,range:i}})).concat(Object.entries(u).map((function(e){var n=(0,l.Z)(e,2),r=n[0];return n[1],{filterText:"".concat(f," ").concat(r),insertText:"".concat(f," ").concat(r," "),kind:t.languages.CompletionItemKind.File,label:"".concat(r),range:Zi({},i)}})))}(n,p,h,t,g,e);f.push.apply(f,(0,r.Z)(O))}if(m.tf.CHART===c||m.tf.SCRATCHPAD===c){var _=[];if(m.tf.CHART===c?u.forEach((function(e,n){_.push({block:i.find((function(n){var t=n.uuid;return e===t})),matchIndex:0,variableName:"df_".concat(n+1)})})):m.tf.SCRATCHPAD===c&&function(e,n){return e.map((function(e){return{block:e,regex:new RegExp("([\\w_]+)[ ]*=[ ]*get_variable\\('".concat(n.uuid,"', '").concat(e.uuid,"', 'output_0'\\)"),"g")}}))}(i,o).forEach((function(e){var n=e.block,t=e.regex,i=p.matchAll(t);(0,r.Z)(i).forEach((function(e){var t=null===e||void 0===e?void 0:e.index,i=null===e||void 0===e?void 0:e[1];i&&_.push({block:n,matchIndex:t,variableName:i})}))})),_.length>=1){var C,S=null===(C=p.split("\n")[d.lineNumber-1])||void 0===C?void 0:C.slice(0,h.startColumn-1);if(S){var E=[];if(_.forEach((function(e){var n=e.block,i=e.matchIndex,r=e.variableName,o=new RegExp("".concat(r,"\\["));S.match(o)&&E.push({items:_i(t,g,n),matchIndex:i})})),E.length>=1)return{suggestions:Ci(h,(0,pe.YC)(E,"matchIndex",{ascending:!1})[0].items)}}}1===b&&(m.tf.CHART===c?f.push.apply(f,(0,r.Z)(Ci(h,u.map((function(e,n){var i="df_".concat(n+1);return{label:"".concat(i," ").concat(e," block"),kind:t.languages.CompletionItemKind.Snippet,insertText:i,range:g}}))))):m.tf.SCRATCHPAD===c&&f.push.apply(f,(0,r.Z)(Ci(h,function(e,n,t){var i=t.block,r=t.blocks,o=t.pipeline;return r.reduce((function(t,r){var l=r.type,c=r.uuid;return i.uuid!==c&&[m.tf.DATA_LOADER,m.tf.TRANSFORMER].includes(l)?t.concat({label:"df ".concat(c," ").concat(l," block"),kind:e.languages.CompletionItemKind.Snippet,documentation:"Get the data from ".concat(l," block ").concat(c,"."),insertText:"from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(o.uuid,"', '").concat(c,"', 'output_0')\n"),range:n}):t}),[])}(t,g,e)))))}var P=new Set;i.concat({content:p}).forEach((function(e){var n=e.content;(0,r.Z)(n.matchAll("([A-Za-z_0-9]+)","g")).forEach((function(e){return P.add(e[1])}))}));var w=(0,r.Z)(P);if(w.length){var I=w.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Variable,label:e,range:g}}));f.push.apply(f,(0,r.Z)(Ci(h,I)))}return{suggestions:f}}}}var Ei=t(32365),Pi=t(80636),wi=t(25958),Ii=t(7715),Ti=t(87323);function Ai(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Di(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ai(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ai(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Ri(e,n){var t,i,c,u=e.addNewBlock,a=e.addNewBlockMenuOpenIdx,f=e.addWidget,p=e.allBlocks,h=e.allowCodeBlockShortcuts,E=e.autocompleteItems,P=e.block,w=e.blockIdx,A=e.blockRefs,D=e.blockTemplates,N=e.blocks,U=e.dataProviders,H=e.defaultValue,G=void 0===H?"":H,z=e.deleteBlock,K=e.disableShortcuts,q=e.executionState,Q=e.extraContent,Y=e.fetchFileTree,X=e.fetchPipeline,J=e.height,$=e.hideRunButton,ee=e.interruptKernel,ne=e.mainContainerRef,te=e.mainContainerWidth,ie=e.messages,re=void 0===ie?[]:ie,oe=e.noDivider,ue=e.onCallbackChange,de=e.onChange,fe=e.onClickAddSingleDBTModel,he=e.onDrop,ve=e.openSidekickView,be=e.pipeline,xe=e.runBlock,je=e.runningBlocks,ye=e.savePipelineContent,ke=e.selected,Ze=e.setAddNewBlockMenuOpenIdx,Oe=e.setAnyInputFocused,_e=e.setCreatingNewDBTModel,Ce=e.setEditingBlock,Se=e.setErrors,Ee=e.setOutputBlocks,Pe=e.setSelected,Ie=e.setSelectedOutputBlock,Te=e.setTextareaFocused,Ae=e.textareaFocused,De=e.widgets,Re=(0,s.useContext)(v.ThemeContext),Me=P||{},Be=Me.callback_content,Ne=Me.configuration,Fe=void 0===Ne?{}:Ne,Ue=Me.color,He=Me.error,Ge=Me.has_callback,ze=Me.language,Ke=Me.replicated_block,qe=Me.type,Qe=Me.upstream_blocks,We=void 0===Qe?[]:Qe,Ve=Me.uuid,Ye=(0,s.useMemo)((function(){return Fe}),[Fe]),Xe=(0,s.useState)(!1),Je=Xe[0],$e=Xe[1],en=(0,s.useState)(null),nn=en[0],tn=en[1],ln=(0,s.useState)(!1),cn=ln[0],fn=ln[1],pn=(0,s.useState)(!1),hn=pn[0],bn=pn[1],gn=(0,s.useState)(G),xn=gn[0],jn=gn[1],yn=(0,s.useState)(null),kn=yn[0],Zn=yn[1],On=be||{},_n=On.type,Cn=On.uuid,Sn=(0,s.useMemo)((function(){return R.qL.STREAMING===_n}),[_n]),En=m.tf.DBT===qe,Pn=m.t6.SQL===ze,wn=m.t6.R===ze,In=m.tf.MARKDOWN===qe,Tn=Ye.limit;Pn&&void 0===Tn&&(Tn=1e3);var An=(0,s.useState)(Di(Di({},Ye),{},(t={},(0,o.Z)(t,lt,Ye.data_provider),(0,o.Z)(t,ct,Ye.data_provider_database),(0,o.Z)(t,ut,Ye.data_provider_profile),(0,o.Z)(t,at,Ye.data_provider_schema),(0,o.Z)(t,st,Ye.data_provider_table),(0,o.Z)(t,dt,Ye.dbt_profile_target),(0,o.Z)(t,ft,Ye.dbt_project_name),(0,o.Z)(t,pt,Ye.export_write_policy||Vt.APPEND),(0,o.Z)(t,ht,Tn),(0,o.Z)(t,mt,Ye.unique_upstream_table_name),(0,o.Z)(t,gt,!!Ye.use_raw_sql),t))),Nn=An[0],Un=An[1],Hn=(0,s.useState)(null),Gn=Hn[0],zn=Hn[1],Kn=(0,s.useState)(In),Qn=Kn[0],Wn=Kn[1],Vn=(0,s.useState)(!1),Yn=Vn[0],Xn=Vn[1],Jn=(0,s.useState)(Ve),$n=Jn[0],et=Jn[1],nt=(0,s.useState)(!1),tt=nt[0],it=nt[1],rt=(0,s.useState)(0),ot=rt[0],vt=rt[1],bt=(0,s.useState)(null),xt=bt[0],jt=bt[1],yt=(0,s.useState)(null),kt=yt[0],Zt=yt[1],Ot=(0,s.useState)(re),_t=Ot[0],Ct=Ot[1],St=(0,s.useState)(Bn(P)[0]),Et=St[0],Pt=St[1],wt=(0,an.c)((function(){return{collect:function(e){return{isDragging:!!e.isDragging()}},item:P,type:Ln}}),[P]),It=(0,l.Z)(wt,2),Tt=It[0],At=It[1],Dt=(0,sn.L)((function(){return{accept:Ln,drop:function(e){return null===he||void 0===he?void 0:he(P,e)}}}),[P]),Rt=(0,l.Z)(Dt,2)[1],Mt=(0,s.useMemo)((function(){var e;return(null===P||void 0===P||null===(e=P.metadata)||void 0===e?void 0:e.dbt)||{project:null,projects:{}}}),[P]),Bt=(0,s.useMemo)((function(){return Mt.projects||{}}),[Mt]),Nt=(0,s.useMemo)((function(){return Mt.project||Nn.dbt_project_name}),[Nn,Mt]),Lt=(0,s.useMemo)((function(){return Bt[Nt]||{target:null,targets:[]}}),[Nt,Bt]),Ft=(0,s.useMemo)((function(){return Lt.targets||[]}),[Lt]),Ut=(0,s.useMemo)((function(){return Nn.dbt_profile_target}),[Nn]),Ht=(0,s.useState)(Ut&&!(null!==Ft&&void 0!==Ft&&Ft.includes(Ut))),Gt=Ht[0],zt=Ht[1],Kt=(0,s.useState)(null),Qt=Kt[0],Wt=Kt[1];(0,s.useEffect)((function(){Be!==Qt&&Wt(Be)}),[Qt,Be]);var $t=(0,ae.Z)(P);(0,s.useEffect)((function(){if(JSON.stringify(P)!=JSON.stringify($t)){var e,n=(0,Fn.Rt)([P]).messages,t=null===n||void 0===n||null===(e=n[qe])||void 0===e?void 0:e[Ve];(null===t||void 0===t?void 0:t.length)>=1&&Ct(t)}}),[P,qe,Ve,$t,Ct]);var ei=(0,ae.Z)(re);(0,s.useEffect)((function(){"undefined"!==typeof re&&re.length!==(null===ei||void 0===ei?void 0:ei.length)&&Ct(re)}),[re,ei,Ct]);var ni=(0,s.useMemo)((function(){var e=new Set;return null===U||void 0===U||U.forEach((function(n){var t=n.profiles;e=new Set([].concat((0,r.Z)(e),(0,r.Z)(t)))})),(0,r.Z)(e)}),[U]),ti=(0,s.useMemo)((function(){return"".concat(Cn,"/").concat(Ve,"/codeCollapsed")}),[Cn,Ve]),ii=(0,s.useMemo)((function(){return"".concat(Cn,"/").concat(Ve,"/outputCollapsed")}),[Cn,Ve]);(0,s.useEffect)((function(){bn((0,L.U2)(ti,!1)),it((0,L.U2)(ii,!1))}),[ti,ii]);var ri=(0,s.useRef)(null),li=(0,s.useMemo)((function(){return(0,pe.HK)(N,(function(e){return e.uuid}))}),[N]),ci=(0,s.useMemo)((function(){return!(null===De||void 0===De||!De.find((function(e){return e.upstream_blocks.includes(Ve)})))}),[Ve,De]),ui=(0,s.useCallback)((function(e){var n=e||{},t=n.block,i=n.code,r=n.disableReset,o=n.runDownstream,l=n.runSettings,c=n.runUpstream,u=n.runTests;if(null===u||"undefined"===typeof u){var a=(t||{}).type;u=[m.tf.DATA_LOADER,m.tf.DATA_EXPORTER,m.tf.TRANSFORMER].includes(a)}En&&Dn!==Et&&Pt(Dn),xe({block:t,code:i||xn,runDownstream:o||ci,runSettings:l,runTests:u||!1,runUpstream:c||!1}),r||(vt(1+Number(ot)),jt(null),it(!1))}),[xn,ci,En,xe,ot,Et,vt,jt,Pt]),ai=!(null===je||void 0===je||!je.find((function(e){return e.uuid===Ve})))||(null===_t||void 0===_t?void 0:_t.length)>=1&&q!==ge.uF.IDLE;(0,s.useEffect)((function(){ai&&Zt(Number(new Date))}),[ai,Zt]);var si=(0,ae.Z)(q);(0,s.useEffect)((function(){q===ge.uF.IDLE&&q!==si&&jt(Number(new Date))}),[q,si,jt]);var di=(0,s.useCallback)((function(e){var n=e.editorRect.top,t=e.position.lineNumberTop;if(null!==ne&&void 0!==ne&&ne.current){var i=ne.current.getBoundingClientRect().height;if(n+t>i){var r=ne.current.scrollTop+(t-i+n);ne.current.scrollTo(0,r)}else if(t+n<Ei.aU){var o=ne.current.scrollTop+(t+n-Ei.aU);ne.current.scrollTo(0,o)}}}),[ne]),fi=(0,s.useMemo)((function(){return(null===Gn||void 0===Gn?void 0:Gn.length)>=0?Gn.map((function(e){return{data:e,execution_state:ge.uF.IDLE,type:ge.Gi.TEXT_PLAIN}})):_t.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[Gn,_t]),mi=!!fi.find((function(e){return e.error})),bi=(0,C.qn)(qe,{blockColor:Ue,theme:Re}).accent,gi=(null===We||void 0===We?void 0:We.length)||0,xi=(0,Ti.cU)([P],N)[0],yi=xi.dynamic,ki=xi.dynamicUpstreamBlock,Zi=xi.reduceOutput,Oi=xi.reduceOutputUpstreamBlock,_i=(0,s.useMemo)((function(){return(0,qt._o)({block:P,dynamic:yi,dynamicUpstreamBlock:ki,hasError:mi,reduceOutput:Zi,reduceOutputUpstreamBlock:Oi,selected:ke})}),[P,yi,ki,mi,Zi,Oi,ke]),Ci=_i.borderColorShareProps,Ai=_i.tags,Ri=fi.length>=1,Mi=(0,s.useCallback)((function(){ke||(null===Oe||void 0===Oe||Oe(!1),null===Pe||void 0===Pe||Pe(!0))}),[ke,Oe,Pe]),Bi=ce.ZP.blocks.pipelines.detail(Cn,Mn.uuid===(null===Et||void 0===Et?void 0:Et.uuid)||Rn.uuid===(null===Et||void 0===Et?void 0:Et.uuid)?encodeURIComponent(Ve):null,{_format:"dbt"},{revalidateOnFocus:!0}),Ni=Bi.data,Li=Bi.mutate,Fi=(0,s.useMemo)((function(){var e;return(null===Ni||void 0===Ni||null===(e=Ni.block)||void 0===e?void 0:e.metadata)||{}}),[Ni]),Ui=(0,d.Db)(ce.ZP.blocks.pipelines.useUpdate(Cn,Ve),{onError:function(e){var n=(0,me.qQ)(e).messages;zn(n)},onSuccess:function(e){return(0,me.wD)(e,{callback:function(){Xn(!1),X(),Y(),jn(xn)},onErrorCallback:function(e,n){return Se({errors:n,response:e})}})}}),Hi=(0,l.Z)(Ui,1)[0],Gi="CodeBlock/".concat(Ve),zi=(0,V.y)(),Ki=zi.registerOnKeyDown,qi=zi.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){qi(Gi)}}),[qi,Gi]),Ki(Gi,(function(e,n,t){K&&!h||(Yn&&String(t[0])===String(B.Uq)&&String(t[1])!==String(B.zX)?Ve===$n?e.target.blur():Hi({block:Di(Di({},P),{},{name:$n})}):ke&&!$&&((0,F.y)([B.zX,B.Uq],n)||(0,F.y)([B.PQ,B.Uq],n)?ui({block:P}):(0,F.y)([B.XR,B.Uq],n)&&u&&(e.preventDefault(),u({language:ze,type:qe,upstream_blocks:[Ve]}),ui({block:P}))))}),[u,P,$,Yn,$n,ui,ke,Hi]),(0,s.useEffect)((function(){var e;return kt&&(e=setInterval((function(){return Zn(Number(new Date))}),1e3)),kn&&!ai&&clearInterval(e),function(){return clearInterval(e)}}),[kn,ai,kt]);var Qi=(0,s.useCallback)((function(e){return(0,o.Z)({},m.tf.SCRATCHPAD,(0,r.Z)((0,qt.Ts)(e,N,"block_menu/scratchpad",u)).map((function(e){return Di(Di({},e),{},{onClick:function(){return ye().then((function(){return e.onClick()}))}})})))[e.type]}),[u,N,ye]),Wi=(0,s.useMemo)((function(){return Ke&&(null===li||void 0===li?void 0:li[Ke])}),[li,Ke]),Vi=(0,s.useMemo)((function(){return!Ke&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(vn.Z,{autoHeight:!0,autocompleteProviders:nn,block:P,height:J,language:ze,onChange:function(e){jn(e),null===de||void 0===de||de(e)},onDidChangeCursorPosition:di,placeholder:m.tf.DBT===qe&&m.t6.YAML===ze?"e.g. --select ".concat(Nt||"project","/models --exclude ").concat(Nt||"project","/models/some_dir"):"Start typing here...",selected:ke,setSelected:Pe,setTextareaFocused:Te,shortcuts:$?[]:[function(e,n){return(0,Pi.Q)(e,(function(){$||ui({block:P,code:n.getValue()})}))}],textareaFocused:Ae,value:xn,width:"100%"}),Ge&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(x.Z,{}),(0,S.jsxs)(Z.Z,{mt:1,children:[(0,S.jsxs)(C.y9,{normalPadding:!0,children:[(0,S.jsx)(O.ZP,{small:!0,children:"Callback block: define @on_success or @on_failure callbacks for this block."}),(0,S.jsxs)(O.ZP,{monospace:!0,muted:!0,small:!0,children:["kwargs",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:" \u2192 "}),"global variables"]})]}),(0,S.jsx)(vn.Z,{autoHeight:!0,autocompleteProviders:nn,language:"python",onChange:function(e){Wt(e),null===ue||void 0===ue||ue(e)},onDidChangeCursorPosition:di,placeholder:"Start typing here...",selected:ke,setSelected:Pe,setTextareaFocused:Te,textareaFocused:Ae,value:Qt,width:"100%"})]})]})]})}),[nn,P,ze,qe,Qt,xn,Nt,Ge,J,$,ue,de,di,Ke,ui,ke,jn,Pe,Te,Ae]);(0,s.useEffect)((function(){tn({python:Si({autocompleteItems:E,block:P,blocks:N,pipeline:be})})}),[E,P,N,be]);var Yi=(0,s.useMemo)((function(){return En?(0,S.jsx)(Z.Z,{py:1,children:(0,S.jsx)(T.Z,{onClickTab:function(e){Pt(e),Mn.uuid!==e.uuid&&Rn.uuid!==e.uuid||Li()},selectedTabUUID:null===Et||void 0===Et?void 0:Et.uuid,small:!0,tabs:Bn(P)})}):null}),[Li,En,Et]),Xi=(0,s.useMemo)((function(){return(0,S.jsx)(qn,Di(Di({},Ci),{},{block:P,blockMetadata:Fi,buttonTabs:Yi,collapsed:tt,hasOutput:Ri,isInProgress:ai,mainContainerWidth:te,messages:fi,openSidekickView:ve,pipeline:be,runCount:ot,runEndTime:xt,runStartTime:kt,selected:ke,selectedTab:Et,setCollapsed:function(e){it((function(){return(0,L.t8)(ii,e),e}))},setErrors:Se,setOutputBlocks:Ee,setSelectedOutputBlock:Ie,setSelectedTab:Pt}))}),[P,Fi,Ci,Yi,Ri,ai,te,fi,ve,tt,ii,be,ot,xt,kt,ke,Et,Se,Ee,it,Ie]),Ji=(0,s.useCallback)((function(){return fn(!1)}),[]),$i=(0,s.useRef)(null),er=(0,s.useCallback)((function(e){clearTimeout($i.current),Un((function(n){return Di(Di({},n),e)})),$i.current=setTimeout((function(){var n=Di(Di({},Nn),e);("undefined"!==typeof n.data_provider&&"undefined"!==n.data_provider_profile||"undefined"!==typeof n.dbt_profile_target||"undefined"!==typeof n.dbt_project_name||"undefined"!==typeof n.limit)&&ye({block:{configuration:n,uuid:Ve}})}),1e3)}),[Ve,Nn,ye]),nr=Le.BIGQUERY===Nn.data_provider||Le.SNOWFLAKE===Nn.data_provider,tr=(0,s.useMemo)((function(){return(null===N||void 0===N?void 0:N.length)||0}),[N]),ir=(0,s.useMemo)((function(){return xn?(0,S.jsx)(pi,{children:xn}):(0,S.jsx)(Z.Z,{px:1,children:(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,children:"Double-click to edit"})})}),[xn]);(0,s.useEffect)((function(){In&&Qn&&!ke&&Wn(!1)}),[Qn,In,ke]);var rr=(0,s.useMemo)((function(){return(0,S.jsx)(M.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){Oe(!1)}),300)},onChange:function(e){Oe(!0),er((0,o.Z)({},ht,+e.target.value)),e.preventDefault()},onClick:vi.j,onFocus:function(){Oe(!0)},small:!0,type:"number",value:Nn.limit||"",width:11*_.iI})}),[Nn,Oe,er]);return(0,S.jsx)("div",{ref:Rt,children:(0,S.jsxs)("div",{ref:n,style:{position:"relative",zIndex:w===a?tr+9:null},children:[(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(C.nz,Di(Di({},Di(Di({},Ci),Tt)),{},{bottomBorder:In,onClick:function(){return Mi()},ref:At,zIndex:tr+1-(w||0),children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(j.Z,{alignItems:"center",flex:1,children:[(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(dn.Z,{monospace:!0,children:m.dO[ze]}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(g.Z,{color:bi,size:1.5*_.iI,square:!0}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(we.Z,{items:Qi(P),onClickCallback:Ji,onClickOutside:Ji,open:cn,parentRef:ri,uuid:"CodeBlock/block_menu",children:(0,S.jsx)(O.ZP,{color:bi,monospace:!0,children:null===(i=En?m.tf.DBT:m.V4[qe])||void 0===i?void 0:i.toUpperCase()})}),m.tf.SCRATCHPAD===qe&&(0,S.jsxs)(S.Fragment,{children:["\xa0",(0,S.jsx)(I.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return fn(!0)},transparent:!0,children:(0,S.jsx)(se.K5,{muted:!0})})]})]}),(0,S.jsx)(Z.Z,{mr:_.cd}),(0,S.jsx)(se.iU,{size:1.5*_.iI}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsxs)(y.Z,{alignItems:"center",children:[En&&m.t6.YAML!==ze&&(0,S.jsx)(le.Z,{block:!0,label:(0,wi.$1)(P,{fullPath:!0}),size:null,children:(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,children:(0,wi.$1)(P)})}),(!En||m.t6.YAML===ze)&&(0,S.jsx)(oi,{bold:!1,inputValue:$n,monospace:!0,muted:!0,notRequired:!0,onBlur:function(){return setTimeout((function(){Oe(!1),Xn(!1)}),300)},onChange:function(e){et(e.target.value),e.preventDefault()},onClick:function(){Oe(!0),Xn(!0)},onFocus:function(){Oe(!0),Xn(!0)},stacked:!0,value:!Yn&&Ve}),Yn&&!En&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{ml:1}),(0,S.jsx)(k.Z,{onClick:function(){return ye({block:{name:$n,uuid:Ve}}).then((function(){Xn(!1),X(),Y()}))},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]}),(0,S.jsx)(Z.Z,{mr:2}),!m.iZ.includes(qe)&&te>700&&(0,S.jsx)(le.Z,{appearBefore:!0,block:!0,label:"\n ".concat((0,W._6)("parent block",gi),". ").concat(0===gi?"Click to select 1 or more blocks to depend on.":"Edit parent blocks.","\n "),size:null,widthFitContent:gi>=1,children:(0,S.jsx)(I.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){Pe(!0),Ce({upstreamBlocks:{block:P,values:null===We||void 0===We?void 0:We.map((function(e){return{uuid:e}}))}})},children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsxs)(O.ZP,{monospace:gi>=1,small:gi>=1,underline:0===gi,children:[0===gi&&"Edit parent blocks",gi>=1&&(0,W._6)("parent block",gi)]}),(0,S.jsx)(Z.Z,{mr:1}),0===gi&&(0,S.jsx)(se.Jj,{size:3*_.iI}),gi>=1&&(0,S.jsx)(se.eV,{size:3*_.iI})]})})})]}),(0,S.jsx)(Yt,{addNewBlock:u,addWidget:f,block:P,blocks:N,deleteBlock:z,executionState:q,fetchFileTree:Y,fetchPipeline:X,interruptKernel:ee,isEditingBlock:Qn,pipeline:be,runBlock:$?null:ui,savePipelineContent:ye,setErrors:Se,setIsEditingBlock:Wn,setOutputCollapsed:it}),(0,S.jsx)(Z.Z,{px:1,children:(0,S.jsx)(I.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){bn((function(e){return(0,L.t8)(ti,!e),!e})),hn||it((function(){return(0,L.t8)(ii,!0),!0}))},transparent:!0,children:hn?(0,S.jsx)(se._M,{muted:!0,size:2*_.iI}):(0,S.jsx)(se.Kh,{muted:!0,size:2*_.iI})})})]})})),(0,S.jsxs)(C.Nk,{onClick:function(){return Mi()},children:[(0,S.jsxs)(C.jv,Di(Di({},Ci),{},{className:ke&&Ae?"selected":null,hasOutput:!!Yi||Ri,lightBackground:In&&!Qn,onDoubleClick:function(){In&&!Qn&&Wn(!0)},children:[m.tf.DBT===qe&&!hn&&(0,S.jsxs)(C.y9,{normalPadding:!0,children:[(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(j.Z,{alignItems:"center",children:[m.t6.YAML===ze&&(0,S.jsx)(hi.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){Oe(!1)}),300)},onChange:function(e){var n;er((n={},(0,o.Z)(n,dt,""),(0,o.Z)(n,ft,e.target.value),n)),e.preventDefault()},onClick:vi.j,onFocus:function(){Oe(!0)},placeholder:"Project",small:!0,value:Nn.dbt_project_name||"",children:Object.keys(Bt||{}).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))}),m.t6.YAML!==ze&&(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:Nt}),(0,S.jsx)(Z.Z,{mr:2}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,small:!0,children:"Target"}),(0,S.jsx)("span",{children:"\xa0"}),!Gt&&(0,S.jsx)(hi.Z,{compact:!0,disabled:!Nt,monospace:!0,onBlur:function(){return setTimeout((function(){Oe(!1)}),300)},onChange:function(e){er((0,o.Z)({},dt,e.target.value)),e.preventDefault()},onClick:vi.j,onFocus:function(){Oe(!0)},placeholder:Nt?Pn?null===Lt||void 0===Lt?void 0:Lt.target:null:"Select project first",small:!0,value:Ut||"",children:null===Ft||void 0===Ft?void 0:Ft.map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))}),Gt&&(0,S.jsx)(M.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){Oe(!1)}),300)},onChange:function(e){er((0,o.Z)({},dt,e.target.value)),e.preventDefault()},onClick:vi.j,onFocus:function(){Oe(!0)},placeholder:Nt?Pn?null===Lt||void 0===Lt?void 0:Lt.target:null:"Select project first",small:!0,value:Ut||"",width:21*_.iI}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(y.Z,{alignItems:"center",children:(0,S.jsx)(le.Z,{block:!0,description:(0,S.jsxs)(O.ZP,{default:!0,inline:!0,children:["Manually type the name of the target you want to use in the profile.",(0,S.jsx)("br",{}),"Interpolate environment variables and global variables using the following syntax:",(0,S.jsx)("br",{}),(0,S.jsx)(O.ZP,{default:!0,inline:!0,monospace:!0,children:"{{ env_var('NAME') }}"})," or ",(0,S.jsx)(O.ZP,{default:!0,inline:!0,monospace:!0,children:"{{ variables('NAME') }}"})]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(b.Z,{checked:Gt,label:(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:"Manually enter target"}),onClick:function(e){(0,vi.j)(e),zt(!Gt)}}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(se.kI,{muted:!0})]})})})]}),m.t6.YAML!==ze&&!(null!==Mt&&void 0!==Mt&&null!==(c=Mt.block)&&void 0!==c&&c.snapshot)&&(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(le.Z,{appearBefore:!0,block:!0,description:(0,S.jsxs)(O.ZP,{default:!0,inline:!0,children:["Limit the number of results that are returned",(0,S.jsx)("br",{}),"when running this block in the notebook.",(0,S.jsx)("br",{}),"This limit won\u2019t affect the number of results",(0,S.jsx)("br",{}),"returned when running the pipeline end-to-end."]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(se.kI,{muted:!0}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,small:!0,children:"Sample limit"}),(0,S.jsx)("span",{children:"\xa0"})]})}),rr,(0,S.jsx)(Z.Z,{mr:1})]})]}),m.t6.YAML===ze&&(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsxs)(j.Z,{flex:1,children:[(0,S.jsxs)(O.ZP,{default:!0,monospace:!0,small:!0,children:["dbt run ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,small:!0,children:"[type your --select and --exclude syntax below]"})]}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsxs)(O.ZP,{monospace:!0,muted:!0,small:!0,children:["(paths start from ",(null===Nn||void 0===Nn?void 0:Nn.dbt_project_name)||"project"," folder)"]})]}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:(0,S.jsx)(k.Z,{href:"https://docs.getdbt.com/reference/node-selection/syntax#examples",openNewWindow:!0,small:!0,children:"Examples"})}),(0,S.jsx)(Z.Z,{mr:1})]})})]}),Pn&&!hn&&m.tf.DBT!==qe&&(0,S.jsx)(C.y9,{normalPadding:!0,children:(0,S.jsxs)(y.Z,{flexWrap:"wrap",style:{marginTop:"-8px"},children:[(0,S.jsxs)(y.Z,{style:{marginTop:"8px"},children:[(0,S.jsx)(hi.Z,{compact:!0,label:"Connection",onChange:function(e){return er((0,o.Z)({},lt,e.target.value))},onClick:vi.j,small:!0,value:Nn.data_provider,children:null===U||void 0===U?void 0:U.map((function(e){var n=e.id,t=e.value;return(0,S.jsx)("option",{value:t,children:n},n)}))}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(hi.Z,{compact:!0,label:"Profile",onChange:function(e){return er((0,o.Z)({},ut,e.target.value))},onClick:vi.j,small:!0,value:Nn.data_provider_profile,children:null===ni||void 0===ni?void 0:ni.map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(y.Z,{alignItems:"center",children:(0,S.jsx)(le.Z,{block:!0,description:(0,S.jsxs)(O.ZP,{default:!0,inline:!0,children:["If checked, you\u2019ll have to write your own custom",(0,S.jsx)("br",{}),"CREATE TABLE commands and INSERT commands.",(0,S.jsx)("br",{}),"Separate your commands using a semi-colon: ",(0,S.jsx)(O.ZP,{default:!0,inline:!0,monospace:!0,children:";"})]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(b.Z,{checked:Nn.use_raw_sql,label:(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:"Use raw SQL"}),onClick:function(e){(0,vi.j)(e),er((0,o.Z)({},gt,!Nn.use_raw_sql))}}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(se.kI,{muted:!0})]})})}),!Nn.use_raw_sql&&(0,S.jsxs)(S.Fragment,{children:[nr&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(y.Z,{alignItems:"center",children:(0,S.jsx)(M.Z,{compact:!0,label:"Database",monospace:!0,onBlur:function(){return setTimeout((function(){Oe(!1)}),300)},onChange:function(e){er((0,o.Z)({},ct,e.target.value)),e.preventDefault()},onClick:vi.j,onFocus:function(){Oe(!0)},small:!0,value:Nn.data_provider_database,width:10*_.iI})})]}),(0,S.jsx)(Z.Z,{mr:1}),![Xt.CLICKHOUSE,Xt.MYSQL].includes(Nn.data_provider)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(le.Z,{block:!0,description:(0,S.jsxs)(O.ZP,{default:!0,inline:!0,children:["Schema that is used when creating a table and inserting values.",(0,S.jsx)("br",{}),"This field is required."]}),size:null,widthFitContent:!0,children:(0,S.jsx)(y.Z,{alignItems:"center",children:(0,S.jsx)(M.Z,{compact:!0,label:"Schema",monospace:!0,onBlur:function(){return setTimeout((function(){Oe(!1)}),300)},onChange:function(e){er((0,o.Z)({},at,e.target.value)),e.preventDefault()},onClick:vi.j,onFocus:function(){Oe(!0)},small:!0,value:Nn.data_provider_schema,width:10*_.iI})})}),(0,S.jsx)(Z.Z,{mr:1})]}),(0,S.jsx)(le.Z,{block:!0,description:(0,S.jsxs)(O.ZP,{default:!0,inline:!0,children:["This value will be used as the table name.",(0,S.jsx)("br",{}),"If blank, the default table name will be:",(0,S.jsx)("br",{}),(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,children:[Cn,"_",Ve]}),(0,S.jsx)("br",{}),"This field is optional."]}),size:null,widthFitContent:!0,children:(0,S.jsx)(y.Z,{alignItems:"center",children:(0,S.jsx)(M.Z,{compact:!0,label:"Table (optional)",monospace:!0,onBlur:function(){return setTimeout((function(){Oe(!1)}),300)},onChange:function(e){er((0,o.Z)({},st,e.target.value)),e.preventDefault()},onClick:vi.j,onFocus:function(){Oe(!0)},small:!0,value:Nn.data_provider_table,width:20*_.iI})})})]}),(0,S.jsx)(Z.Z,{mr:1})]}),!Nn.use_raw_sql&&(0,S.jsxs)(y.Z,{alignItems:"center",style:{marginTop:"8px"},children:[(0,S.jsx)(le.Z,{block:!0,description:(0,S.jsxs)(O.ZP,{default:!0,inline:!0,children:["Limit the number of results that are returned",(0,S.jsx)("br",{}),"when running this block in the notebook.",(0,S.jsx)("br",{}),"This limit won\u2019t affect the number of results",(0,S.jsx)("br",{}),"returned when running the pipeline end-to-end."]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(se.kI,{muted:!0}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,small:!0,children:"Limit"}),(0,S.jsx)("span",{children:"\xa0"})]})}),rr,(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(le.Z,{autoWidth:!0,block:!0,description:(0,S.jsxs)(O.ZP,{default:!0,inline:!0,children:["How do you want to handle existing data with the same",nr?" database,":""," schema, and table name?",(0,S.jsx)("br",{}),(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:"Append"}),": add rows to the existing table.",(0,S.jsx)("br",{}),(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:"Replace"}),": delete the existing data.",(0,S.jsx)("br",{}),(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:"Fail"}),": raise an error during execution."]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(se.kI,{muted:!0}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,small:!0,children:"Write policy:"}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(hi.Z,{compact:!0,label:"strategy",onChange:function(e){return er((0,o.Z)({},pt,e.target.value))},onClick:vi.j,small:!0,value:Nn.export_write_policy,children:null===Jt||void 0===Jt?void 0:Jt.map((function(e){return(0,S.jsx)("option",{value:e,children:(0,W.kC)(e)},e)}))})]})}),(0,S.jsx)(Z.Z,{mr:1})]}),(null===Nn||void 0===Nn?void 0:Nn.data_provider)===Xt.TRINO&&We.length>=1&&(0,S.jsxs)(y.Z,{alignItems:"center",style:{marginTop:"8px"},children:[(0,S.jsx)(le.Z,{appearBefore:!0,block:!0,description:(0,S.jsxs)(O.ZP,{default:!0,inline:!0,children:["If checked, upstream blocks that aren\u2019t SQL blocks",(0,S.jsx)("br",{}),"will have their data exported into a table that is",(0,S.jsx)("br",{}),"uniquely named upon each block run. For example,",(0,S.jsx)("br",{}),(0,S.jsx)(O.ZP,{default:!0,inline:!0,monospace:!0,children:"[pipeline_uuid]_[block_uuid]_[unique_timestamp]"}),"."]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(b.Z,{checked:Nn.unique_upstream_table_name,label:(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:"Unique upstream table names"}),onClick:function(e){(0,vi.j)(e),er((0,o.Z)({},mt,!Nn.unique_upstream_table_name))}}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(se.kI,{muted:!0})]})}),(0,S.jsx)(Z.Z,{mr:1})]})]})}),Ai.length>=1&&(0,S.jsx)(C.y9,{normalPadding:!0,children:(0,S.jsx)(y.Z,{children:Ai.map((function(e,n){var t=e.description,i=e.title;return(0,S.jsx)(Z.Z,{ml:n>=1?1:0,children:(0,S.jsx)(le.Z,{block:!0,description:t,size:null,widthFitContent:!0,children:(0,S.jsx)(dn.Z,{children:i})})},i)}))})}),We.length>=1&&!hn&&m.f2.includes(qe)&&!Sn&&!Ke&&(0,S.jsxs)(C.y9,{normalPadding:!0,children:[(0,S.jsx)(Z.Z,{mr:1,children:(0,S.jsxs)(O.ZP,{muted:!0,small:!0,children:[!Pn&&"Positional arguments for ".concat(wn?"":"decorated ","function:"),Pn&&(0,S.jsxs)(S.Fragment,{children:["The interpolated tables below are available in queries from upstream blocks.",(0,S.jsx)("br",{}),"Example: ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,small:!0,children:"SELECT * FROM {{ df_1 }}"})," to insert all rows from ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,small:!0,children:null===We||void 0===We?void 0:We[0]})," into a table."]})]})}),(0,S.jsxs)(Z.Z,{mt:1,children:[!Pn&&!wn&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(O.ZP,{monospace:!0,muted:!0,small:!0,children:[m.tf.DATA_EXPORTER===qe&&"@data_exporter",m.tf.DATA_LOADER===qe&&"@data_loader",m.tf.TRANSFORMER===qe&&"@transformer",m.tf.CUSTOM===qe&&"@custom"]}),(0,S.jsxs)(O.ZP,{monospace:!0,muted:!0,small:!0,children:["def ",(m.tf.DATA_EXPORTER===qe?"export_data":m.tf.DATA_LOADER===qe&&"load_data")||m.tf.TRANSFORMER===qe&&"transform"||m.tf.CUSTOM===qe&&"transform_custom","(",We.map((function(e,n){return n>=1?"data_".concat(n+1):"data"})).join(", "),"):"]})]}),wn&&(0,S.jsx)(S.Fragment,{children:(0,S.jsxs)(O.ZP,{monospace:!0,muted:!0,small:!0,children:[m.tf.DATA_EXPORTER===qe?"export_data":m.tf.TRANSFORMER===qe&&"transform","\xa0\u2190 function(",We.map((function(e,n){return"df_".concat(n+1)})).join(", "),"):"]})}),Pn&&(null===We||void 0===We?void 0:We.length)>=1&&(0,S.jsx)(ji,{block:P,blockConfiguration:Nn,blockRefs:A,blocks:null===We||void 0===We?void 0:We.map((function(e){return null===li||void 0===li?void 0:li[e]})),updateBlockConfiguration:er}),!Pn&&We.map((function(e,n){var t=li[e],i=(0,C.qn)(null===t||void 0===t?void 0:t.type,{blockColor:null===t||void 0===t?void 0:t.color,theme:Re}).accent,r="{{ df_".concat(n+1," }}");return(0,S.jsxs)("div",{children:[!Pn&&!wn&&(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0data",n>=1?"_".concat(n+1):null]}),Pn&&(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:r}),wn&&(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0","df".concat(n+1)]})," ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"\u2192"})," ",(0,S.jsx)(k.Z,{color:i,onClick:function(){var e,n,i=null===A||void 0===A||null===(e=A.current)||void 0===e?void 0:e["".concat(null===t||void 0===t?void 0:t.type,"s/").concat(null===t||void 0===t?void 0:t.uuid,".py")];null===i||void 0===i||null===(n=i.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,S.jsx)(O.ZP,{color:i,inline:!0,monospace:!0,small:!0,children:e})})]},e)}))]})]}),!He&&(0,S.jsx)(S.Fragment,{children:hn?(0,S.jsx)(Z.Z,{px:1,children:(0,S.jsxs)(O.ZP,{monospace:!0,muted:!0,children:["(",(0,W._6)("line",null===xn||void 0===xn?void 0:xn.split(/\r\n|\r|\n/).length)," collapsed)"]})}):!In||Qn?Wi?(0,S.jsx)(Z.Z,{px:1,children:(0,S.jsxs)(O.ZP,{monospace:!0,muted:!0,children:["Replicated from block ",(0,S.jsx)(k.Z,{color:(0,C.qn)(null===Wi||void 0===Wi?void 0:Wi.type,{blockColor:null===Wi||void 0===Wi?void 0:Wi.color,theme:Re}).accent,onClick:function(e){var n,t;(0,vi.j)(e);var i=null===A||void 0===A||null===(n=A.current)||void 0===n?void 0:n["".concat(null===Wi||void 0===Wi?void 0:Wi.type,"s/").concat(null===Wi||void 0===Wi?void 0:Wi.uuid,".py")];null===i||void 0===i||null===(t=i.current)||void 0===t||t.scrollIntoView()},preventDefault:!0,children:(0,S.jsx)(O.ZP,{color:(0,C.qn)(null===Wi||void 0===Wi?void 0:Wi.type,{blockColor:null===Wi||void 0===Wi?void 0:Wi.color,theme:Re}).accent,inline:!0,monospace:!0,children:null===Wi||void 0===Wi?void 0:Wi.uuid})})]})}):Vi:ir}),Q&&s.cloneElement(Q,{runBlockAndTrack:ui}),He&&(0,S.jsxs)(Z.Z,{p:_.cd,children:[(0,S.jsx)(O.ZP,{bold:!0,danger:!0,children:null===He||void 0===He?void 0:He.error}),(0,S.jsx)(O.ZP,{muted:!0,children:null===He||void 0===He?void 0:He.message})]}),ai&&kn&&kn>kt&&(0,S.jsx)(C.HC,{children:(0,S.jsxs)(O.ZP,{muted:!0,children:["".concat(Math.round((kn-kt)/1e3)),"s"]})}),!hn&&![m.tf.CALLBACK,m.tf.CONDITIONAL,m.tf.EXTENSION].includes(qe)&&(0,S.jsx)(mn,{block:P,blocks:p,openSidekickView:ve})]})),Xi]})]}),!oe&&(0,S.jsxs)(C.gE,{additionalZIndex:tr-w,onMouseEnter:function(){return $e(!0)},onMouseLeave:function(){$e(!1),null===Ze||void 0===Ze||Ze(null)},children:[Je&&u&&(0,S.jsx)(Z.Z,{mt:2,children:(0,S.jsx)(un,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=(0,qt.eY)(P,e),r=(0,qt.fA)(be,P,e).map((function(e){var n=Di({},li[e]||{}),t=n.upstream_blocks;return t&&(n.upstream_blocks=t.filter((function(e){return e!==Ve}))),n}));return[m.tf.DATA_LOADER,m.tf.TRANSFORMER].includes(qe)&&m.tf.SCRATCHPAD===e.type&&(n="from mage_ai.data_preparation.variable_manager import get_variable\n\n\n df = get_variable('".concat(Cn,"', '").concat(Ve,"', 'output_0')")),n=on(e,n),m.t6.SQL===ze&&(t=Di(Di({},(0,Ii.GL)(Ye,[lt,ct,ut,at,pt])),t)),m.t6.SQL===e.language&&(n=rn(n)),u(Di(Di({},e),{},{configuration:t,content:n,upstream_blocks:i}),r)},blockIdx:w,blockTemplates:D,compact:!0,hideCustom:Sn,hideDbt:Sn,onClickAddSingleDBTModel:fe,pipeline:be,setAddNewBlockMenuOpenIdx:Ze,setCreatingNewDBTModel:_e})}),(0,S.jsx)(C.t1,{className:"block-divider-inner"})]})]})})}var Mi=s.forwardRef(Ri),Bi=t(90880),Ni=6.25*_.iI,Li=(_.iI,100*_.iI),Fi=v.default.div.withConfig({displayName:"indexstyle__WindowContainerStyle",componentId:"sc-g0cszf-0"})(["border-radius:","px;width:100%;max-width:","px;z-index:101;position:absolute;overflow:hidden;top:50%;left:50%;transform:translate(-50%,-50%);",""],Te.n_,Li,(function(e){return"\n box-shadow: ".concat((e.theme||ue.Z).shadow.window,";\n background-color: ").concat((e.theme||ue.Z).background.panel,";\n ")})),Ui=(0,v.css)(["display:flex;align-items:center;justify-content:space-between;height:","px;padding:","px ","px;",""],Ni,_.iI,_.cd*_.iI,(function(e){return"\n background-color: ".concat((e.theme||ue.Z).background.output,";\n ")})),Hi=v.default.div.withConfig({displayName:"indexstyle__WindowHeaderStyle",componentId:"sc-g0cszf-1"})([""," border-top-left-radius:","px;border-top-right-radius:","px;",""],Ui,Te.n_,Te.n_,(function(e){return"\n border-bottom: ".concat(Te.YF,"px ").concat(Te.M8," ").concat((e.theme||ue.Z).borders.medium,";\n ")})),Gi=v.default.div.withConfig({displayName:"indexstyle__WindowContentStyle",componentId:"sc-g0cszf-2"})(["overflow:auto;padding:","px 0;"," "," "," ",""],_.iI,Tn.w5,(0,Bi.eR)(),(function(e){return e.minMaxHeight&&"\n max-height: ".concat(7*_.iI,"px;\n ")}),(function(e){return!e.minMaxHeight&&"\n max-height: calc(100vh - ".concat(6.5*Ni,"px);\n ")})),zi=v.default.div.withConfig({displayName:"indexstyle__WindowFooterStyle",componentId:"sc-g0cszf-3"})([""," justify-content:flex-end;border-bottom-left-radius:","px;border-bottom-right-radius:","px;",""],Ui,Te.n_,Te.n_,(function(e){return"\n border-top: ".concat(Te.YF,"px ").concat(Te.M8," ").concat((e.theme||ue.Z).borders.medium,";\n ")})),Ki=v.default.div.withConfig({displayName:"indexstyle__InputRowStyle",componentId:"sc-g0cszf-4"})(["padding:","px ","px;",""],.75*_.iI,2*_.iI,(function(e){return"\n border-bottom: ".concat(Te.YF,"px ").concat(Te.M8," ").concat((e.theme||ue.Z).borders.medium,";\n ")}));function qi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Qi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?qi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):qi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Wi=function(e){var n=e.blocks,t=e.creatingNewDBTModel,i=e.dbtModelName,r=e.files,o=e.onClose,l=e.onOpenFile,c=e.setDbtModelName,u=(0,s.useState)(!1),a=u[0],d=u[1],f=(0,s.useState)(null),p=f[0],h=f[1],v=(0,s.useMemo)((function(){var e,n,t=null===(e=(0,pe.sE)((null===r||void 0===r||null===(n=r[0])||void 0===n?void 0:n.children)||[],(function(e){return"dbt"===e.name})))||void 0===e?void 0:e.children,i=[];return null===t||void 0===t||t.forEach((function(e){var n=e.children,t=void 0===n?[]:n;t.length>=1&&i.push(Qi(Qi({},e),{},{children:t}))})),i}),[r]),b=(0,s.useMemo)((function(){return(0,pe.HK)(n,(function(e){return e.configuration.file_path}))}),[n]);return(0,S.jsxs)(Fi,{children:[(0,S.jsxs)(Hi,{children:[(0,S.jsx)(j.Z,{alignItems:"center",children:(0,S.jsx)(O.ZP,{disableWordBreak:!0,monospace:!0,children:t?"Create new dbt model":"Select dbt model or snapshot file"})}),(0,S.jsx)(I.Z,{iconOnly:!0,onClick:o,children:(0,S.jsx)(se.x8,{muted:!0})})]}),t&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Ki,{children:(0,S.jsx)(oi,{dynamicSizing:!0,inputValue:i,label:"Model name (cannot be changed):",labelColor:ue.Z.accent.dbt,notRequired:!0,onBlur:function(){d(!1)},onChange:function(e){c(e.target.value),e.preventDefault()},onClick:function(){d(!0)},onFocus:function(){d(!0)},placeholder:"Enter name",required:!0,stacked:!0,suffixValue:".".concat(m.t6.SQL),value:!a&&i})}),(0,S.jsxs)(Ki,{children:[(0,S.jsx)(O.ZP,{bold:!0,color:ue.Z.accent.dbt,children:"Select folder location:"}),(0,S.jsx)(O.ZP,{bold:!0,muted:!p,children:p?"dbt".concat(xe.sep).concat(p):"Choose folder below"})]})]}),(0,S.jsx)(Gi,{children:(0,S.jsx)(H.Z,{allowSelectingFolders:t,disableContextMenu:!0,files:v,isFileDisabled:function(e,n){return t?!n||(null===n||void 0===n?void 0:n.some((function(e){return"models"===(null===e||void 0===e?void 0:e.name)}))):!!b[e]||!(null!==n&&void 0!==n&&n.length)&&!e.match(new RegExp(".".concat(m.t6.SQL,"$")))},openFile:l,selectFile:h,uncollapsed:!0,useRootFolder:!0})}),t&&(0,S.jsx)(zi,{children:(0,S.jsx)(I.Z,{backgroundColor:i&&p?ue.Z.accent.dbt:ue.Z.monotone.grey500,disabled:!i||!p,onClick:function(){return l(p)},padding:"6px 8px",children:"Create model"})})]})};function Vi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Yi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Vi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Vi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Xi(e,n){var t,i=e.block,r=e.blocks,o=e.onClick,c=e.onDrop,u=i.type,a=(0,an.c)((function(){return{collect:function(e){return{isDragging:!!e.isDragging()}},item:i,type:Ln}}),[i]),d=(0,l.Z)(a,3),f=d[0],p=d[1],h=(d[2],(0,sn.L)((function(){return{accept:Ln,drop:function(e){return null===c||void 0===c?void 0:c(i,e)}}}),[i])),b=(0,l.Z)(h,2)[1],x=(0,s.useContext)(v.ThemeContext),E=(0,C.qn)(u,{blockColor:i.color,theme:x}).accent,P=(0,Ti.cU)([i],r)[0],w=P.dynamic,I=P.dynamicUpstreamBlock,T=P.reduceOutput,A=P.reduceOutputUpstreamBlock,D=(0,s.useMemo)((function(){return(0,qt._o)({block:i,dynamic:w,dynamicUpstreamBlock:I,reduceOutput:T,reduceOutputUpstreamBlock:A})}),[i,w,I,T,A]).borderColorShareProps,R=(0,s.useMemo)((function(){return m.tf.DBT===(null===i||void 0===i?void 0:i.type)}),[i]);return(0,S.jsx)(Z.Z,{pb:1,ref:b,children:(0,S.jsx)(C.PY,Yi(Yi({},Yi(Yi({},D),f)),{},{ref:p,children:(0,S.jsx)(k.Z,{noHoverUnderline:!0,noOutline:!0,onClick:function(){return o()},preventDefault:!0,ref:n,children:(0,S.jsx)(Z.Z,{p:1,children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(j.Z,{alignItems:"center",flex:1,children:[(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(dn.Z,{monospace:!0,children:m.dO[i.language]}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(g.Z,{color:E,size:1.5*_.iI,square:!0}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(O.ZP,{color:E,monospace:!0,children:null===(t=R?m.tf.DBT:m.V4[i.type])||void 0===t?void 0:t.toUpperCase()})]}),(0,S.jsx)(Z.Z,{mr:_.cd}),(0,S.jsx)(se.iU,{size:1.5*_.iI}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,children:null===i||void 0===i?void 0:i.uuid})]}),(0,S.jsx)(le.Z,{appearAbove:!0,appearBefore:!0,block:!0,label:"Show ".concat(null===i||void 0===i?void 0:i.uuid," block"),size:2*_.iI,widthFitContent:!0,children:(0,S.jsx)(se.Db,{muted:!0,size:2*_.iI})})]})})})}))})}var Ji,$i,er,nr,tr=s.forwardRef(Xi),ir=t(4804),rr=t(65730);!function(e){e.FULL_TABLE="FULL_TABLE",e.INCREMENTAL="INCREMENTAL",e.LOG_BASED="LOG_BASED"}($i||($i={})),function(e){e.IGNORE="IGNORE",e.UPDATE="UPDATE"}(er||(er={})),function(e){e.DATE_TIME="date-time",e.UUID="uuid"}(nr||(nr={}));var or,lr="datetime",cr=(Ji={},(0,o.Z)(Ji,nr.DATE_TIME,lr),(0,o.Z)(Ji,nr.UUID,nr.UUID),Ji);!function(e){e.ARRAY="array",e.BOOLEAN="boolean",e.INTEGER="integer",e.NULL="null",e.NUMBER="number",e.OBJECT="object",e.STRING="string"}(or||(or={}));var ur,ar,sr,dr,fr,pr=[or.ARRAY,or.BOOLEAN,lr,or.INTEGER,or.NULL,or.NUMBER,or.OBJECT,or.STRING,nr.UUID];!function(e){e.PROPERTIES="properties"}(ur||(ur={})),function(e){e.AUTOMATIC="automatic",e.AVAILABLE="available",e.UNSUPPORTED="unsupported"}(ar||(ar={})),function(e){e.FORCED_REPLICATION_METHOD="forced-replication-method",e.KEY_PROPERTIES="table-key-properties",e.REPLICATION_KEYS="valid-replication-keys",e.SCHEMA_NAME="schema-name"}(sr||(sr={})),function(e){e.AMPLITUDE="amplitude",e.BIGQUERY="bigquery",e.CHARGEBEE="chargebee",e.GOOGLE_ADS="google_ads",e.GOOGLE_SEARCH_CONSOLE="google_search_console",e.GOOGLE_SHEETS="google_sheets",e.INTERCOM="intercom",e.MYSQL="mysql",e.PIPEDRIVE="pipedrive",e.POSTGRESQL="postgresql",e.REDSHIFT="redshift",e.SALESFORCE="salesforce",e.STRIPE="stripe"}(dr||(dr={})),function(e){e.BIGQUERY="bigquery",e.DELTA_LAKE_S3="delta_lake_s3",e.MYSQL="mysql",e.POSTGRESQL="postgresql",e.SNOWFLAKE="snowflake"}(fr||(fr={}));var hr=t(79891),mr=t(70902),vr=t(85307);function br(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function gr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?br(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):br(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var xr="4px",jr=[fr.BIGQUERY,fr.DELTA_LAKE_S3];var yr=function(e){var n=e.bookmarkValues,t=e.destination,i=e.isLoadingLoadSampleData,r=e.isLoadingUpdateDestinationBlockState,c=e.loadSampleData,u=e.source,a=e.stream,d=e.streams,f=e.updateAllStreams,p=e.updateDestinationBlockState,h=e.updateMetadataForColumns,m=e.updateSchemaProperty,v=e.updateStream,g=(0,s.useRef)(null),x=a.bookmark_properties,k=a.destination_table,C=void 0===k?"":k,E=a.key_properties,P=a.metadata,w=a.partition_keys,T=a.replication_method,A=a.schema.properties,R=a.tap_stream_id,B=a.unique_constraints,N=a.unique_conflict_method,L=(0,s.useState)(C),F=L[0],U=L[1],H=(0,s.useState)(!1),G=H[0],z=H[1],K=(0,s.useState)(null),q=K[0],Q=K[1],V=(0,s.useState)(!1),Y=V[0],X=V[1],J=(0,s.useState)((0,o.Z)({},R,n||{})),$=J[0],ee=J[1],ne=(0,ae.Z)(R);(0,s.useEffect)((function(){ne!==R&&(U(C),Q(null))}),[C,T,R,ne,N]),(0,s.useEffect)((function(){var e=null===$||void 0===$?void 0:$[R];(null===x||void 0===x?void 0:x.length)>0&&((0,Ii.Qr)(e)||!(0,Ii.Xy)(n,e))&&ee((function(e){return gr(gr({},e),{},(0,o.Z)({},R,n))}))}),[null===x||void 0===x?void 0:x.length,n,R]);var te=(0,s.useMemo)((function(){return(0,pe.HK)(P,(function(e){return e.breadcrumb.join("/")}))}),[P]),ie=(0,s.useMemo)((function(){var e;return null===(e=(0,pe.sE)(P,(function(e){return 0===e.breadcrumb.length})))||void 0===e?void 0:e.metadata}),[P]),re=(0,s.useMemo)((function(){return ie[sr.KEY_PROPERTIES]||[]}),[ie]),oe=(0,s.useMemo)((function(){return ie[sr.REPLICATION_KEYS]||[]}),[ie]),ce=jr.includes(t),ue=d.length>1,se=(0,s.useCallback)((function(e){var n=gr({},null===$||void 0===$?void 0:$[R]);n.hasOwnProperty(e)&&delete n[e],ee((function(e){return gr(gr({},e),{},(0,o.Z)({},R,gr({},n)))})),p({block:{bookmark_values:n,destination_table:F,tap_stream_id:R}})}),[$,F,R,p]),de=(0,s.useMemo)((function(){var e=[],n=[],i=(0,pe.mr)(Object.entries(A)).map((function(i,r){var o=(0,l.Z)(i,2),c=o[0],u=o[1],a=u.anyOf,s=void 0===a?[]:a,d=u.format,p=u.type,g=void 0===p?[]:p,k=new Set(Array.isArray(g)?g:[g]),C=new Set(k);s.forEach((function(e){var n=e.format,t=(e.items,e.type);Array.isArray(t)?t.forEach((function(e){k.add(e),C.add(e)})):(k.add(t),C.add(t),n&&C.add(n))}));var P=Array.from(k);d&&C.add(d);var T=(te["properties/".concat(c)]||{}).metadata,A=(T.inclusion,T.selected);e.push(A),n.push(c);var D=pr.reduce((function(e,n){return P.indexOf(n)>=0||lr===String(n)&&nr.DATE_TIME===d||nr.UUID===String(n)&&nr.UUID===d?e:e.concat((0,S.jsx)("option",{value:n,children:n},n))}),[]),M=P.findIndex((function(e){return e===or.STRING})),N=[(0,S.jsx)(b.Z,{checked:A,onClick:function(){h(R,[c],{selected:!A})}},"".concat(R,"/").concat(c,"/selected")),(0,S.jsx)(O.ZP,{children:c},"".concat(R,"/").concat(c,"/name")),(0,S.jsxs)(y.Z,{children:[(0,S.jsx)(j.Z,{flex:1,children:(0,S.jsx)(y.Z,{alignItems:"center",flexWrap:"wrap",fullWidth:!0,children:P.map((function(e,n){return(0,S.jsx)(Z.Z,{mb:1,mr:1,children:(0,S.jsx)(hr.Z,{border:!0,label:d&&or.STRING===e&&M===n?cr[d]:e,onClick:function(){var n={format:d,type:P.filter((function(n){return n!==e}))};nr.DATE_TIME!==d&&nr.UUID!==d||or.STRING!==e||(n.format=null),m(R,c,n)},small:!0})},"".concat(R,"/").concat(c,"/").concat(e,"/").concat(n,"/chip"))}))})}),D.length>=1&&(0,S.jsxs)(hi.Z,{compact:!0,onChange:function(e){var n=e.target.value,t={format:d,type:P};lr===String(n)?(t.format=nr.DATE_TIME,t.type.push(or.STRING)):nr.UUID===String(n)?(t.format=nr.UUID,t.type.push(or.STRING)):t.type.push(n),m(R,c,t)},primary:!0,small:!0,value:"",width:10*_.iI,children:[(0,S.jsx)("option",{value:""}),D]})]},"".concat(R,"/").concat(c,"/type")),(0,S.jsx)(b.Z,{checked:!(null===B||void 0===B||!B.includes(c)),disabled:re.length>=1&&!re.includes(c),onClick:re.length>=1&&!re.includes(c)?null:function(){return v(R,(function(e){var n;return null!==(n=e.unique_constraints)&&void 0!==n&&n.includes(c)?e.unique_constraints=(0,pe.Od)(e.unique_constraints,(function(e){return c===e})):e.unique_constraints=[c].concat(e.unique_constraints||[]),e}))}},"".concat(R,"/").concat(c,"/unique")),(0,S.jsx)(b.Z,{checked:!(null===x||void 0===x||!x.includes(c)),disabled:oe.length>=1&&!oe.includes(c),onClick:oe.length>=1&&!oe.includes(c)?null:function(){return v(R,(function(e){var n;return null!==(n=e.bookmark_properties)&&void 0!==n&&n.includes(c)?(se(c),e.bookmark_properties=(0,pe.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),e}))}},"".concat(R,"/").concat(c,"/bookmark")),(0,S.jsx)(b.Z,{checked:!(null===E||void 0===E||!E.includes(c)),onClick:function(){return v(R,(function(e){var n;return null!==(n=e.key_properties)&&void 0!==n&&n.includes(c)?e.key_properties=(0,pe.Od)(e.key_properties,(function(e){return c===e})):e.key_properties=[c].concat(e.key_properties||[]),e}))}},"".concat(R,"/").concat(c,"/key_property"))];if(ce){var L=t!==fr.DELTA_LAKE_S3,F=L&&(re.includes(c)||!C.has(nr.DATE_TIME));N.push((0,S.jsx)(b.Z,{checked:!(null===w||void 0===w||!w.includes(c)),disabled:F,onClick:F?null:function(){return v(R,(function(e){var n,t;null!==(n=e.partition_keys)&&void 0!==n&&n.includes(c)?e.partition_keys=(0,pe.Od)(e.partition_keys,(function(e){return c===e})):L&&1===(null===(t=e.partition_keys)||void 0===t?void 0:t.length)?e.partition_keys=[c]:e.partition_keys=[c].concat(e.partition_keys||[]);return e}))}},"".concat(R,"/").concat(c,"/partition_key")))}if(ue){var U=q===r;N.push((0,S.jsx)(I.Z,{compact:!0,disabled:U,onClick:function(){Q(r),setTimeout((function(){return Q(null)}),2e3),f((function(e){var n,t;if((null===e||void 0===e?void 0:e.tap_stream_id)!==R&&null!==e&&void 0!==e&&null!==(n=e.schema)&&void 0!==n&&null!==(t=n.properties)&&void 0!==t&&t[c]){var i,r,o,l,u,a,s,f,p;e.schema.properties[c]={format:d||null,type:P};var h=null===(i=(0,pe.sE)((null===e||void 0===e?void 0:e.metadata)||[],(function(e){return 0===e.breadcrumb.length})))||void 0===i?void 0:i.metadata,m=h[sr.REPLICATION_KEYS]||[],v=h[sr.KEY_PROPERTIES]||[];null===B||void 0===B||!B.includes(c)||null!==e&&void 0!==e&&null!==(r=e.unique_constraints)&&void 0!==r&&r.includes(c)||!v.includes(c)?null!==B&&void 0!==B&&B.includes(c)||null===e||void 0===e||null===(o=e.unique_constraints)||void 0===o||!o.includes(c)||(e.unique_constraints=(0,pe.Od)(e.unique_constraints,(function(e){return c===e}))):e.unique_constraints=[c].concat(e.unique_constraints||[]),null===x||void 0===x||!x.includes(c)||null!==e&&void 0!==e&&null!==(l=e.bookmark_properties)&&void 0!==l&&l.includes(c)||!m.includes(c)?null!==x&&void 0!==x&&x.includes(c)||null===e||void 0===e||null===(u=e.bookmark_properties)||void 0===u||!u.includes(c)||(e.bookmark_properties=(0,pe.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),null===E||void 0===E||!E.includes(c)||null!==e&&void 0!==e&&null!==(a=e.key_properties)&&void 0!==a&&a.includes(c)?null!==E&&void 0!==E&&E.includes(c)||null===e||void 0===e||null===(s=e.key_properties)||void 0===s||!s.includes(c)||(e.key_properties=(0,pe.Od)(e.key_properties,(function(e){return c===e}))):e.key_properties=[c].concat(e.key_properties||[]),null===w||void 0===w||!w.includes(c)||null!==e&&void 0!==e&&null!==(f=e.partition_keys)&&void 0!==f&&f.includes(c)?null!==w&&void 0!==w&&w.includes(c)||null===e||void 0===e||null===(p=e.partition_keys)||void 0===p||!p.includes(c)||(e.partition_keys=(0,pe.Od)(e.partition_keys,(function(e){return c===e}))):e.partition_keys=[c].concat(e.partition_keys||[])}return gr({},e)}))},pill:!0,secondary:!0,children:(0,S.jsx)(O.ZP,{success:U,children:U?"Applied!":"Apply"})}))}return N})),r=e.every((function(e){return e})),o=[null,2,1,null,null,null],c=[{label:function(){return(0,S.jsx)(b.Z,{checked:r,onClick:function(){h(R,n,{selected:!r})}})},uuid:"Selected"},{uuid:"Name"},{uuid:"Type"},{uuid:"Unique"},{uuid:"Bookmark"},{uuid:"Key prop"}];return ce&&(o.push(null),c.push({uuid:"Partition key"})),ue&&(o.push(null),c.push({tooltipMessage:"This will apply this individual feature's schema settings to all selected streams that have the same feature. Unique features must be valid key properties in other streams. Bookmark features must be valid replication keys in other streams.",uuid:"All streams"})),(0,S.jsx)(vr.cl,{children:(0,S.jsx)(mi.Z,{alignTop:!0,columnFlex:o,columns:c,rows:i,stickyHeader:!0})})}),[x,t,ue,q,E,te,w,A,ce,R,B,f,h,m,v,re,oe]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(ui.Z,{condensed:!0,level:4,spacingBelow:!0,children:[(0,S.jsx)(ui.Z,{condensed:!0,inline:!0,level:4,monospace:!0,children:R})," schema"]}),(0,S.jsx)(Z.Z,{mb:3,children:(0,S.jsx)(D.Z,{headerTitle:"Output",overflowVisible:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{children:"Destination table name"}),(0,S.jsx)(Z.Z,{ml:xr}),(0,S.jsx)(le.Z,{label:(0,S.jsxs)(O.ZP,{children:["By default, this stream will be saved to your destination under the table named ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:R}),". To change the table name, enter in a different value."]}),lightBackground:!0,primary:!0}),(0,S.jsx)(Z.Z,{ml:1}),(0,S.jsx)(M.Z,{compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;U(n),clearTimeout(g.current),g.current=setTimeout((function(){v(R,(function(e){return gr(gr({},e),{},{destination_table:n})}))}),300)},value:F||"",width:45*_.iI})]})})}),(0,S.jsx)(Z.Z,{mb:3,children:(0,S.jsx)(D.Z,{headerTitle:"Usage",overflowVisible:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(j.Z,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{children:"Replication method"}),(0,S.jsx)(Z.Z,{ml:xr}),(0,S.jsx)(le.Z,{label:(0,S.jsxs)(O.ZP,{children:["Do you want to synchronize the entire stream (",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:$i.FULL_TABLE}),") on each integration pipeline run or only new records (",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:$i.INCREMENTAL}),")?",u===dr.POSTGRESQL&&(0,S.jsxs)(O.ZP,{children:["Log-based incremental replication (",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:$i.LOG_BASED}),") is also available for PostgreSQL sources."]})]}),lightBackground:!0,primary:!0}),(0,S.jsx)(Z.Z,{ml:1}),(0,S.jsxs)(hi.Z,{compact:!0,onChange:function(e){v(R,(function(n){return gr(gr({},n),{},{replication_method:e.target.value})}))},primary:!0,value:T,children:[(0,S.jsx)("option",{value:""}),Object.values($i).filter((function(e){return u===dr.POSTGRESQL||e!==$i.LOG_BASED})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))]}),(0,S.jsx)(Z.Z,{ml:3}),(0,S.jsx)(O.ZP,{children:"Unique conflict method"}),(0,S.jsx)(Z.Z,{ml:xr}),(0,S.jsx)(le.Z,{label:(0,S.jsxs)(O.ZP,{wordBreak:!0,children:["If a new record has the same value as an existing record in the ",(0,W._6)("column",null===B||void 0===B?void 0:B.length),(null===B||void 0===B?void 0:B.length)>0&&(0,S.jsx)(S.Fragment,{children:"\xa0"}),null===B||void 0===B?void 0:B.sort().map((function(e,n){return(0,S.jsxs)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:[1!==(null===B||void 0===B?void 0:B.length)&&n===(null===B||void 0===B?void 0:B.length)-1?(0,S.jsx)(O.ZP,{inline:!0,children:" and "},e):n>=1&&(0,S.jsx)(S.Fragment,{children:",\xa0"}),e]},e)})),", how do you want to resolve the conflict? The conflict method ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:er.IGNORE})," will skip the new record if it\u2019s a duplicate of an existing record. The conflict method ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:er.UPDATE})," will not save the new record and instead update the existing record with the new record\u2019s properties."]}),lightBackground:!0,primary:!0}),(0,S.jsx)(Z.Z,{ml:1}),(0,S.jsxs)(hi.Z,{compact:!0,inputWidth:11*_.iI,onChange:function(e){v(R,(function(n){return gr(gr({},n),{},{unique_conflict_method:e.target.value})}))},primary:!0,value:N,children:[(0,S.jsx)("option",{value:""}),(0,S.jsx)("option",{value:er.IGNORE,children:er.IGNORE}),(0,S.jsx)("option",{value:er.UPDATE,children:er.UPDATE})]})]}),ue&&(0,S.jsxs)(j.Z,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{default:!0,children:"All streams"}),(0,S.jsx)(Z.Z,{ml:xr}),(0,S.jsx)(le.Z,{appearBefore:!0,label:(0,S.jsx)(O.ZP,{children:"This will apply this stream's replication method and unique conflict method settings to all selected streams."}),lightBackground:!0,primary:!0}),(0,S.jsx)(Z.Z,{ml:1}),(0,S.jsx)(I.Z,{compact:!0,disabled:G,onClick:function(){z(!0),setTimeout((function(){return z(!1)}),2e3),f((function(e){return gr(gr({},e),{},{replication_method:T,unique_conflict_method:N})}))},pill:!0,secondary:!0,children:(0,S.jsx)(O.ZP,{bold:!G,success:G,children:G?"Applied!":"Apply"})})]})]})})}),(0,S.jsx)(D.Z,{headerTitle:"Features",noPadding:!0,children:de}),(0,S.jsx)(Z.Z,{mt:2,children:(0,S.jsx)(I.Z,{loading:i,onClick:function(){return c(R)},primary:!0,small:!0,children:"Load sample data"})}),(0,S.jsxs)(Z.Z,{mt:5,children:[(0,S.jsx)(ui.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Settings"}),$i.INCREMENTAL===T&&(0,S.jsxs)(Z.Z,{mb:5,children:[(0,S.jsxs)(Z.Z,{mb:1,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Bookmark properties"}),(0,S.jsxs)(O.ZP,{default:!0,children:["After each integration pipeline run, the last record that was successfully synchronized will be used as the bookmark. The properties listed below will be extracted from the last record and used as the bookmark.",(0,S.jsx)("br",{}),"On the next run, the synchronization will start after the bookmarked record."]})]}),(0,S.jsxs)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==x&&void 0!==x&&x.length)&&(0,S.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Bookmark"})," to use a specific column as a bookmark property."]}),null===x||void 0===x?void 0:x.sort().map((function(e){return(0,S.jsx)(Z.Z,{mb:1,mr:1,children:(0,S.jsx)(hr.Z,{label:e,onClick:function(){se(e),v(R,(function(n){return gr(gr({},n),{},{bookmark_properties:(0,pe.Od)(n.bookmark_properties||[],(function(n){return n===e}))})}))},primary:!0})},"bookmark_properties/".concat(e))}))]}),(null===x||void 0===x?void 0:x.length)>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{my:2,children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{mr:2,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Manually edit bookmark property values"}),(0,S.jsx)(O.ZP,{default:!0,children:'In order to override the bookmark values for the next sync, you must first select a destination. Then click the toggle to edit the values for the bookmark properties in the table below. Click the "Save" button to save your changes.'})]}),(0,S.jsx)(mr.Z,{checked:Y,disabled:!t,onCheck:function(){return X((function(e){return!e}))}})]})}),Y&&!!t&&(0,S.jsx)(D.Z,{header:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(O.ZP,{bold:!0,default:!0,children:"Bookmark property values"}),(0,S.jsx)(I.Z,{compact:!0,loading:r,onClick:function(){p({block:{bookmark_values:(null===$||void 0===$?void 0:$[R])||{},destination_table:F,tap_stream_id:R}})},pill:!0,secondary:!0,children:"Save"})]}),headerPaddingVertical:_.iI,noPadding:!0,overflowVisible:!0,children:(0,S.jsx)(mi.Z,{columnBorders:!0,columnFlex:[null,1],columns:[{uuid:"Bookmark property"},{uuid:"Value"}],rows:x.map((function(e){var n;return[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,children:e},e),(0,S.jsx)(M.Z,{borderless:!0,monospace:!0,onChange:function(n){n.preventDefault(),ee((function(t){return gr(gr({},t),{},(0,o.Z)({},R,gr(gr({},t[R]),{},(0,o.Z)({},e,n.target.value))))}))},paddingHorizontal:0,placeholder:"Enter value",value:null===$||void 0===$||null===(n=$[R])||void 0===n?void 0:n[e]},"".concat(e,"_value"))]}))})})]})]}),(0,S.jsxs)(Z.Z,{mb:5,children:[(0,S.jsxs)(Z.Z,{mb:1,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Unique constraints"}),(0,S.jsx)(O.ZP,{default:!0,children:"Multiple records (e.g. 2 or more) with the same values in the columns listed below will be considered duplicates."})]}),(0,S.jsxs)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==B&&void 0!==B&&B.length)&&(0,S.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Unique"})," to use a specific column as a unique constraint."]}),null===B||void 0===B?void 0:B.sort().map((function(e){return(0,S.jsx)(Z.Z,{mb:1,mr:1,children:(0,S.jsx)(hr.Z,{label:e,onClick:function(){v(R,(function(n){return gr(gr({},n),{},{unique_constraints:(0,pe.Od)(n.unique_constraints||[],(function(n){return n===e}))})}))},primary:!0})},"unique_constraints/".concat(e))}))]})]}),(0,S.jsxs)(Z.Z,{mb:5,children:[(0,S.jsxs)(Z.Z,{mb:1,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Key properties"}),(0,S.jsx)(O.ZP,{default:!0,children:"Key properties are used as the primary key for the destination table."})]}),(0,S.jsxs)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==E&&void 0!==E&&E.length)&&(0,S.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Key prop"})," to use a specific column as a key property."]}),null===E||void 0===E?void 0:E.sort().map((function(e){return(0,S.jsx)(Z.Z,{mb:1,mr:1,children:(0,S.jsx)(hr.Z,{label:e,onClick:function(){v(R,(function(n){return gr(gr({},n),{},{key_properties:(0,pe.Od)(n.key_properties||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]}),ce&&(0,S.jsxs)(Z.Z,{mb:3,children:[(0,S.jsxs)(Z.Z,{mb:1,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Partition keys"}),(0,S.jsx)(O.ZP,{default:!0,children:"One datetime column can be used to partition the table. (Note: Partition keys currently only work with BigQuery destinations. Support for other destinations is WIP.)"})]}),(0,S.jsxs)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==w&&void 0!==w&&w.length)&&(0,S.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Partition key"})," to use a specific column as a partition key."]}),null===w||void 0===w?void 0:w.sort().map((function(e){return(0,S.jsx)(Z.Z,{mb:1,mr:1,children:(0,S.jsx)(hr.Z,{label:e,onClick:function(){v(R,(function(n){return gr(gr({},n),{},{partition_keys:(0,pe.Od)(n.partition_keys||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]})]})]})},kr=["catalog","pipeline","setErrors","setSelectedStream"];function Zr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Or(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Zr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Zr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var _r=function(e){var n,t=e.catalog,i=e.pipeline,r=e.setErrors,o=e.setSelectedStream,c=(0,$t.Z)(e,kr),u=(0,s.useState)(null),a=u[0],f=u[1],p=(0,s.useMemo)((function(){return(null===t||void 0===t?void 0:t.streams)||[]}),[t]),h=(0,s.useMemo)((function(){return(0,pe.YC)(p,"stream").map((function(e){return{uuid:e.stream}}))}),[p]),v=(0,s.useMemo)((function(){return(0,pe.HK)(p,(function(e){return e.stream}))}),[p]),b=(0,s.useMemo)((function(){return v[null===a||void 0===a?void 0:a.uuid]}),[a,v]),g=(0,s.useMemo)((function(){return(0,pe.sE)((null===i||void 0===i?void 0:i.blocks)||[],(function(e){var n=e.type;return m.tf.DATA_EXPORTER===n}))}),[null===i||void 0===i?void 0:i.blocks]),x=b||{},j=x.destination_table,y=x.tap_stream_id,k=!(!y||!j),_=ce.ZP.blocks.pipelines.detail(k?null===i||void 0===i?void 0:i.uuid:null,k?null===g||void 0===g?void 0:g.uuid:null,{destination_table:j,state_stream:y}),C=_.data,E=_.mutate,P=null===C||void 0===C||null===(n=C.block)||void 0===n?void 0:n.bookmarks,w=(0,d.Db)(ce.ZP.blocks.pipelines.useUpdate(null===i||void 0===i?void 0:i.uuid,null===g||void 0===g?void 0:g.uuid,{query:{update_state:!0}}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){null===E||void 0===E||E()},onErrorCallback:function(e,n){return null===r||void 0===r?void 0:r({errors:n,response:e})}})}}),I=(0,l.Z)(w,2),A=I[0],D=I[1].isLoading;(0,s.useEffect)((function(){h.length>0&&(a&&(0,pe.sE)(h,(function(e){var n=e.uuid;return a.uuid===n}))||f(h[0]))}),[a,f,h]);var R=(0,s.useMemo)((function(){var e=[{uuid:"Stream"},{uuid:"Columns Selected"},{uuid:"Replication Method"},{uuid:"Destination Table"},{uuid:"Bookmark Props"},{uuid:"Key Props"},{uuid:"Unique Constraints"},{uuid:"Unique Conflict Method"},{uuid:"Partition Keys"}];return(0,S.jsx)(vr.cl,{children:(0,S.jsx)(mi.Z,{alignTop:!0,columnBorders:!0,columnFlex:e.map((function(e){return 1})),columns:e,rows:p.map((function(e){var n=e.replication_method,t=e.destination_table,i=e.bookmark_properties,r=e.key_properties,o=e.metadata,l=e.unique_constraints,c=e.unique_conflict_method,u=e.partition_keys,a=e.tap_stream_id,s=o.reduce((function(e,n){var t=n.breadcrumb,i=n.metadata.selected,r=(null===t||void 0===t?void 0:t.length)>0,o=i&&r?1:0,l=r?1:0;return{selectedCount:e.selectedCount+o,totalCount:e.totalCount+l}}),{selectedCount:0,totalCount:0}),d=(0,S.jsx)(O.ZP,{children:"".concat(s.selectedCount," of ").concat(s.totalCount," total")},"".concat(a,"_col_selected")),f=[a,n,t,i,r,l,c,u].map((function(e,n){return(0,S.jsx)(O.ZP,{bold:0===n,children:Array.isArray(e)?e.sort().join(", "):e},"".concat(a,"_cell_").concat(n))}));return f.slice(0,1).concat(d).concat(f.slice(1))})),stickyFirstColumn:!0,stickyHeader:!0,wrapColumns:!0})})}),[p]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(T.Z,{allowScroll:!0,noPadding:!0,onClickTab:function(e){f(e),o(e.uuid)},selectedTabUUID:null===a||void 0===a?void 0:a.uuid,tabs:h}),b&&(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsx)(vr.dE,{children:(0,S.jsx)(yr,Or(Or({},c),{},{bookmarkValues:P,isLoadingUpdateDestinationBlockState:D,stream:b,streams:p,updateDestinationBlockState:A}))})}),p.length>=1&&(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsxs)(vr.dE,{children:[(0,S.jsx)(ui.Z,{level:4,children:"Streams Summary"}),(0,S.jsx)(Z.Z,{mt:1}),R]})})]})},Cr=v.default.div.withConfig({displayName:"indexstyle__PanelStyle",componentId:"sc-1rfr5wd-0"})(["border-radius:","px;"," ",""],Te.n_,(function(e){return"\n background-color: ".concat((e.theme.background||ue.Z.background).panel,";\n ")}),(function(e){return e.fullWidth&&"\n width: 100%;\n "}));var Sr,Er=function(e){var n=e.children,t=e.fullWidth,i=void 0===t||t;return(0,S.jsx)(Cr,{fullWidth:i,children:n})};function Pr(e){return Object.values(e).filter((function(e){return null!==e})).map((function(e){return e.tap_stream_id}))}function wr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ir(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?wr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):wr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}!function(e){e.ALL="All",e.SELECTED="Selected",e.NOT_SELECTED="Not selected"}(Sr||(Sr={}));var Tr=45*_.iI;var Ar=function(e){var n=e.catalog,t=e.isLoading,i=e.onActionCallback,r=e.streams,l=(0,pe.HK)((null===n||void 0===n?void 0:n.streams)||[],(function(e){return e.stream})),c=(0,s.useMemo)((function(){var e=new Set(r.map((function(e){return e.stream})));return Object.values(l).filter((function(n){var t=n.stream;return!e.has(t)})).map((function(e){return Ir(Ir({},e),{},{isMissingStream:!0})}))}),[l,r]),u=Ir({},l);c.forEach((function(e){var n=e.stream;delete u[n]}));var a=(0,s.useState)(u),d=a[0],f=a[1],p=(0,s.useState)(null),h=p[0],m=p[1],v=(0,s.useState)(!1),g=v[0],j=v[1],k=(0,s.useState)(Sr.ALL),C=k[0],E=k[1],P=(0,s.useRef)(null),w=Pr(d),T=(0,s.useMemo)((function(){var e=r;return e=e.filter((function(e){var n=e.tap_stream_id;return C===Sr.SELECTED?w.includes(n):C!==Sr.NOT_SELECTED||!w.includes(n)})),h?e.filter((function(e){var n=e.tap_stream_id;return null===n||void 0===n?void 0:n.toLowerCase().includes(null===h||void 0===h?void 0:h.toLowerCase())})):e}),[C,h,w,r]),A=(0,s.useMemo)((function(){return r.every((function(e){var n=e.stream;return!!d[n]}))}),[d,r]);return(0,S.jsxs)(Er,{children:[(0,S.jsx)(vr.cv,{rounded:!0,children:(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Select streams to sync"})}),(0,S.jsx)(vr.cv,{padding:1.25*_.iI,children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(M.Z,{beforeIcon:(0,S.jsx)(se.HN,{}),compact:!0,noBackground:!0,noBorder:!0,onChange:function(e){return m(e.target.value)},placeholder:"Search",value:h}),(0,S.jsx)(Z.Z,{pr:1,children:(0,S.jsx)(we.Z,{items:[{label:function(){return Sr.ALL},onClick:function(){return E(Sr.ALL)},uuid:"all_streams"},{label:function(){return Sr.SELECTED},onClick:function(){return E(Sr.SELECTED)},uuid:"selected"},{label:function(){return Sr.NOT_SELECTED},onClick:function(){return E(Sr.NOT_SELECTED)},uuid:"unselected"}],onClickCallback:function(){return j(!1)},onClickOutside:function(){return j(!1)},open:g,parentRef:P,uuid:"SelectStreams/filter",children:(0,S.jsx)(I.Z,{beforeIcon:(0,S.jsx)(se.wn,{}),noBackground:!0,onClick:function(){return j((function(e){return!e}))},ref:P,children:(0,S.jsx)(O.ZP,{children:C})})})})]})}),(0,S.jsx)(vr.cl,{height:"55vh",hideHorizontalScrollbar:!0,width:"".concat(Tr,"px"),children:(0,S.jsx)(mi.Z,{borderCollapseSeparate:!0,columnFlex:[1,6],columns:[{label:function(){return(0,S.jsx)(b.Z,{checked:A,onClick:function(){var e=(0,pe.HK)(r||[],(function(e){return e.stream}));f(A?{}:e)}})},uuid:"Selected"},{uuid:"Stream name"}],rows:T.concat(c).map((function(e){var n=e.isMissingStream,t=e.stream,i=!!d[t];return[(0,S.jsx)(b.Z,{checked:i,disabled:!i&&n,onClick:function(){f((function(n){return Ir(Ir({},n),{},(0,o.Z)({},t,i?null:e))}))}},"selected-".concat(t)),(0,S.jsxs)(O.ZP,{danger:n,title:t,width:Tr-48-32,children:[t,n?" (no longer available)":""]},"stream-".concat(t))]})),stickyHeader:!0})}),(0,S.jsx)(x.Z,{medium:!0}),(0,S.jsxs)(Z.Z,{p:2,children:[(null===w||void 0===w?void 0:w.length)>50&&(0,S.jsx)(Z.Z,{pb:2,children:(0,S.jsxs)(O.ZP,{danger:!0,maxWidth:Tr-4*_.iI,rightAligned:!0,whiteSpaceNormal:!0,children:["WARNING: Selecting too many streams (e.g. >50)",(0,S.jsx)("br",{}),"may cause app performance issues."]})}),(0,S.jsx)(y.Z,{justifyContent:"flex-end",children:(0,S.jsx)(I.Z,{loading:t,onClick:function(){return i(d)},primary:!0,children:"Confirm ".concat(Pr(d).length," streams")})})]})]})};function Dr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Rr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Dr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Dr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Mr=function(e){var n=e.api,t=e.block,i=e.blockContent,r=e.onChangeCodeBlock,c=e.pipeline,u=(0,s.useState)(null),a=u[0],f=u[1];(0,s.useEffect)((function(){i&&!a&&f((0,ir.Pz)(null===i||void 0===i?void 0:i.config))}),[a,i]);var p=(0,s.useState)(null),h=p[0],v=p[1],b=(0,s.useState)(),g=b[0],x=b[1],j=(0,d.Db)(ce.ZP[n].useCreate(),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){var t,i,r=(0,W.C5)(n);v(null===e||void 0===e||null===(t=e[r])||void 0===t?void 0:t.success),x(null===e||void 0===e||null===(i=e[r])||void 0===i?void 0:i.error_message)},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})}}),k=(0,l.Z)(j,2),_=k[0],C=k[1].isLoading;return t?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(vr.$W,{children:(0,S.jsx)(vn.Z,{autoHeight:!0,language:m.t6.YAML,onChange:function(e){f(e),r(t.type,t.uuid,(0,ir.Pz)(Rr(Rr({},i),{},{config:(0,ir.Qc)(e)})))},tabSize:2,value:a||void 0,width:"100%"})}),(0,S.jsxs)(Z.Z,{mt:1,children:[(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(I.Z,{onClick:function(){_((0,o.Z)({},(0,W.C5)(n),{action_type:"test_connection",config:a,pipeline_uuid:c.uuid})),x(null)},small:!0,success:!0,children:"Test connection"}),(0,S.jsx)(Z.Z,{ml:1,children:C?(0,S.jsx)(Kt.Z,{color:"white",small:!0}):(0,S.jsxs)(S.Fragment,{children:[h&&(0,S.jsx)(O.ZP,{small:!0,success:!0,children:"Connected successfully!"}),!1===h&&(0,S.jsx)(O.ZP,{small:!0,warning:!0,children:"Failed to connect, see error below."})]})})]}),g&&(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsx)(O.ZP,{small:!0,warning:!0,children:g})})]})]}):null};function Br(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Nr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Br(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Br(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Lr=function(e){var n,t,i,r=e.addNewBlockAtIndex,o=e.blocks,c=e.codeBlocks,u=e.fetchFileTree,a=e.fetchPipeline,f=e.fetchSampleData,p=e.globalVariables,h=e.onChangeCodeBlock,v=e.openSidekickView,b=e.pipeline,g=e.savePipelineContent,x=e.setErrors,j=e.setIntegrationStreams,C=e.setOutputBlocks,E=e.setSelectedBlock,P=e.setSelectedOutputBlock,w=e.setSelectedStream,T=(0,s.useState)(!0),A=T[0],D=T[1],R=(0,s.useState)(!0),M=R[0],B=R[1],N=(0,s.useState)(!0),L=N[0],F=N[1],U=ce.ZP.integration_sources.list({},{revalidateOnFocus:!1}).data,H=(0,s.useMemo)((function(){return(null===U||void 0===U?void 0:U.integration_sources)||[]}),[U]),G=(0,s.useMemo)((function(){return(0,pe.HK)(H,(function(e){return e.uuid}))}),[H]),z=ce.ZP.integration_destinations.list({},{revalidateOnFocus:!1}).data,K=(0,s.useMemo)((function(){return(null===z||void 0===z?void 0:z.integration_destinations)||[]}),[z]),q=(0,s.useMemo)((function(){return(0,pe.HK)(K,(function(e){return e.uuid}))}),[K]),Q=(0,s.useMemo)((function(){return(0,pe.sE)(o,(function(e){var n=e.type;return m.tf.DATA_LOADER===n}))}),[o]),W=(0,s.useMemo)((function(){return Q?(0,ir.Qc)(Q.content):{}}),[Q]),V=(0,s.useMemo)((function(){return(0,S.jsx)(Mr,{api:"integration_sources",block:Q,blockContent:W,onChangeCodeBlock:h,pipeline:b})}),[Q,W,h,b]),Y=(0,s.useMemo)((function(){return(0,pe.sE)(o,(function(e){var n=e.type;return m.tf.DATA_EXPORTER===n}))}),[o]),X=(0,s.useMemo)((function(){return Y?(0,ir.Qc)(Y.content):{}}),[Y]),J=(0,s.useMemo)((function(){return(0,S.jsx)(Mr,{api:"integration_destinations",block:Y,blockContent:X,onChangeCodeBlock:h,pipeline:b})}),[Y,X,h,b]),$=(0,s.useMemo)((function(){return(0,pe.sE)(o,(function(e){var n=e.type;return m.tf.TRANSFORMER===n}))}),[o]),ee=(0,s.useMemo)((function(){var e;return(0,Ii.Qr)(null===W||void 0===W?void 0:W.catalog)?null===b||void 0===b||null===(e=b.data_integration)||void 0===e?void 0:e.catalog:null===W||void 0===W?void 0:W.catalog}),[W,null===b||void 0===b||null===(n=b.data_integration)||void 0===n?void 0:n.catalog]),ne=((null===ee||void 0===ee?void 0:ee.streams)||[]).every((function(e){return e.auto_add_new_fields})),te=((null===ee||void 0===ee?void 0:ee.streams)||[]).every((function(e){return e.disable_column_type_check})),ie=(0,ae.Z)(ee);(0,s.useEffect)((function(){!ie&&ee&&(C((function(){return P(Q),[Q]})),j((function(e){var n;return e||(null===ee||void 0===ee||null===(n=ee.streams)||void 0===n?void 0:n.map((function(e){return e.tap_stream_id})))})))}),[ee]);var re=(0,s.useState)(),oe=re[0],le=re[1],ue=(0,d.Db)(ce.ZP.integration_sources.useCreate(),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){var n=e.integration_source;if(n.success){var t=(null===n||void 0===n?void 0:n.streams)||[];C((function(){return P(Q),[Q]})),t.length>0&&w(t[0]),j((function(e){var n=(e||[]).concat(t);return Array.from(new Set(n)).sort()})),v(hn.cH.DATA),f()}else le(null===n||void 0===n?void 0:n.error_message)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),de=(0,l.Z)(ue,2),fe=de[0],he=de[1].isLoading,be=(0,d.Db)(ce.ZP.integration_sources.useUpdate(null===b||void 0===b?void 0:b.uuid),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){var n=e.integration_source,t=n.selected_streams,i=n.streams,r=((null===ee||void 0===ee?void 0:ee.streams)||[]).filter((function(e){var n=e.tap_stream_id;return t.includes(n)})),o=r.map((function(e){return e.tap_stream_id})),l=i.filter((function(e){var n=e.tap_stream_id;return t.includes(n)&&!o.includes(n)}));l.forEach((function(e){e.metadata.forEach((function(n,t){var i=n.metadata;if(ar.UNSUPPORTED!==i.inclusion){var r;if(e.replication_method||(e.replication_method=$i.FULL_TABLE),e.unique_conflict_method||(e.unique_conflict_method=er.UPDATE),!e.destination_table)e.destination_table=null===e||void 0===e||null===(r=e.tap_stream_id)||void 0===r?void 0:r.replace(/\W+/g,"_");e.metadata[t]=Nr(Nr({},n),{},{metadata:Nr(Nr({},i),{},{selected:!0})})}}))}));var c={streams:r.concat(l)};j(Me.map((function(e){return e.tap_stream_id})));var s=null===W||void 0===W?void 0:W.catalog;(0,Ii.Qr)(s)||h(Q.type,Q.uuid,(0,ir.Pz)(Nr(Nr({},W),{},{catalog:{}})));var d={pipeline:Nr(Nr({},b),{},{data_integration:Nr(Nr({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:c})})};g(d).then((function(){a(),u()}))},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),ge=(0,l.Z)(be,2),xe=ge[0],je=ge[1].isLoading,ye=(0,s.useState)(null),ke=ye[0],Ze=ye[1],Oe=(0,d.Db)(ce.ZP.integration_source_streams.useUpdate(null===b||void 0===b?void 0:b.uuid),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){Ze(e.integration_source_stream)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),_e=(0,l.Z)(Oe,2),Ce=_e[0],Se=_e[1].isLoading,Ee=(0,s.useCallback)((function(e,n){var t=function(e,n){var t,i=[];return e.streams.forEach((function(e){e.tap_stream_id===n?t=e:i.push(e)})),{stream:t,streams:i}}(ee,e),i=t.stream,r=t.streams,o=Nr(Nr({},ee),{},{streams:r.concat(n(i))}),l=null===W||void 0===W?void 0:W.catalog;(0,Ii.Qr)(l)||h(Q.type,Q.uuid,(0,ir.Pz)(Nr(Nr({},W),{},{catalog:{}})));var c={pipeline:Nr(Nr({},b),{},{data_integration:Nr(Nr({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:o})})};g(c).then((function(){return a()}))}),[ee,Q,W,a,h,b,g]),Pe=(0,s.useCallback)((function(e){if(null!==ee&&void 0!==ee&&ee.streams){var n=Nr(Nr({},ee),{},{streams:ee.streams.map((function(n){return e(n)}))}),t=null===W||void 0===W?void 0:W.catalog;(0,Ii.Qr)(t)||h(Q.type,Q.uuid,(0,ir.Pz)(Nr(Nr({},W),{},{catalog:{}})));var i={pipeline:Nr(Nr({},b),{},{data_integration:Nr(Nr({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:n})})};g(i).then((function(){return a()}))}}),[ee,Q,W,a,h,b,g]),we=(0,s.useCallback)((function(e,n,t){Ee(e,(function(e){return e.schema.properties[n]=t,e}))}),[Ee]),Ie=(0,s.useCallback)((function(e,n,t){Ee(e,(function(e){var i=e.metadata;return n.forEach((function(n){var r=i.findIndex((function(e){var t=e.breadcrumb,i=void 0===t?[]:t;return 2===i.length&&"properties"===i[0]&&i[1]===n}));if(r>=0){var o=i[r].metadata;e.metadata[r].metadata=Nr(Nr({},o),t)}})),e}))}),[Ee]),Te=(0,d.Db)(ce.ZP.blocks.pipelines.useUpdate(null===b||void 0===b?void 0:b.uuid,null===Y||void 0===Y?void 0:Y.uuid),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){null===a||void 0===a||a()},onErrorCallback:function(e,n){return null===x||void 0===x?void 0:x({errors:n,response:e})}})}}),Ae=(0,l.Z)(Te,1)[0],De=(0,s.useMemo)((function(){var e=[];return null===p||void 0===p||p.forEach((function(n){var t=n.variables;return null===t||void 0===t?void 0:t.forEach((function(n){var t=n.uuid,i=n.value,r="\"{{ variables('".concat(t,"') }}\"");if(!t.startsWith("output"))return e.push([(0,S.jsx)(O.ZP,{monospace:!0,children:t},"variable-uuid-".concat(t)),(0,S.jsx)(O.ZP,{monospace:!0,children:i},"variable-uuid-".concat(t,"-{value}")),(0,S.jsx)(O.ZP,{monospace:!0,children:r},"variable-uuid-".concat(t,"-{value}-code")),(0,S.jsx)(rr.Z,{copiedText:r,monospace:!0,withCopyIcon:!0},"variable-uuid-".concat(t,"-{value}-code-copy"))])}))})),(0,S.jsx)(mi.Z,{alignTop:!0,columnFlex:[null,null,1],columns:[{uuid:"Key"},{uuid:"Value"},{uuid:"Code"}],rows:e})}),[p]),Re=(0,s.useCallback)((function(e){return(0,S.jsxs)(Z.Z,{mt:2,children:[(0,S.jsxs)(O.ZP,{default:!0,children:["Use the following variables to interpolate sensitive or dynamic information into the configuration.",(0,S.jsx)("br",{}),"You can also access values from your environment variables by using the following syntax: ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:"\"{{ env_var('MY_ENV_VARIABLE_NAME') }}\""}),(0,S.jsx)("br",{}),"For more information, check out the ",(0,S.jsx)(k.Z,{href:e,openNewWindow:!0,primary:!0,children:"documentation"}),"."]}),(0,S.jsx)(Z.Z,{mt:1,children:De})]})}),[De]),Me=(0,s.useMemo)((function(){return(null===ke||void 0===ke?void 0:ke.streams)||[]}),[ke]),Be=(0,ve.dd)((function(){return(0,S.jsx)(Ar,{catalog:ee,isLoading:je,onActionCallback:function(e){var n=Object.entries(e).reduce((function(e,n){var t=(0,l.Z)(n,2),i=t[0];return t[1]?e.concat(i):e}),[]);if(n.length>0)xe({integration_source:{streams:n}}),Fe();else{var t=null===W||void 0===W?void 0:W.catalog;(0,Ii.Qr)(t)||h(Q.type,Q.uuid,(0,ir.Pz)(Nr(Nr({},W),{},{catalog:{}}))),g({pipeline:Nr(Nr({},b),{},{data_integration:Nr(Nr({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:null})})}).then((function(){return a()})),Fe()}},streams:Me})}),{},[ee,Q,W,a,je,h,g,Me],{background:!0,uuid:"select_streams"}),Ne=(0,l.Z)(Be,2),Le=Ne[0],Fe=Ne[1];return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{mb:1,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(I.Z,{iconOnly:!0,onClick:function(){return B((function(e){return!e}))},children:(0,S.jsxs)(S.Fragment,{children:[M&&(0,S.jsx)(se.Kh,{size:1.5*_.iI}),!M&&(0,S.jsx)(se._M,{size:1.5*_.iI})]})}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(ui.Z,{children:"Source"}),!M&&(0,S.jsxs)(ui.Z,{default:!0,inline:!0,children:["\xa0",null===(t=G[null===W||void 0===W?void 0:W.source])||void 0===t?void 0:t.name]})]})]})}),M&&(0,S.jsxs)(Z.Z,{mb:5,children:[(0,S.jsxs)(vr.dE,{children:[(0,S.jsxs)(Z.Z,{mb:5,children:[(0,S.jsx)(ui.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select source"}),(null===H||void 0===H?void 0:H.length)>0?(0,S.jsxs)(hi.Z,{onChange:function(e){var n,t,i=e.target.value;if(i){var o=null===(n=G[i])||void 0===n||null===(t=n.templates)||void 0===t?void 0:t.config;o&&Object.keys(o).forEach((function(e){o[e]=o[e]||null})),Q?h(Q.type,Q.uuid,(0,ir.Pz)(Nr(Nr({},W),{},{catalog:{},config:o,source:i}))):r({content:(0,ir.Pz)({config:o,source:i}),language:m.t6.YAML,type:m.tf.DATA_LOADER},0,E),Ze(null),g().then((function(){a()}))}},primary:!0,value:null===W||void 0===W?void 0:W.source,children:[(0,S.jsx)("option",{value:""}),H.map((function(e){var n=e.name,t=e.uuid;return(0,S.jsx)("option",{value:t,children:n},t)}))]}):(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(Kt.Z,{inverted:!0}),(0,S.jsx)(Z.Z,{ml:1}),(0,S.jsx)(ui.Z,{level:5,primary:!0,children:"Loading sources..."})]})]}),Q&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(Z.Z,{mb:5,children:[(0,S.jsx)(ui.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===W||void 0===W?void 0:W.source)&&(0,S.jsxs)(Z.Z,{mb:2,children:[(0,S.jsxs)(O.ZP,{default:!0,children:["For more information on how to configure this source, read the ",(0,S.jsxs)(k.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/sources/".concat(W.source,"/README.md"),openNewWindow:!0,primary:!0,children:[W.source," documentation"]})]}),Re("https://docs.mage.ai/guides/data-integration-pipeline#configure-source")]}),V]}),(0,S.jsxs)("div",{children:[(0,S.jsx)(ui.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select stream"}),(0,S.jsx)(I.Z,{loading:Se,onClick:function(){g().then((function(){Ce().then((function(){return Le()})),a()}))},primary:!0,small:!0,children:"View and select streams"})]}),oe&&(0,S.jsx)(O.ZP,{warning:!0,children:oe})]})]}),je&&(0,S.jsx)(Z.Z,{p:2,children:(0,S.jsx)(Kt.Z,{})}),!je&&(0,S.jsx)(Z.Z,{mt:3,children:(0,S.jsx)(_r,{catalog:ee,destination:null===X||void 0===X?void 0:X.destination,isLoadingLoadSampleData:he,loadSampleData:function(e){return fe({integration_source:{action_type:"sample_data",pipeline_uuid:null===b||void 0===b?void 0:b.uuid,streams:[e]}})},pipeline:b,setErrors:x,setSelectedStream:w,source:null===W||void 0===W?void 0:W.source,updateAllStreams:Pe,updateMetadataForColumns:Ie,updateSchemaProperty:we,updateStream:Ee})})]}),(0,S.jsx)(Z.Z,{mb:1,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(I.Z,{disabled:!Q,iconOnly:!0,onClick:function(){return F((function(e){return!e}))},children:(0,S.jsxs)(S.Fragment,{children:[L&&Q&&(0,S.jsx)(se.Kh,{size:1.5*_.iI}),(!L||!Q)&&(0,S.jsx)(se._M,{disabled:!Q,size:1.5*_.iI})]})}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(y.Z,{alignItems:"center",children:(0,S.jsx)(ui.Z,{children:"Transformers"})})]})}),L&&Q&&(0,S.jsx)(Z.Z,{mb:5,children:(0,S.jsxs)(vr.dE,{children:[c.length>0&&(0,S.jsx)(Z.Z,{mb:1,children:c.map((function(e,n){return(0,S.jsx)(Z.Z,{mb:1,children:e},n)}))}),(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsx)(un,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=[];return Q&&i.push(Q.uuid),r(Nr(Nr({},e),{},{configuration:t,content:n,upstream_blocks:i}),o.length-1,(function(e){Y&&(Ae({block:Nr(Nr({},Y),{},{upstream_blocks:[e.uuid]})}),E(e))}))},compact:!0,hideCustom:!0,hideDataExporter:!0,hideDataLoader:!0,hideDbt:!0,hideMarkdown:!0,hideScratchpad:!0,hideSensor:!0,hideTransformer:!!$,hideTransformerDataSources:!0,pipeline:b})})]})}),(0,S.jsx)(Z.Z,{mb:1,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(I.Z,{disabled:!Q,iconOnly:!0,onClick:function(){return D((function(e){return!e}))},children:(0,S.jsxs)(S.Fragment,{children:[A&&Q&&(0,S.jsx)(se.Kh,{size:1.5*_.iI}),(!A||!Q)&&(0,S.jsx)(se._M,{disabled:!Q,size:1.5*_.iI})]})}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(ui.Z,{children:"Destination"}),!A&&(0,S.jsxs)(ui.Z,{default:!0,inline:!0,children:["\xa0",null===(i=q[null===X||void 0===X?void 0:X.destination])||void 0===i?void 0:i.name]})]})]})}),A&&Q&&(0,S.jsxs)(vr.dE,{children:[(0,S.jsxs)(Z.Z,{mb:5,children:[(0,S.jsx)(ui.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select destination"}),(null===K||void 0===K?void 0:K.length)>0?(0,S.jsxs)(hi.Z,{onChange:function(e){var n=e.target.value;if(n){if(Y)h(Y.type,Y.uuid,(0,ir.Pz)(Nr(Nr({},X),{},{destination:n})));else{var t,i,l=null===(t=q[n])||void 0===t||null===(i=t.templates)||void 0===i?void 0:i.config;l&&(Object.keys(l).forEach((function(e){l[e]=l[e]||null})),l.hasOwnProperty("table")&&delete l.table);var c=[];if((null===o||void 0===o?void 0:o.length)>=2){var u=o.find((function(e){var n=e.uuid;return(null===Q||void 0===Q?void 0:Q.uuid)!==n}));u&&c.push(u.uuid)}else Q&&c.push(Q.uuid);r({content:(0,ir.Pz)({config:l,destination:n}),language:m.t6.YAML,type:m.tf.DATA_EXPORTER,upstream_blocks:c},1,E)}g().then((function(){a()}))}},primary:!0,value:null===X||void 0===X?void 0:X.destination,children:[(0,S.jsx)("option",{value:""}),K.map((function(e){var n=e.name,t=e.uuid;return(0,S.jsx)("option",{value:t,children:n},t)}))]}):(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(Kt.Z,{inverted:!0}),(0,S.jsx)(Z.Z,{ml:1}),(0,S.jsx)(ui.Z,{level:5,primary:!0,children:"Loading destinations..."})]})]}),Y&&(0,S.jsxs)(Z.Z,{mb:5,children:[(0,S.jsx)(ui.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===X||void 0===X?void 0:X.destination)&&(0,S.jsx)(S.Fragment,{children:(0,S.jsxs)(Z.Z,{mb:2,children:[(0,S.jsxs)(O.ZP,{default:!0,children:["For more information on how to configure this destination, read the ",(0,S.jsxs)(k.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/destinations/".concat(X.destination,"/README.md"),openNewWindow:!0,primary:!0,children:[X.destination," documentation"]}),".",(0,S.jsx)("br",{}),(0,S.jsx)("br",{}),"If your configuration contains a key named ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:"table"}),", it\u2019s optional.",(0,S.jsx)("br",{}),"The table that\u2019s created in this destination will have a name corresponding to the stream\u2019s unique name (by default) or the value you entered under the input field labeled ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,children:"Table name"})," in a previous section."]}),Re("https://docs.mage.ai/guides/data-integration-pipeline#configure-destination")]})}),J,(0,S.jsx)(Z.Z,{mt:3,children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{mr:2,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Automatically add new fields"}),(0,S.jsx)(O.ZP,{default:!0,children:"Turn the toggle on if you want new table columns in each data source stream to be automatically added and synced with the data destination."})]}),(0,S.jsx)(mr.Z,{checked:!!ne,disabled:!(null!==ee&&void 0!==ee&&ee.streams),onCheck:function(){return Pe((function(e){return Nr(Nr({},e),{},{auto_add_new_fields:!ne})}))}})]})}),(0,S.jsx)(Z.Z,{mt:3,children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{mr:2,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Disable column type check"}),(0,S.jsxs)(O.ZP,{default:!0,children:["By default, the value for each column is validated according to the schema property for that column.",(0,S.jsx)("br",{}),"If a value in a column doesn\u2019t match its type, an error will be raised and the process will be stopped.",(0,S.jsx)("br",{}),"Turn this toggle on if you want to disable this strict type checking."]})]}),(0,S.jsx)(mr.Z,{checked:!!te,disabled:!(null!==ee&&void 0!==ee&&ee.streams),onCheck:function(){return Pe((function(e){return Nr(Nr({},e),{},{disable_column_type_check:!te})}))}})]})})]})]})]})};function Fr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ur(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Fr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Fr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Hr=function(e){var n=e.addNewBlockAtIndex,t=e.addWidget,i=e.allBlocks,c=e.allowCodeBlockShortcuts,u=e.anyInputFocused,a=e.autocompleteItems,f=e.blockRefs,p=e.blocks,h=void 0===p?[]:p,v=e.dataProviders,b=e.deleteBlock,g=e.disableShortcuts,x=e.fetchFileTree,j=e.fetchPipeline,y=e.fetchSampleData,k=e.files,O=e.globalVariables,C=e.hiddenBlocks,E=e.interruptKernel,P=e.mainContainerRef,w=e.mainContainerWidth,I=e.messages,T=e.onChangeCallbackBlock,A=e.onChangeCodeBlock,D=e.openSidekickView,M=e.pipeline,N=e.pipelineContentTouched,L=e.restartKernel,U=e.runBlock,H=e.runningBlocks,G=void 0===H?[]:H,K=e.savePipelineContent,q=e.selectedBlock,Q=e.setAnyInputFocused,Y=e.setDisableShortcuts,X=e.setEditingBlock,J=e.setErrors,$=e.setIntegrationStreams,ee=e.setHiddenBlocks,ne=e.setOutputBlocks,te=e.setPipelineContentTouched,ie=e.setSelectedBlock,re=e.setSelectedOutputBlock,oe=e.setSelectedStream,le=e.setTextareaFocused,ue=e.textareaFocused,se=e.widgets,fe=(0,s.useState)(!1),he=fe[0],ve=fe[1],be=(0,s.useState)(!1),Ze=be[0],Oe=be[1],_e=(0,s.useState)(!0),Ce=_e[0],Se=_e[1],Ee=(0,s.useState)(null),Pe=Ee[0],we=Ee[1],Ie=(0,s.useState)(null),Te=Ie[0],Ae=Ie[1],De=(0,s.useState)(!1),Re=De[0],Me=De[1],Be=(0,s.useState)(""),Ne=Be[0],Le=Be[1],Fe=(0,s.useMemo)((function(){return G.reduce((function(e,n,t){return Ur(Ur({},e),{},(0,o.Z)({},n.uuid,Ur(Ur({},n),{},{priority:t})))}),{})}),[G]),Ue=(0,ae.Z)(q),He=(0,s.useMemo)((function(){return h.length}),[h]),Ge=(0,s.useMemo)((function(){return R.qL.INTEGRATION===(null===M||void 0===M?void 0:M.type)}),[M]),ze=(0,s.useMemo)((function(){return R.qL.STREAMING===(null===M||void 0===M?void 0:M.type)}),[M]),Ke=ce.ZP.block_templates.list({},{revalidateOnFocus:!1}).data,qe=(0,s.useMemo)((function(){return(null===Ke||void 0===Ke?void 0:Ke.block_templates)||[]}),[Ke]),Qe="PipelineDetail/index",We=(0,V.y)(),Ve=We.disableGlobalKeyboardShortcuts,Ye=We.registerOnKeyDown,Xe=We.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){Xe(Qe)}}),[Xe,Qe]),Ye(Qe,(function(e,n,t){if(N&&(0,F.y)([B.zX,B.hS],n)){e.preventDefault();"undefined"!==typeof location&&window.confirm("You have changes that are unsaved. Click cancel and save your changes before reloading page.")&&location.reload()}if(!g&&!Ve)if((0,F.y)([B.zX,B.Um],n)||(0,F.y)([B.PQ,B.Um],n))e.preventDefault(),K();else if(ue)n[B.vP]?le(!1):N||B.Z1.find((function(e){return n[e]}))||te(!0);else if(!Ge){if(q){var i=h.findIndex((function(e){var n=e.uuid;return q.uuid===n}));if(n[B.vP])ie(null);else if(t[0]===B.xD&&t[1]===B.xD)E();else if(t[0]===B.l1&&t[1]===B.l1&&-1!==i)b(q).then((function(e){null!==e&&void 0!==e&&e.error||setTimeout((function(){i===h.length-1?ie(h[i-1]):h.length>=0?ie(h[i+1]):ie(null)}),100)}));else if(n[B.Bu]&&i>=1){var r=h[i-1];if(r){var o,l;ie(r);var c="".concat(r.type,"s/").concat(r.uuid,".py");null===(o=f.current[c])||void 0===o||null===(l=o.current)||void 0===l||l.scrollIntoView()}}else if(n[B.kD]&&i<=He-2){var a=h[i+1];if(a){var s,d;ie(a);var p="".concat(a.type,"s/").concat(a.uuid,".py");null===(s=f.current[p])||void 0===s||null===(d=s.current)||void 0===d||d.scrollIntoView()}}else(0,F.y)([B.Uq],n)&&le(!0)}else Ue&&n[B.Uq]&&ie(Ue);u||t[0]!==B.OC||t[1]!==B.OC||L()}}),[n,u,f.current,h,E,Ge,He,N,L,K,q,Ue,te,ie,le,ue]),(0,s.useEffect)((function(){var e=setInterval((function(){N&&K()}),1e4);return function(){clearInterval(e)}}),[N,K]),(0,s.useEffect)((function(){setTimeout((function(){return Oe(!0)}),2*de.zn)}),[M]);var Je=(0,d.Db)((function(e){var n=e.block,t=e.upstreamBlocks;return ce.ZP.blocks.pipelines.useUpdate(null===M||void 0===M?void 0:M.uuid,null===n||void 0===n?void 0:n.uuid)({block:{upstream_blocks:t}})}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){j()},onErrorCallback:function(e,n){return null===J||void 0===J?void 0:J({errors:n,response:e})}})}}),$e=(0,l.Z)(Je,1)[0],en=(0,s.useCallback)((function(e){ve(!0),Ae(e),Y(!0)}),[ve,Y,Ae]),nn=(0,s.useCallback)((function(){ve(!1),Me(!1),Le(""),Y(!1)}),[Y]),tn=(0,s.useCallback)((function(e,n){var t,i;h.forEach((function(r,o){var l=r.uuid;t>=0&&i>=0||(l===e.uuid?t=o:l===n.uuid&&(i=o))}));var r=(0,pe.oM)(h,i);return r=(0,pe.Hk)(n,Math.max(t,0),r),K({pipeline:{blocks:r,uuid:null===M||void 0===M?void 0:M.uuid}})}),[h,M,K]),ln=(0,s.useMemo)((function(){var e=[];return h.filter((function(e){var n=e.type;return!Ge||m.tf.TRANSFORMER===n})).forEach((function(l,u){var d,p=l.type,y=l.uuid,k=(null===q||void 0===q?void 0:q.uuid)===y,Z=Fe[y],O=Z?0===Z.priority?ge.uF.BUSY:ge.uF.QUEUED:ge.uF.IDLE,_="".concat(p,"s/").concat(y,".py");f.current[_]=(0,s.createRef)();var R=p===m.tf.MARKDOWN,B=p===m.tf.TRANSFORMER,N=!(null===C||void 0===C||!C[y]),L=u===He-1||Ge,F=f.current[_];d=N?(0,S.jsx)(tr,{block:l,blocks:h,onClick:function(){return ee((function(e){return Ur(Ur({},e),{},(0,o.Z)({},y,!N))}))},onDrop:tn,ref:F},y):(0,S.jsx)(Mi,{addNewBlock:function(e,t){le(!0);return n(e,u+1,(function(e){if(1===(null===t||void 0===t?void 0:t.length)){var n,i,o=null===(n=t[0])||void 0===n?void 0:n.uuid,l=(null===(i=t[0])||void 0===i?void 0:i.upstream_blocks)||[];$e({block:{uuid:o},upstreamBlocks:[e.uuid].concat((0,r.Z)(l))})}null===ie||void 0===ie||ie(e)}))},addNewBlockMenuOpenIdx:Pe,addWidget:t,allBlocks:i,allowCodeBlockShortcuts:c,autocompleteItems:a,block:l,blockIdx:u,blockRefs:f,blockTemplates:qe,blocks:h,dataProviders:v,defaultValue:l.content,deleteBlock:function(e){b(e),Q(!1)},disableShortcuts:g,executionState:O,fetchFileTree:x,fetchPipeline:j,hideRunButton:ze||R||Ge&&B,interruptKernel:E,mainContainerRef:P,mainContainerWidth:w,messages:I[y],noDivider:L,onCallbackChange:function(e){return T(p,y,e)},onChange:function(e){return A(p,y,e)},onClickAddSingleDBTModel:en,onDrop:tn,openSidekickView:D,pipeline:M,ref:F,runBlock:U,runningBlocks:G,savePipelineContent:K,selected:k,setAddNewBlockMenuOpenIdx:we,setAnyInputFocused:Q,setCreatingNewDBTModel:Me,setEditingBlock:X,setErrors:J,setOutputBlocks:ne,setSelected:function(e){return ie(!0===e?l:null)},setSelectedOutputBlock:re,setTextareaFocused:le,textareaFocused:k&&ue,widgets:se},y),e.push(d)})),e}),[n,Pe,t,i,c,a,f,qe,h,v,b,g,x,j,C,E,Ge,ze,P,w,I,He,T,A,en,tn,D,M,U,G,Fe,K,q,we,Q,X,J,ee,ne,ie,re,le,ue,$e,se]),cn=(0,s.useMemo)((function(){return(0,S.jsx)(Lr,{addNewBlockAtIndex:n,blocks:h,codeBlocks:ln,fetchFileTree:x,fetchPipeline:j,fetchSampleData:y,globalVariables:O,onChangeCodeBlock:A,openSidekickView:D,pipeline:M,savePipelineContent:K,setErrors:J,setIntegrationStreams:$,setOutputBlocks:ne,setSelectedBlock:ie,setSelectedOutputBlock:re,setSelectedStream:oe})}),[n,h,ln,x,j,y,O,A,D,M,K,J,$,ne,ie,re,oe]),an=(0,s.useMemo)((function(){return(0,S.jsx)(un,{addNewBlock:function(e){var t=h[h.length-1],i=null,r={},o=t?(0,qt.eY)(t,e):[];t&&([m.tf.DATA_LOADER,m.tf.TRANSFORMER].includes(t.type)&&m.tf.SCRATCHPAD===e.type&&(i="from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(M.uuid,"', '").concat(t.uuid,"', 'output_0')\n")),m.t6.SQL===t.language&&(r=Ur(Ur({},(0,Ii.GL)(t.configuration,[lt,ct,ut,at,pt])),r))),m.t6.SQL===e.language&&(i=rn(i)),i=on(e,i),n(Ur(Ur({},e),{},{configuration:r,content:i,upstream_blocks:o}),He,ie),le(!0)},blockTemplates:qe,hideCustom:Ge||ze,hideDataExporter:Ge,hideDataLoader:Ge,hideDbt:Ge||ze,hideScratchpad:Ge,hideSensor:Ge,onClickAddSingleDBTModel:en,pipeline:M,setCreatingNewDBTModel:Me})}),[n,qe,h,Ge,ze,He,en,M,ie,le]);return(0,S.jsxs)(ye.W,{backend:ke.PD,children:[(0,S.jsx)(de.lO,{children:Ce&&(0,S.jsx)(je.Z,{classNames:"pipeline-detail",in:Ze,onEntered:function(){return setTimeout((function(){return Se(!1)}),de.zn)},timeout:1,children:(0,S.jsx)(de.fm,{})})}),(0,S.jsxs)(Z.Z,{mt:1,px:_.cd,children:[Ge&&cn,!Ge&&(0,S.jsxs)(S.Fragment,{children:[ln,(0,S.jsx)(Z.Z,{mt:_.cd,children:an})]}),he&&(0,S.jsx)(z.Z,{onClickOutside:nn,open:!0,children:(0,S.jsx)(Wi,{blocks:h,creatingNewDBTModel:Re,dbtModelName:Ne,files:k,onClose:nn,onOpenFile:function(e){var t=e;if(Re){var i=(0,W.RA)(Ne||(0,W.Y6)()),r=".".concat(En.Lu.SQL);i.endsWith(r)&&(i=i.slice(0,-4)),t="".concat(e).concat(xe.sep).concat(i,".").concat(En.Lu.SQL)}var o={configuration:{file_path:t,limit:1e3},language:m.t6.SQL,name:(0,W.wE)(t),type:m.tf.DBT};Re&&(o.content="--Docs: https://docs.mage.ai/dbt/sources\n");var l="undefined"===typeof Te||null===Te,c=h[l?h.length-1:Te],u=c?(0,qt.eY)(c,o):[];n(Ur(Ur({},o),{},{upstream_blocks:u}),l?He:Te+1,ie),nn(),le(!0)},setDbtModelName:Le})})]})]})},Gr=t(49894),zr=t(41424),Kr=t(32063),qr=t(82386),Qr=t(70543),Wr=t(24141);function Vr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Yr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Vr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Vr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Xr=function(e){var n=e.after,t=e.afterHeader,i=e.afterHeightOffset,r=e.afterHidden,o=e.afterNavigationItems,c=e.afterOverflow,u=e.afterSubheader,a=e.before,d=e.beforeHeader,f=e.beforeHeightOffset,p=e.beforeNavigationItems,h=e.children,m=e.errors,v=e.headerOffset,b=e.mainContainerHeader,g=e.mainContainerRef,x=e.page,j=e.pipeline,y=e.setAfterHidden,k=e.setAfterWidthForChildren,Z=e.setErrors,O=e.setMainContainerWidth,_=(0,Wr.i)().width,C=(0,s.useState)((0,L.U2)(L.L8,qr.Zt)),E=C[0],P=C[1],w=(0,s.useState)((0,L.U2)(L.J3,qr.ve)),I=w[0],T=w[1],A=(0,s.useState)(!!(0,L.U2)(L.Uu)),D=A[0],R=A[1],M=(0,s.useState)(!1),B=M[0],N=M[1],F=(0,s.useState)(!1),U=F[0],H=F[1],G=r,K=y;if(!K){var q=(0,s.useState)(!!(0,L.U2)(L.zg)),Q=(0,l.Z)(q,2);G=Q[0],K=Q[1]}(0,s.useEffect)((function(){null===g||void 0===g||!g.current||B||U||null===O||void 0===O||O(g.current.getBoundingClientRect().width)}),[B,U,G,E,D,I,g,O,_]),(0,s.useEffect)((function(){B||(null===k||void 0===k||k(E),(0,L.t8)(L.L8,E))}),[B,E,k]),(0,s.useEffect)((function(){U||(0,L.t8)(L.J3,I)}),[U,I]);var V=ce.ZP.projects.list({},{revalidateOnFocus:!1}).data,Y=null===V||void 0===V?void 0:V.projects,X=(0,s.useMemo)((function(){var e,n=[{label:function(){return"Pipelines"},linkProps:{as:"/pipelines",href:"/pipelines"}}];return j&&(n.push.apply(n,[{bold:Qr.b7!==x,label:function(){return null===j||void 0===j?void 0:j.uuid},linkProps:{as:"/pipelines/".concat(null===j||void 0===j?void 0:j.uuid),href:"/pipelines/[pipeline]"}}]),Qr.b7===x&&n.push.apply(n,[{bold:!0,label:function(){return(0,W.kC)(x)}}])),(0,S.jsx)(zr.Z,{breadcrumbs:n,project:null===Y||void 0===Y?void 0:Y[0],version:null===Y||void 0===Y||null===(e=Y[0])||void 0===e?void 0:e.version})}),[x,j,Y]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(te.Z,{title:null===j||void 0===j?void 0:j.name}),(0,S.jsx)(Kr.Z,{after:n,afterHeader:t,afterHeightOffset:i,afterHidden:G,afterMousedownActive:B,afterNavigationItems:o,afterOverflow:c,afterSubheader:u,afterWidth:E,before:a,beforeHeader:d,beforeHeightOffset:f,beforeHidden:D,beforeMousedownActive:U,beforeNavigationItems:p,beforeWidth:I,header:X,headerOffset:v,mainContainerHeader:b,mainContainerRef:g,navigationShowMore:!0,setAfterHidden:K,setAfterMousedownActive:N,setAfterWidth:P,setBeforeHidden:R,setBeforeMousedownActive:H,setBeforeWidth:T,children:h}),m&&(0,S.jsx)(z.Z,{disableClickOutside:!0,isOpen:!0,onClickOutside:function(){return Z(null)},children:(0,S.jsx)(Gr.Z,Yr(Yr({},m),{},{onClose:function(){return Z(null)}}))})]})},Jr=t(41788),$r=t(70001),eo=t(26226),no=t(29989),to=t(53655),io=t(84181),ro=t(31969);function oo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function lo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?oo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):oo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var co=v.default.div.withConfig({displayName:"HeatMap__YAxisLabelContainer",componentId:"sc-h2irj-0"})(["-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-o-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);white-space:nowrap;"]);function uo(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function ao(e,n){return Math.min.apply(Math,(0,r.Z)(e.map(n)))}var so=function(e){return e.bins},fo=function(e){return e.count},po={top:0,left:0,right:0,bottom:0};function ho(e){var n=e.countMidpoint,t=e.data,i=(e.events,e.height),r=e.margin,o=void 0===r?{}:r,l=e.minCount,c=e.width,u=(e.yLabels,(0,s.useContext)(v.ThemeContext)),a=(u.monotone||ro.Z.monotone).grey300,d=(u.brand||ro.Z.brand).wind400,f=(u.content||ro.Z.content).default,p=(u.monotone||ro.Z.monotone).white,h=lo(lo({},po),o),m=[];t[0].forEach((function(e,n){var i=t.map((function(e){return e[n]}));m.push({bin:n,bins:i.reverse().map((function(e,n){return{bin:n,count:e}}))})}));var b=uo(m,(function(e){return uo(so(e),fo)})),g=ao(m,(function(e){return ao(so(e),fo)})),x=uo(m,(function(e){return so(e).length})),j="undefined"!==typeof n?n:0,y="undefined"!==typeof l?l:g,k=(0,io.Z)({domain:[0,m.length]}),Z=(0,io.Z)({domain:[0,x]}),O=(0,io.Z)({range:[a,d],domain:[j,b]}),_=(0,io.Z)({range:[.1,1],domain:[j,b]}),C=(0,io.Z)({range:[a,d],domain:[y,j]}),E=(0,io.Z)({range:[1,.1],domain:[y,j]}),P=c-(h.left+h.right),w=i-(h.bottom+h.top),I=P/m.length,T=w/x;return k.range([0,P]),Z.range([w,0]),c<10?null:(0,S.jsx)(S.Fragment,{children:(0,S.jsx)("svg",{width:c,height:i,children:(0,S.jsx)(no.Z,{left:h.left,top:h.top,children:(0,S.jsx)(to.Z,{data:m,xScale:k,yScale:Z,colorScale:O,opacityScale:_,binWidth:I,binHeight:I,gap:0,children:function(e){return e.map((function(e){return e.map((function(e){var t=e.opacity,i=e.color;return"undefined"!==typeof n&&e.count<n&&(t=E(e.count),i=C(e.count)),(0,S.jsxs)("svg",{height:T,width:I,x:e.x,y:e.y-T,children:[(0,S.jsx)("rect",{className:"visx-heatmap-rect",fill:i,fillOpacity:t,height:T,width:I}),(0,S.jsx)("text",{alignmentBaseline:"middle",fill:e.count>=.8*b?p:f,fontFamily:ai.ry,fontSize:14,textAnchor:"middle",x:"50%",y:"50%",children:e.count})]},"heatmap-rect-".concat(e.row,"-").concat(e.column))}))}))}})})})})}var mo=function(e){var n=e.countMidpoint,t=e.data,i=e.height,r=e.margin,o=e.minCount,l=e.xAxisLabel,c=e.xLabels,u=e.yAxisLabel,a=e.yLabels,s=function(e){return e.length>12?"".concat(e.substring(0,12),"..."):e},d=4*_.iI,f=8*_.iI,p=0;return u&&(p+=d+1*_.iI),a&&(p+=f+1*_.iI),(0,S.jsxs)(S.Fragment,{children:[(l||c)&&(0,S.jsx)("div",{style:{marginBottom:null===r||void 0===r?void 0:r.bottom,marginLeft:null===r||void 0===r?void 0:r.left,marginRight:null===r||void 0===r?void 0:r.right,marginTop:null===r||void 0===r?void 0:r.top,paddingLeft:p},children:(0,S.jsxs)(Z.Z,{mb:{xs:1},children:[l&&(0,S.jsx)(Z.Z,{mb:1,children:(0,S.jsx)(O.ZP,{center:!0,muted:!0,xsmall:!0,children:l})}),c&&(0,S.jsx)(y.Z,{children:c.map((function(e){var n=e.label,t=e.linkProps;return(0,S.jsx)(j.Z,{flex:"1",justifyContent:"center",children:t?(0,S.jsx)(k.Z,{bold:!0,centerAlign:!0,minWidth:70,onClick:t.onClick,xsmall:!0,children:n}):(0,S.jsx)(O.ZP,{bold:!0,center:!0,minWidth:70,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})]})}),(0,S.jsxs)("div",{style:{height:i,display:"flex",width:"100%"},children:[u&&(0,S.jsx)("div",{style:{marginRight:1*_.iI,width:d},children:(0,S.jsx)(y.Z,{alignItems:"center",justifyContent:"center",children:(0,S.jsx)(co,{children:(0,S.jsx)(O.ZP,{center:!0,muted:!0,xsmall:!0,children:u})})})}),a&&(0,S.jsx)("div",{style:{marginRight:1*_.iI},children:(0,S.jsx)(y.Z,{alignItems:"center",flexDirection:"column",fullHeight:!0,width:f,children:a.map((function(e){var n=e.label,t=e.linkProps;return(0,S.jsx)(j.Z,{alignItems:"center",flex:"1",children:t?(0,S.jsx)(k.Z,{bold:!0,centerAlign:!0,onClick:t.onClick,xsmall:!0,children:n}):(0,S.jsx)(O.ZP,{bold:!0,center:!0,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})}),(0,S.jsx)("div",{style:{height:i,width:"100%"},children:(0,S.jsx)(eo.Z,{children:function(e){var i=e.width,l=e.height;return(0,S.jsx)(ho,{countMidpoint:n,data:t,height:l,margin:r,minCount:o,width:i,yLabels:a})}})})]})]})},vo=t(11754);var bo=function(e){var n=e.afterWidth,t=e.features,i=e.insightsOverview,r=e.statistics,o=i.correlations,c=void 0===o?[]:o,u=n-(2*_.cd*_.iI+Tn.nn),a=function(e){var n=[];return{heatmapData:null===e||void 0===e?void 0:e.map((function(e,t){var i=e.correlations,r=e.feature.uuid;n.push({label:r});var o=i[0].y.map((function(e){var n=e.value;return(0,W.QV)(n)}));return o.splice(t,0,1),o})),xyLabels:n}}(c),s=a.heatmapData,d=a.xyLabels,f=function(e,n){return(0,pe.YC)(null===e||void 0===e?void 0:e.map((function(e){return{feature:e,value:1-n["".concat(e.uuid,"/null_value_rate")]}})),"value")}(t,r),p=function(e,n){return(0,pe.YC)(null===e||void 0===e?void 0:e.map((function(e){return{feature:e,value:n["".concat(e.uuid,"/count_distinct")]}})),"value")}(t,r),h=function(e,n){return(0,pe.YC)(null===e||void 0===e?void 0:e.map((function(e){var t=Object.entries(n["".concat(e.uuid,"/value_counts")]||{})[0]||[],i=(0,l.Z)(t,2),r=i[0],o=i[1];return{feature:e,percentage:Number(o)/n.count,value:r}})),"percentage")}(t,r);return(0,S.jsxs)(y.Z,{flexDirection:"column",children:[(null===f||void 0===f?void 0:f.length)>=1&&(0,S.jsx)(vo.Z,{headerTitle:"Data completion",width:u,children:(0,S.jsx)($r.Z,{data:f.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*_.iI,50*_.iI),renderTooltipContent:function(e){var n=e.x;return"".concat((0,W.T3)(n)," of rows have a value")},xNumTicks:2,ySerialize:function(e){return e.y}})}),(null===p||void 0===p?void 0:p.length)>=1&&(0,S.jsx)(vo.Z,{headerTitle:"Number of unique values",width:u,children:(0,S.jsx)($r.Z,{data:p.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*_.iI,50*_.iI),renderTooltipContent:function(e){var n=e.x;return"".concat(n," unique values")},xNumTicks:2,ySerialize:function(e){return e.y}})}),h.length>=1&&(0,S.jsx)(vo.Z,{headerTitle:"Distribution of values",width:u,children:(0,S.jsx)($r.Z,{data:h.map((function(e){var n=e.feature,t=e.percentage;return{feature:n,value:e.value,x:t,y:n.uuid}})),height:Math.max(3*h.length*_.iI,50*_.iI),renderTooltipContent:function(e){var n=e.value,t=e.x;return"".concat(n," is ").concat((0,W.T3)(t)," of all rows")},xNumTicks:2,ySerialize:function(e){return e.y}})}),c&&(null===s||void 0===s?void 0:s.length)>=1&&(0,S.jsx)(vo.Z,{headerTitle:"Correlations",children:(0,S.jsx)(Z.Z,{p:1,children:(0,S.jsx)(mo,{countMidpoint:0,data:s,height:8*_.iI*d.length,minCount:-1,xLabels:d,yLabels:d})})})]})},go=t(92083),xo=t.n(go),jo=t(84969),yo=t(90948),ko=t(65743),Zo=t(39048),Oo=t(79487),_o=t(61655),Co=t(16853),So=t(65376),Eo=t(52359),Po=t(48072),wo=t(24903),Io=t(98677),To=t(73899);function Ao(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Do(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ao(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ao(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ro={bottom:_.iI*(3+_.cd),left:_.iI*_.cd,right:_.iI*_.cd,top:_.iI*_.cd};function Mo(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function Bo(e){var n=e.data,t=e.height,i=e.keyForYData,o=e.large,l=e.margin,c=void 0===l?{}:l,u=e.orientationVertical,a=void 0!==u&&u,d=e.showTooltip,f=e.width,p=e.yLabelFormat,h=(0,s.useContext)(v.ThemeContext),m=(0,s.useCallback)((function(e){return e[i]}),[i]),b=p;b||(b=function(e){return e.length>20?"".concat(e.substring(0,20),"..."):e});var g=o?si.iD:si.J5,x=Do(Do({},Ro),c),j=n.slice(Math.max(0,n.length-50)),y=(0,s.useMemo)((function(){return Object.keys((null===j||void 0===j?void 0:j[0])||{}).filter((function(e){return e!==i}))}),[j,i]),k=(0,wo.Z)({domain:y,range:[To.a$,To.Ej,To.hM,To.ZA,To.$R,To.X_,To.er,To.hl,To.nQ]}),Z=(0,s.useMemo)((function(){return j.map(m)}),[j,m]),O=(0,Io.Z)({domain:Z,padding:.1}),_=(0,Io.Z)({domain:y,padding:.1}),C=(0,io.Z)({domain:[0,Mo(j,(function(e){return Mo(y,(function(n){return Number(e[n])}))}))]}),S={active:(null===h||void 0===h?void 0:h.content.default)||ue.Z.content.default,backgroundPrimary:(null===h||void 0===h?void 0:h.chart.backgroundPrimary)||ue.Z.chart.backgroundPrimary,backgroundSecondary:(null===h||void 0===h?void 0:h.chart.backgroundSecondary)||ue.Z.chart.backgroundSecondary,muted:(null===h||void 0===h?void 0:h.content.muted)||ue.Z.content.muted,primary:(null===h||void 0===h?void 0:h.chart.primary)||ue.Z.chart.primary,tooltipBackground:(null===h||void 0===h?void 0:h.background.navigation)||ue.Z.background.navigation},E=Z;a&&(E=j.reduce((function(e,n){return e.concat(y.map((function(e){var t=n[e];return(0,W.HW)(t)?parseInt(String(t)):t})))}),[]));var P=Math.min(Math.max.apply(Math,(0,r.Z)(E.map((function(e){return String(e).length})))),20);x.left+=7*P;var w=f-(x.left+x.right),I=t-(x.top+x.bottom);a?(O.rangeRound([0,w]),C.rangeRound([I,0])):(O.rangeRound([I,0]),C.rangeRound([0,w])),_.rangeRound([0,O.bandwidth()]);var T=j.map(m).length,A=0;a||(A=O(E[T-1]));var D=(0,s.useCallback)((function(e){var n=(0,Po.Z)(e)||{x:0,y:0},t=n.x,i=n.y,r=t-x.left,o=i-x.top,l=0;l=a?(r-A/2)/(w-A):1-(o-A/2)/(I-A);var c=Math.floor(l*T),u=j[c];"undefined"===typeof u&&(u=j[c-1]),a?r>A&&r<w+x.left-A&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i}):o>A&&o<I-A&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i})}),[j,T,x.left,x.top,a,d,A,w,I]);return{colorScale:k,colors:S,data:j,fontSize:g,handleTooltip:D,margin:x,tempScale:C,tickValues:E,xKeys:y,xMax:w,y1Scale:_,yLabelFormat:b,yMax:I,yScale:O,ySerialize:m}}var No=["height","width","xAxisLabel","yAxisLabel"];function Lo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Fo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Lo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Lo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Uo=3*_.iI,Ho=(_.iI,_.iI,_.iI,(0,_o.Z)((function(e){var n=e.data,t=e.height,i=e.hideTooltip,r=e.keyForYData,o=void 0===r?"__y":r,c=e.large,u=e.margin,a=void 0===u?{}:u,s=e.renderNoDataText,d=e.renderTooltipContent,f=e.showTooltip,p=e.tooltipData,h=e.tooltipLeft,m=e.tooltipOpen,v=e.tooltipTop,b=e.width,g=e.xAxisLabel,x=e.xNumTicks,j=e.yLabelFormat,y=Bo({data:n,height:t,keyForYData:o,large:c,margin:a,showTooltip:f,width:b,yLabelFormat:j}),k=y.colorScale,Z=y.colors,_=y.data,C=y.fontSize,E=y.handleTooltip,P=y.margin,w=y.tempScale,I=y.tickValues,T=y.xKeys,A=y.xMax,D=y.y1Scale,R=y.yLabelFormat,M=y.yMax,B=y.yScale,N=y.ySerialize,L=[],F=Math.floor((null===I||void 0===I?void 0:I.length)/Math.floor(t/Uo));return null===I||void 0===I||I.forEach((function(e,n){n%F===0&&L.push(e)})),b<10?null:(0,S.jsxs)("div",{children:[(0,S.jsxs)("svg",{height:t,width:b,children:[s&&!(null!==_&&void 0!==_&&_.length)&&(0,S.jsx)("text",{fill:Z.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:ai.ry,fontSize:C,x:"50%",y:"50%",children:s()}),(0,S.jsx)(ko.Z,{fill:"transparent",height:t-(P.top+P.bottom),onMouseLeave:function(){return i()},onMouseMove:E,onTouchMove:E,onTouchStart:E,rx:14,width:b-(P.left+P.right),x:P.left,y:P.top}),(null===_||void 0===_?void 0:_.length)&&(0,S.jsxs)(no.Z,{left:P.left,top:P.top,children:[(0,S.jsx)(Zo.Z,{color:k,data:_,keys:T,width:A,xScale:w,y0:N,y0Scale:B,y1Scale:D,children:function(e){return e.map((function(e){return(0,S.jsx)(no.Z,{top:e.y0,children:e.bars.map((function(n){return(0,S.jsx)("g",{children:(0,S.jsx)(S.Fragment,{children:(0,S.jsx)("rect",{fill:n.color,height:n.height,pointerEvents:"none",rx:4,width:n.width,x:n.x,y:n.y})})},"".concat(e.index,"-").concat(n.index,"-").concat(n.key))}))},"bar-group-horizontal-".concat(e.index,"-").concat(e.y0))}))}}),(0,S.jsx)(jo.Z,{hideTicks:!0,scale:B,stroke:Z.muted,tickFormat:function(e){return R(e)},tickLabelProps:function(){return{fill:Z.active,fontFamily:ai.ry,fontSize:C,style:{width:"10px"},textAnchor:"end"}},tickStroke:Z.muted,tickValues:L,top:2}),(0,S.jsx)(yo.Z,{label:g,labelProps:{fill:Z.muted,fontFamily:ai.ry,fontSize:C,textAnchor:"middle"},numTicks:x,scale:w,stroke:Z.muted,tickLabelProps:function(){return{fill:Z.active,fontFamily:ai.ry,fontSize:C,textAnchor:"middle"}},tickStroke:Z.muted,top:M})]}),p&&(0,S.jsx)("g",{children:(0,S.jsx)(Oo.Z,{from:{x:P.left,y:v},pointerEvents:"none",stroke:Z.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:A+P.left,y:v}})})]}),m&&p&&(0,S.jsxs)(Co.Z,{left:h,style:Fo(Fo({},So.j),{},{backgroundColor:Z.tooltipBackground}),top:v,children:[d&&d(p),!d&&Object.entries(p).map((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];if(o!==t){var r=i;return(0,W.HW)(r)&&String(r).split(".").length>=2&&(r=r.toFixed(4)),(0,S.jsxs)(O.ZP,{inverted:!0,small:!0,children:[t,": ",r]},t)}}))]})]})})));var Go=function(e){var n,t=e.height,i=e.width,r=e.xAxisLabel,o=e.yAxisLabel,l=(0,$t.Z)(e,No);return n="undefined"===typeof i?"100%":o?0===i?i:i-28:i,(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{style:{display:"flex",height:t,marginBottom:r?_.iI:null,width:"100%"},children:[o&&(0,S.jsx)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,S.jsx)(Eo.Z,{children:(0,S.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:o})})}),(0,S.jsx)("div",{style:{height:t,width:n},children:(0,S.jsx)(eo.Z,{children:function(e){var n=e.width,t=e.height;return(0,S.jsx)(Ho,Fo(Fo({},l),{},{height:t,width:n}))}})})]}),r&&(0,S.jsx)("div",{style:{paddingLeft:o?36:0,paddingTop:4},children:(0,S.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:r})})]})},zo=t(95422),Ko=["keyForYData"],qo=["height","width","xAxisLabel","yAxisLabel"];function Qo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Wo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Qo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Qo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Vo=6*_.iI,Yo=(0,_o.Z)((function(e){var n=e.keyForYData,t=void 0===n?"__y":n,i=(0,$t.Z)(e,Ko),r=i.height,o=i.hideTooltip,c=i.renderNoDataText,u=i.renderTooltipContent,a=i.tooltipData,s=i.tooltipLeft,d=i.tooltipOpen,f=i.tooltipTop,p=i.width,h=i.xLabelFormat,m=i.xNumTicks,v=i.yNumTicks,b=Bo(Wo(Wo({},i),{},{keyForYData:t,orientationVertical:!0})),g=b.colorScale,x=b.colors,j=b.data,y=b.fontSize,k=b.handleTooltip,Z=b.margin,_=b.tempScale,C=(b.tickValues,b.xKeys),E=(b.xMax,b.y1Scale),P=b.yLabelFormat,w=b.yMax,I=b.yScale,T=b.ySerialize,A=Math.min(m,p/Vo);return p<10?null:(0,S.jsxs)("div",{children:[(0,S.jsxs)("svg",{height:r,width:p,children:[c&&!(null!==j&&void 0!==j&&j.length)&&(0,S.jsx)("text",{fill:x.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:ai.ry,fontSize:y,x:"50%",y:"50%",children:c()}),(null===j||void 0===j?void 0:j.length)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(ko.Z,{fill:"transparent",height:r-(Z.top+Z.bottom),onMouseLeave:function(){return o()},onMouseMove:k,onTouchMove:k,onTouchStart:k,rx:14,width:p-(Z.left+Z.right),x:Z.left,y:2*Z.top}),(0,S.jsxs)(no.Z,{top:Z.top,children:[(0,S.jsx)(zo.Z,{color:g,data:j,height:w,keys:C,x0:T,x0Scale:I,x1Scale:E,yScale:_,children:function(e){return e.map((function(e){return(0,S.jsx)(no.Z,{left:e.x0+Z.left,top:Z.top,children:e.bars.map((function(n){return(0,S.jsx)("g",{children:(0,S.jsx)("rect",{fill:n.color,height:n.height,pointerEvents:"none",rx:4,width:n.width,x:n.x,y:n.y})},"".concat(e.index,"-").concat(n.index,"-").concat(n.key))}))},"bar-group-horizontal-".concat(e.index,"-").concat(e.x0))}))}}),(0,S.jsx)(jo.Z,{left:Z.left,numTicks:v,scale:_,stroke:x.muted,tickFormat:function(e){return P(e)},tickLabelProps:function(){return{fill:x.active,fontFamily:ai.ry,fontSize:y,textAnchor:"end",transform:"translate(-2,2.5)"}},tickStroke:x.muted,top:Z.top}),(0,S.jsx)(yo.Z,{hideTicks:!0,left:Z.left,numTicks:A,scale:I,stroke:x.muted,tickFormat:h,tickLabelProps:function(){return{fill:x.active,fontFamily:ai.ry,fontSize:y,textAnchor:"middle"}},tickStroke:x.muted,top:w+Z.top})]})]}),a&&(0,S.jsx)("g",{children:(0,S.jsx)(Oo.Z,{from:{x:s,y:2*Z.top},pointerEvents:"none",stroke:x.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:s,y:w+2*Z.top}})})]}),d&&a&&(0,S.jsxs)(Co.Z,{left:s,style:Wo(Wo({},So.j),{},{backgroundColor:x.tooltipBackground}),top:f,children:[u&&u(a),!u&&Object.entries(a).map((function(e){var n=(0,l.Z)(e,2),i=n[0],r=n[1];if(t!==i){var o=r;return(0,W.HW)(o)&&String(o).split(".").length>=2&&(o=o.toFixed(4)),(0,S.jsxs)(O.ZP,{inverted:!0,small:!0,children:[i,": ",o]},i)}})),(0,S.jsx)("br",{}),(0,S.jsxs)(O.ZP,{inverted:!0,small:!0,children:[h&&h(T(a)),!h&&T(a)]})]})]})}));var Xo=function(e){var n=e.height,t=e.width,i=e.xAxisLabel,r=e.yAxisLabel,o=(0,$t.Z)(e,qo);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{style:{display:"flex",height:n,marginBottom:i?_.iI:null,width:"100%"},children:[r&&(0,S.jsx)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,S.jsx)(Eo.Z,{children:(0,S.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:r})})}),(0,S.jsx)("div",{style:{height:n,width:r?0===t?t:t-28:t},children:(0,S.jsx)(eo.Z,{children:function(e){var n=e.height,t=e.width;return(0,S.jsx)(Yo,Wo(Wo({},o),{},{height:n,width:t}))}})})]}),i&&(0,S.jsx)("div",{style:{paddingLeft:r?36:0,paddingTop:4},children:(0,S.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:i})})]})},Jo=t(66872),$o=t(68735),el=t(320),nl=40*_.iI,tl=v.default.div.withConfig({displayName:"indexstyle__ChartBlockStyle",componentId:"sc-1c3ufnj-0"})(["border-radius:","px;margin-left:","px;margin-right:","px;margin-top:","px;",""],Te.n_,.5*_.iI,.5*_.iI,1*_.iI,(function(e){return"\n background-color: ".concat((e.theme.background||ue.Z.background).codeArea,";\n ")})),il=v.default.div.withConfig({displayName:"indexstyle__ConfigurationOptionsStyle",componentId:"sc-1c3ufnj-1"})(["flex:4;padding-left:","px;padding-right:","px;"],1*_.iI,1*_.iI),rl=v.default.div.withConfig({displayName:"indexstyle__CodeStyle",componentId:"sc-1c3ufnj-2"})(["padding-top:","px;",""],_.iI/2,(function(e){return"\n background-color: ".concat((e.theme.background||ue.Z.background).codeTextarea,";\n ")})),ol=v.default.div.withConfig({displayName:"indexstyle__CodeHelperStyle",componentId:"sc-1c3ufnj-3"})(["margin-bottom:","px;padding-bottom:","px;padding-left:","px;",""],_.cd*_.iI,_.iI,_.iI,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.borders||ue.Z.borders).medium,";\n ")}));function ll(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function cl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ll(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ll(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ul=function(e){var n,t=e.block,i=e.data,r=e.width,c=t.configuration,u=void 0===c?{}:c,a=u||{},s=a.chart_style,d=a.chart_type,f=a.y_sort_order,p=u.height||nl,h=(null===u||void 0===u||null===(n=u.metrics)||void 0===n?void 0:n.map((function(e){return"".concat((n=e).aggregation,"(").concat(n.column,")");var n})))||[],m=fe.n1,v=u.time_interval;if([Ot.HOUR,Ot.MINUTE,Ot.SECOND].includes(v)&&(m=fe.OC),Kn.BAR_CHART===d||Kn.TIME_SERIES_BAR_CHART===d){var b=i.x,g=i.y,x=Kn.TIME_SERIES_BAR_CHART===d;if(b&&g&&Array.isArray(b)&&Array.isArray(g)){var j,y=null===(j=u.group_by)||void 0===j?void 0:j.join(", "),k=null===h||void 0===h?void 0:h.join(", ");h.length||h.push(rt);var Z=h[0],C=b.map((function(e,n){return cl({__y:e},h.reduce((function(e,t,i){var r,l=null===g||void 0===g||null===(r=g[i])||void 0===r?void 0:r[n];return"undefined"===typeof l?e:cl(cl({},e),{},(0,o.Z)({},t,l))}),{}))}));Zt.ASCENDING===f?C=(0,pe.YC)(C,(function(e){return e[Z]}),{ascending:!1}):Zt.DESCENDING===f&&(C=(0,pe.YC)(C,(function(e){return e[Z]}),{ascending:!0}));var E={data:C,height:p,renderNoDataText:function(){return"No data matching query"},width:r,xNumTicks:3};return jt.HORIZONTAL===s?(0,S.jsx)(Go,cl(cl({},E),{},{xAxisLabel:k||u.y,yAxisLabel:y||u.x})):(0,S.jsx)(Xo,cl(cl({},E),{},{xAxisLabel:y,xLabelFormat:function(e){return x?xo()(1e3*e).format(fe.n1):e},xNumTicks:C.length,yAxisLabel:k,yNumTicks:5}))}}else if(Kn.HISTOGRAM===d){var P,w=i.x,I=i.y,T=null===(P=u.group_by)||void 0===P?void 0:P.join(", ");if(w&&I&&Array.isArray(w))return(0,S.jsx)(Jo.Z,{data:w.map((function(e,n){var t,i=e.max,r=e.min;return[i,null===I||void 0===I||null===(t=I[n])||void 0===t?void 0:t.value,r]})),height:p,width:r,large:!0,margin:{left:5*_.iI,right:1*_.iI,top:3*_.iI},noPadding:!0,renderTooltipContent:function(e){var n=(0,l.Z)(e,3),t=n[0],i=n[1],r=n[2];return(0,S.jsxs)(O.ZP,{inverted:!0,monospace:!0,small:!0,children:["Count : ",i,(0,S.jsx)("br",{}),"Bucket: ",r,"-",t]})},showAxisLabels:!0,showYAxisLabels:!0,showZeroes:!0,sortData:function(e){return(0,pe.YC)(e,"[0]")},xAxisLabel:T||u.x,yAxisLabel:T?"count(".concat(T,")"):u.y})}else if(Kn.LINE_CHART===d||Kn.TIME_SERIES_LINE_CHART===d){var A=i.x,D=i.y,R=Kn.TIME_SERIES_LINE_CHART===d;if(A&&D&&Array.isArray(A)&&Array.isArray(D)&&Array.isArray(null===D||void 0===D?void 0:D[0])){var M,B=h;u.legend_labels&&(B=u.legend_labels.split(",").map((function(e){return e.trim()})));var N=A.map((function(e,n){return{x:e,y:(0,pe.w6)(D.length).map((function(e,t){var i=D[t][n];return"undefined"===typeof i||null===i?0:i}))}})),L=null===(M=u.group_by)||void 0===M?void 0:M.join(", "),F=h.join(", ");return(0,S.jsx)($o.Z,{data:N,height:p,lineLegendNames:B,margin:{bottom:8*_.iI,left:5*_.iI},noCurve:!0,renderXTooltipContent:function(e){e.index;var n=e.x,t=u.x,i=n;return u.group_by&&(t=u.group_by.map(String).join(", ")),R&&(i=xo()(1e3*n).format(m)),(0,S.jsxs)(O.ZP,{inverted:!0,small:!0,children:[t,": ",i]})},renderYTooltipContent:function(e,n){var t=e.y;return(0,S.jsxs)(O.ZP,{inverted:!0,small:!0,children:[B&&B[n]&&"".concat(B[n],": "),t&&(0,W.x6)((0,W.QV)(t[n],4))]})},width:r?r-3*_.iI:r,xAxisLabel:L||String(u.x),xLabelFormat:function(e){return R?xo()(1e3*e).format(fe.n1):e},yAxisLabel:F||String(u.y),yLabelFormat:function(e){return e}})}}else if(Kn.PIE_CHART===d){var U,H=i[String(u.x)],G=null===(U=u.group_by)||void 0===U?void 0:U.join(", ");if(H)return(0,S.jsx)(el.Z,{data:Object.entries(H),getX:function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];return"".concat(t," (").concat((0,W.x6)(i),")")},getY:function(e){return(0,l.Z)(e,2)[1]},height:p,width:r,xAxisLabel:G||String(u.x)})}else if(Kn.TABLE===d){var z=i.index,K=i.x,q=i.y;return Array.isArray(K)&&Array.isArray(q)&&Array.isArray(q[0])&&(0,S.jsx)(xn.Z,{columns:K,index:z,height:u.height?null:p,maxHeight:u.height?p:null,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,rows:q,width:r})}return(0,S.jsx)("div",{})},al=t(76096);var sl=function(e){var n=e.children,t=e.onChange,i=(0,s.useState)(s.Children.map(n,(function(){return null}))),r=i[0],o=i[1],l=(0,s.useState)(0),c=l[0],u=l[1];return(0,S.jsx)(y.Z,{children:s.Children.map(n,(function(e,n){return(0,S.jsx)(Z.Z,{ml:n>=1?1:0,style:{display:"flex",flex:1},children:s.cloneElement(e,{onChange:function(e){o((function(i){return i[n]=e.target.value,t(i,{resetValues:function(){return u((function(e){return e+1}))},setValues:o}),i}))},value:r[n]})},"multi-select-child-".concat(n,"-").concat(c))}))})};function dl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function fl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?dl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):dl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function pl(e,n){var t,i,r,c,u=e.autocompleteItems,a=e.block,f=e.blockRefs,p=e.blocks,h=e.deleteWidget,b=e.executionState,g=e.fetchPipeline,x=e.fetchFileTree,E=e.messages,P=void 0===E?[]:E,w=e.onChangeContent,I=e.pipeline,T=e.runBlock,D=e.runningBlocks,R=e.savePipelineContent,N=e.selected,L=e.setAnyInputFocused,F=e.setErrors,U=e.setSelectedBlock,H=e.setTextareaFocused,G=e.textareaFocused,z=e.updateWidget,K=e.width,q=(0,s.useRef)(null),Q=(0,s.useContext)(v.ThemeContext),Y=ce.ZP.blocks.pipelines.detail(null===I||void 0===I?void 0:I.uuid,null===a||void 0===a?void 0:a.upstream_blocks[0]).data,X=(null===Y||void 0===Y||null===(t=Y.block)||void 0===t?void 0:t.outputs)||(null===a||void 0===a?void 0:a.outputs)||[],J=(0,s.useState)(null),$=J[0],ee=J[1],ne=(0,s.useState)(null===(i=a.configuration)||void 0===i?void 0:i.chart_type),te=ne[0],ie=ne[1],re=(0,s.useState)(a.configuration),oe=re[0],de=re[1],fe=(0,s.useState)(a.content),he=fe[0],ve=fe[1],be=(0,s.useState)(!te||0===X.length),xe=be[0],je=be[1],ye=(0,s.useState)(!1),ke=ye[0],Ze=ye[1],Oe=(0,s.useState)(null),_e=Oe[0],Ce=Oe[1],Se=(0,s.useState)(null===a||void 0===a?void 0:a.upstream_blocks),Ee=Se[0],Pe=Se[1],we=(0,s.useState)((null===X||void 0===X?void 0:X.length)||0),Ie=we[0],Te=we[1],Ae=(0,s.useState)(a.uuid),De=Ae[0],Re=Ae[1],Me=Dt[te],Be=Rt[te],Ne=(0,s.useMemo)((function(){return null===p||void 0===p?void 0:p.filter((function(e){var n=e.type;return[m.tf.DATA_LOADER,m.tf.TRANSFORMER].includes(n)}))}),[p]),Le=(0,s.useMemo)((function(){return(0,pe.HK)(Ne,(function(e){return e.uuid}))}),[Ne]),Fe=!!D.find((function(e){return e.uuid===a.uuid}))||(null===P||void 0===P?void 0:P.length)>=1&&b!==ge.uF.IDLE,Ue=(0,s.useMemo)((function(){return null===P||void 0===P?void 0:P.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[P]),He=!!Ue.find((function(e){return e.error})),Ge=Ue.length>=1,ze=(0,s.useMemo)((function(){return{blockType:a.type,hasError:He,selected:N}}),[a.type,He,N]);if(null!==Ue&&void 0!==Ue&&Ue.length){var Ke,qe,Qe=Ue.length-1;c=null===Ue||void 0===Ue||null===(Ke=Ue[Qe])||void 0===Ke||null===(qe=Ke.data)||void 0===qe?void 0:qe[0]}c?(c=(c=c.slice(1,c.length-1)).replaceAll('\\"','"').replaceAll("\\'","'"),(0,W.Pb)(c)&&(r=JSON.parse(c))):(null===X||void 0===X?void 0:X.length)>=1&&(r={},X.forEach((function(e){var n=e||{},t=n.text_data,i=n.type,o=n.variable_uuid;ge.Gi.TEXT===i&&(0,W.Pb)(t)&&(r[o]=JSON.parse(t))})));var We=(0,s.useCallback)((function(e){var n=fl(fl(fl({},a),e),{},{configuration:fl(fl({},a.configuration),e.configuration)});R().then((function(){T({block:n,code:he,ignoreAlreadyRunning:!0,runUpstream:!!Ee.find((function(e){var n;return![m.DA.EXECUTED,m.DA.UPDATED].includes(null===(n=Le[e])||void 0===n?void 0:n.status)}))})})),Te((function(e){return e+1}))}),[a,Le,he,Te,Ee]),Ve=(0,s.useCallback)((function(e){ve(e),w(e)}),[w,ve]),Ye=(0,s.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.autoRun;de((function(n){return fl(fl({},n),e)}));var i=fl(fl({},a),{},{configuration:fl(fl(fl({},oe),e),{},{chart_type:te})});z(i),Ie&&t&&We(i)}),[a,te,oe,Ie,We,de,z]);(0,s.useEffect)((function(){ee({python:Si({autocompleteItems:u,block:a,blocks:p,pipeline:I})})}),[u,a,p,I]);var Xe=(0,s.useMemo)((function(){return(0,S.jsx)(vn.Z,{autoHeight:!0,autocompleteProviders:$,onChange:Ve,selected:N,setSelected:function(e){return U(!0===e?a:null)},setTextareaFocused:H,showLineNumbers:!1,textareaFocused:G||Kn.TABLE===te&&!xe,value:he,width:"100%"})}),[$,a,te,he,xe,N,U,H,G,Ve]),Je=(0,s.useMemo)((function(){return(He||Ge)&&(0,S.jsx)(qn,fl(fl({},ze),{},{block:a,contained:!1,hideExtraInfo:!0,isInProgress:Fe,messages:Ue,selected:N}))}),[a,ze,He,Ge,Fe,Ue,N]),$e=(0,ae.Z)(xe),en=(0,ae.Z)(K);(0,s.useEffect)((function(){var e,n=null===q||void 0===q||null===(e=q.current)||void 0===e?void 0:e.getBoundingClientRect();$e!==xe||en!==K?(Ce(0),setTimeout((function(){var e,n,t=null===q||void 0===q||null===(e=q.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.width;t&&Ce(t)}),100)):n&&Ce(n.width)}),[xe,$e,q,Ce,K,en]);var nn=(0,s.useMemo)((function(){var e=[];return Ee.forEach((function(n,t){var i=Le[n],r=(0,C.qn)(null===i||void 0===i?void 0:i.type,{blockColor:null===i||void 0===i?void 0:i.color,theme:Q}).accent;e.push((0,S.jsxs)(Z.Z,{ml:2,children:[(0,S.jsxs)(O.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:["df_",t+1]})," ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,S.jsx)(k.Z,{color:r,inline:!0,onClick:function(){var e,n,t=null===f||void 0===f||null===(e=f.current)||void 0===e?void 0:e["".concat(null===i||void 0===i?void 0:i.type,"s/").concat(null===i||void 0===i?void 0:i.uuid,".py")];null===t||void 0===t||null===(n=t.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,S.jsx)(O.ZP,{color:r,monospace:!0,small:!0,children:n})})]},n))})),e}),[f,Le,Q,Ee]),tn=(0,s.useMemo)((function(){var e,n=[],t=null===Me||void 0===Me||null===(e=Me.code)||void 0===e?void 0:e.reduce((function(e,n){var t=n.uuid;return xt.includes(t)?e.concat(t):e}),[]);return null===t||void 0===t||t.forEach((function(e){var t=oe[e];if(t){var i,r,o=null===(i=Mt[te])||void 0===i||null===(r=i[e])||void 0===r?void 0:r.call(i);n.push((0,S.jsxs)(Z.Z,{ml:2,children:[(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:t})," ",o&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,S.jsx)(O.ZP,{default:!0,inline:!0,small:!0,children:o})]})]},t))}})),n}),[te,oe,Me]),rn=(0,ae.Z)(te),on=(0,ae.Z)(Ee);(0,s.useEffect)((function(){if((!rn&&te&&null!==Ee&&void 0!==Ee&&Ee.length||(null===on||void 0===on||!on.length)&&(null===Ee||void 0===Ee?void 0:Ee.length)>=1&&te)&&!he&&(0,Ii.Qr)(oe)&&Be){var e=fl(fl({},a),{},{upstream_blocks:Ee});Be.configuration&&Ye(Be.configuration(e)),Be.content&&Ve(Be.content(e))}}),[a,te,rn,oe,he,Be,Ye,Ve,Ee,on]);var ln=(0,s.useMemo)((function(){return oe.width_percentage||1}),[oe]),cn=(0,s.useMemo)((function(){return Object.entries(Me||{}).reduce((function(e,n){var t=(0,l.Z)(n,2),i=t[0],r=t[1];return fl(fl({},e),{},(0,o.Z)({},i,r.map((function(e){var n,t=e.autoRun,i=e.label,r=e.monospace,l=e.options,c=e.settings,u=void 0===c?{}:c,s=e.type,d=e.uuid,f={fullWidth:!0,key:d,label:(0,W.kC)(i()),monospace:r,onBlur:function(){return U(a)},onChange:function(e){return Ye((0,o.Z)({},d,e.target.value),{autoRun:t})},onFocus:function(){return U(a)},value:(null===oe||void 0===oe?void 0:oe[d])||""},p=(null!==Y&&void 0!==Y&&Y.block?[Y.block]:[]).reduce((function(e,n){var t=n.outputs;return t?e.concat(t.reduce((function(e,n){var t=n.sample_data;return null!==t&&void 0!==t&&t.columns?e.concat(t.columns):e}),[])):e}),[]);if(It.COLUMNS===s){var h=oe[d]||[];n=(0,S.jsxs)(S.Fragment,{children:[(!u.maxValues||h.length<u.maxValues)&&(0,S.jsx)(hi.Z,fl(fl({},f),{},{onChange:function(e){var n=oe[d]||[],i=e.target.value;n.includes(i)?n=(0,pe.Od)(n,(function(e){return e===i})):n.push(i),Ye((0,o.Z)({},d,n),{autoRun:t})},value:null,children:(0,pe.YC)(p.filter((function(e){return!h.includes(e)})),(function(e){return e})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))})),h.map((function(e){return(0,S.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,S.jsx)(hr.Z,{label:e,onClick:function(){Ye((0,o.Z)({},d,(0,pe.Od)(h,(function(n){return n===e}))),{autoRun:t})}})},e)}))]})}else if(It.METRICS===s){var m=oe[d]||[];n=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.ZP,{bold:!0,children:"Metrics"}),(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:"Select a column and an aggregation function."}),(0,S.jsxs)(sl,{onChange:function(e,n){var i=n.resetValues,r=n.setValues;2===e.filter((function(e){return!!e})).length&&(m.find((function(n){var t=n.aggregation;return n.column===e[1]&&t===e[0]}))||(Ye((0,o.Z)({},d,m.concat({aggregation:e[0],column:e[1]})),{autoRun:t}),r([null,null]),i()))},children:[(0,S.jsx)(hi.Z,fl(fl({},f),{},{label:"aggregation",children:(0,pe.YC)(Tt,(function(e){return e})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))})),(0,S.jsx)(hi.Z,fl(fl({},f),{},{label:"column",children:(0,pe.YC)(p,(function(e){return e})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))}))]}),m.map((function(e){var n=e.aggregation,i=e.column;return(0,S.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,S.jsx)(hr.Z,{label:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,children:[n,"("]}),i,(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:")"})]}),onClick:function(){Ye((0,o.Z)({},d,(0,pe.Od)(m,(function(e){var t=e.aggregation,r=e.column;return n===t&&i===r}))),{autoRun:t})}})},"".concat(n,"(").concat(i,")"))}))]})}else n=l?(0,S.jsx)(hi.Z,fl(fl({},f),{},{children:l.map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))})):(0,S.jsx)(M.Z,fl(fl({},f),{},{type:s}));return(0,S.jsx)(Z.Z,{mb:1,children:n},d)}))))}),{noCode:[]})}),[a,oe,Me,Y,U,Ye]),un=cn.code,an=cn.noCode,sn=(0,d.Db)(ce.ZP.widgets.pipelines.useUpdate(null===I||void 0===I?void 0:I.uuid,a.uuid),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){Ze(!1),g(),x()},onErrorCallback:function(e,n){return null===F||void 0===F?void 0:F({errors:n,response:e})}})}}),dn=(0,l.Z)(sn,1)[0],fn="ChartBlock/".concat(a.uuid),pn=(0,V.y)(),hn=pn.registerOnKeyDown,mn=pn.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){mn(fn)}}),[mn,fn]),hn(fn,(function(e,n,t){ke&&String(t[0])===String(B.Uq)&&String(t[1])!==String(B.zX)&&dn({widget:fl(fl({},a),{},{name:De})})}),[a,ke,De,dn]),(0,S.jsx)(al.Z,{sm:12,md:12*ln,children:(0,S.jsxs)(tl,{ref:n,children:[(0,S.jsx)(Z.Z,{mt:1,pt:1,px:1,children:(0,S.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,S.jsxs)(j.Z,{flex:1,style:{position:"relative"},children:[(0,S.jsx)(oi,{bold:!1,fullWidth:!0,inputValue:De,notRequired:!0,onBlur:function(){return setTimeout((function(){return Ze(!1)}),300)},onChange:function(e){Re(e.target.value),e.preventDefault()},onClick:function(){L(!0),Ze(!0)},onFocus:function(){L(!0),Ze(!0)},small:!0,stacked:!0,value:!ke&&a.uuid}),ke&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{ml:1}),(0,S.jsx)(k.Z,{noWrapping:!0,onClick:function(){return dn({widget:fl(fl({},a),{},{name:De})})},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update chart name"})]})]}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(hi.Z,{compact:!0,onChange:function(e){var n=[e.target.value],t=fl(fl({},a),{},{upstream_blocks:n});z(t),We(t),Pe(n)},placeholder:"Source block",small:!0,value:(null===Ee||void 0===Ee?void 0:Ee[0])||"",children:null===Ne||void 0===Ne?void 0:Ne.map((function(e){var n=e.uuid;return(0,S.jsx)("option",{value:n,children:n},n)}))}),(0,S.jsx)(Z.Z,{mr:1}),!Fe&&(0,S.jsx)(le.Z,{appearBefore:!0,default:!0,label:"Run chart block",size:null,widthFitContent:!0,children:(0,S.jsx)(A.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return We(a)},uuid:"ChartBlock/run/".concat(a.uuid),children:(0,S.jsx)(se.Py,{size:2*_.iI})})}),ge.uF.QUEUED===b&&(0,S.jsx)(Kt.Z,{color:(Q||ue.Z).content.active,small:!0,type:"cylon"}),ge.uF.BUSY===b&&(0,S.jsx)(Kt.Z,{color:(Q||ue.Z).content.active,small:!0}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(le.Z,{appearBefore:!0,default:!0,label:"Edit chart",size:null,widthFitContent:!0,children:(0,S.jsx)(A.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return je((function(e){return!e}))},selected:xe,uuid:"ChartBlock/edit/".concat(a.uuid),children:(0,S.jsx)(se.I8,{size:2*_.iI})})}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(le.Z,{appearBefore:!0,default:!0,label:"Delete chart",size:null,widthFitContent:!0,children:(0,S.jsx)(A.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return h(a)},uuid:"ChartBlock/delete/".concat(a.uuid),children:(0,S.jsx)(se.rF,{size:2*_.iI})})})]})]})}),(0,S.jsx)(Z.Z,{mt:1}),(0,S.jsxs)(y.Z,{fullWidth:!0,justifyContent:"space-between",children:[(0,S.jsx)(j.Z,{flex:6,ref:q,children:r&&!(0,Ii.Qr)(r)&&(0,S.jsx)(Z.Z,{pb:3,children:(0,S.jsx)(ul,{block:fl(fl({},a),{},{configuration:fl(fl({},a.configuration),oe)}),data:r,width:_e})})}),xe&&(0,S.jsx)(il,{children:(0,S.jsxs)(y.Z,{flexDirection:"column",fullWidth:!0,children:[(0,S.jsx)(Z.Z,{mb:1,children:(0,S.jsx)(hi.Z,{onChange:function(e){var n=e.target.value,t=fl(fl({},a),{},{configuration:fl(fl({},oe),{},{chart_type:n})});z(t),We(t),ie(n)},placeholder:"Select chart type",value:te,children:kt.map((function(e){return(0,S.jsx)("option",{value:e,children:(0,W.kC)(e)},e)}))})}),(0,S.jsx)(Z.Z,{mb:1,children:(0,S.jsx)(hi.Z,{onChange:function(e){return Ye((0,o.Z)({},tt,e.target.value))},placeholder:"Chart width",value:(null===oe||void 0===oe?void 0:oe.width_percentage)||1,children:[["1/2 width",.5],["full width",1]].map((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];return(0,S.jsx)("option",{value:i,children:t},t)}))})}),an]})})]}),xe&&!(null===un||void 0===un||!un.length)&&m.t6.SQL!==a.language&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(Z.Z,{my:1,px:1,children:[(0,S.jsx)(O.ZP,{bold:!0,children:"Custom chart code"}),(0,S.jsxs)(O.ZP,{muted:!0,children:["Write custom logic mapping data to input values for your chart.",(0,S.jsx)("br",{}),"This code is only executed if you don\u2019t have any columns or metrics selected."]})]}),(0,S.jsxs)(rl,{children:[Ee.length>=1&&(0,S.jsxs)(ol,{children:[(0,S.jsxs)(O.ZP,{muted:!0,small:!0,children:["Variables you can use in your code: ",nn]}),(0,S.jsxs)(O.ZP,{muted:!0,small:!0,children:["Variables that you must define: ",tn]})]}),Xe]})]}),Je&&(0,S.jsx)(Z.Z,{px:1,children:Je})]})})}var hl=s.forwardRef(pl),ml=t(97361),vl=["blockRefs","blocks","chartRefs","deleteWidget","messages","onChangeChartBlock","runBlock","runningBlocks","savePipelineContent","selectedBlock","setAnyInputFocused","setErrors","setSelectedBlock","setTextareaFocused","textareaFocused","updateWidget","widgets","width"];function bl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function gl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?bl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):bl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var xl=function(e){var n=e.blockRefs,t=e.blocks,i=e.chartRefs,r=e.deleteWidget,l=e.messages,c=e.onChangeChartBlock,u=e.runBlock,a=e.runningBlocks,d=e.savePipelineContent,f=e.selectedBlock,p=e.setAnyInputFocused,h=e.setErrors,m=e.setSelectedBlock,v=e.setTextareaFocused,b=e.textareaFocused,g=e.updateWidget,x=e.widgets,j=e.width,k=(0,$t.Z)(e,vl),Z=(0,s.useMemo)((function(){return a.reduce((function(e,n,t){return gl(gl({},e),{},(0,o.Z)({},n.uuid,gl(gl({},n),{},{priority:t})))}),{})}),[a]);return(0,S.jsxs)(y.Z,{flexDirection:"column",fullWidth:!0,children:[(0,S.jsx)(ml.Z,{fullHeight:!0,style:{marginLeft:.5*_.iI,marginRight:.5*_.iI},children:null===x||void 0===x?void 0:x.map((function(e){var o=e.uuid,x=Z[o],y=x?0===x.priority?ge.uF.BUSY:ge.uF.QUEUED:ge.uF.IDLE;return i.current[o]=(0,s.createRef)(),(0,s.createElement)(hl,gl(gl({},k),{},{block:e,blockRefs:n,blocks:t,chartRefs:i,deleteWidget:r,executionState:y,key:o,messages:l[o],onChangeContent:function(e){return c(o,e)},ref:i.current[o],runBlock:u,runningBlocks:a,savePipelineContent:d,selected:(null===f||void 0===f?void 0:f.uuid)===o,setAnyInputFocused:p,setErrors:h,setSelectedBlock:m,setTextareaFocused:v,textareaFocused:b,updateWidget:g,width:j}))}))}),(0,S.jsx)("div",{style:{height:"80vh"}})]})},jl=v.default.svg.withConfig({displayName:"EmptyCharts__SVGStyle",componentId:"sc-ttsjrp-0"})([""]),yl=function(e){var n=e.size,t=void 0===n?20:n,i=e.viewBox,r=void 0===i?"0 0 358 305":i;return(0,S.jsxs)(jl,{height:t*(305/358),viewBox:r,width:t,children:[(0,S.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M290 47H66c-3.866 0-7 3.134-7 7v200c0 3.866 3.134 7 7 7h224c3.866 0 7-3.134 7-7V54c0-3.866-3.134-7-7-7zM66 46c-4.4183 0-8 3.5817-8 8v200c0 4.418 3.5817 8 8 8h224c4.418 0 8-3.582 8-8V54c0-4.4183-3.582-8-8-8H66z",fill:"#000"}),(0,S.jsx)("path",{fill:"#000",d:"M118 46h1v216h-1zM178 46h1v216h-1zM238 46h1v216h-1z"}),(0,S.jsx)("path",{fill:"#000",d:"M59 208.25v-1h239v1zM59 154.5v-1h239v1zM59 100.75v-1h239v1z"}),(0,S.jsx)("rect",{x:"209.651",y:"17.1125",width:"1.0163",height:"14.2284",rx:".5082",transform:"rotate(24.933 209.651 17.1125)",fill:"#2AB2FE"}),(0,S.jsx)("path",{fill:"#2AB2FE",d:"M207.788 23.5313l35.4813 16.4949-.4285.9215-35.4812-16.4948zM247.033 31.9316c.946-2.0359 3.364-2.9191 5.4-1.9726l31.795 14.7811-11.383 24.4836-31.794-14.7811c-2.036-.9465-2.92-3.3642-1.973-5.4002l7.955-17.1108z"}),(0,S.jsx)("path",{d:"M284.228 44.7401l31.795 14.7811c2.036.9465 2.919 3.3642 1.972 5.4001l-7.954 17.1109c-.947 2.0359-3.365 2.9191-5.401 1.9726l-31.795-14.7811 11.383-24.4836z",fill:"#0093E4"}),(0,S.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M352.959 83.7347a.5082.5082 0 00-.675.2466l-2.571 5.5296-35.481-16.4949-.428.9216 35.481 16.4949-2.571 5.5295a.5081.5081 0 00.247.675.5082.5082 0 00.675-.2466l5.57-11.9806a.5083.5083 0 00-.247-.6751z",fill:"#2AB2FE"}),(0,S.jsx)("circle",{cx:"55.2178",cy:"34.6274",r:"5.2954",fill:"#8ADE00"}),(0,S.jsx)("circle",{cx:"113.818",cy:"106.582",r:"5.2954",fill:"#8ADE00"}),(0,S.jsx)("circle",{cx:"84.2832",cy:"80.6953",r:"5.2954",fill:"#8ADE00"}),(0,S.jsx)("circle",{cx:"117.115",cy:"43.6274",r:"5.2954",fill:"#8ADE00"}),(0,S.jsx)("path",{d:"M337.354 256.065a38.3848 38.3848 0 01-10.816 21.271 38.3722 38.3722 0 01-21.293 10.768 38.3787 38.3787 0 01-23.542-3.895 38.3764 38.3764 0 01-16.691-17.054l17.208-8.494a19.1932 19.1932 0 0020.117 10.475 19.189 19.189 0 0010.647-5.385c2.886-2.88 4.78-6.605 5.407-10.635l18.963 2.949z",fill:"#FF3C3C"}),(0,S.jsx)("path",{d:"M294.876 288.277a38.3849 38.3849 0 01-21.64-10.056 38.3818 38.3818 0 01-11.516-20.899 38.3896 38.3896 0 013.06-23.666 38.386 38.386 0 0116.453-17.283l9.098 16.897a19.1904 19.1904 0 00-9.757 20.474 19.1937 19.1937 0 005.758 10.45 19.194 19.194 0 0010.82 5.028l-2.276 19.055z",fill:"#2ECDF7"}),(0,S.jsx)("path",{d:"M275.892 219.85a38.3804 38.3804 0 0145.342-1.268 38.3803 38.3803 0 0114.45 18.989 38.3873 38.3873 0 01.436 23.858l-18.346-5.631a19.1827 19.1827 0 00-.218-11.929 19.1907 19.1907 0 00-7.225-9.495 19.1875 19.1875 0 00-11.439-3.39 19.192 19.192 0 00-11.232 4.024l-11.768-15.158z",fill:"#885EFF"}),(0,S.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M259.206 102.57c.241.135.327.439.193.68l-39.314 70.576c-.613 1.1-1.962 1.565-3.124 1.093-3.766-1.53-13.762-5.285-26.356-7.597-12.6-2.314-27.762-3.177-41.881 1.037-16.112 4.81-27.78 14.07-35.424 22.135-3.822 4.032-6.635 7.763-8.491 10.483-.928 1.36-1.616 2.467-2.072 3.232-.228.383-.397.68-.509.881-.057.1-.098.177-.126.227l-.03.057-.008.014-.001.003a.5008.5008 0 01-.676.21.5005.5005 0 01-.209-.676l.442.233-.442-.233.001-.001.002-.005.009-.016.033-.062c.03-.055.073-.135.132-.239.116-.208.29-.513.523-.904.465-.782 1.165-1.906 2.105-3.285 1.881-2.756 4.727-6.53 8.591-10.607 7.727-8.153 19.539-17.532 35.864-22.405 14.331-4.278 29.668-3.391 42.347-1.063 12.685 2.329 22.748 6.109 26.552 7.654.699.284 1.51.002 1.875-.653l39.313-70.575a.5008.5008 0 01.681-.194z",fill:"#7D55EC"}),(0,S.jsx)("path",{d:"M221.651 176.111c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.873-1.734-3.873-3.873 0-2.139 1.734-3.873 3.873-3.873 2.139 0 3.873 1.734 3.873 3.873zM157.778 166.428c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.873-1.734-3.873-3.873 0-2.139 1.734-3.873 3.873-3.873 2.139 0 3.873 1.734 3.873 3.873zM106.428 204.191c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.8726-1.734-3.8726-3.873 0-2.139 1.7336-3.873 3.8726-3.873s3.873 1.734 3.873 3.873zM262.35 104.459c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.873-1.734-3.873-3.873 0-2.139 1.734-3.873 3.873-3.873 2.139 0 3.873 1.734 3.873 3.873z",fill:"#7D55EC"}),(0,S.jsx)("path",{d:"M8.5523 214.855c-.3562-1.045.2025-2.181 1.248-2.538l13.7251-4.677c1.0456-.356 2.1819.203 2.5382 1.248l29.6737 87.084-17.5112 5.967-29.6738-87.084z",fill:"#4776FF"}),(0,S.jsx)("path",{d:"M45.0935 264.735c-.3562-1.045.2025-2.182 1.2481-2.538l13.725-4.677c1.0455-.356 2.1819.203 2.5382 1.248l10.6438 31.237-17.5112 5.967-10.6439-31.237z",fill:"#FFCC19"}),(0,S.jsx)("path",{d:"M54.4607 234.868c-.3563-1.046.2025-2.182 1.248-2.538l13.7251-4.677c1.0455-.356 2.1819.202 2.5382 1.248l18.7879 55.137-17.5113 5.967-18.7879-55.137z",fill:"#4776FF"})]})};var kl,Zl=function(e){var n=e.blocksInNotebook;return e.extensionOption,(0,s.useMemo)((function(){return(null===n||void 0===n?void 0:n.filter((function(e){var n=e.type;return m.tf.DBT===n})))||[]}),[n]),(0,S.jsx)(S.Fragment,{})};function Ol(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function _l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ol(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ol(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}!function(e){e.DBT="dbt",e.GREAT_EXPECTATIONS="great_expectations"}(kl||(kl={}));var Cl=function(e){var n,t,i=e.block,r=e.blockActionDescription,o=e.blocks,l=e.inputPlaceholder,c=e.loading,u=e.onClickTag,a=e.runBlockAndTrack,d=e.supportedUpstreamBlockLanguages,f=e.supportedUpstreamBlockTypes,p=e.updateBlock,h=(0,s.useContext)(v.ThemeContext),m=(0,s.useState)(""),k=m[0],E=m[1],P=(0,s.useState)(!1),w=P[0],T=P[1],A=(0,s.useState)(null),D=A[0],R=A[1],B=(0,s.useMemo)((function(){return(0,pe.HK)(o,(function(e){return e.uuid}))}),[o]);(0,s.useEffect)((function(){D||R((0,pe.HK)((null===i||void 0===i?void 0:i.upstream_blocks)||[],(function(e){return e})))}),[i,D]);var N=(0,s.useMemo)((function(){return(null===o||void 0===o?void 0:o.filter((function(e){var n=e.name,t=e.type,i=e.uuid;return((null===n||void 0===n?void 0:n.toLowerCase().includes(null===k||void 0===k?void 0:k.toLowerCase()))||(null===i||void 0===i?void 0:i.toLowerCase().includes(null===k||void 0===k?void 0:k.toLowerCase())))&&(null===f||void 0===f?void 0:f.includes(t))})))||[]}),[k,o,f]),L=(0,s.useMemo)((function(){var e=[];return null===N||void 0===N||N.forEach((function(n,t){var i=n.color,r=n.language,o=n.type,l=n.uuid,c=(0,C.qn)(o,{blockColor:i,theme:h}).accent;t>=1&&e.push((0,S.jsx)(x.Z,{light:!0},"divider-".concat(l)));var u=!(null===D||void 0===D||!D[l]),a=null!==d&&"undefined"!==typeof d&&!(null!==d&&void 0!==d&&d.includes(r));e.push((0,S.jsx)(Z.Z,{px:2,py:1,children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(j.Z,{alignItems:"center",children:[(0,S.jsx)(g.Z,{color:c,size:1.5*_.iI,square:!0}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(O.ZP,{monospace:!0,muted:a,small:!0,children:l})]}),a&&(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:[r," support coming soon"]}),!a&&(0,S.jsx)(b.Z,{checked:!a&&u,disabled:a,onClick:function(){R((function(e){var n=_l({},e);return u?delete n[l]:n[l]=l,n}))}})]})},"option-".concat(l)))})),e}),[N,h,D]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(z.Z,{onClickOutside:function(){return T(!1)},open:!0,children:[(0,S.jsx)(M.Z,{beforeIcon:(0,S.jsx)(se.HN,{}),borderless:!0,compact:!0,onChange:function(e){return E(e.target.value)},onClick:function(e){(0,vi.j)(e),T(!0)},onFocus:function(e){(0,vi.j)(e),T(!0)},placeholder:l,small:!0,value:k}),w&&(0,S.jsxs)(S.Fragment,{children:[L,(0,S.jsx)(Z.Z,{mx:1,children:(0,S.jsx)(y.Z,{justifyContent:"flex-end",children:(0,S.jsx)(I.Z,{compact:!0,loading:c,onClick:function(){return p({block:i,upstream_blocks:Object.keys(D)}).then((function(){return T(!1)}))},small:!0,children:"Save selected blocks"})})})]})]}),!w&&(null===i||void 0===i||null===(n=i.upstream_blocks)||void 0===n?void 0:n.length)>=1&&(0,S.jsxs)(Z.Z,{pb:1,pr:1,children:[r&&(0,S.jsx)(Z.Z,{mt:1,pl:1,children:(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:r})}),(0,S.jsx)(y.Z,{alignItems:"center",children:null===i||void 0===i||null===(t=i.upstream_blocks)||void 0===t?void 0:t.map((function(e){var n=null===B||void 0===B?void 0:B[e];if(!n)return(0,S.jsx)("div",{},e);var t=n.color,r=n.type,o=(0,C.qn)(r,{blockColor:t,theme:h}).accentLight;return(0,S.jsx)(Z.Z,{ml:1,mt:1,children:(0,S.jsx)(I.Z,{backgroundColor:o,compact:!0,disabled:!a,onClick:function(e){(0,vi.j)(e),u?u(n):null===a||void 0===a||a({block:_l(_l({},i),{},{upstream_blocks:[null===n||void 0===n?void 0:n.uuid]})})},small:!0,children:(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:e})})},e)}))})]})]})};function Sl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function El(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Sl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Sl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Pl=function(e){var n=e.addNewBlockAtIndex,t=e.autocompleteItems,i=e.blockRefs,r=e.blocks,c=e.blocksInNotebook,u=e.deleteBlock,a=e.extensionOption,f=e.fetchFileTree,p=e.fetchPipeline,h=e.interruptKernel,v=e.messages,b=e.onChangeCallbackBlock,g=e.onChangeCodeBlock,x=e.pipeline,j=e.runBlock,y=e.runningBlocks,C=e.savePipelineContent,E=e.selectedBlock,P=e.setAnyInputFocused,w=e.setErrors,I=e.setSelectedBlock,T=e.setTextareaFocused,D=e.textareaFocused,R=(0,s.useRef)(null),M=(0,s.useState)(!1),N=M[0],L=M[1],U=(a||{}).uuid,H=(x||{}).extensions,G=(0,s.useMemo)((function(){return(null===a||void 0===a?void 0:a.templates)||[]}),[a]),K=(0,s.useMemo)((function(){return null===H||void 0===H?void 0:H[U]}),[U,H]),q=(0,s.useMemo)((function(){return(null===K||void 0===K?void 0:K.blocks)||[]}),[K]),Q=(0,s.useMemo)((function(){return(0,pe.HK)(q,(function(e){return e.uuid}))}),[q]),W=(0,s.useMemo)((function(){return U===(null===E||void 0===E?void 0:E.extension_uuid)&&Q[null===E||void 0===E?void 0:E.uuid]}),[Q,U,E]),Y=(0,s.useMemo)((function(){return y.reduce((function(e,n,t){return El(El({},e),{},(0,o.Z)({},n.uuid,El(El({},n),{},{priority:t})))}),{})}),[y]),X=(0,d.Db)((function(e){var n=e.block,t=e.upstream_blocks;return ce.ZP.blocks.pipelines.useUpdate(null===x||void 0===x?void 0:x.uuid,encodeURIComponent(null===n||void 0===n?void 0:n.uuid),{query:{extension_uuid:null===n||void 0===n?void 0:n.extension_uuid}})({block:{upstream_blocks:t}})}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){p()},onErrorCallback:function(e,n){return null===w||void 0===w?void 0:w({errors:n,response:e})}})}}),J=(0,l.Z)(X,2),$=J[0],ee=J[1].isLoading,ne=(0,s.useMemo)((function(){return q.map((function(e,n){var o=El(El({},e),{},{extension_uuid:U}),l=o.type,a=o.uuid,d=(null===E||void 0===E?void 0:E.uuid)===a,k=Y[a],O=k?0===k.priority?ge.uF.BUSY:ge.uF.QUEUED:ge.uF.IDLE,A="".concat(l,"s/").concat(a,".py");return i.current[A]=(0,s.createRef)(),(0,S.jsx)(Z.Z,{mt:_.cd,children:(0,S.jsx)(Mi,{allBlocks:r,autocompleteItems:t,block:o,blockIdx:n,blockRefs:i,blocks:r,defaultValue:o.content,deleteBlock:function(e){u(El(El({},e),{},{extension_uuid:U})),P(!1)},executionState:O,extraContent:(0,S.jsx)(Cl,{block:o,blockActionDescription:"Click a block name to run expectations on it.",blocks:c,inputPlaceholder:"Select blocks to run expectations on",loading:ee,supportedUpstreamBlockLanguages:[m.t6.PYTHON],supportedUpstreamBlockTypes:[m.tf.DATA_EXPORTER,m.tf.DATA_LOADER,m.tf.DBT,m.tf.TRANSFORMER],updateBlock:$}),fetchFileTree:f,fetchPipeline:p,hideRunButton:!0,interruptKernel:h,messages:v[a],noDivider:!0,onCallbackChange:function(e){return b(l,a,e)},onChange:function(e){return g(l,a,e)},pipeline:x,ref:i.current[A],runBlock:j,runningBlocks:y,savePipelineContent:C,selected:d,setAnyInputFocused:P,setErrors:w,setSelected:function(e){return I(!0===e?o:null)},setTextareaFocused:T,textareaFocused:d&&D})},a)}))}),[t,i,r,c,u,q,U,f,p,h,ee,v,b,g,x,j,y,Y,C,E,P,w,I,T,D,$]),te="Extensions/GreatExpectations/index",ie=(0,V.y)(),re=ie.disableGlobalKeyboardShortcuts,oe=ie.registerOnKeyDown,le=ie.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){le(te)}}),[le,te]),oe(te,(function(e,n){!re&&W&&((0,F.y)([B.zX,B.Um],n)||(0,F.y)([B.PQ,B.Um],n))&&(e.preventDefault(),C())}),[W,C]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(Z.Z,{mb:_.cd,children:[(0,S.jsx)(O.ZP,{default:!0,children:"Add an extension block to start writing expectations for blocks in the current pipeline."}),(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["When a block in your pipeline runs, it\u2019ll run any tests you define in its code. All associated extension blocks will also run during that phase. Learn more about the ",(0,S.jsx)(k.Z,{href:"https://docs.mage.ai/development/testing/great-expectations",openNewWindow:!0,children:"Great Expectation power up"}),"."]})}),(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["For all available expectations, read Great Expectation\u2019s ",(0,S.jsx)(k.Z,{href:"https://greatexpectations.io/expectations/",openNewWindow:!0,children:"documentation"}),"."]})})]}),ne,(0,S.jsx)(Z.Z,{mt:_.cd,children:(0,S.jsx)(z.Z,{onClickOutside:function(){return L(!1)},open:!0,children:(0,S.jsx)(we.Z,{disableKeyboardShortcuts:!0,items:null===G||void 0===G?void 0:G.map((function(e){var t=e.description,i=e.name,r=e.path;return{label:function(){return i},onClick:function(){return n({config:{template_path:r},extension_uuid:U,type:m.tf.EXTENSION},(null===q||void 0===q?void 0:q.length)||0)},tooltip:function(){return t},uuid:e.uuid}})),onClickCallback:function(){return L(!1)},open:N,parentRef:R,uuid:"Extension",children:(0,S.jsx)(A.ZP,{beforeElement:(0,S.jsx)(De,{teal:!0,children:(0,S.jsx)(se.mm,{size:Ae})}),inline:!0,onClick:function(e){e.preventDefault(),L(!0)},uuid:"AddNewBlocks/Extension",children:"Extension block"})})})})]})},wl=t(59e3),Il=["pipeline"];function Tl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Al(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Tl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Tl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Dl=function(e){var n=e.pipeline,t=(0,$t.Z)(e,Il),i=(0,f.useRouter)(),r=ce.ZP.extension_options.list().data,o=(0,s.useMemo)((function(){return(null===r||void 0===r?void 0:r.extension_options)||[]}),[r]),l=(0,s.useMemo)((function(){return(0,pe.HK)(o,(function(e){return e.uuid}))}),[o]),c=(0,s.useState)(null),u=c[0],a=c[1],d=(0,s.useMemo)((function(){return l[u]}),[l,u]),p=(0,s.useMemo)((function(){return Al(Al({},t),{},{pipeline:n})}),[n,t]);(0,s.useEffect)((function(){var e;a(null===(e=(0,wl.iV)())||void 0===e?void 0:e.extension)}),[i.asPath]);var h=(0,s.useMemo)((function(){return n?(kl.GREAT_EXPECTATIONS===u?e=Pl:kl.DBT===u&&(e=Zl),e?(0,S.jsx)(e,Al(Al({},p),{},{extensionOption:d})):void 0):null;var e}),[d,n,u,p]);return(0,S.jsx)(ye.W,{backend:ke.PD,children:(0,S.jsxs)(Z.Z,{p:_.cd,children:[!u&&(0,S.jsxs)(Z.Z,{mb:_.cd,children:[(0,S.jsxs)(O.ZP,{default:!0,children:["Power up your pipeline with extensions. Learn more about ",(0,S.jsx)(k.Z,{href:"https://docs.mage.ai/design/blocks/extension",openNewWindow:!0,children:"extension blocks"}),"."]}),(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["Click on a power up below to add and configure it for the ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:null===n||void 0===n?void 0:n.uuid})," pipeline."]})})]}),!r&&!u&&(0,S.jsx)(Kt.Z,{}),h,!u&&(null===o||void 0===o?void 0:o.map((function(e,n){var t=e.description,i=e.name,r=e.uuid;return(0,S.jsx)(Z.Z,{mt:n>=1?_.cd:0,children:(0,S.jsx)(k.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,he.u7)({extension:r},{pushHistory:!0})},preventDefault:!0,children:(0,S.jsx)(D.Z,{dark:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(j.Z,{alignItems:"center",children:[(0,S.jsx)(Er,{fullWidth:!1,children:(0,S.jsx)(Z.Z,{p:_.cd,children:(0,S.jsx)(y.Z,{alignItems:"center",children:(0,S.jsx)("img",{alt:i,height:3*_.iI,src:"/images/extensions/".concat(r,"/logo.png"),width:3*_.iI})})})}),(0,S.jsx)(Z.Z,{mr:_.cd}),(0,S.jsxs)(j.Z,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{bold:!0,children:i}),(0,S.jsx)(O.ZP,{default:!0,small:!0,children:t})]})]}),(0,S.jsx)(se._Q,{})]})})})},r)})))]})})},Rl=t(88560),Ml=t(86585),Bl=(v.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-43nc8t-0"})(["border-radius:","px;",""],Te.TR,(function(e){return"\n border: 1px solid ".concat((e.theme.interactive||ro.Z.interactive).defaultBorder,";\n ")})),v.default.div.withConfig({displayName:"indexstyle__ColumnProfileStyle",componentId:"sc-43nc8t-1"})(["",""],(function(e){return"\n background: ".concat((e.theme.background||ro.Z.background).table,";\n border-bottom: 1px solid ").concat((e.theme.interactive||ro.Z.interactive).defaultBorder,";\n border-right: 1px solid ").concat((e.theme.interactive||ro.Z.interactive).defaultBorder,";\n ")}))),Nl=(v.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-43nc8t-2"})(["background:",";padding:","px ","px;"," border-top-left-radius:","px;border-top-right-radius:","px;"],To.Uq,1.75*_.iI,_.tr,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||ro.Z.interactive).defaultBorder,";\n ")}),Te.TR,Te.TR),v.default.div.withConfig({displayName:"indexstyle__FeatureProfileStyle",componentId:"sc-43nc8t-3"})(["",""],(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||ro.Z.interactive).defaultBorder,";\n ")}))),Ll=(v.default.div.withConfig({displayName:"indexstyle__BodyStyle",componentId:"sc-43nc8t-4"})(["border-bottom-left-radius:","px;border-bottom-right-radius:","px;overflow-y:scroll;"],Te.TR,Te.TR),v.default.div.withConfig({displayName:"indexstyle__CellStyle",componentId:"sc-43nc8t-5"})([""," padding:","px;"],(function(e){return e.backgroundColor&&"\n background-color: ".concat(e.backgroundColor,";\n ")}),_.iI)),Fl=v.default.div.withConfig({displayName:"indexstyle__ScrollOverflowStyle",componentId:"sc-43nc8t-6"})([""," overflow-x:auto;"],Tn.w5);function Ul(e,n){return{average:e["".concat(n,"/average")],avg_string_length:e["".concat(n,"/avg_string_length")],avg_word_count:e["".concat(n,"/avg_word_count")],completeness:e["".concat(n,"/completeness")],count:e["".concat(n,"/count")],count_distinct:e["".concat(n,"/count_distinct")],invalid_indices:e["".concat(n,"/invalid_indices")],invalid_value_count:e["".concat(n,"/invalid_value_count")],invalid_value_rate:e["".concat(n,"/invalid_value_rate")],invalid_values:e["".concat(n,"/invalid_values")],max:e["".concat(n,"/max")],max_character_count:e["".concat(n,"/max_character_count")],max_null_seq:e["".concat(n,"/max_null_seq")],max_word_count:e["".concat(n,"/max_word_count")],median:e["".concat(n,"/median")],min:e["".concat(n,"/min")],min_character_count:e["".concat(n,"/min_character_count")],min_word_count:e["".concat(n,"/min_word_count")],mode:e["".concat(n,"/mode")],null_value_count:e["".concat(n,"/null_value_count")],null_value_rate:e["".concat(n,"/null_value_rate")],outlier_count:e["".concat(n,"/outlier_count")],outlier_ratio:e["".concat(n,"/outlier_ratio")],outliers:e["".concat(n,"/outliers")],quality:e["".concat(n,"/quality")],skew:e["".concat(n,"/skew")],std:e["".concat(n,"/std")],sum:e["".concat(n,"/sum")],unique_value_rate:e["".concat(n,"/unique_value_rate")],validity:e["".concat(n,"/validity")],value_counts:e["".concat(n,"/value_counts")]}}var Hl=["Type","Missing","Unique","Min","Max","Mean","Median","Mode","Invalid","Outliers","Skewness","Std dev"],Gl={Missing:0,Invalid:0,Outliers:0,Unique:.9};function zl(e){var n=e.columns,t=e.feature,i=e.shouldLink,r=e.statistics,o=(0,s.useContext)(v.ThemeContext),l=t.columnType,c=t.uuid,u=Ul(r,c),a=u.average,d=u.avg_string_length,f=u.avg_word_count,p=u.count,h=u.count_distinct,m=u.invalid_value_count,b=u.invalid_value_rate,g=u.max,x=u.max_character_count,C=u.max_word_count,E=u.min,P=u.min_character_count,w=u.min_word_count,I=u.median,T=u.mode,A=u.null_value_count,D=u.null_value_rate,R=u.outlier_count,M=u.skew,B=u.std,N=u.unique_value_rate,L=[l,A,h,E,g,a,I,T,m,R,M,B],F={Min:w,Max:C,Mean:f},U={Min:"".concat((0,W._6)("character",P)),Max:"".concat((0,W._6)("character",x)),Mean:"".concat((0,W._6)("character",(0,W.QV)(d)))},H={Invalid:(0,W.T3)(b),Missing:(0,W.T3)(D),Unique:(0,W.T3)(N)},G=Ml.T5[l],z=[o.background.row,o.background.row2],K=z[0],q=z[1],Q=i?k.Z:O.ZP;return(0,S.jsxs)(j.Z,{flexDirection:"column",children:[(0,S.jsx)(Nl,{children:(0,S.jsx)(Z.Z,{px:1,py:2,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[G&&(0,S.jsxs)(j.Z,{title:Rl.Rp[l],children:[(0,S.jsx)(G,{size:2*_.iI}),"\xa0"]}),(0,S.jsx)(Q,{inline:!0,onClick:i?function(){return(0,he.u7)({column:n.indexOf(c)},{pushHistory:!0})}:void 0,preventDefault:!0,secondary:!0,children:(0,S.jsx)(O.ZP,{bold:!0,default:!i,maxWidth:25*_.iI,monospace:!0,secondary:i,textOverflow:!0,title:c,children:c})})]})})}),L.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"-",n=arguments.length>1?arguments[1]:void 0,t=Hl[n],i=l===Rl.RL.TEXT&&t in F,r=i?F[t]:e,o=isNaN(r)?r:(0,W.QV)(r),c=t in Gl&&o/p>Gl[t];return(0,S.jsx)(Ll,{backgroundColor:n%2===0?K:q,children:(0,S.jsxs)(O.ZP,{bold:c,danger:c,default:!0,textOverflow:!0,title:i?U[t]:"",children:[i?"".concat((0,W._6)("word",o)):o,t in H&&" (".concat(H[t],")")]})},n)}))]})}var Kl=function(e){var n=e.features,t=void 0===n?[]:n,i=e.shouldLink,r=e.statistics,o=(0,s.useContext)(v.ThemeContext),l=(0,s.useMemo)((function(){return t.map((function(e){return e.uuid}))}),[t]);return(0,S.jsx)(vo.Z,{headerTitle:"Feature profiles",children:(0,S.jsxs)(y.Z,{children:[(0,S.jsx)(Bl,{children:(0,S.jsxs)(j.Z,{flex:1,flexDirection:"column",style:{background:o.background.table},children:[(0,S.jsx)(Z.Z,{mr:1.25*_.iI,mt:"".concat(53,"px")}),Hl.map((function(e,n){return(0,S.jsx)(Ll,{children:(0,S.jsx)(O.ZP,{default:!i,secondary:i,children:e})},"".concat(e,"-").concat(n))}))]})}),(0,S.jsx)(Fl,{children:(0,S.jsx)(y.Z,{children:t.map((function(e,n){return(0,S.jsx)(Nl,{children:(0,S.jsx)(zl,{columns:l,feature:e,shouldLink:i,statistics:r})},"".concat(e,"-").concat(n))}))})})]})})},ql=t(23351),Ql=t(21764),Wl=t(22673),Vl=t(52769),Yl=t(1286),Xl=(_.iI,Yl.O$,_.iI,si.dN,v.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-cr39lf-0"})(["height:calc(100vh - ","px - ","px);width:fit-content;",""],qr.Wi,Tn.nn,(function(e){return e.fullWidth&&"\n width: 100%;\n "})),v.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-cr39lf-1"})(["padding:","px;",""],2*_.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "})),v.default.table.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-cr39lf-2"})(["",""],(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}))),Jl=v.default.td.withConfig({displayName:"indexstyle__CellStyle",componentId:"sc-cr39lf-3"})(["display:flex;align-items:center;justify-content:space-between;border:1px solid #1C1C1C;height:100%;",""],(function(e){return!e.noPadding&&"\n padding: 0 ".concat(2*_.iI,"px;\n ")})),$l=t(19963);var ec=function(e){var n=e.copyText,t=e.deleteVariable,i=e.fetchVariables,r=e.hideEdit,o=e.obfuscate,c=e.pipelineUUID,u=e.variable,a=u.uuid,f=(u.type,u.value),p=(0,s.useRef)(null),h=(0,s.useState)(!1),m=h[0],v=h[1],b=(0,s.useState)(a),g=b[0],x=b[1],y=(0,s.useState)(f),k=y[0],Z=y[1],C=(0,s.useState)(!1),E=C[0],P=C[1],w=(0,d.Db)(ce.ZP.variables.pipelines.useUpdate(c,a),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){P(!1),i()}})}}),I=(0,l.Z)(w,1)[0],T=(0,s.useCallback)((function(e){if("Enter"===e.key){var n=k;try{n=JSON.parse(k)}catch(t){}I({variable:{name:g,value:n}})}else"Escape"===e.key&&P(!1)}),[g,k]);(0,s.useEffect)((function(){var e;E&&(null===p||void 0===p||null===(e=p.current)||void 0===e||e.focus())}),[E,p]);var D=n||"kwargs['".concat(a,"']");return(0,S.jsx)("div",{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},children:(0,S.jsxs)(ml.Z,{children:[(0,S.jsx)(al.Z,{md:1,hiddenSmDown:!0,children:(0,S.jsx)(Jl,{noPadding:!0,children:(0,S.jsx)(A.ZP,{backgroundColor:$l.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(D),Ql.Am.success("Successfully copied to clipboard.",{position:Ql.Am.POSITION.BOTTOM_RIGHT,toastId:a})},small:!0,uuid:"Sidekick/GlobalVariables/".concat(a),withIcon:!0,children:(0,S.jsx)(se.CK,{size:2.5*_.iI})})})}),(0,S.jsx)(al.Z,{md:4,children:E?(0,S.jsx)(Jl,{children:(0,S.jsx)(M.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){x(e.target.value),e.preventDefault()},onKeyDown:T,paddingHorizontal:0,placeholder:"variable",small:!0,value:g})}):(0,S.jsx)(Jl,{children:(0,S.jsx)(O.ZP,{color:To.Or,monospace:!0,small:!0,textOverflow:!0,children:a})})}),(0,S.jsx)(al.Z,{md:7,children:E?(0,S.jsx)(Jl,{children:(0,S.jsx)(M.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){Z(e.target.value),e.preventDefault()},onKeyDown:T,paddingHorizontal:0,placeholder:"enter value",ref:p,small:!0,value:k})}):(0,S.jsxs)(Jl,{children:[o?(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:"********"}):(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:f}),(0,S.jsxs)(j.Z,{children:[!r&&m&&(0,S.jsx)(A.ZP,{backgroundColor:$l.qJ,borderless:!0,inline:!0,muted:!0,onClick:function(){P(!0)},small:!0,uuid:"Sidekick/GlobalVariables/edit_".concat(a),withIcon:!0,children:(0,S.jsx)(se.I8,{size:2.5*_.iI})}),t&&m&&(0,S.jsx)(A.ZP,{backgroundColor:$l.qJ,borderless:!0,inline:!0,muted:!0,onClick:t,small:!0,uuid:"Sidekick/GlobalVariables/delete_".concat(a),withIcon:!0,children:(0,S.jsx)(se.rF,{size:2.5*_.iI})})]})]})})]})})},nc=t(93348),tc=t(58122);var ic=function(e){e.blocks;var n=e.fetchVariables,t=e.pipeline,i=e.selectedBlock,r=e.setErrorMessages,o=e.variables,c=e.width,u=(0,s.useState)(!1),a=u[0],f=u[1],p=(0,s.useState)(),h=p[0],v=p[1],b=(0,s.useState)(),g=b[0],x=b[1],j=null===t||void 0===t?void 0:t.uuid,C=(0,d.Db)(ce.ZP.variables.pipelines.useCreate(j),{onSuccess:function(e){return(0,me.wD)(e,{onErrorCallback:function(e){var n=e.error,t=n.message,i=n.exception;r((function(e){var n=e||[];return i&&(n=n.concat(i)),t&&(n=n.concat(t)),n}))}})}}),E=(0,l.Z)(C,1)[0],P=(0,d.Db)((function(e){return ce.ZP.variables.pipelines.useDelete(j,e)()}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),w=(0,l.Z)(P,1)[0],I=(0,s.useCallback)((function(e){if("Enter"===e.key){var t=g;try{t=JSON.parse(g)}catch(i){}E({variable:{name:h,value:t}}).then((function(){n(),v(null),x(null)})),f(!1)}else"Escape"===e.key&&f(!1)}),[E,n,h,g]),T=(0,s.useMemo)((function(){return c-4*_.iI}),[c]),D=(0,s.useMemo)((function(){return(0,tc.wx)(o,(function(e){return e.uuid===Vl.C}))}),[o]),R=(0,s.useMemo)((function(){return(0,tc.wx)(o,(function(e){return e.uuid===(null===i||void 0===i?void 0:i.uuid)}))}),[i,o]),B=(0,s.useMemo)((function(){return(0,S.jsxs)(Xl,{width:T,children:[a&&(0,S.jsxs)(ml.Z,{children:[(0,S.jsx)(al.Z,{md:1,children:(0,S.jsx)(Jl,{noPadding:!0,children:(0,S.jsx)(A.ZP,{backgroundColor:$l.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(h),Ql.Am.success("Successfully copied to clipboard.",{position:Ql.Am.POSITION.BOTTOM_RIGHT,toastId:h})},uuid:"Sidekick/GlobalVariables/".concat(h),withIcon:!0,children:(0,S.jsx)(se.CK,{size:2.5*_.iI})})})}),(0,S.jsx)(al.Z,{md:4,children:(0,S.jsx)(Jl,{children:(0,S.jsx)(M.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){v(e.target.value),e.preventDefault()},onKeyDown:I,paddingHorizontal:0,placeholder:"variable",small:!0,value:h})})}),(0,S.jsx)(al.Z,{md:7,children:(0,S.jsx)(Jl,{children:(0,S.jsx)(M.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){x(e.target.value),e.preventDefault()},onKeyDown:I,paddingHorizontal:0,placeholder:"enter value",small:!0,value:g})})})]}),null===D||void 0===D?void 0:D.map((function(e){return(0,S.jsx)(ec,{deleteVariable:function(){return w(e.uuid)},fetchVariables:n,pipelineUUID:j,variable:e},e.uuid)}))]})}),[w,D,h,g,j,v,x,f,a,T]),N=(0,s.useMemo)((function(){return(0,S.jsx)(Xl,{width:T,children:null===R||void 0===R?void 0:R.map((function(e){return(0,S.jsx)(ec,{copyText:(n=e.uuid,"from mage_ai.data_preparation.variable_manager import (\n get_variable,\n)\n\n".concat(function(e,n,t){return"\n".concat(t," = get_variable('").concat(e,"', '").concat(n,"', '").concat(t,"')\n")}(j,null===i||void 0===i?void 0:i.uuid,n))),hideEdit:!0,pipelineUUID:j,variable:e},e.uuid);var n}))})}),[R,i,T]);return(0,S.jsxs)(Z.Z,{p:_.cd,children:[(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(ui.Z,{level:4,monospace:!0,children:"Global Variables"}),(0,S.jsx)(Z.Z,{ml:2}),(0,S.jsx)(A.ZP,{Icon:se.mm,blackBorder:!0,inline:!0,onClick:function(){return f((function(e){return!e}))},uuid:"Sidekick/GlobalVariables/addNewVariable",children:"New"})]})}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsxs)(O.ZP,{muted:!0,children:["Press ",(0,S.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,S.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,S.jsx)(Z.Z,{mb:_.cd,children:B}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsx)(O.ZP,{children:"Global variables will be passed into all non-scratchpad blocks as keyword arguments (Python), interpolated variables (SQL), or vector elements (R). To load a global variable, use the following syntax:"})}),(0,S.jsxs)(Z.Z,{mb:_.cd,children:[(0,S.jsxs)(O.ZP,{bold:!0,large:!0,children:["For Python (",(0,S.jsx)(k.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/runtime-variable",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,S.jsx)(Wl.Z,{language:"python",small:!0,source:"\n var = kwargs['variable_name']\n"})]}),(0,S.jsxs)(Z.Z,{mb:_.cd,children:[(0,S.jsxs)(O.ZP,{bold:!0,large:!0,children:["For SQL (",(0,S.jsx)(k.Z,{href:"https://docs.mage.ai/guides/sql-blocks#variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,S.jsx)(Wl.Z,{language:"sql",small:!0,source:"\n {{ variable_name }}\n"})]}),(0,S.jsxs)(Z.Z,{mb:_.cd,children:[(0,S.jsxs)(O.ZP,{bold:!0,large:!0,children:["For R (",(0,S.jsx)(k.Z,{href:"https://docs.mage.ai/guides/r-blocks#runtime-variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,S.jsx)(Wl.Z,{language:"r",small:!0,source:"\n var <- global_vars['variable_name']\n"})]}),(0,S.jsxs)(Z.Z,{mb:_.cd,children:[(0,S.jsx)(ui.Z,{level:4,monospace:!0,children:"Trigger Runtime Variables"}),(0,S.jsx)(Z.Z,{mb:_.cd}),(0,S.jsx)(O.ZP,{children:"Depending on what kind of trigger you use for this pipeline, some default runtime variables will be provided."})]}),Object.values(nc.Xm).map((function(e,n){var t;return(0,S.jsxs)(Z.Z,{mb:_.cd,children:[(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsx)(O.ZP,{large:!0,monospace:!0,children:(0,W.vg)(null===(t=nc.Z4[e])||void 0===t?void 0:t.call(nc.Z4))})}),(0,tc.JZ)([],e).map((function(n,t){return(0,S.jsx)(ec,{hideEdit:!0,pipelineUUID:j,variable:n},"var_".concat(e,"_").concat(t))}))]},"".concat(e,"_").concat(n))})),R&&R.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{my:2,children:(0,S.jsx)(ui.Z,{level:4,monospace:!0,children:"Block Output Variables"})}),(0,S.jsx)(Z.Z,{mb:2,children:N}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsxs)(O.ZP,{children:["Output variables can be used in any ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,warning:!0,children:m.tf.SCRATCHPAD})," block. They are for scratchpad blocks, specifically. To get upstream block outputs inside of other blocks, use the positional arguments."]})}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsx)(O.ZP,{children:"To load the variable in a scratchpad block, use the following syntax:"})}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsx)(Wl.Z,{language:"python",small:!0,source:"\n from mage_ai.data_preparation.variable_manager import (\n get_variable,\n )\n\n\n df = get_variable(\n 'pipeline_uuid',\n 'block_uuid',\n 'variable_name',\n )\n"})})]})]})},rc=v.default.div.withConfig({displayName:"indexstyle__OutputContainerStyle",componentId:"sc-wkjnrg-0"})([""," overflow-y:scroll;"," ",""],Tn.w5,(function(e){return e.height&&"\n height: ".concat(e.height,"px;\n ")}),(function(e){return!e.height&&"\n max-height: ".concat(e.maxHeight||300,"px;\n ")}));function oc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function lc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?oc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):oc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var cc=function(e){var n=e.cancelPipeline,t=e.checkIfPipelineRunning,i=e.executePipeline,r=e.isPipelineExecuting,o=e.pipelineExecutionHidden,l=e.pipelineMessages,c=e.setPipelineExecutionHidden,u=(0,s.useMemo)((function(){return(null===l||void 0===l?void 0:l.length)||0}),[l]),a=(0,s.useMemo)((function(){return u>100?l.slice(-100):l}),[u,l]),d=(0,s.useCallback)((function(){var e=!o;c(e),(0,L.t8)(L.Q9,e)}),[o,c]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(j.Z,{children:[(0,S.jsx)(I.Z,{beforeIcon:(0,S.jsx)(se.JM,{inverted:!0,size:2*_.iI}),compact:r,disabled:r,loading:r,onClick:i,success:!0,children:(0,S.jsx)(O.ZP,{bold:!0,inverted:!0,primary:!1,children:"Execute pipeline"})}),(0,S.jsx)(Z.Z,{ml:1}),r&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(I.Z,{beforeIcon:(0,S.jsx)(se.x8,{inverted:!0,size:2*_.iI}),onClick:n,success:!0,children:(0,S.jsx)(O.ZP,{bold:!0,inverted:!0,primary:!1,children:"Cancel pipeline"})}),(0,S.jsx)(Z.Z,{ml:1})]}),(0,S.jsx)(I.Z,{onClick:t,secondary:!0,children:"Running status"})]}),(0,S.jsxs)(j.Z,{alignItems:"center",children:[(0,S.jsx)(Z.Z,{ml:1}),(0,S.jsx)(O.ZP,{children:"Hide"}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(mr.Z,{checked:o,onCheck:d})]})]}),!o&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Z.Z,{mb:1}),(0,S.jsx)(rc,{noScrollbarTrackBackground:!0,children:(0,S.jsx)(kn,{executedAndIdle:!0,hasError:!1,selected:!0,children:a.map((function(e,n){var t=e.data,i=e.type,r=[],o=(r=(r=Array.isArray(t)?t:[t]).filter((function(e){return e}))).length;return r.map((function(e,t){var r,l={first:0===n&&0===t,last:n===u-1&&t===o-1};return ge.jU.includes(i)?r=(0,S.jsx)(Zn,lc(lc({},l),{},{children:(0,S.jsx)(O.ZP,{monospace:!0,preWrap:!0,children:(0,S.jsx)(gn(),{children:e})})})):i===ge.Gi.IMAGE_PNG&&(r=(0,S.jsx)("div",{style:{backgroundColor:"white"},children:(0,S.jsx)("img",{alt:"Image ".concat(n," from code output"),src:"data:image/png;base64, ".concat(e)})})),(0,S.jsx)("div",{children:r},"code-output-".concat(n,"-").concat(t))}))}))})})]})]})};var uc=function(e){var n=e.fetchSecrets,t=e.pipelineUUID,i=e.secrets,r=e.setErrorMessages,o=e.width,c=(0,s.useState)(!1),u=c[0],a=c[1],f=(0,s.useState)(),p=f[0],h=f[1],m=(0,s.useState)(),v=m[0],b=m[1],g=(0,s.useMemo)((function(){return o-_.cd*_.iI*2}),[o]),x=(0,d.Db)(ce.ZP.secrets.useCreate(),{onSuccess:function(e){return(0,me.wD)(e,{onErrorCallback:function(e){var n=e.error,t=n.message,i=n.exception;r((function(e){var n=e||[];return i&&(n=n.concat(i)),t&&(n=n.concat(t)),n}))}})}}),j=(0,l.Z)(x,1)[0],k=(0,d.Db)((function(e){return ce.ZP.secrets.useDelete(e)()}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),C=(0,l.Z)(k,1)[0],E=(0,s.useCallback)((function(e){"Enter"===e.key?(j({secret:{name:p,value:v}}).then((function(){n(),h(null),b(null)})),a(!1)):"Escape"===e.key&&a(!1)}),[j,n,p,v]);return(0,S.jsxs)(Z.Z,{p:_.cd,children:[(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(ui.Z,{level:4,monospace:!0,children:"Secrets"}),(0,S.jsx)(Z.Z,{ml:2}),(0,S.jsx)(A.ZP,{Icon:se.mm,blackBorder:!0,inline:!0,onClick:function(){return a((function(e){return!e}))},uuid:"Sidekick/Secrets/addNewSecret",children:"New"})]})}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsxs)(O.ZP,{children:[(0,S.jsx)(O.ZP,{inline:!0,warning:!0,children:"WARNING:"})," the encryption key is stored in a file on your machine. If you need more secure encryption, we recommend using a secrets manager."]})}),u&&(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsxs)(O.ZP,{muted:!0,children:["Press ",(0,S.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,S.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsxs)(Xl,{width:g,children:[u&&(0,S.jsxs)(ml.Z,{children:[(0,S.jsx)(al.Z,{md:1,children:(0,S.jsx)(Jl,{noPadding:!0,children:(0,S.jsx)(A.ZP,{backgroundColor:$l.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText("{{ mage_secret_var(".concat(p,") }}")),Ql.Am.success("Successfully copied to clipboard.",{position:Ql.Am.POSITION.BOTTOM_RIGHT,toastId:p})},uuid:"Sidekick/Secrets/".concat(p),withIcon:!0,children:(0,S.jsx)(se.CK,{size:2.5*_.iI})})})}),(0,S.jsx)(al.Z,{md:4,children:(0,S.jsx)(Jl,{children:(0,S.jsx)(M.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){h(e.target.value),e.preventDefault()},onKeyDown:E,paddingHorizontal:0,placeholder:"secret name",small:!0,value:p})})}),(0,S.jsx)(al.Z,{md:7,children:(0,S.jsx)(Jl,{children:(0,S.jsx)(M.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){b(e.target.value),e.preventDefault()},onKeyDown:E,paddingHorizontal:0,placeholder:"secret value",small:!0,value:v})})})]}),null===i||void 0===i?void 0:i.map((function(e){return(0,S.jsx)(ec,{deleteVariable:function(){return C(e.name)},fetchVariables:n,hideEdit:!0,obfuscate:!0,pipelineUUID:t,variable:{uuid:e.name,value:e.value}},e.name)}))]})}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsx)(O.ZP,{children:"Secrets are not editable, they can only be created and deleted. Secrets are shared across the project, and can be used in configuration fields. To reference a secret, use the following templating syntax:"})}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsx)(Wl.Z,{language:"yaml",small:!0,source:"\n \"{{ mage_secret_var('<secret_name>') }}\"\n ",maxWidth:g})}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsx)(O.ZP,{children:"To reference a secret in code, you can import the `get_secret_value` helper method:"})}),(0,S.jsx)(Z.Z,{mb:_.cd,children:(0,S.jsx)(Wl.Z,{language:"python",small:!0,source:"\n from mage_ai.data_preparation.shared.secrets import get_secret_value\n\n get_secret_value('<secret_name>')\n ",maxWidth:g})})]})},ac=t(66607),sc=t(33699),dc=t(72454),fc=t(64155),pc=t(91835);function hc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function mc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?hc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):hc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var vc=function(e){var n=e.addNewBlockAtIndex,t=e.addOnBlocks,i=e.addOnBlockType,r=e.autocompleteItems,c=e.blockRefs,u=e.blocks,a=e.blocksInNotebook,f=e.deleteBlock,p=e.displayBlockName,h=e.fetchFileTree,v=e.fetchPipeline,b=e.interruptKernel,g=e.messages,x=(e.onChangeCallbackBlock,e.onChangeCodeBlock),j=e.onSelectBlockFile,y=e.pipeline,C=e.runBlock,E=e.runningBlocks,P=e.savePipelineContent,w=e.selectedBlock,I=e.setAnyInputFocused,T=e.setErrors,D=e.setHiddenBlocks,R=e.setSelectedBlock,M=e.setTextareaFocused,N=e.textareaFocused,L=(0,s.useRef)(null),U=(0,s.useState)(!1),H=U[0],G=U[1],K=(0,wl.iV)().block_uuid;(0,s.useEffect)((function(){var e=u.find((function(e){var n,t=e.uuid;return(null===K||void 0===K||null===(n=K.split(":"))||void 0===n?void 0:n[0])===t}));e&&(w&&(null===e||void 0===e?void 0:e.uuid)===(null===w||void 0===w?void 0:w.uuid)||(D((function(n){return mc(mc({},n),{},(0,o.Z)({},e.uuid,!1))})),j(e.uuid,e.type,null)))}),[K,u,j,w,D]);var q=(y||{}).type,Q=(0,s.useMemo)((function(){return(0,pe.HK)(t||[],(function(e){return e.uuid}))}),[t]),Y=ce.ZP.block_templates.list({},{revalidateOnFocus:!1}).data,X=(0,s.useMemo)((function(){return(null===Y||void 0===Y?void 0:Y.block_templates)||[]}),[Y]),J=(0,s.useCallback)((function(e){return n(e,(null===Q||void 0===Q?void 0:Q.length)||0)}),[n,Q]),$=(0,s.useMemo)((function(){return Je(X,J)}),[J,X]),ee=(0,s.useMemo)((function(){return $e(J,i,q,{blockTemplatesByBlockType:$,languages:[m.t6.PYTHON]})}),[J,i,$,q]),ne=(0,s.useMemo)((function(){return null===Q||void 0===Q?void 0:Q[null===w||void 0===w?void 0:w.uuid]}),[Q,w]),te=(0,s.useMemo)((function(){return E.reduce((function(e,n,t){return mc(mc({},e),{},(0,o.Z)({},n.uuid,mc(mc({},n),{},{priority:t})))}),{})}),[E]),ie=(0,d.Db)((function(e){var n=e.block,t=e.upstream_blocks;return ce.ZP.blocks.pipelines.useUpdate(null===y||void 0===y?void 0:y.uuid,encodeURIComponent(null===n||void 0===n?void 0:n.uuid),{query:{block_type:null===n||void 0===n?void 0:n.type}})({block:{upstream_blocks:t}})}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){v()},onErrorCallback:function(e,n){return null===T||void 0===T?void 0:T({errors:n,response:e})}})}}),re=(0,l.Z)(ie,2),oe=re[0],le=re[1].isLoading,ue=(0,s.useMemo)((function(){return null===t||void 0===t?void 0:t.map((function(e,n){var t=e.type,i=e.uuid,l=(null===w||void 0===w?void 0:w.uuid)===i,d=te[i],k=d?0===d.priority?ge.uF.BUSY:ge.uF.QUEUED:ge.uF.IDLE,O="".concat(t,"s/").concat(i,".py");return c.current[O]=(0,s.createRef)(),(0,S.jsx)(Z.Z,{mt:_.cd,children:(0,S.jsx)(Mi,{allBlocks:u,autocompleteItems:r,block:e,blockIdx:n,blockRefs:c,blocks:u,defaultValue:e.content,deleteBlock:function(e){f(mc({},e)),I(!1)},executionState:k,extraContent:(0,S.jsx)(Cl,{block:e,blocks:a,inputPlaceholder:"Select blocks to add ".concat((0,W._6)(p,null)," to"),loading:le,onClickTag:function(e){D((function(n){return mc(mc({},n),{},(0,o.Z)({},e.uuid,!1))})),j(e.uuid,e.type,null)},supportedUpstreamBlockTypes:[m.tf.CUSTOM,m.tf.DATA_EXPORTER,m.tf.DATA_LOADER,m.tf.DBT,m.tf.SCRATCHPAD,m.tf.SENSOR,m.tf.TRANSFORMER],updateBlock:oe}),fetchFileTree:h,fetchPipeline:v,hideRunButton:!0,interruptKernel:b,messages:g[i],noDivider:!0,onChange:function(e){return x(t,i,e)},pipeline:y,ref:c.current[O],runBlock:C,runningBlocks:E,savePipelineContent:P,selected:l,setAnyInputFocused:I,setErrors:T,setSelected:function(n){return R(!0===n?e:null)},setTextareaFocused:M,textareaFocused:l&&N})},i)}))}),[t,r,c,u,a,f,p,h,v,b,le,g,x,j,y,C,E,te,P,w,I,T,D,R,M,N,oe]),ae="".concat(p,"/index"),de=(0,V.y)(),fe=de.disableGlobalKeyboardShortcuts,he=de.registerOnKeyDown,ve=de.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){ve(ae)}}),[ve,ae]),he(ae,(function(e,n){!fe&&ne&&((0,F.y)([B.zX,B.Um],n)||(0,F.y)([B.PQ,B.Um],n))&&(e.preventDefault(),P())}),[ne,P]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(Z.Z,{mb:_.cd,children:[(0,S.jsxs)(O.ZP,{default:!0,children:["Run 1 or more ",(0,W.wX)(p)," block functions whenever another block succeeds or fails."]}),(0,S.jsx)(Z.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["Learn more about ",(0,S.jsx)(k.Z,{href:"https://docs.mage.ai/development/blocks/".concat((0,W.wX)((0,W._6)(p,null)),"/overview"),openNewWindow:!0,children:(0,W.wX)((0,W._6)(p,null))}),"."]})})]}),ue,(0,S.jsx)(Z.Z,{mt:_.cd,children:(0,S.jsx)(z.Z,{onClickOutside:function(){return G(!1)},open:!0,children:(0,S.jsx)(we.Z,{disableKeyboardShortcuts:!0,items:ee,onClickCallback:function(){return G(!1)},open:H,parentRef:L,uuid:p,children:(0,S.jsxs)(A.ZP,{beforeElement:(0,S.jsx)(De,{rose:i===m.tf.CALLBACK,children:(0,S.jsx)(se.mm,{size:Ae})}),inline:!0,onClick:function(e){e.preventDefault(),G(!0)},uuid:"AddNewBlocks/".concat(p),children:[(0,W.kC)(p)," block"]})})})})]})};function bc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function gc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?bc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):bc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var xc=[{Icon:se.AQ,name:"Callbacks",uuid:fn.CALLBACK},{Icon:se.hW,name:"Conditionals",uuid:fn.CONDITIONAL}];var jc=function(e){var n=(0,pc.Z)({},e),t=(0,f.useRouter)(),i=(0,s.useState)(null),r=i[0],o=i[1];(0,s.useEffect)((function(){var e;o(null===(e=(0,wl.iV)())||void 0===e?void 0:e.addon)}),[t.asPath]);var l=(0,s.useMemo)((function(){var e,t;if(fn.CALLBACK===r)e={addOnBlockType:m.tf.CALLBACK,addOnBlocks:null===(t=n.pipeline)||void 0===t?void 0:t.callbacks,displayBlockName:"callback"};else if(fn.CONDITIONAL===r){var i;e={addOnBlockType:m.tf.CONDITIONAL,addOnBlocks:null===(i=n.pipeline)||void 0===i?void 0:i.conditionals,displayBlockName:"conditional"}}if(e)return(0,S.jsx)(vc,gc(gc({},e),n))}),[n,r]);return(0,S.jsx)(ye.W,{backend:ke.PD,children:(0,S.jsxs)(Z.Z,{p:_.cd,children:[l,!r&&(null===xc||void 0===xc?void 0:xc.map((function(e,n){var t=e.name,i=e.uuid,r=e.Icon;return(0,S.jsx)(Z.Z,{mt:n>=1?_.cd:0,children:(0,S.jsx)(k.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,he.u7)({addon:i},{pushHistory:!0})},preventDefault:!0,children:(0,S.jsx)(D.Z,{dark:!0,children:(0,S.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(j.Z,{alignItems:"center",children:[(0,S.jsx)(Er,{fullWidth:!1,children:(0,S.jsx)(Z.Z,{p:_.cd,children:(0,S.jsx)(y.Z,{alignItems:"center",children:(0,S.jsx)(r,{fill:"#885EFF",size:2*_.iI})})})}),(0,S.jsx)(Z.Z,{mr:_.cd}),(0,S.jsx)(j.Z,{flexDirection:"column",children:(0,S.jsx)(O.ZP,{bold:!0,children:t})})]}),(0,S.jsx)(se._Q,{})]})})})},i)})))]})})};function yc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function kc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?yc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):yc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Zc=function(e){var n=e.activeView,t=e.addNewBlockAtIndex,i=e.afterWidth,r=e.autocompleteItems,l=e.blockRefs,c=e.blocks,u=e.blocksInNotebook,a=e.cancelPipeline,d=e.chartRefs,f=e.checkIfPipelineRunning,h=e.deleteBlock,m=e.deleteWidget,v=e.editingBlock,b=e.executePipeline,g=e.fetchFileTree,x=e.fetchPipeline,j=e.fetchSecrets,k=e.fetchVariables,C=e.globalVariables,E=e.insights,P=e.interruptKernel,w=e.isPipelineExecuting,T=e.lastTerminalMessage,A=e.messages,D=e.metadata,M=e.onChangeCallbackBlock,B=e.onChangeChartBlock,N=e.onChangeCodeBlock,F=e.onSelectBlockFile,U=e.pipeline,H=e.pipelineMessages,G=e.runBlock,z=e.runningBlocks,K=e.sampleData,q=e.savePipelineContent,Q=e.secrets,W=e.selectedBlock,V=e.selectedFilePath,Y=e.sendTerminalMessage,X=e.setAllowCodeBlockShortcuts,J=e.setAnyInputFocused,$=e.setDepGraphZoom,ee=e.setDisableShortcuts,ne=e.setEditingBlock,te=e.setErrors,ie=e.setHiddenBlocks,re=e.setSelectedBlock,oe=e.setTextareaFocused,le=e.statistics,ce=e.textareaFocused,ue=e.treeRef,ae=e.updateWidget,de=e.widgets,fe=(0,Wr.i)().height,he=qr.uX,me=(0,s.useState)([]),ve=me[0],be=me[1],ge=(0,s.useState)(!!(0,L.U2)(L.Q9)),xe=ge[0],je=ge[1],ye=(0,s.useMemo)((function(){return i-(dc.k1+1)}),[i]),ke=((null===v||void 0===v?void 0:v.upstreamBlocks)||{}).block,Ze=((null===K||void 0===K?void 0:K.columns)||[]).slice(0,100),Oe=(null===K||void 0===K?void 0:K.rows)||[],_e=(null===D||void 0===D?void 0:D.column_types)||{},Ce=null===Ze||void 0===Ze?void 0:Ze.map((function(e){return{columnType:_e[e],uuid:e}})),Se=(null===E||void 0===E?void 0:E[1])||{},Ee=(0,s.useMemo)((function(){return(0,pe.HK)((null===E||void 0===E?void 0:E[0])||[],(function(e){return e.feature.uuid}))}),[E]),Pe=(0,tc.v0)({statistics:le}),we=(0,tc.CL)({columnTypes:_e,statistics:le}),Ie=!!K,Te=(0,s.useMemo)((function(){return R.qL.INTEGRATION===(null===U||void 0===U?void 0:U.type)}),[U]),Ae=R.qL.STREAMING!==(null===U||void 0===U?void 0:U.type)?-70:xe?-16:300,De=(0,s.useCallback)((0,Yl.Fk)({columnTypes:_e,columns:Ze,insightsByFeatureUUID:Ee,insightsOverview:Se,noColumnLinks:!0,statistics:le}),[_e,Ze,Ee,Se,le]),Re=(0,s.useMemo)((function(){return(0,S.jsx)(ic,{blocks:c,fetchVariables:k,pipeline:U,selectedBlock:W,setErrorMessages:be,variables:C,width:ye})}),[ye,c,k,C,U,W]),Me=(0,s.useMemo)((function(){return(0,S.jsx)(ql.Z,{selectedBlock:W,selectedFilePath:V,setErrors:te,width:ye>Tn.nn?ye-Tn.nn:ye})}),[ye,W,V,te]),Be=(0,s.useMemo)((function(){return(0,S.jsx)(uc,{fetchSecrets:j,pipelineUUID:null===U||void 0===U?void 0:U.uuid,secrets:Q,setErrorMessages:be,width:ye})}),[ye,j,U,Q]),Ne={addNewBlockAtIndex:t,autocompleteItems:r,blockRefs:l,blocks:c,blocksInNotebook:u,deleteBlock:h,fetchFileTree:g,fetchPipeline:x,interruptKernel:P,messages:A,onChangeCallbackBlock:M,onChangeCodeBlock:N,onSelectBlockFile:F,pipeline:U,runBlock:G,runningBlocks:z,savePipelineContent:q,selectedBlock:W,setAnyInputFocused:J,setErrors:te,setHiddenBlocks:ie,setSelectedBlock:re,setTextareaFocused:oe,textareaFocused:ce};return(0,S.jsxs)(S.Fragment,{children:[(null===ve||void 0===ve?void 0:ve.length)>=1&&(0,S.jsxs)(Z.Z,{mb:3,mt:2,mx:2,children:[(0,S.jsxs)(y.Z,{justifyContent:"space-between",children:[(0,S.jsx)(O.ZP,{bold:!0,danger:!0,children:"Errors"}),(0,S.jsx)(I.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return be([])},transparent:!0,children:(0,S.jsx)(se.x8,{muted:!0})})]}),null===ve||void 0===ve?void 0:ve.map((function(e){return(0,S.jsx)(Z.Z,{pb:1,children:(0,S.jsx)(O.ZP,{monospace:!0,xsmall:!0,children:e})},e)}))]}),(0,S.jsxs)(fc.t0,{fullWidth:!0,heightOffset:hn.cH.TERMINAL===n?0:Tn.nn,onBlur:function(){V||ee(!1),null===X||void 0===X||X(!1)},onFocus:function(){ee(!0),n===hn.cH.TREE&&(null===X||void 0===X||X(!0))},children:[n===hn.cH.TREE&&(0,S.jsx)(p.Z,{uuid:"PipelineDetail/".concat(null===U||void 0===U?void 0:U.uuid),children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(jn.Z,{blockRefs:l,editingBlock:v,enablePorts:!Te,fetchPipeline:x,height:fe-he-Ae,onClickNode:function(e){var n=e.block.uuid;return ie((function(e){var t=!(null===e||void 0===e||!e[n]);return t?kc(kc({},e),{},(0,o.Z)({},n,!t)):e}))},pipeline:U,runningBlocks:z,selectedBlock:W,setEditingBlock:ne,setErrors:te,setSelectedBlock:re,setZoom:$,treeRef:ue}),!ke&&R.qL.STREAMING===(null===U||void 0===U?void 0:U.type)&&(0,S.jsx)(Z.Z,{p:1,children:(0,S.jsx)(cc,{cancelPipeline:a,checkIfPipelineRunning:f,executePipeline:b,isPipelineExecuting:w,pipelineExecutionHidden:xe,pipelineMessages:H,setPipelineExecutionHidden:je})})]})}),n===hn.cH.DATA&&Ze.length>0&&(0,S.jsx)(xn.Z,{columnHeaderHeight:(0,Ii.Qr)(_e)&&(0,Ii.Qr)(Ee)&&(0,Ii.Qr)(Se)?0:fc.Eh,columns:Ze,height:fe-he-qr.OM,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,renderColumnHeader:De,rows:Oe,width:ye}),n===hn.cH.REPORTS&&(0,S.jsx)(fc.ht,{noPadding:!W||!Ie,children:(0,S.jsxs)(y.Z,{flexDirection:"column",fullWidth:!0,children:[Pe&&(0,S.jsx)(ac.Z,{stats:Pe,title:"Quality metrics"}),we&&(0,S.jsx)(Z.Z,{mt:_.cd,children:(0,S.jsx)(ac.Z,{stats:we,title:"Statistics"})}),Ce.length>0&&(0,S.jsx)(Z.Z,{mt:_.cd,children:(0,S.jsx)(Kl,{features:Ce,statistics:le})})]})}),n===hn.cH.GRAPHS&&(0,S.jsx)(fc.ht,{noPadding:!W||!Ie,children:(0,S.jsx)(bo,{afterWidth:ye,features:Ce,insightsOverview:Se,statistics:le})}),hn.cH.SECRETS===n&&Be,hn.cH.VARIABLES===n&&Re,hn.cH.FILE_VERSIONS===n&&(0,S.jsx)(p.Z,{uuid:"FileVersions/".concat(V?decodeURIComponent(V):""),children:Me}),Te||W&&Ie||!W&&Ie&&n===hn.cH.DATA?null:hn.du.includes(n)&&(0,S.jsx)(y.Z,{alignItems:"center",justifyContent:"center",verticalHeight:hn.fp,verticalHeightOffset:he,width:ye,children:(0,S.jsx)(O.ZP,{center:!0,default:!0,disableWordBreak:!0,large:!0,monospace:!0,children:W?!Ie&&"No data or insights available":"Select a block for insights"})}),hn.cH.CHARTS===n&&(de.length>0?(0,S.jsx)(xl,{autocompleteItems:r,blockRefs:l,blocks:c,chartRefs:d,deleteWidget:m,fetchFileTree:g,fetchPipeline:x,messages:A,onChangeChartBlock:B,pipeline:U,runBlock:G,runningBlocks:z,savePipelineContent:q,selectedBlock:W,setAnyInputFocused:J,setErrors:te,setSelectedBlock:re,setTextareaFocused:oe,textareaFocused:ce,updateWidget:ae,widgets:de,width:ye}):(0,S.jsxs)(y.Z,{alignItems:"center",flexDirection:"column",justifyContent:"center",verticalHeight:hn.fp,verticalHeightOffset:he,width:ye,children:[(0,S.jsx)(Z.Z,{px:1,children:(0,S.jsx)(y.Z,{flexDirection:"row",children:(0,S.jsxs)(O.ZP,{center:!0,default:!0,children:["Add a chart by clicking the chart icon \xa0",(0,S.jsx)(se.GQ,{size:1.5*_.iI}),"\xa0in",(0,S.jsx)("br",{}),"the top right corner of a block (if applicable)."]})})}),(0,S.jsx)(Z.Z,{mt:_.cd,px:1,children:(0,S.jsx)(yl,{size:40*_.iI})})]})),hn.cH.TERMINAL===n&&(0,S.jsx)("div",{style:{height:"100%",position:"relative",width:ye},children:(0,S.jsx)(sc.Z,{lastMessage:T,onFocus:function(){return re(null)},sendMessage:Y,width:ye})}),hn.cH.EXTENSIONS===n&&(0,S.jsx)(Dl,kc({},Ne)),hn.cH.ADDON_BLOCKS===n&&(0,S.jsx)(jc,kc({},Ne))]})]})},Oc=t(12691),_c=t.n(Oc),Cc=t(35438);function Sc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ec(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Sc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Sc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Pc=function(e){var n,t=e.activeView,i=e.depGraphZoom,r=e.pipeline,o=e.secrets,l=e.treeRef,c=e.variables,u=null===r||void 0===r?void 0:r.uuid,a=(0,wl.iV)(),d=(0,tc.wx)(c,(function(e){return e.uuid===Vl.C})),f=hn.Qq[t],p=(null===f||void 0===f||null===(n=f.buildLabel)||void 0===n?void 0:n.call(f,{pipeline:r,secrets:o,variables:d}))||(null===f||void 0===f?void 0:f.label),h=(0,S.jsx)(O.ZP,{bold:!0,children:p}),m=hn.cH.EXTENSIONS===t&&(null===a||void 0===a?void 0:a.extension),v=ce.ZP.extension_options.list({},{},{pauseFetch:!m}).data,b=(0,s.useMemo)((function(){return(null===v||void 0===v?void 0:v.extension_options)||[]}),[v]),g=(0,s.useMemo)((function(){return(0,pe.HK)(b,(function(e){return e.uuid}))}),[b]),x=hn.cH.ADDON_BLOCKS===t&&(null===a||void 0===a?void 0:a.addon);if(!t)return(0,S.jsx)("div",{});if(l&&hn.cH.TREE===t)h=(0,S.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[h,(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsxs)(j.Z,{alignItems:"center",children:[(0,S.jsx)(I.Z,Ec(Ec({},Cc.Ai),{},{onClick:function(){var e,n;null===l||void 0===l||null===(e=l.current)||void 0===e||null===(n=e.zoomIn)||void 0===n||n.call(e)},children:(0,S.jsx)(O.ZP,{noWrapping:!0,children:"Zoom in"})})),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(I.Z,Ec(Ec({},Cc.Ai),{},{onClick:function(){var e,n;null===l||void 0===l||null===(e=l.current)||void 0===e||null===(n=e.zoomOut)||void 0===n||n.call(e)},children:(0,S.jsx)(O.ZP,{noWrapping:!0,children:"Zoom out"})})),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsx)(le.Z,{appearAbove:!0,appearBefore:!0,default:!0,label:"Shortcut: Double-click canvas",lightBackground:!0,size:null,widthFitContent:!0,children:(0,S.jsx)(I.Z,Ec(Ec({},Cc.Ai),{},{onClick:function(){var e,n;null===l||void 0===l||null===(e=l.current)||void 0===e||null===(n=e.fitCanvas)||void 0===n||n.call(e)},children:(0,S.jsx)(O.ZP,{noWrapping:!0,children:"Reset"})}))}),(0,S.jsx)(Z.Z,{mr:1}),(0,S.jsxs)(O.ZP,{bold:!0,children:[null===i||void 0===i?void 0:i.toFixed(2),"x"]})]})]});else if(m){var _=g[null===a||void 0===a?void 0:a.extension];h=(0,S.jsxs)(y.Z,{children:[(0,S.jsx)(_c(),{as:"/pipelines/".concat(u,"/edit?").concat(hn.uM,"=").concat(hn.cH.EXTENSIONS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,S.jsx)(k.Z,{default:!0,children:p})}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,S.jsx)(O.ZP,{bold:!0,children:null===_||void 0===_?void 0:_.name})]})}else x&&(h=(0,S.jsxs)(y.Z,{children:[(0,S.jsx)(_c(),{as:"/pipelines/".concat(u,"/edit?").concat(hn.uM,"=").concat(hn.cH.ADDON_BLOCKS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,S.jsx)(k.Z,{default:!0,children:p})}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,S.jsx)(O.ZP,{bold:!0,children:(0,W.vg)(null===a||void 0===a?void 0:a.addon)})]}));return(0,S.jsx)(qr.ym,{children:h})},wc=t(3055),Ic=t(59920),Tc=t(36405);function Ac(e){var n=e.activeView,t=e.pipeline,i=e.secrets,r=e.setActiveSidekickView,o=e.variables,l=(0,tc.wx)(o,(function(e){return e.uuid===Vl.C}));return hn.j5.map((function(e){var o=e.buildLabel,c=e.key,u=e.label;return{Icon:hn.Z7[c],id:c,isSelected:function(){return n===c},label:function(){return(null===o||void 0===o?void 0:o({pipeline:t,secrets:i,variables:l}))||u},onClick:function(){return r(c,!0)}}}))}var Dc=t(28799);function Rc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Mc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Rc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Rc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Bc(e){var n,t,i=e.page,c=e.pipeline,u=(0,f.useRouter)(),v=(0,Wr.i)().height,b=u.query.pipeline,g=c.uuid||b,x=(0,s.useState)(!!(0,L.U2)(L.zg)),j=x[0],k=x[1],O=(0,s.useState)(null),C=O[0],E=O[1],P=(0,s.useState)(null),D=P[0],M=P[1],B=(0,s.useState)(null),F=B[0],z=B[1],K=(0,s.useState)(null),q=K[0],Q=K[1],V=(0,s.useState)([]),Y=V[0],X=V[1],J=(0,s.useState)({}),$=J[0],ie=J[1],re=(0,s.useState)(!1),le=re[0],ue=re[1],xe=(0,s.useState)(!1),je=xe[0],ye=xe[1],ke=(0,s.useState)(!1),Ze=ke[0],Oe=ke[1],_e=(0,s.useState)(!1),Ce=_e[0],Se=_e[1],Ee=(0,s.useState)(1),Pe=Ee[0],we=Ee[1],Ie="".concat(N.H8,"_").concat(g),Te=(0,L.U2)(Ie),Ae=(0,s.useState)((0,pe.sE)(Qr.NR,(function(e){return e.uuid===Te}))||Qr.NR[0]),De=Ae[0],Re=Ae[1],Me=(0,s.useCallback)((function(e){Re(e),(0,L.t8)(Ie,null===e||void 0===e?void 0:e.uuid)}),[Ie,Re]),Be="".concat(N.g6,"_").concat(g),Ne=(0,s.useState)({}),Le=Ne[0],Fe=Ne[1],Ue=(0,s.useCallback)((function(e){Fe((function(n){var t=e(n);return(0,L.t8)(Be,JSON.stringify(t)),t}))}),[Be,Fe]);(0,s.useEffect)((function(){var e=(0,L.U2)(Be);e&&(0,W.Pb)(e)&&Fe(JSON.parse(e))}),[Be,Fe]);var He=(0,s.useRef)(null),Ge=ce.ZP.statuses.list({},{revalidateOnFocus:!1}).data,ze=(0,s.useMemo)((function(){var e,n;return null===Ge||void 0===Ge||null===(e=Ge.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.disable_pipeline_edit_access}),[Ge]),Ke=(0,s.useMemo)((function(){var e,n;return null===Ge||void 0===Ge||null===(e=Ge.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.max_print_output_lines}),[Ge]),qe=(0,s.useState)({}),Qe=qe[0],We=qe[1],Ve=(0,s.useState)([]),Ye=Ve[0],Xe=Ve[1],Je=ce.ZP.kernels.list({},{refreshInterval:5e3,revalidateOnFocus:!0}),$e=Je.data,en=Je.mutate,nn=null===$e||void 0===$e?void 0:$e.kernels,tn=(null===nn||void 0===nn?void 0:nn.find((function(e){return e.name===R.a_[null===fn||void 0===fn?void 0:fn.type]})))||(null===nn||void 0===nn?void 0:nn[0]),rn=(0,ae.Z)(g),on=ce.ZP.pipelines.detail(g,{includes_outputs:(0,Ii.Qr)(Qe)},{refreshInterval:6e4}),ln=on.data,cn=on.mutate,un=ce.ZP.files.list(),an=un.data,sn=un.mutate,dn=(0,s.useMemo)((function(){return(null===an||void 0===an?void 0:an.files)||[]}),[an]),fn=null===ln||void 0===ln?void 0:ln.pipeline,pn=(0,s.useMemo)((function(){return R.qL.INTEGRATION===(null===fn||void 0===fn?void 0:fn.type)}),[fn]),mn=(0,s.useState)(null),vn=mn[0],bn=mn[1],gn=(0,s.useState)((0,fe.Tz)({dateObj:!0})),xn=gn[0],jn=gn[1],yn=(0,s.useState)(!1),kn=yn[0],Zn=yn[1],On=(0,ve.dd)((function(){return(0,S.jsx)(oe.Z,{centerOnScreen:!0,neutral:!0,onClick:Sn,subtitle:"Please refresh your page to have the most up-to-date data before making any changes.",title:"Your pipeline may be stale.",width:34*_.iI})}),{},[],{background:!0,uuid:"stale_pipeline_message"}),_n=(0,l.Z)(On,2),Cn=_n[0],Sn=_n[1];(0,s.useEffect)((function(){var e,n;null!==ln&&void 0!==ln&&null!==(e=ln.pipeline)&&void 0!==e&&e.updated_at&&(null===vn||void 0===vn?void 0:vn.toISOString())!==new Date(null===ln||void 0===ln||null===(n=ln.pipeline)||void 0===n?void 0:n.updated_at).toISOString()&&bn(new Date(ln.pipeline.updated_at)),vn&&Number(vn)>Number(xn)&&Cn()}),[null===ln||void 0===ln||null===(n=ln.pipeline)||void 0===n?void 0:n.updated_at,vn,xn,Cn]),(0,s.useEffect)((function(){(0,me.bB)(ln,M)}),[ln]);var wn=(0,wl.iV)(),Tn=wn[hn.uM],An=wn.block_uuid,Dn=wn.file_path,Rn=(0,s.useMemo)((function(){var e=wn["file_paths[]"]||[];return Array.isArray(e)||(e=[e]),e}),[wn]),Mn=(0,s.useCallback)((function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=arguments.length>2?arguments[2]:void 0,i=(0,o.Z)({},hn.uM,e);null!==t&&void 0!==t&&t.blockUUID&&(i.block_uuid=null===t||void 0===t?void 0:t.blockUUID),null!==t&&void 0!==t&&t.addon&&(i.addon=null===t||void 0===t?void 0:t.addon),(0,he.u7)(i,{preserveParams:["addon","block_uuid","file_path","file_paths[]"],pushHistory:n,replaceParams:!0})}),[]);(0,s.useEffect)((function(){Tn||Mn(hn.cH.TREE,!1)}),[Tn,Mn]);var Bn=(0,s.useCallback)((function(e,n,t){k(!1),setTimeout((function(){return Mn(e,n,t)}),1)}),[Mn]),Nn=(0,s.useRef)({}),Ln=(0,s.useRef)({}),Un=(0,s.useRef)(null),Hn=(0,s.useRef)({}),Gn=(0,s.useRef)({}),zn=(0,s.useRef)({}),Kn=(0,s.useCallback)((function(e,n,t){var i=Hn.current||{};Hn.current=Mc(Mc({},i),{},(0,o.Z)({},e,Mc(Mc({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[Hn]),qn=(0,s.useCallback)((function(e,n,t){var i=Gn.current||{};Gn.current=Mc(Mc({},i),{},(0,o.Z)({},e,Mc(Mc({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[Gn]),Qn=(0,s.useCallback)((function(e,n,t){Kn(e,n,t),Zn(!0)}),[Kn,Zn]),Wn=(0,s.useCallback)((function(e,n,t){qn(e,n,t),Zn(!0)}),[qn,Zn]),Vn=(0,s.useCallback)((function(e){zn.current=Mc(Mc({},zn.current),e)}),[zn]),Yn=(0,s.useCallback)((function(e,n){Vn((0,o.Z)({},e,n)),Zn(!0)}),[Vn,Zn]),Xn=(0,s.useState)(null),Jn=Xn[0],$n=Xn[1],et=ce.ZP.data_providers.list({},{revalidateOnFocus:!1}).data,nt=null===et||void 0===et?void 0:et.data_providers,tt=ce.ZP.variables.pipelines.list(g,{},{revalidateOnFocus:!1}),it=tt.data,rt=tt.mutate,ot=null===it||void 0===it?void 0:it.variables,lt=ce.ZP.secrets.list({},{revalidateOnFocus:!1}),ct=lt.data,ut=lt.mutate,at=null===ct||void 0===ct?void 0:ct.secrets,st=(0,s.useState)([]),dt=st[0],ft=st[1],pt=(0,s.useState)([]),ht=pt[0],mt=pt[1],vt=(0,s.useRef)({}),bt=(0,s.useCallback)((function(e){var n;Zn(!0);var t=vt.current[e.uuid]||{},i=t.upstream_blocks;(null===e||void 0===e||null===(n=e.upstream_blocks)||void 0===n?void 0:n.length)>=1&&(i=e.upstream_blocks),vt.current[e.uuid]=Mc(Mc(Mc({},t),e),{},{configuration:Mc(Mc({},t.configuration),e.configuration),upstream_blocks:i})}),[Zn,vt]),gt=(0,s.useState)(!1),xt=gt[0],jt=gt[1],yt=(0,s.useState)({upstreamBlocks:null}),kt=yt[0],Zt=yt[1],Ot=(0,s.useState)([]),_t=Ot[0],Ct=Ot[1],St=(0,s.useState)(null),Et=St[0],Pt=St[1],wt=(0,Fn.Dp)(g),It=(0,Fn.Q9)(wt,dt),Tt=(0,s.useState)(It),At=Tt[0],Dt=Tt[1],Rt=(0,s.useState)(),Mt=Rt[0],Bt=Rt[1],Nt=(0,s.useState)(),Lt=Nt[0],Ft=Nt[1],Ut=(0,s.useState)(null),Ht=Ut[0],Gt=Ut[1],zt=(0,ae.Z)(At),Kt=(0,s.useCallback)((function(){Zt({upstreamBlocks:{block:null,values:[]}}),We({}),Zn(!1),Ct([]),Pt(null)}),[]);(0,s.useEffect)((function(){g!==rn&&(Hn.current={},Gn.current={})}),[g,rn]);var qt=ce.ZP.block_outputs.detail((null===Ht||void 0===Ht?void 0:Ht.type)!==m.tf.SCRATCHPAD&&(null===Ht||void 0===Ht?void 0:Ht.type)!==m.tf.CHART&&(null===Ht||void 0===Ht?void 0:Ht.uuid)&&encodeURIComponent(null===Ht||void 0===Ht?void 0:Ht.uuid),{pipeline_uuid:!j&&g}),Qt=qt.data,Wt=qt.mutate,Vt=(0,s.useMemo)((function(){return null===Qt||void 0===Qt?void 0:Qt.block_output}),[Qt]),Yt=(0,s.useMemo)((function(){var e,n,t;return pn?null===(e=(0,pe.sE)(null===Vt||void 0===Vt?void 0:Vt.outputs,(function(e){return e.variable_uuid==="output_sample_data_".concat((0,W.kE)(Lt))})))||void 0===e?void 0:e.sample_data:null===Vt||void 0===Vt||null===(n=Vt.outputs)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.sample_data}),[Vt,pn,Lt]),Xt=ce.ZP.blocks.pipelines.analyses.detail(!j&&g,(null===Ht||void 0===Ht?void 0:Ht.type)!==m.tf.SCRATCHPAD&&(null===Ht||void 0===Ht?void 0:Ht.type)!==m.tf.CHART&&(null===Ht||void 0===Ht?void 0:Ht.uuid)&&encodeURIComponent(null===Ht||void 0===Ht?void 0:Ht.uuid)),Jt=Xt.data,$t=Xt.mutate,ei=(null===Jt||void 0===Jt||null===(t=Jt.analyses)||void 0===t?void 0:t[0])||{},ni=ei.insights,ti=void 0===ni?{}:ni,ii=ei.metadata,ri=void 0===ii?{}:ii,oi=ei.statistics,li=void 0===oi?{}:oi;(0,s.useEffect)((function(){0===_t.length&&($t(),Wt(),rt())}),[$t,Wt,rt,_t]),(0,s.useEffect)((function(){if(0===At.length)Gt(null);else if((null===zt||void 0===zt?void 0:zt.length)!==(null===At||void 0===At?void 0:At.length)&&(null===At||void 0===At?void 0:At.length)<(null===zt||void 0===zt?void 0:zt.length)){var e=zt.findIndex((function(e){return e.uuid===(null===Ht||void 0===Ht?void 0:Ht.uuid)})),n=zt.length-1===e?e-1:e+1;Gt(zt[Math.max(0,n)])}}),[At,zt,null===Ht||void 0===Ht?void 0:Ht.uuid]),(0,s.useEffect)((function(){var e;null!==(e=kt.upstreamBlocks)&&void 0!==e&&e.block&&(k(!1),Mn(hn.cH.TREE))}),[kt.upstreamBlocks,Mn]);var ci=ce.ZP.autocomplete_items.list({},{refreshInterval:!1,revalidateOnFocus:!1}),ui=ci.data,ai=ci.mutate,si=null===ui||void 0===ui?void 0:ui.autocomplete_items;(0,s.useEffect)((function(){Dn||Oe(!1),Q(Dn)}),[Dn]),(0,s.useEffect)((function(){(0,pe.fS)(Rn,Y)||X(Rn)}),[Rn,Y]);var di=(0,d.Db)(ce.ZP.pipelines.useCreate(),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){var n=e.pipeline.uuid;u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(n,"/edit")),sn()},onErrorCallback:function(e,n){return M({errors:n,response:e})}})}}),fi=(0,l.Z)(di,1)[0],pi=(0,d.Db)(ce.ZP.pipelines.useUpdate(g,{update_content:!0}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){Zn(!1),cn()},onErrorCallback:function(e,n){return M({errors:n,response:e})}})}}),hi=(0,l.Z)(pi,2),mi=hi[0],vi=hi[1].isLoading,bi=(0,s.useCallback)((function(e,n){var t=e||{},i=t.block,r=t.pipeline,o=void 0===r?{extensions:{}}:r,c=(n||{}).contentOnly;if(!(vn&&Number(vn)>Number(xn))){var u=(0,fe.Tz)({dateObj:!0}),a=(0,fe.Tz)();jn(u);var s={},d={},f={},p={};dt.forEach((function(e){var n,t,r,o=e.extension_uuid,u=e.type,a=e.uuid,h=null===(n=Gn.current[u])||void 0===n?void 0:n[a];"undefined"===typeof h&&(h=e.content);var v,b=null===(t=Hn.current[u])||void 0===t?void 0:t[a];"undefined"===typeof b&&(b=e.callback_content);var g=null===(r=Qe[a])||void 0===r?void 0:r.filter((function(e){return!!e})),x=null===g||void 0===g?void 0:g.find((function(e){return e.error}));if(g){var j=[],y=0;g.forEach((function(n){var t=n.data,i=n.type;(m.tf.SCRATCHPAD===e.type||x||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(Pn)?e:e.concat(n)}),[]),i===ge.Gi.TEXT_PLAIN&&(y+=(null===t||void 0===t?void 0:t.length)||0)),(!Ke||y<Ke+5)&&j.push(n))})),v=j.map((function(e,n){return{text_data:JSON.stringify(e),variable_uuid:"".concat(a,"_").concat(n)}}))}var k=Mc(Mc({},e),{},{callback_content:b,content:h,outputs:v});(null===i||void 0===i?void 0:i.uuid)===a&&Object.entries(i).forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];"object"===typeof i&&!Array.isArray(i)&&i?Object.entries(i).forEach((function(e){var n=(0,l.Z)(e,2),i=n[0],r=n[1];k[t]||(k[t]={}),k[t][i]=r})):k[t]=i})),c?d[k.uuid]={callback_content:k.callback_content,content:k.content,outputs:k.outputs,uuid:k.uuid}:[m.tf.EXTENSION].includes(u)?(s[o]||(s[o]=[]),s[o].push(k)):m.tf.CALLBACK===u?f[k.uuid]=k:m.tf.CONDITIONAL===u?p[k.uuid]=k:d[k.uuid]=k}));var h=Mc(Mc({},null===fn||void 0===fn?void 0:fn.extensions),null===o||void 0===o?void 0:o.extensions);Object.entries(s).forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];h[t]||(h[t]={}),h[t].blocks=i}));var v=[],b=[],g=[];return((null===o||void 0===o?void 0:o.blocks)||dt).forEach((function(e){var n=e.uuid,t=d[n],i=f[n],r=p[n];"undefined"!==typeof t?v.push(t):"undefined"!==typeof i?b.push(i):"undefined"!==typeof r&&g.push(r)})),mi({pipeline:Mc(Mc(Mc({},fn),o),{},{blocks:v,callbacks:b,conditionals:g,extensions:h,updated_at:a,widgets:ht.map((function(e){var n,t,i=zn.current[e.uuid],r=vt.current[e.uuid]||{};"undefined"===typeof i&&(i=e.content);var o=null===(n=Qe[e.uuid])||void 0===n?void 0:n.filter((function(e){return!!e})),l=null===o||void 0===o?void 0:o.find((function(e){return e.error}));if(o){var c=[];o.forEach((function(n){var t=n.data,i=n.type;(m.tf.SCRATCHPAD===e.type||l||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(Pn)?e:e.concat(n)}),[])),c.push(n))})),t=c.map((function(n,t){return{text_data:JSON.stringify(n),variable_uuid:"".concat(e.uuid,"_").concat(t)}}))}return Mc(Mc(Mc({},e),r),{},{configuration:Mc(Mc({},e.configuration),r.configuration),content:i,outputs:t})}))})})}Cn()}),[dt,Ke,Qe,fn,vn,xn,Cn,mi,ht]),gi=(0,s.useCallback)((function(e){bi();var n=encodeURIComponent(e),t=(0,wl.iV)()["file_paths[]"]||[];Array.isArray(t)||(t=[t]),t.includes(n)||t.push(n),(0,he.u7)({file_path:n,"file_paths[]":t})}),[bi]),xi=(0,s.useMemo)((function(){var e=[],n=[];return dt.forEach((function(t){m.M5.includes(t.type)?n.push(t):e.push(t)})),{blocksInNotebook:e,blocksInSidekick:n}}),[dt]),ji=xi.blocksInNotebook,yi=xi.blocksInSidekick,ki=(0,s.useCallback)((function(e,n){return bi({pipeline:{name:e,type:n}}).then((function(e){var t,i;if(null!==e&&void 0!==e&&null!==(t=e.data)&&void 0!==t&&t.pipeline){var r=e.data.pipeline.uuid;g!==r?window.location.href="/pipelines/".concat(r,"/edit"):(sn(),n!==(null===fn||void 0===fn?void 0:fn.type)&&cn(),(0,Fn.k1)(ji,g,r),(0,Fn.k1)(yi,g,r))}else null!==e&&void 0!==e&&null!==(i=e.data)&&void 0!==i&&i.error&&M((function(e){return Mc(Mc({},e),{},{links:[{label:"Check pipeline configuration",onClick:function(){gi("pipelines/".concat(g,"/").concat(En.dT.METADATA_YAML)),M(null)}}]})}))}))}),[ji,yi,sn,cn,gi,null===fn||void 0===fn?void 0:fn.type,g,bi]),Zi=(0,d.Db)((function(e){var n=e.type,t=e.extension_uuid,i=e.uuid,r={};return n&&(r.block_type=n),t&&(r.extension_uuid=t),ce.ZP.blocks.pipelines.useDelete(g,encodeURIComponent(i),r)()}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){var n=e.block,t=n.type,i=n.uuid;ft((function(e){return(0,pe.oM)(e,e.findIndex((function(e){var n=e.type,r=e.uuid;return t===n&&i===r})))})),cn(),Pt(null),t===m.tf.SCRATCHPAD&&sn()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;M({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&We((function(e){return Mc(Mc({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:ge.Gi.TEXT_PLAIN}}))))}))}})}}),Oi=(0,l.Z)(Zi,1)[0],_i=(0,d.Db)((function(e){var n=e.uuid;return ce.ZP.widgets.pipelines.useDelete(g,n)()}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){var n=e.widget.uuid;mt((function(e){return(0,pe.oM)(e,e.findIndex((function(e){var t=e.uuid;return n===t})))})),cn(),sn()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;M({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&We((function(e){return Mc(Mc({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:ge.Gi.TEXT_PLAIN}}))))}))}})}}),Ci=(0,l.Z)(_i,1)[0],Si=(0,ve.dd)((function(e){return(0,S.jsx)(oe.Z,{centerOnScreen:!0,neutral:!0,onCancel:wi,onClick:function(){return Ai(e)},subtitle:"Deleting this block is dangerous. Your block may have downstream dependencies that depend on this block. You can delete this block anyway and remove it as a dependency from downstream blocks.",title:"Your block has dependencies",width:34*_.iI})})),Ei=(0,l.Z)(Si,2),Pi=Ei[0],wi=Ei[1],Ti=(0,d.Db)((function(e){var n=e.language,t=e.type,i=e.uuid,r="".concat(t,"/").concat(i);return n&&En.JD[n]&&(r="".concat(r,".").concat(En.JD[n].toLowerCase())),ce.ZP.blocks.useDelete(encodeURIComponent(r))()}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){ai(),cn(),sn()},onErrorCallback:function(e,n){Pi(),M({displayMessage:e.exception,errors:n,response:e})}})}}),Ai=(0,l.Z)(Ti,1)[0],Di=(0,d.Db)(ce.ZP.kernels.useUpdate(null===tn||void 0===tn?void 0:tn.id),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){return en()},onErrorCallback:function(e,n){return M({errors:n,response:e})}})}}),Ri=(0,l.Z)(Di,1)[0],Mi=(0,s.useCallback)((function(){return Ri({kernel:{action_type:"restart"}})}),[Ri]),Bi=(0,s.useCallback)((function(){Ri({kernel:{action_type:"interrupt"}}),Ct([])}),[Ri]),Ni=(0,d.Db)(ce.ZP.blocks.pipelines.useCreate(g)),Li=(0,l.Z)(Ni,1)[0],Fi=(0,s.useCallback)((function(e,n,t){var i,o,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,W.Y6)();e.converted_from_type&&e.converted_from_uuid&&(i=null===(o=Gn.current[e.converted_from_type])||void 0===o?void 0:o[e.converted_from_uuid]);var u=e.language,a=e.type;if(pn){var s=(0,pe.HK)((null===fn||void 0===fn?void 0:fn.blocks)||[],(function(e){return e.type})),d=s[m.tf.DATA_EXPORTER],f=s[m.tf.DATA_LOADER],p=s[m.tf.TRANSFORMER];if(m.tf.DATA_LOADER===a){if(m.t6.YAML!==u)return void M({displayMessage:"The source you\u2019re trying to add must contain the language ".concat(m.t6.YAML," and not ").concat(u,".")});if(f)return void M({displayMessage:"Pipeline ".concat(null===fn||void 0===fn?void 0:fn.uuid," already has a source: ").concat(null===f||void 0===f?void 0:f.uuid,".")})}else if(m.tf.TRANSFORMER===a){if(p)return void M({displayMessage:"Pipeline ".concat(null===fn||void 0===fn?void 0:fn.uuid," already has a transformer: ").concat(null===p||void 0===p?void 0:p.uuid,".")})}else if(m.tf.DATA_EXPORTER===a){if(m.t6.YAML!==u)return void M({displayMessage:"The destination you\u2019re trying to add must contain the language ".concat(m.t6.YAML," and not ").concat(u,".")});if(d)return void M({displayMessage:"Pipeline ".concat(null===fn||void 0===fn?void 0:fn.uuid," already has a destination: ").concat(null===d||void 0===d?void 0:d.uuid,".")})}}return Li({block:Mc({content:i,name:c,priority:n},e)}).then((function(e){(0,me.wD)(e,{callback:function(){var n=e.data.block;null===t||void 0===t||t(n),sn(),cn().then((function(e){var n=e.pipeline,t=n.blocks,i=n.extensions;return ft((function(e){var n=(0,r.Z)(t);Object.entries(i||{}).forEach((function(e){var t=(0,l.Z)(e,2),i=t[0],o=t[1].blocks;o&&n.push.apply(n,(0,r.Z)(o.map((function(e){return Mc(Mc({},e),{},{extension_uuid:i})}))))}));var o=(0,pe.HK)(e,(function(e){return e.uuid})),c=[];return n.forEach((function(e){var n=o[e.uuid];n?c.push(n):c.push(e)})),c}))}))},onErrorCallback:function(e,n){return M({errors:n,response:e})}})}))}),[Li,sn,cn,pn,ft,M,fn]),Ui=(0,s.useState)(!1),Hi=Ui[0],Gi=Ui[1];(0,s.useEffect)((function(){Gi(!!(0,L.U2)(N.kY))}),[]);var zi=(0,ve.dd)((function(e){var n=e.block,t=e.idx,i=e.name,r=void 0===i?(0,W.Y6)():i,o=e.onCreateCallback;return(0,S.jsx)(U,{block:n,defaultName:r,onClose:Qi,onSave:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Fi(n,t,o,null===e||void 0===e?void 0:e.name).then((function(){return Qi()}))},pipeline:fn})}),{},[Fi,fn],{background:!0,uuid:"configure_block_name_and_create"}),Ki=(0,l.Z)(zi,2),qi=Ki[0],Qi=Ki[1],Wi=(0,d.Db)(ce.ZP.widgets.pipelines.useCreate(g)),Vi=(0,l.Z)(Wi,1)[0],Yi=(0,s.useCallback)((function(e,n,t){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,W.Y6)();return Vi({widget:Mc({name:i,priority:n,type:m.tf.CHART},e)}).then((function(e){return(0,me.wD)(e,{callback:function(){var n=e.data.widget;null===t||void 0===t||t(n),sn(),cn(),Mn(hn.cH.CHARTS),z(n)},onErrorCallback:function(e,n){return M({errors:n,response:e})}})}))}),[sn,cn,Vi,Mn]);(0,s.useEffect)((function(){if(F){var e,n=null===(e=Ln.current[F.uuid])||void 0===e?void 0:e.current;n&&(n.scrollIntoView(),z(null))}}),[F,z]),(0,s.useEffect)((function(){rn!==g&&(ft([]),mt([]),Dt([]),Xe([]))}),[g,rn]),(0,s.useEffect)((function(){if("undefined"!==typeof(null===fn||void 0===fn?void 0:fn.blocks)||"undefined"!==typeof(null===fn||void 0===fn?void 0:fn.extensions)){var e=[];"undefined"!==typeof(null===fn||void 0===fn?void 0:fn.blocks)&&e.push.apply(e,(0,r.Z)(null===fn||void 0===fn?void 0:fn.blocks)),"undefined"!==typeof(null===fn||void 0===fn?void 0:fn.callbacks)&&e.push.apply(e,(0,r.Z)(null===fn||void 0===fn?void 0:fn.callbacks)),"undefined"!==typeof(null===fn||void 0===fn?void 0:fn.conditionals)&&e.push.apply(e,(0,r.Z)(null===fn||void 0===fn?void 0:fn.conditionals)),"undefined"!==typeof(null===fn||void 0===fn?void 0:fn.extensions)&&Object.entries((null===fn||void 0===fn?void 0:fn.extensions)||{}).forEach((function(n){var t=(0,l.Z)(n,2),i=t[0],o=t[1].blocks;o&&e.push.apply(e,(0,r.Z)(o.map((function(e){return Mc(Mc({},e),{},{extension_uuid:i})}))))})),ft(e)}}),[null===fn||void 0===fn?void 0:fn.blocks,null===fn||void 0===fn?void 0:fn.callbacks,null===fn||void 0===fn?void 0:fn.conditionals,null===fn||void 0===fn?void 0:fn.extensions]),(0,s.useEffect)((function(){"undefined"!==typeof(null===fn||void 0===fn?void 0:fn.widgets)&&mt(fn.widgets)}),[null===fn||void 0===fn?void 0:fn.widgets]),(0,s.useEffect)((function(){(null===It||void 0===It?void 0:It.length)>0&&0===(null===At||void 0===At?void 0:At.length)&&(Dt(It),Gt(It[0]))}),[At,It]);var Xi=(0,ae.Z)(dt);(0,s.useEffect)((function(){if("undefined"!==typeof(null===fn||void 0===fn?void 0:fn.blocks)&&(!dt.length||!(0,pe.fS)(null===Xi||void 0===Xi?void 0:Xi.map((function(e){return e.uuid})).sort(),null===dt||void 0===dt?void 0:dt.map((function(e){return e.uuid})).sort()))){var e=(0,Fn.Rt)(fn.blocks),n=e.content,t=e.messages;Gn.current=n,We((function(e){return Mc(Mc({},t),e)}))}}),[dt,Xi,null===fn||void 0===fn?void 0:fn.blocks,We]),(0,s.useEffect)((function(){if(!ht.length&&"undefined"!==typeof(null===fn||void 0===fn?void 0:fn.widgets)){var e=(0,Fn.Rt)(fn.widgets),n=e.content,t=e.messages;zn.current=n,We((function(e){return Mc(Mc({},t),e)}))}}),[null===fn||void 0===fn?void 0:fn.widgets,We,ht]);var Ji=(0,s.useCallback)((function(e,n,t){var i=dt.find((function(t){var i=t.type,r=t.uuid;return i===n&&r===e}));if(i){if(Pt(i),null!==Nn&&void 0!==Nn&&Nn.current){var r,o=Nn.current["".concat(i.type,"s/").concat(i.uuid,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}(0,he.u7)({block_uuid:null,file_path:null,"file_paths[]":[]})}else if(n===m.tf.CHART){var l=ht.find((function(n){return n.uuid===e}));if(l&&(Pt(l),null!==Ln&&void 0!==Ln&&Ln.current)){var c,u=Ln.current[l.uuid];null===u||void 0===u||null===(c=u.current)||void 0===c||c.scrollIntoView()}}else t&&gi(t)}),[dt,gi,ht]);(0,s.useEffect)((function(){if(An&&!Et){var e=dt.find((function(e){var n,t=e.uuid;return(null===An||void 0===An||null===(n=An.split(":"))||void 0===n?void 0:n[0])===t}));e&&(Ue((function(n){return Mc(Mc({},n),{},(0,o.Z)({},e.uuid,!1))})),Ji(e.uuid,e.type,null))}else(null===Xi||void 0===Xi?void 0:Xi.length)!==(null===dt||void 0===dt?void 0:dt.length)&&Et&&(Ue((function(e){return Mc(Mc({},e),{},(0,o.Z)({},Et.uuid,!1))})),Ji(Et.uuid,Et.type,null))}),[An,dt,null===Xi||void 0===Xi?void 0:Xi.length,Ji,Et,Ue]);var $i=(0,s.useMemo)((function(){return new h.Z}),[]),er=(0,s.useMemo)((function(){return{api_key:In.l,token:$i.decodedToken.token}}),[$i]),nr=(0,a.ZP)((0,Dc.Ib)(),{onClose:function(){return console.log("socketUrlPublish closed")},onMessage:function(e){if(e){var n=JSON.parse(e.data),t=n.block_type,i=n.execution_state,l=n.msg_type,c=n.pipeline_uuid,u=n.uuid;if(!u&&!c)return;var a=dt.find((function(e){var n=e.type,i=e.uuid;return t===n&&u===i}));"stream_pipeline"!==l?We((function(e){var t=e[u]||[];return Mc(Mc({},e),{},(0,o.Z)({},u,t.concat(n)))})):(Xe((function(e){return[].concat((0,r.Z)(e),[n])})),ge.uF.IDLE===i&&(Ct([]),cn(),u||jt(!1))),ge.uF.BUSY===i?Ct((function(e){return e.find((function(e){var n=e.uuid;return u===n}))||!a?e:e.concat(a)})):ge.uF.IDLE===i&&Ct((function(e){return e.filter((function(e){var n=e.uuid;return u!==n}))})),ze||Zn(!0)}},onOpen:function(){return console.log("socketUrlPublish opened")},reconnectAttempts:10,reconnectInterval:3e3,shouldReconnect:function(){return console.log("Attempting to reconnect..."),!0}}).sendMessage,tr=(0,s.useCallback)((function(){bi().then((function(){jt(!0),Xe([]),nr(JSON.stringify(Mc(Mc({},er),{},{execute_pipeline:!0,pipeline_uuid:g})))}))}),[g,bi,nr,er]),ir=(0,s.useCallback)((function(){nr(JSON.stringify(Mc(Mc({},er),{},{cancel_pipeline:!0,pipeline_uuid:g})))}),[g,nr,er]),rr=(0,s.useCallback)((function(){nr(JSON.stringify(Mc(Mc({},er),{},{cancel_pipeline:!0,pipeline_uuid:g,skip_publish_message:!0})))}),[g,nr,er]),or=(0,s.useCallback)((function(){nr(JSON.stringify(Mc(Mc({},er),{},{check_if_pipeline_running:!0,pipeline_uuid:g})))}),[g,nr,er]);(0,s.useEffect)((function(){var e;return window.addEventListener("pagehide",rr),null===u||void 0===u||null===(e=u.events)||void 0===e||e.on("routeChangeStart",rr),function(){var e;null===u||void 0===u||null===(e=u.events)||void 0===e||e.off("routeChangeStart",rr),window.removeEventListener("pagehide",rr)}}),[rr,null===u||void 0===u?void 0:u.events]);var lr=(0,s.useCallback)((function(e){var n=e.block,t=e.code,i=e.ignoreAlreadyRunning,r=e.runDownstream,o=void 0!==r&&r,l=e.runSettings,c=void 0===l?{}:l,u=e.runUpstream,a=void 0!==u&&u,s=e.runTests,d=void 0!==s&&s,f=n.extension_uuid,p=n.upstream_blocks,h=n.uuid;_t.find((function(e){var n=e.uuid;return h===n}))&&!i||(nr(JSON.stringify(Mc(Mc({},er),{},{code:t,extension_uuid:f,pipeline_uuid:null===fn||void 0===fn?void 0:fn.uuid,run_downstream:o,run_settings:c,run_tests:d,run_upstream:a,type:n.type,upstream_blocks:p,uuid:h}))),We((function(e){return delete e[h],e})),ue(!1),Ct((function(e){return e.find((function(e){var n=e.uuid;return h===n}))?e:e.concat(n)}))),cn()}),[cn,fn,_t,nr,We,Ct,ue,er]),cr=(0,s.useCallback)((function(e){var n=e.block;return ze?lr(e):bi({block:{outputs:[],uuid:n.uuid}},{contentOnly:!0}).then((function(){return lr(e)}))}),[ze,lr,bi]),ur=(0,a.ZP)((0,Dc.Ib)("terminal"),{queryParams:er,shouldReconnect:function(){return!0}}),ar=ur.lastMessage,sr=ur.sendMessage,dr=(0,s.useMemo)((function(){return(0,S.jsx)(Zc,{activeView:Tn,addNewBlockAtIndex:function(e,n,t,i){return new Promise((function(){return qi({block:e,idx:n,name:i,onCreateCallback:t})}))},afterWidth:C,autocompleteItems:si,blockRefs:Nn,blocks:dt,blocksInNotebook:ji,cancelPipeline:ir,chartRefs:Ln,checkIfPipelineRunning:or,deleteBlock:Oi,deleteWidget:Ci,editingBlock:kt,executePipeline:tr,fetchFileTree:sn,fetchPipeline:cn,fetchSecrets:ut,fetchVariables:rt,globalVariables:ot,insights:ti,interruptKernel:Bi,isPipelineExecuting:xt,isPipelineUpdating:vi,lastTerminalMessage:ar,messages:Qe,metadata:ri,onChangeCallbackBlock:Qn,onChangeChartBlock:Yn,onChangeCodeBlock:Wn,onSelectBlockFile:Ji,pipeline:fn,pipelineMessages:Ye,runBlock:cr,runningBlocks:_t,sampleData:Yt,savePipelineContent:bi,secrets:at,selectedBlock:Et,selectedFilePath:q,sendTerminalMessage:sr,setActiveSidekickView:Mn,setAllowCodeBlockShortcuts:Se,setAnyInputFocused:ye,setDepGraphZoom:we,setDisableShortcuts:Oe,setEditingBlock:Zt,setErrors:M,setHiddenBlocks:Ue,setSelectedBlock:Pt,setTextareaFocused:ue,statistics:li,textareaFocused:le,treeRef:Un,updatePipelineMetadata:ki,updateWidget:bt,widgets:ht})}),[Tn,C,si,Nn,dt,ji,ir,or,Oi,Ci,kt,tr,sn,cn,ut,rt,ot,ti,Bi,xt,vi,ar,Qe,ri,Qn,Yn,Wn,Ji,fn,Ye,cr,_t,Yt,bi,at,Et,q,sr,Mn,ye,Zt,M,Ue,ue,qi,li,le,ki,bt,ht]),fr=(0,s.useMemo)((function(){return(0,S.jsx)(Hr,{addNewBlockAtIndex:Hi?Fi:function(e,n,t,i){return new Promise((function(r,o){m.tf.DBT===(null===e||void 0===e?void 0:e.type)&&m.t6.SQL===(null===e||void 0===e?void 0:e.language)?Fi(e,n,t,i):qi({block:e,idx:n,name:i,onCreateCallback:t})}))},addWidget:function(e,n){var t=n.onCreateCallback;return Yi(e,ht.length,t)},allBlocks:dt,allowCodeBlockShortcuts:Ce,anyInputFocused:je,autocompleteItems:si,blockRefs:Nn,blocks:ji,dataProviders:nt,deleteBlock:Oi,disableShortcuts:Ze,fetchFileTree:sn,fetchPipeline:cn,fetchSampleData:Wt,files:dn,globalVariables:ot,hiddenBlocks:Le,interruptKernel:Bi,mainContainerRef:He,mainContainerWidth:Jn,messages:Qe,onChangeCallbackBlock:Qn,onChangeCodeBlock:Wn,openSidekickView:Bn,pipeline:fn,pipelineContentTouched:kn,restartKernel:Mi,runBlock:cr,runningBlocks:_t,savePipelineContent:bi,selectedBlock:Et,setAnyInputFocused:ye,setDisableShortcuts:Oe,setEditingBlock:Zt,setErrors:M,setHiddenBlocks:Ue,setIntegrationStreams:Bt,setOutputBlocks:Dt,setPipelineContentTouched:Zn,setSelectedBlock:Pt,setSelectedOutputBlock:Gt,setSelectedStream:Ft,setTextareaFocused:ue,textareaFocused:le,widgets:ht})}),[Fi,Yi,Ce,je,si,Hi,Nn,dt,ji,nt,Oi,Ze,sn,cn,Wt,dn,ot,Le,Bi,He,Jn,Qe,Qn,Wn,Bn,fn,kn,Mi,cr,_t,bi,Et,ye,Zt,M,Ue,Zn,Pt,ue,qi,le,ht]),pr=(0,s.useMemo)((function(){if(i===Qr.b7)return(0,S.jsx)(ee,{cancelPipeline:ir,createPipeline:fi,executePipeline:tr,interruptKernel:Bi,isPipelineExecuting:xt,pipeline:fn,restartKernel:Mi,savePipelineContent:bi,setActiveSidekickView:Mn,setMessages:We,children:q&&(0,S.jsx)(Z.Z,{ml:1,children:(0,S.jsx)(y.Z,{alignItems:"center",fullHeight:!0,children:(0,S.jsx)(I.Z,{compact:!0,onClick:function(){return Q(null)},small:!0,children:"View pipeline"})})})})}),[ir,fi,tr,Bi,xt,i,fn,Mi,bi,q,Mn,We,Q]),hr=(0,s.useMemo)((function(){if(i===Qr.b7)return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(be,{filePaths:Y,filesTouched:$,isBusy:_t.length>=1,isPipelineUpdating:vi,kernel:tn,pipeline:fn,pipelineContentTouched:kn,pipelineLastSaved:vn,restartKernel:Mi,savePipelineContent:bi,selectedFilePath:q,setErrors:M,setRunningBlocks:Ct,updatePipelineMetadata:ki,children:pr}),(null===Y||void 0===Y?void 0:Y.length)>0&&(0,S.jsx)(de.rK,{relativePosition:!0,secondary:!0,children:(0,S.jsx)(ne.Z,{filePaths:Y,filesTouched:$,savePipelineContent:bi,selectedFilePath:q})})]})}),[pr,$,vi,tn,i,fn,kn,vn,Mi,_t,bi,q,Y,M,ki]),mr=(0,s.useMemo)((function(){var e;return null===Mt||void 0===Mt||null===(e=Mt.filter((function(e){return(0,pe.sE)(null===Vt||void 0===Vt?void 0:Vt.outputs,(function(n){return n.variable_uuid==="output_sample_data_".concat((0,W.kE)(e))}))})))||void 0===e?void 0:e.map((function(e){return(0,S.jsx)(Z.Z,{pl:1,children:(0,S.jsx)(A.ZP,{blackBorder:!0,compact:!0,muted:!0,onClick:function(){return Ft(e)},selected:Lt===e,uuid:e,children:e})},e)}))}),[Vt,Mt,Lt]),vr=(0,s.useRef)(null),br=(0,s.useMemo)((function(){return(0,S.jsx)(H.Z,{addNewBlock:function(e,n){Fi(e,dt.length,n,e.name),(null===Rn||void 0===Rn?void 0:Rn.length)>=1&&u.push("/pipelines/".concat(g,"/edit"))},blocks:dt,deleteWidget:Ci,fetchAutocompleteItems:ai,fetchFileTree:sn,fetchPipeline:cn,files:dn,onSelectBlockFile:Ji,openFile:gi,openPipeline:function(e){Kt(),u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(e,"/edit"))},openSidekickView:Bn,pipeline:fn,ref:vr,setErrors:M,setSelectedBlock:Pt,widgets:ht})}),[Fi,dt,Ci,ai,sn,cn,null===Rn||void 0===Rn?void 0:Rn.length,dn,Ji,gi,Bn,fn,g,Kt,u,M,Pt,ht]),gr=(0,s.useMemo)((function(){return(0,S.jsx)(w,{blockRefs:Nn,hiddenBlocks:Le,pipeline:fn,setHiddenBlocks:Ue})}),[Nn,Le,fn,Ue]),xr=(0,s.useMemo)((function(){return Qr.Jf.uuid===(null===De||void 0===De?void 0:De.uuid)?br:Qr.IY.uuid===(null===De||void 0===De?void 0:De.uuid)?gr:null}),[br,gr,De]),jr=(0,s.useMemo)((function(){return(0,S.jsx)(Z.Z,{px:1,children:(0,S.jsx)(T.Z,{noPadding:!0,onClickTab:function(e){Me(e)},selectedTabUUID:null===De||void 0===De?void 0:De.uuid,small:!0,tabs:Qr.NR})})}),[Me,De]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(te.Z,{title:null===fn||void 0===fn?void 0:fn.name}),(0,S.jsxs)(Xr,{after:dr,afterHeader:(0,S.jsx)(Pc,{activeView:Tn,depGraphZoom:Pe,pipeline:fn,secrets:at,treeRef:Un,variables:ot}),afterHeightOffset:wc.Mz,afterHidden:j,afterNavigationItems:Ac({activeView:Tn,pipeline:fn,secrets:at,setActiveSidekickView:Mn,variables:ot}),afterOverflow:hn.cH.DATA===Tn?"hidden":null,afterSubheader:(null===At||void 0===At?void 0:At.length)>0&&Tn===hn.cH.DATA&&(0,S.jsxs)(y.Z,{alignItems:"center",fullHeight:!0,fullWidth:!0,children:[!pn&&At.map((function(e){var n=e.uuid,t=(null===Ht||void 0===Ht?void 0:Ht.uuid)===n;return(0,S.jsx)(Z.Z,{pl:1,children:(0,S.jsx)(A.ZP,{afterElement:t?(0,S.jsx)(I.Z,{basic:!0,highlightOnHover:!0,onClick:function(){(0,Fn.h8)(g,e.uuid),Dt((function(e){return e.filter((function(e){return e.uuid!==n}))}))},padding:"2px",transparent:!0,children:(0,S.jsx)(se.x8,{muted:!0,size:1.25*_.iI})}):null,blackBorder:!0,compact:!0,muted:!0,onClick:function(){return Gt(e)},selected:t,uuid:n,children:n})},n)})),pn&&mr]}),before:xr,beforeHeader:jr,beforeHeightOffset:wc.Mz,beforeNavigationItems:(0,Tc.H)(Ic.M.EDIT,fn),errors:D,headerOffset:(null===Y||void 0===Y?void 0:Y.length)>0?36:0,mainContainerHeader:hr,mainContainerRef:He,page:i,pipeline:fn,setAfterHidden:k,setAfterWidthForChildren:E,setErrors:M,setMainContainerWidth:$n,children:[(0,S.jsx)("div",{style:{height:q?0:null,opacity:q?0:null,visibility:q?"hidden":null},children:(0,S.jsx)(p.Z,{uuid:"PipelineDetail/".concat(g),children:fr})}),null===Rn||void 0===Rn?void 0:Rn.map((function(e){return(0,S.jsx)("div",{style:{display:q===e?null:"none"},children:(0,S.jsx)(p.Z,{uuid:"FileEditor/".concat(decodeURIComponent(e)),children:(0,S.jsx)(G.Z,{active:q===e,addNewBlock:function(e,n){Fi(e,dt.length,n,e.name),u.push("/pipelines/".concat(g,"/edit"))},fetchPipeline:cn,fetchVariables:rt,filePath:e,openSidekickView:Bn,pipeline:fn,selectedFilePath:q,sendTerminalMessage:sr,setDisableShortcuts:Oe,setErrors:M,setFilesTouched:ie,setSelectedBlock:Pt})})},e)})),(0,S.jsx)(Z.Z,{pb:Dn?0:Math.max(Math.floor(v*(2/3)/_.iI),0)})]})]})}Bc.getInitialProps=function(){var e=(0,i.Z)(u().mark((function e(n){var t,i,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.query.pipeline,i=Qr.b7,r={page:i,pipeline:{uuid:t}},e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();var Nc=(0,Jr.Z)(Bc)},11366:function(e,n,t){"use strict";t.d(n,{H8:function(){return r},g6:function(){return o},kY:function(){return i}});var i="automatically_name_blocks",r="pipeline_edit_before_tab_selected",o="pipeline_edit_hidden_blocks"},76419:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/pipelines/[pipeline]/edit",function(){return t(40369)}])}},function(e){e.O(0,[3662,844,7607,5896,4804,1774,9350,5872,7011,2714,4259,8789,7107,1424,1005,7815,3714,3752,1286,551,4822,7722,4127,8735,9774,2888,179],(function(){return n=76419,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
|