mage-ai 0.9.7__py3-none-any.whl → 0.9.9__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/ai/constants.py +1 -0
- mage_ai/ai/generator.py +6 -0
- mage_ai/ai/{gen_doc_for_pipeline.py → generator_cmds.py} +5 -0
- mage_ai/ai/llm_pipeline_wizard.py +108 -3
- mage_ai/api/policies/BlockPolicy.py +1 -0
- mage_ai/api/policies/BlockTemplatePolicy.py +9 -0
- mage_ai/api/policies/LlmPolicy.py +3 -2
- mage_ai/api/policies/OauthAccessTokenPolicy.py +31 -0
- mage_ai/api/policies/PipelinePolicy.py +1 -0
- mage_ai/api/policies/ProjectPolicy.py +9 -0
- mage_ai/api/policies/SearchResultPolicy.py +32 -0
- mage_ai/api/policies/VariablePolicy.py +8 -0
- mage_ai/api/presenters/BlockTemplatePresenter.py +1 -0
- mage_ai/api/presenters/OauthAccessTokenPresenter.py +9 -0
- mage_ai/api/presenters/ProjectPresenter.py +2 -0
- mage_ai/api/presenters/SearchResultPresenter.py +73 -0
- mage_ai/api/resources/BlockResource.py +43 -4
- mage_ai/api/resources/BlockTemplateResource.py +15 -2
- mage_ai/api/resources/CustomTemplateResource.py +15 -3
- mage_ai/api/resources/FileContentResource.py +8 -1
- mage_ai/api/resources/FileResource.py +22 -2
- mage_ai/api/resources/OauthAccessTokenResource.py +24 -0
- mage_ai/api/resources/PipelineResource.py +70 -2
- mage_ai/api/resources/ProjectResource.py +15 -1
- mage_ai/api/resources/SearchResultResource.py +68 -0
- mage_ai/api/resources/VariableResource.py +25 -14
- mage_ai/cache/base.py +3 -0
- mage_ai/cache/block_action_object/__init__.py +282 -0
- mage_ai/cache/block_action_object/constants.py +4 -0
- mage_ai/cache/constants.py +1 -0
- mage_ai/data_integrations/destinations/constants.py +2 -0
- mage_ai/data_preparation/executors/k8s_pipeline_executor.py +1 -1
- mage_ai/data_preparation/models/block/__init__.py +20 -1
- mage_ai/data_preparation/models/block/dbt/utils/__init__.py +1 -0
- mage_ai/data_preparation/models/custom_templates/custom_block_template.py +8 -3
- mage_ai/data_preparation/models/custom_templates/utils.py +6 -3
- mage_ai/data_preparation/models/file.py +3 -0
- mage_ai/data_preparation/models/pipeline.py +10 -1
- mage_ai/data_preparation/models/{project.py → project/__init__.py} +17 -0
- mage_ai/data_preparation/models/project/constants.py +5 -0
- mage_ai/data_preparation/repo_manager.py +9 -6
- mage_ai/data_preparation/templates/constants.py +478 -1
- mage_ai/data_preparation/templates/template.py +9 -1
- mage_ai/orchestration/backfills/service.py +20 -1
- mage_ai/orchestration/db/__init__.py +25 -0
- mage_ai/orchestration/db/models/schedules.py +20 -1
- mage_ai/orchestration/pipeline_scheduler.py +23 -0
- 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/OwvTROmputQCA1Z9HEGDv/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{1005-ce36fe7ed460d006.js → 1005-16c1a6678de5311e.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1424-e22139f33196c5c1.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/1484-a76b2c31e4808379.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/2485-b569baad92049d6b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{2786-d8b593e5d7c42665.js → 2786-acce6ea0d9b4898e.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3654-573457b62efff6e2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/3881-0eb04f7f7a244347.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{4317-b112fe7bb532b998.js → 4317-3fe63fc9401685d6.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{4822-52d9d661b6bd1ae9.js → 4822-045cc7cdd7c95163.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{547-14029bdacc0ed267.js → 547-4ad2cdae967055b6.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6299-cf188c1b7a1bc33c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{7815-6dc55b5fd5d1f48a.js → 7815-fbd99c8f259d9e8b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{8312-cdc4d6c3b9f53099.js → 8312-c88a3b1012e5448b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{8952-492bf0e29d215ddd.js → 8952-e94a7334fcd5c68b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9055-d0d25298cb5f4e45.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{_app-c7557dc9e725825e.js → _app-fa38a24707c76411.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-b9dac983c75798f2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/{settings-17bb362b9683079c.js → settings-453aaa7bf78f8101.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/{[user]-bfa53c0ee79920a0.js → [user]-3b502aa6d1a04cad.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/{new-2f7e6bf8e2a37380.js → new-dd41d718cbb5990c.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users-ec748f838b7b8fad.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-bcc24120f5911f76.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{overview-8ffbc4b0e8a43266.js → overview-6f20b9e9cbec91d6.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/{[...slug]-373f6b8c9161e819.js → [...slug]-55212dfc15881ef2.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{backfills-226bf0c5c1bfe004.js → backfills-6b4a82cd0516e121.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-0705c99df236ec8a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{logs-4ade07836fd577c9.js → logs-c294f5d74bd2d50f.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{monitors-fd9eb711e89425e9.js → monitors-1b9e4abc54842cdf.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{runs-027666ed18d3151e.js → runs-17ebe87e94242ae5.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-48b60ca236a26818.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{syncs-de58e6b91e5e4552.js → syncs-5153f4665aaf8b17.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/{[...slug]-432843576e1ed09e.js → [...slug]-1306e85191f6b47c.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{triggers-ae31b1d0d8a4634d.js → triggers-2e731d343a26d46a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-0fab737dbc9074fc.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-b2354688508b0755.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{users-a4f01b5c429757cc.js → users-6522c963087f18e8.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{sign-in-1140f8ee7e89381a.js → sign-in-7dcd1257ca9660bb.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/templates/{[...slug]-f59b3f04c5a49351.js → [...slug]-78a07e7fe8973811.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{templates-dbb209ce131390a9.js → templates-19df643f52679d5a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-a1cf445565b68809.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 +2 -2
- mage_ai/server/frontend_dist/manage/users/[user].html +2 -2
- mage_ai/server/frontend_dist/manage/users/new.html +2 -2
- mage_ai/server/frontend_dist/manage/users.html +2 -2
- mage_ai/server/frontend_dist/manage.html +2 -2
- mage_ai/server/frontend_dist/overview.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 +16 -16
- mage_ai/server/frontend_dist/templates/[...slug].html +2 -2
- mage_ai/server/frontend_dist/templates.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/server.py +5 -0
- mage_ai/server/websocket_server.py +1 -0
- mage_ai/services/search/__init__.py +0 -0
- mage_ai/services/search/block_action_objects.py +33 -0
- mage_ai/services/search/constants.py +1 -0
- mage_ai/shared/array.py +7 -0
- mage_ai/shared/parsers.py +11 -2
- mage_ai/tests/shared/test_parsers.py +73 -0
- mage_ai/usage_statistics/constants.py +1 -0
- mage_ai/usage_statistics/logger.py +19 -1
- {mage_ai-0.9.7.dist-info → mage_ai-0.9.9.dist-info}/METADATA +9 -7
- {mage_ai-0.9.7.dist-info → mage_ai-0.9.9.dist-info}/RECORD +145 -132
- mage_ai/server/frontend_dist/_next/static/chunks/1424-de97c5aa0477894b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1484-c9d6bc33227070dd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2485-86c97f516c1abb9f.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3215-c2f5f19b650f9a50.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3654-bff4740b63cf280c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3881-7f121dbbe6e273cd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6299-97f283be01adf6a8.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-daf49c7c6f7e70f8.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users-1f6cb7656299cbd1.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-4894eabb442a039c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-a9bd86bee73b5762.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-cf51793c2112915c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-f1131ffe0d2a4a06.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-170943ca00445486.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-2ecda1f1437013f2.js +0 -1
- mage_ai/server/frontend_dist/_next/static/tMZjCwLa1LRYRzhFRdKNf/_buildManifest.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{tMZjCwLa1LRYRzhFRdKNf → OwvTROmputQCA1Z9HEGDv}/_middlewareManifest.js +0 -0
- /mage_ai/server/frontend_dist/_next/static/{tMZjCwLa1LRYRzhFRdKNf → OwvTROmputQCA1Z9HEGDv}/_ssgManifest.js +0 -0
- {mage_ai-0.9.7.dist-info → mage_ai-0.9.9.dist-info}/LICENSE +0 -0
- {mage_ai-0.9.7.dist-info → mage_ai-0.9.9.dist-info}/WHEEL +0 -0
- {mage_ai-0.9.7.dist-info → mage_ai-0.9.9.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.9.7.dist-info → mage_ai-0.9.9.dist-info}/top_level.txt +0 -0
mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-a9bd86bee73b5762.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2551],{48591:function(e,n,t){"use strict";var i=t(21831),r=t(75582),o=t(82684),l=t(37958);n.Z=function(e){var n=e.children,t=e.uuid,c=e.uuids,u=void 0===c?[]:c,a=(0,l.j)("apiReloads"),s=(0,r.Z)(a,1)[0],d=(0,i.Z)(u);t&&d.push(t);var f=d.map((function(e){return String(s[e])||"-"})).join("_");return o.cloneElement(n,{key:f})}},91207:function(e,n,t){"use strict";t.d(n,{Z:function(){return R}});var i=t(82394),r=t(75582),o=t(17717),l=t(82684),c=t(37958),u=t(83455),a=t(35490),s=t(86422),d=t(60328),f=t(38626),p=t(93461),h=t(67971),v=t(28598),m=f.default.div.withConfig({displayName:"ButtonGroup__ButtonGroupStyle",componentId:"sc-15vbmc8-0"})([""]),b=f.default.div.withConfig({displayName:"ButtonGroup__VerticalDivider",componentId:"sc-15vbmc8-1"})(["width:1px;"]),g=function(e){var n=e.children,t=e.divider,i=l.Children.toArray(n).length;return(0,v.jsx)(m,{children:(0,v.jsx)(h.Z,{children:l.Children.map(n,(function(e,n){return e&&(0,v.jsxs)(p.Z,{children:[n>=1&&t&&(0,v.jsx)(b,{}),l.cloneElement(e,{borderRadiusLeft:i>=2&&0===n,borderRadiusRight:i>=2&&n===i-1,halfPaddingLeft:i>=2&&0!==n,halfPaddingRight:i>=2&&n!==i-1,noBorder:i>=2&&n>0&&n<i-1,noBorderRight:i>=2&&n!==i-1})]},"button-group-child-".concat(n))}))})})},x=t(57722),j=t(73828),y=t(11135),k=t(98781),Z=t(86673),O=t(82531),P=t(16115),C=t(94353),w=t(60701),S=t(55512),_=t(24224),E=t(32821),I=t(90211),T=t(96510),D=t(51504),A=t(41150);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 B(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,i.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}var R=function(e){var n=e.active,t=e.addNewBlock,f=e.disableRefreshWarning,p=e.fetchPipeline,m=e.fetchVariables,b=e.filePath,M=e.hideHeaderButtons,R=e.onContentChange,N=e.openSidekickView,F=e.pipeline,L=e.saveFile,H=e.selectedFilePath,U=e.sendTerminalMessage,z=e.setDisableShortcuts,V=e.setErrors,W=e.setFilesTouched,K=e.setSelectedBlock,G=(0,c.j)("apiReloads"),Y=(0,r.Z)(G,2)[1],q=(0,l.useState)(null),Q=q[0],J=q[1],X=(0,l.useState)(!1),$=X[0],ee=(X[1],(0,l.useRef)(null)),ne=(0,l.useMemo)((function(){return new a.Z}),[]),te=(0,l.useMemo)((function(){return{api_key:C.l,token:ne.decodedToken.token}}),[ne]),ie=O.ZP.statuses.list().data,re=(0,l.useMemo)((function(){var e,n;return null===ie||void 0===ie||null===(e=ie.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.repo_path}),[ie]),oe=O.ZP.file_contents.detail(b).data;(0,l.useEffect)((function(){null!==oe&&void 0!==oe&&oe.file_content&&J(oe.file_content)}),[oe]);var le=(0,l.useState)(null===Q||void 0===Q?void 0:Q.content),ce=le[0],ue=le[1],ae=(0,l.useCallback)((function(e){ue(e),R&&(null===R||void 0===R||R(e))}),[R]),se=(0,l.useState)(!1),de=se[0],fe=se[1];(0,l.useEffect)((function(){n&&z&&(null===z||void 0===z||z(!0))}),[n,z]),(0,l.useEffect)((function(){var e;H&&(null===ee||void 0===ee||null===(e=ee.current)||void 0===e||e.scrollIntoView())}),[H]);var pe=(0,u.Db)(O.ZP.file_contents.useUpdate((null===Q||void 0===Q?void 0:Q.path)&&encodeURIComponent(null===Q||void 0===Q?void 0:Q.path)),{onSuccess:function(e){return(0,T.wD)(e,{callback:function(){Y((function(e){return B(B({},e),{},(0,i.Z)({},"FileVersions/".concat(null===Q||void 0===Q?void 0:Q.path),Number(new Date)))}))},onErrorCallback:function(e,n){return null===V||void 0===V?void 0:V({errors:n,response:e})}})}}),he=(0,r.Z)(pe,1)[0],ve=(0,l.useCallback)((function(e,n){if(L)return L(e,n);he({file_content:B(B({},n),{},{content:e})}).then((function(){decodeURIComponent(b).split(o.sep).pop()===j.dT.METADATA_YAML&&m&&(null===m||void 0===m||m())})),W((function(e){return B(B({},e),{},(0,i.Z)({},null===n||void 0===n?void 0:n.path,!1))})),fe(!1)}),[m,b,L,W,he]),me=(0,l.useMemo)((function(){return(0,S.lU)()}),[]),be=(0,l.useMemo)((function(){var e,n,t,i;return null===(null===Q||void 0===Q||null===(e=Q.path)||void 0===e?void 0:e.match(me))?j.Lu.TXT:null===Q||void 0===Q||null===(n=Q.path)||void 0===n||null===(t=n.match(me))||void 0===t||null===(i=t[0])||void 0===i?void 0:i.split(".")[1]}),[me,Q]),ge=(0,l.useMemo)((function(){if(null!==Q&&void 0!==Q&&Q.path)return(0,v.jsx)(x.Z,{autoHeight:!0,language:j.nB[be],onChange:function(e){ae(e),W((function(e){return B(B({},e),{},(0,i.Z)({},null===Q||void 0===Q?void 0:Q.path,!0))})),fe(!0)},onSave:function(e){ve(e,Q)},selected:!0,textareaFocused:!0,value:(0,I.Pb)(null===Q||void 0===Q?void 0:Q.content)?JSON.stringify(JSON.parse(null===Q||void 0===Q?void 0:Q.content),null,2):null===Q||void 0===Q?void 0:Q.content,width:"100%"})}),[Q,be,ve,ae,W]),xe=null!==F&&void 0!==F&&F.blocks?(0,_.sE)(null===F||void 0===F?void 0:F.blocks,(function(e){var n=e.type;return s.tf.DATA_EXPORTER===n})):null,je=(0,u.Db)(O.ZP.blocks.pipelines.useUpdate(null===F||void 0===F?void 0:F.uuid,null===xe||void 0===xe?void 0:xe.uuid),{onSuccess:function(e){return(0,T.wD)(e,{callback:function(){null===p||void 0===p||p()}})}}),ye=(0,r.Z)(je,1)[0],ke=t&&F&&(be===j.Lu.PY||be===j.Lu.SQL||(be===j.Lu.YAML||be===j.Lu.R)&&(0,E.V3)(Q,null===Q||void 0===Q?void 0:Q.path))&&(0,S.ck)(Q.path.split(o.sep))!==s.tf.SCRATCHPAD&&(0,E.lr)(Q)&&(0,v.jsx)(d.Z,{onClick:function(){var e=(null===F||void 0===F?void 0:F.type)===k.qL.INTEGRATION,n=(0,S.TU)(Q,re,F);t(n,(function(n){e&&xe&&ye({block:B(B({},xe),{},{upstream_blocks:[n.uuid]})}),null===K||void 0===K||K(n)}))},primary:!0,children:"Add to current pipeline"}),Ze=U&&(0,v.jsx)(Z.Z,{m:2,children:(0,v.jsx)(y.ZP,{disabled:!re,inline:!0,loading:$,onClick:function(){null===N||void 0===N||N(w.cH.TERMINAL),null===U||void 0===U||U(JSON.stringify(B(B({},te),{},{command:["stdin","pip install -r ".concat(re,"/requirements.txt\r")]})))},title:re?"Pip install packages from your saved requirements.txt file (\u2318+S to save).":"Please use right panel terminal to install packages.",uuid:"FileEditor/InstallPackages",children:"Install packages"})}),Oe="FileEditor/".concat(null===Q||void 0===Q?void 0:Q.path),Pe=(0,A.y)(),Ce=Pe.registerOnKeyDown,we=Pe.unregisterOnKeyDown;return(0,l.useEffect)((function(){return function(){we(Oe)}}),[we,Oe]),Ce(Oe,(function(e,t){if(n&&!f)if((0,D.y)([P.zX,P.Um],t)||(0,D.y)([P.PQ,P.Um],t))e.preventDefault(),ve(ce,Q);else if(de&&(0,D.y)([P.zX,P.hS],t)){e.preventDefault();var i="".concat(Q.path," has changes that are unsaved. ")+"Click cancel and save your changes before reloading page.";"undefined"!==typeof location&&window.confirm(i)&&location.reload()}}),[n,ce,f,Q,ve,de]),(0,v.jsxs)("div",{ref:ee,children:[!M&&(0,v.jsx)(Z.Z,{p:2,children:(0,v.jsxs)(h.Z,{justifyContent:"space-between",children:[(0,v.jsxs)(g,{children:[ke,(0,v.jsx)(d.Z,{disabled:!ce,onClick:function(e){e.preventDefault(),ve(ce,Q)},title:ce?null:"No changes have been made to this file.",children:"Save file content"})]}),N&&(0,v.jsx)(g,{children:(0,v.jsx)(d.Z,{compact:!0,onClick:function(){N(w.cH.FILE_VERSIONS)},small:!0,title:"View previous changes to this file.",children:"Show versions"})})]})}),ge,b===j.dT.REQS_TXT&&Ze]})}},23351:function(e,n,t){"use strict";var i=t(82394),r=t(75582),o=t(17717),l=t(37958),c=t(82684),u=t(83455),a=t(60328),s=t(57722),d=t(73828),f=t(93461),p=t(67971),h=t(87372),v=t(86673),m=t(54283),b=t(87815),g=t(19711),x=t(82531),j=t(49125),y=t(55512),k=t(42305),Z=t(90211),O=t(96510),P=t(66653),C=t(24224),w=t(28598);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 _(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,i.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}n.Z=function(e){var n=e.onActionCallback,t=e.selectedBlock,S=e.selectedFilePath,E=e.setErrors,I=e.width,T=(0,l.j)("apiReloads"),D=(0,r.Z)(T,2)[1],A=x.ZP.file_versions.files.list(S&&encodeURIComponent(S)),M=A.data,B=A.mutate,R=(0,c.useMemo)((function(){return(null===M||void 0===M?void 0:M.file_versions)||[]}),[M]),N=(0,c.useState)(null),F=N[0],L=N[1],H=(0,c.useMemo)((function(){return null===R||void 0===R?void 0:R[F]}),[F,R]),U=x.ZP.file_contents.detail(H?encodeURIComponent(H.path):null).data,z=(0,c.useMemo)((function(){return null===U||void 0===U?void 0:U.file_content}),[U]),V=(0,c.useMemo)((function(){return(0,y.lU)()}),[]),W=(0,c.useMemo)((function(){var e,n,t;return null===S||void 0===S||null===(e=S.match(V))||void 0===e||null===(n=e[0])||void 0===n||null===(t=n.split("."))||void 0===t?void 0:t[1]}),[S,V]),K=(0,u.Db)(x.ZP.file_contents.useUpdate(S&&encodeURIComponent(S)),{onSuccess:function(e){return(0,O.wD)(e,{callback:function(e){var t;S&&B();var r=null===e||void 0===e||null===(t=e.file_content)||void 0===t?void 0:t.path,l="FileEditor/".concat(r);if(r){var c=r.split(o.sep);if("pipelines"===c[0]){var u=c.slice(1,c.length-1).join(o.sep);l="PipelineDetail/".concat(u)}}D((function(e){return _(_({},e),{},(0,i.Z)({},l,Number(new Date)))})),L((function(e){return e+1})),null===n||void 0===n||n(e)},onErrorCallback:function(e,n){return E({errors:n,response:e})}})}}),G=(0,r.Z)(K,2),Y=G[0],q=G[1].isLoading,Q=(0,c.useMemo)((function(){var e=R.map((function(e){var n=e.name,t=e.path;return[(0,w.jsxs)(p.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(f.Z,{flex:1,children:[(0,w.jsx)(g.ZP,{default:!0,monospace:!0,children:(0,k.JX)(n,{withSeconds:!0})}),(0,w.jsx)(v.Z,{px:2*j.cd,children:(0,w.jsx)(g.ZP,{monospace:!0,children:n})})]}),H&&(null===H||void 0===H?void 0:H.path)===t&&(0,w.jsx)(a.Z,{compact:!0,loading:q,onClick:function(e){(0,P.j)(e),Y({file_content:{version:n}})},small:!0,children:"Replace with this version"})]},n)]}));if(H){var n=(0,w.jsx)(v.Z,{p:j.cd,children:(0,w.jsx)(m.Z,{},"spinner")});if(z&&(null===z||void 0===z?void 0:z.path)===(null===H||void 0===H?void 0:H.path)){var t=z.content,i=void 0===t?"":t;n=(0,w.jsx)(s.Z,{autoHeight:!0,language:d.nB[W],padding:!0,readOnly:!0,value:(0,Z.Pb)(i)?JSON.stringify(JSON.parse(i),null,2):i,width:I})}e=(0,C.Hk)([n],F+1,e)}return e}),[z,W,R,q,H,F,Y,I]);return(0,w.jsxs)("div",{style:{width:I},children:[(0,w.jsxs)(v.Z,{p:j.cd,children:[(0,w.jsx)(h.Z,{level:5,children:"File versions"}),(0,w.jsx)(g.ZP,{inline:!0,monospace:!0,children:S?decodeURIComponent(S):null===t||void 0===t?void 0:t.uuid})]}),(0,w.jsx)(b.Z,{buildRowProps:function(e){if(H&&F+1===e)return{renderCell:function(e){return e},renderRow:function(e){return e}}},columnFlex:[1],columns:[{uuid:"Version"}],isSelectedRow:function(e){var n;return(null===(n=R[e])||void 0===n?void 0:n.name)===(null===H||void 0===H?void 0:H.name)},onClickRow:function(e){H?e===F?L(null):e<F?L(e):e>F+1&&L(e-1):L(e)},rows:Q})]})}},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 ")}))},38488:function(e,n,t){"use strict";t.d(n,{Z:function(){return P}});var i=t(82394),r=t(26304),o=t(82684),l=t(38626),c=t(16634),u=t(67971),a=t(10919),s=t(86673),d=t(19711),f=t(46261),p=t(23831),h=t(10503),v=t(28347),m=t(49125),b=t(33766),g=t(66653),x=t(28598);var j=function(e){var n=e.filePath,t=e.filesTouched,i=void 0===t?{}:t,r=e.isLast,l=e.onClickTab,j=e.onClickTabClose,y=e.renderTabTitle,k=e.savePipelineContent,Z=e.selected,O=e.themeContext,P=(0,o.useState)(!1),C=P[0],w=P[1];return(0,x.jsx)(u.Z,{flexDirection:"column",fullHeight:!0,onClick:function(e){e.preventDefault(),Z||(l?l(n):(null===k||void 0===k||k(),(0,b.u7)({file_path:encodeURIComponent(n)})))},onMouseEnter:function(){return w(!0)},onMouseLeave:function(){return w(!1)},children:(0,x.jsx)(v.Gb,{last:r,selected:Z,children:(0,x.jsxs)(u.Z,{alignItems:"center",fullHeight:!0,children:[(0,x.jsx)(f.Z,{appearAbove:!0,appearBefore:!0,label:n,size:null,widthFitContent:!0,children:(0,x.jsxs)(u.Z,{alignItems:"center",fullHeight:!0,children:[!i[n]&&(0,x.jsx)(h.iU,{muted:!Z,size:1.5*m.iI}),i[n]&&(0,x.jsx)(f.Z,{label:"Unsaved changes",size:null,widthFitContent:!0,children:(0,x.jsx)("div",{style:{padding:1},children:(0,x.jsx)(c.Z,{borderColor:(O||p.Z).borders.danger,size:1.25*m.iI})})}),(0,x.jsx)(s.Z,{mr:1}),(0,x.jsx)(d.ZP,{muted:!Z,children:y?y(n):n})]})}),(0,x.jsx)(s.Z,{mr:2}),(0,x.jsx)(f.Z,{label:"Close",size:null,widthFitContent:!0,children:(0,x.jsxs)(a.Z,{autoHeight:!0,block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(e){(0,g.j)(e),null===j||void 0===j||j(n)},preventDefault:!0,children:[(C||Z)&&(0,x.jsx)(h.x8,{muted:!Z,size:1.25*m.iI}),!C&&!Z&&(0,x.jsx)("div",{style:{width:1.25*m.iI}})]})})]})})})},y=t(24224),k=["filePaths","isSelectedFilePath","onClickTabClose","selectedFilePath"];function Z(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 O(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Z(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Z(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var P=function(e){var n=e.filePaths,t=e.isSelectedFilePath,i=e.onClickTabClose,c=e.selectedFilePath,a=(0,r.Z)(e,k),s=(0,o.useContext)(l.ThemeContext),d=(0,o.useMemo)((function(){return n.map((function(e){return decodeURIComponent(e)}))}),[n]),f=(0,o.useMemo)((function(){return null===d||void 0===d?void 0:d.length}),[d]);return(0,x.jsx)(u.Z,{alignItems:"center",justifyContent:"flex-start",children:null===d||void 0===d?void 0:d.map((function(e,n){var r=t?t(e,c):c===encodeURIComponent(e);return(0,o.createElement)(j,O(O({},a),{},{filePath:e,isLast:n===f-1,key:e,onClickTabClose:function(e){if(i)i(e);else{var n=(0,y.Od)(d,(function(n){return n===e})).map((function(e){return encodeURIComponent(e)}));(0,b.u7)({file_path:n[n.length-1]||null,"file_paths[]":n},{pushHistory:!0})}},selected:r,themeContext:s}))}))})}},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]},28347:function(e,n,t){"use strict";t.d(n,{Gb:function(){return f},fm:function(){return s},lO:function(){return a},rK:function(){return d},zn:function(){return u}});var i=t(38626),r=t(23831),o=t(82386),l=t(49125),c=t(37391),u=300,a=i.default.div.withConfig({displayName:"indexstyle__PipelineContainerStyle",componentId:"sc-1sv9513-0"})([".pipeline-detail-enter-active{opacity:1;transition:opacity ","ms linear;}.pipeline-detail-enter-done{opacity:0;transition:opacity ","ms linear;}"],u,u),s=i.default.div.withConfig({displayName:"indexstyle__OverlayStyle",componentId:"sc-1sv9513-1"})(["height:100vh;opacity:1;position:fixed;width:100vw;z-index:9999;",""],(function(e){return"\n background-color: ".concat((e.theme.background||r.Z.background).codeArea,";\n ")})),d=i.default.div.withConfig({displayName:"indexstyle__PipelineHeaderStyle",componentId:"sc-1sv9513-2"})(["height:","px;position:sticky;top:","px;width:100%;z-index:5;"," "," "," ",""],o.Wi,o.Wi,(function(e){return"\n background-color: ".concat((e.theme.background||r.Z.background).panel,";\n border-bottom: 1px solid ").concat((e.theme.borders||r.Z.borders).medium,";\n ")}),(function(e){return e.relativePosition&&"\n position: relative;\n "}),(function(e){return e.secondary&&"\n height: ".concat(37,"px;\n top: ").concat(o.Wi,"px;\n overflow-x: auto;\n z-index: 3;\n ")}),(0,c.y$)()),f=i.default.div.withConfig({displayName:"indexstyle__FileTabStyle",componentId:"sc-1sv9513-3"})(["border-right:1px solid transparent;height:100%;padding:","px ","px;"," "," ",""],l.iI,l.cd*l.iI,(function(e){return"\n &:hover {\n cursor: default;\n\n p {\n color: ".concat((e.theme.content||r.Z.content).active," !important;\n cursor: default;\n }\n }\n ")}),(function(e){return e.selected&&"\n background-color: ".concat((e.theme.interactive||r.Z.interactive).hoverBackground,";\n ")}),(function(e){return!e.selected&&!e.last&&"\n border-color: ".concat((e.theme.borders||r.Z.borders).light," !important;\n ")}))},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}},58122:function(e,n,t){"use strict";t.d(n,{FS:function(){return u},JZ:function(){return s},e7:function(){return d},wx:function(){return a}});var i=t(75582),r=t(82394),o=t(93348);function l(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 c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?l(Object(t),!0).forEach((function(n){(0,r.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function u(e){return"string"===typeof e?e:JSON.stringify(e)}function a(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 c(c({},e),{},{value:u(n)})}))}function s(e,n){return n===o.Xm.TIME?e.push({uuid:"execution_date",value:"<run datetime>"}):n===o.Xm.EVENT&&e.push({uuid:"event",value:"<trigger event>"}),e}function d(e){return e?Object.entries(e).reduce((function(e,n){var t=(0,i.Z)(n,2),o=t[0],l=t[1],u=l;try{u=JSON.parse(l)}catch(a){}return c(c({},e),{},(0,r.Z)({},o,u))}),{}):e}},68735:function(e,n,t){"use strict";var i=t(26304),r=t(21831),o=t(82394),l=t(82684),c=t(26226),u=t(38626),a=t(90948),s=t(84969),d=t(65743),f=t(85587),p=t(79487),h=t(52136),v=t(67778),m=t(29989),b=t(17066),g=t(84482),x=t(76771),j=t(98889),y=t(65376),k=t(61655),Z=t(97745),O=t(48072),P=t(10103),C=t(84181),w=t(24903),S=t(67971),_=t(19711),E=t(52359),I=t(23831),T=t(80906),D=t(73899),A=t(2005),M=t(31012),B=t(49125),R=t(24224),N=t(344),F=t(45739),L=t(28598),H=["areaBetweenLines","data","events","height","lineLegendNames","margin","width","xAxisLabel","xLabelFormat","yAxisLabel","yLabelFormat"];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 z(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,o.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}var V=z(z({},y.j),{},{backgroundColor:I.Z.background.muted,border:"none"}),W=(0,k.Z)((function(e){var n=e.areaBetweenLines,t=e.data,i=e.events,o=void 0!==i&&i,c=e.getX,k=e.getY,S=e.gridProps,E=void 0===S?{}:S,H=e.height,U=e.hideGridX,W=e.hideTooltip,K=e.increasedXTicks,G=e.lineLegendNames,Y=e.margin,q=e.noCurve,Q=e.numYTicks,J=e.renderXTooltipContent,X=e.renderYTooltipContent,$=e.showTooltip,ee=e.thickStroke,ne=e.tooltipData,te=e.tooltipLeft,ie=void 0===te?0:te,re=e.tooltipTop,oe=void 0===re?[]:re,le=e.width,ce=e.xLabelFormat,ue=e.xLabelRotate,ae=void 0===ue||ue,se=e.yLabelFormat,de=(0,l.useContext)(u.ThemeContext),fe=c||function(e){return null===e||void 0===e?void 0:e.x},pe=k||function(e){var n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null===e||void 0===e||null===(n=e.y)||void 0===n?void 0:n[t]},he=I.Z.monotone.gray,ve=I.Z.brand.wind200,me=I.Z.content.muted,be=I.Z.monotone.gray,ge=t.map((function(e){return Number(fe(e))}));if(le<10)return null;var xe=le-Y.left-Y.right,je=H-Y.top-Y.bottom,ye=xe/2,ke=Math.max.apply(Math,(0,r.Z)(t.map((function(e){var n=e.y;return(null===n||void 0===n?void 0:n.length)||0})))),Ze=(0,l.useMemo)((function(){return(0,C.Z)({domain:[Math.min.apply(Math,(0,r.Z)(ge)),Math.max.apply(Math,(0,r.Z)(ge))],range:[0,xe]})}),[xe,ge]),Oe=Math.min.apply(Math,(0,r.Z)(t.map((function(e){var n=e.y;return Math.min.apply(Math,(0,r.Z)(n||[]))})))),Pe=Math.max.apply(Math,(0,r.Z)(t.map((function(e){var n=e.y;return Math.max.apply(Math,(0,r.Z)(n||[]))})))),Ce=(0,l.useMemo)((function(){return(0,C.Z)({domain:[Oe,Pe],nice:!0,range:[je,0]})}),[je,Pe,Oe]),we=le>520?K?20:10:K?10:5,Se=(0,F.K)(de),_e=me,Ee=Se.map((function(e){return{stroke:e}})),Ie=(0,w.Z)({domain:G||[],range:Ee.map((function(e){return e.stroke}))}),Te=(0,l.useCallback)((function(e){var n=((0,O.Z)(e)||{x:0}).x,i=Ze.invert(n-Y.left),r=(0,R.ry)(ge,(function(e){return i>=e})),o=t[r-1],l=t[r],c=o;l&&(i-fe(o)>fe(l)-i?c=l:(c=o,r-=1));var u=(0,P.range)(0,ke).map((function(e){return Ce(pe(c,e))}));pe(c)&&$({tooltipData:z(z({},c),{},{index:r}),tooltipLeft:n,tooltipTop:u})}),[t,fe,pe,Y,$,Ze,Ce]),De={};return q||(De.curve=Z.ZP),(0,L.jsxs)(L.Fragment,{children:[G&&(0,L.jsx)("div",{style:{marginLeft:null===Y||void 0===Y?void 0:Y.left},children:(0,L.jsx)(b.Z,{labelFormat:function(e){return e},scale:Ie,children:function(e){return(0,L.jsx)("div",{style:{display:"flex",flexDirection:T.qs.ROW},children:e.map((function(e,n){return(0,L.jsxs)(g.Z,{margin:"0 5px",onClick:function(){o&&alert("clicked: ".concat(JSON.stringify(e)))},children:[(0,L.jsx)("svg",{height:15,width:15,children:(0,L.jsx)("rect",{fill:e.value,height:15,width:15})}),(0,L.jsx)(x.Z,{align:"left",margin:"0 0 0 4px",children:(0,L.jsx)(_.ZP,{small:!0,children:e.text})})]},"legend-quantile-".concat(n))}))})}})}),(0,L.jsxs)("svg",{height:H,width:le,children:[!n&&(0,L.jsx)(d.Z,{fill:"transparent",height:H,onMouseLeave:function(){return W()},onMouseMove:Te,onTouchMove:Te,onTouchStart:Te,rx:14,width:le-(Y.left+Y.right),x:Y.left,y:0}),(0,L.jsxs)(m.Z,{left:Y.left,top:Y.top,children:[!U&&(0,L.jsx)(h.Z,z({height:je,pointerEvents:"none",scale:Ze,stroke:he,strokeDasharray:"3,3",strokeOpacity:.4,width:xe},E)),(0,L.jsx)(v.Z,z({height:je,pointerEvents:"none",scale:Ce,stroke:he,strokeDasharray:"3,3",strokeOpacity:.4,width:xe},E)),(0,L.jsx)("line",{stroke:he,x1:xe,x2:xe,y1:0,y2:je}),(0,L.jsx)(a.Z,{numTicks:we,scale:Ze,stroke:_e,tickFormat:function(e){return ce?ce(e):e},tickLabelProps:function(e){return{fill:me,fontFamily:A.ry,fontSize:M.J5,textAnchor:"middle",transform:ae&&"rotate(-45, ".concat(Ze(e),", 0) translate(-32, 4)")}},tickStroke:_e,top:je}),(0,L.jsx)(s.Z,{hideTicks:!0,numTicks:Q,scale:Ce,stroke:_e,tickFormat:function(e){return se?se(e):(0,N.P5)(e)},tickLabelProps:function(e){return{dx:String(e).length>4?3:0,fill:me,fontFamily:A.ry,fontSize:M.J5,textAnchor:"end",transform:"translate(0,2.5)"}},tickStroke:_e}),n&&n.map((function(e){var n=e[0],i=e[1];return(0,l.createElement)(j.Z,z(z({},De),{},{aboveAreaProps:{fill:I.Z.brand.earth400,fillOpacity:.3},belowAreaProps:{fill:ve,fillOpacity:.2},clipAboveTo:0,clipBelowTo:je,data:t,id:"".concat(Math.random()),key:"".concat(n,"-").concat(i),x:function(e){return Ze(fe(e))},y0:function(e){return Ce("undefined"===typeof i?Oe:pe(e,i))},y1:function(e){return Ce(pe(e,n))}}))})),(0,P.range)(0,ke).map((function(e){return(0,l.createElement)(f.Z,z(z({},De),{},{data:t.filter((function(e){return void 0!=e.y})),key:e,pointerEvents:"none",strokeWidth:ee?2:1,x:function(e){return Ze(fe(e))},y:function(n){return Ce(n.y&&(e>=n.y.length?Oe:pe(n,e)))}},Ee[e]))}))]}),ne&&(0,L.jsxs)("g",{children:[(0,L.jsx)(p.Z,{from:{x:ie,y:Y.top},pointerEvents:"none",stroke:D.Ej,strokeDasharray:"5,2",strokeWidth:1,to:{x:ie,y:je+Y.top}}),oe.map((function(e,n){return(0,L.jsx)("circle",{cx:ie,cy:e+1+Y.top,fill:Ee[n].stroke,fillOpacity:.1,pointerEvents:"none",r:4,stroke:be,strokeOpacity:.1,strokeWidth:1},n)})),oe.map((function(e,n){return(0,L.jsx)("circle",{cx:ie,cy:e+Y.top,fill:Ee[n].stroke,pointerEvents:"none",r:4,stroke:Ee[n].stroke,strokeWidth:2},n)}))]})]}),ne&&(0,L.jsxs)("div",{children:[oe.map((function(e,n){var t=pe(ne,n);return n>=1&&Math.abs(oe[n-1]-e)<5*B.iI&&(e+=3*B.iI),(0,L.jsxs)(y.Z,{left:ie>ye?ie-(0,N.Vs)(X,ne,n)*B.iI:ie+B.iI,style:V,top:e-2*B.iI,children:[X&&X(ne,n),!X&&(0,L.jsxs)(_.ZP,{center:!0,small:!0,children:[t.toFixed?t.toFixed(3):t," ",null===G||void 0===G?void 0:G[n]]})]},n)})),(0,L.jsxs)(y.Z,{left:ie>ye?ie-4*(0,N.Vs)(J,ne):ie,style:z(z({},V),{},{transform:"translateX(-65%)"}),top:je+Y.top,children:[J&&J(ne),!J&&(0,L.jsx)(_.ZP,{center:!0,small:!0,children:fe(ne).toFixed(3)})]})]})]})}));n.Z=function(e){var n=e.areaBetweenLines,t=e.data,r=(e.events,e.height),o=e.lineLegendNames,l=e.margin,u=void 0===l?{}:l,a=e.width,s=e.xAxisLabel,d=e.xLabelFormat,f=e.yAxisLabel,p=e.yLabelFormat,h=(0,i.Z)(e,H),v=z(z({},{bottom:3*B.iI,left:5*B.iI,right:3*B.iI,top:3*B.iI}),u);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{style:{display:"flex",height:r,marginBottom:B.iI,width:"100%"},children:[f&&(0,L.jsx)(S.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,L.jsx)(E.Z,{children:(0,L.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:f})})}),(0,L.jsx)("div",{style:{height:r,width:"undefined"===typeof a?"100%":a},children:(0,L.jsx)(c.Z,{children:function(e){var i=e.width,r=e.height;return(0,L.jsx)(W,z(z({},h),{},{areaBetweenLines:n,data:t,height:r,lineLegendNames:o,margin:v,width:i,xLabelFormat:d,yLabelFormat:p}))}})})]}),s&&(0,L.jsx)("div",{style:{paddingLeft:f?36:0,paddingTop:4},children:(0,L.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:s})})]})}},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})}))}))}},18221:function(e,n,t){"use strict";var i;t.d(n,{R:function(){return r}}),function(e){e.AZURE_CONTAINER_INSTANCE="azure_container_instance",e.ECS="ecs",e.GCP_CLOUD_RUN="gcp_cloud_run",e.K8S="k8s",e.LOCAL_PYTHON="local_python",e.PYSPARK="pyspark"}(i||(i={}));var r=[i.AZURE_CONTAINER_INSTANCE,i.ECS,i.GCP_CLOUD_RUN,i.K8S,i.LOCAL_PYTHON,i.PYSPARK]},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"},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 v(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 m(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?v(Object(t),!0).forEach((function(n){(0,r.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(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,v=e.iconPosition,b=void 0===v?i.LEFT:v,g=e.inverted,x=e.linkProps,j=e.linkText,y=e.monospace,k=e.muted,Z=e.small,O=e.toastMessage,P=e.withCopyIcon;return t?n=(0,h.jsx)("span",{children:t}):P&&(n=(0,h.jsx)(u.Z,m(m({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})})}},18776:function(e,n,t){"use strict";t.d(n,{Z:function(){return u}});var i=t(38626),r=t(23831),o=t(73942),l=i.default.div.withConfig({displayName:"indexstyle__PanelStyle",componentId:"sc-1rfr5wd-0"})(["border-radius:","px;"," ",""],o.n_,(function(e){return"\n background-color: ".concat((e.theme.background||r.Z.background).panel,";\n ")}),(function(e){return e.fullWidth&&"\n width: 100%;\n "})),c=t(28598);var u=function(e){var n=e.children,t=e.fullWidth,i=void 0===t||t;return(0,c.jsx)(l,{fullWidth:i,children:n})}},14623:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Vr}});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),v=t(86422),m=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),P=t(49125),C=t(44162),w=t(28598);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 _(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,o.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}var E=function(e){var n=e.blockRefs,t=e.hiddenBlocks,i=e.pipeline,r=e.setHiddenBlocks,l=(0,s.useContext)(m.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,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{p:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsx)(j.Z,{flex:1,justifyContent:"center",children:(0,w.jsx)(b.Z,{checked:p,label:"Show all",onClick:function(){return r((function(){return{}}))}})}),(0,w.jsx)(j.Z,{flex:1,justifyContent:"center",children:(0,w.jsx)(b.Z,{checked:f,label:"Hide all",onClick:function(){return r((function(){return c.reduce((function(e,n){var t=n.uuid;return _(_({},e),{},(0,o.Z)({},t,!0))}),{})}))}})})]})}),(0,w.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,w.jsx)(k.Z,{block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){r((function(e){return _(_({},e),{},(0,o.Z)({},n,c))})),c||setTimeout((function(){return h(e)}),1)},preventDefault:!0,children:(0,w.jsx)(Z.Z,{mt:1,px:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(Z.Z,{pr:1,children:(0,w.jsx)(b.Z,{checked:c})}),(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(g.Z,{color:i,size:1.5*P.iI,square:!0}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(O.ZP,{default:!0,monospace:!0,noWrapping:!0,small:!0,children:n})]})]})})},n)}))]})},I=t(2485),T=t(60328),D=t(32316),A=t(11135),M=t(29237),B=t(98781),R=t(82944),N=t(16115),F=t(11366),L=t(91427),H=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)(F.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 B.qL.INTEGRATION===(null===o||void 0===o?void 0:o.type)}),[o]),m=(0,s.useMemo)((function(){var e=null===n||void 0===n?void 0:n.type;if(h){if(v.tf.DATA_LOADER===e)return"Source";if(v.tf.DATA_EXPORTER===e)return"Destination"}return v.V4[e]}),[n,h]);return(0,w.jsxs)(M.Z,{children:[(0,w.jsxs)(O.ZP,{bold:!0,children:[m," block name"]}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsx)(R.Z,{monospace:!0,onChange:function(e){return a(e.target.value)},ref:l,value:u})}),(0,w.jsx)(Z.Z,{mt:2,children:(0,w.jsx)(y.Z,{alignItems:"center",children:(0,w.jsx)(b.Z,{checked:f,label:(0,w.jsxs)(O.ZP,{muted:!0,small:!0,children:["Automatically use randomly generated name",(0,w.jsx)("br",{}),"for blocks created in the future"]}),onClick:function(){p(!f),(0,L.t8)(F.kY,!f)}})})}),(0,w.jsx)(Z.Z,{mt:3,children:(0,w.jsxs)(y.Z,{children:[(0,w.jsx)(A.ZP,{bold:!0,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,H.y)([N.Uq],n)},onClick:function(){return r({name:u||t})},primary:!0,tabIndex:0,uuid:"ConfigureBlock/SaveAndAddBlock",children:"Save and add block"}),(0,w.jsx)(Z.Z,{ml:1,children:(0,w.jsx)(T.Z,{onClick:i,tabIndex:0,children:"Cancel"})})]})})]})},z=t(46299),V=t(91207),W=t(47999),K=t(62084),G=t(64318),Y=t(54405),q=t(90211),Q=t(41150);function J(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?J(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var $,ee,ne=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],v=p[1],m=(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,q.Y6)()}})},uuid:"new_standard_pipeline"},{label:function(){return"New streaming pipeline"},onClick:function(){return i({pipeline:{name:(0,q.Y6)(),type:B.qL.STREAMING}})},uuid:"new_streaming_pipeline"},{keyTextGroups:[[(0,Y.V5)()?N.RJ:N.hE,N.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:[[N.kA],[N.kA]],onClick:function(){return l()},uuid:"Interrupt kernel"},{label:function(){return"Restart kernel"},keyTextGroups:[[N.t_[N.OC]],[N.t_[N.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"},{label:function(){return"Browse custom templates"},linkProps:{href:"/templates"},uuid:"browse_custom_templates"},{label:function(){return"Create custom templates"},linkProps:{href:"/templates?new=1"},uuid:"create_custom_templates"}]}),[u]),Z="FileHeaderMenu/index",P=(0,Q.y)(),C=P.registerOnKeyDown,S=P.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){S(Z)}}),[S,Z]),C(Z,(function(e,n,t){null!==h&&(n[N.QK]?v((function(e){return 0===e?2:e-1})):n[N.DY]&&v((function(e){return 2===e?0:e+1})))}),[h,v]),(0,w.jsx)(W.Z,{onClickOutside:function(){return v(null)},open:!0,style:{position:"relative"},children:(0,w.jsxs)(y.Z,{children:[(0,w.jsxs)("div",{style:{position:"relative"},children:[(0,w.jsx)(G.u,{highlighted:0===h,onClick:function(){return v((function(e){return 0===e?null:0}))},onMouseEnter:function(){return v((function(e){return null!==e?0:null}))},ref:m,children:(0,w.jsx)(O.ZP,{children:"File"})}),(0,w.jsx)(K.Z,{items:x,onClickCallback:function(){return v(null)},open:0===h,parentRef:m,uuid:"FileHeaderMenu/file_items"})]}),(0,w.jsxs)("div",{style:{position:"relative"},children:[(0,w.jsx)(G.u,{highlighted:1===h,onClick:function(){return v((function(e){return 1===e?null:1}))},onMouseEnter:function(){return v((function(e){return null!==e?1:null}))},ref:b,children:(0,w.jsx)(O.ZP,{children:"Run"})}),(0,w.jsx)(K.Z,{items:j,onClickCallback:function(){return v(null)},open:1===h,parentRef:b,uuid:"FileHeaderMenu/run_items"})]}),(0,w.jsxs)("div",{style:{position:"relative"},children:[(0,w.jsx)(G.u,{highlighted:2===h,onClick:function(){return v((function(e){return 2===e?null:2}))},onMouseEnter:function(){return v((function(e){return null!==e?2:null}))},ref:g,children:(0,w.jsx)(O.ZP,{children:"Edit"})}),(0,w.jsx)(K.Z,{items:k,onClickCallback:function(){return v(null)},open:2===h,parentRef:g,uuid:"FileHeaderMenu/edit_items"})]}),t]})})},te=t(38488),ie=t(57384);!function(e){e.CREATE_NEW_CLUSTER="create_new_cluster",e.SET_ACTIVE_CLUSTER="set_active_cluster"}($||($={})),function(e){e.BOOTSTRAPPING="BOOTSTRAPPING",e.STARTING="STARTING",e.WAITING="WAITING"}(ee||(ee={}));var re,oe=t(90686),le=t(62609),ce=t(46261),ue=t(82531),ae=t(23831),se=t(66166),de=t(10503);!function(e){e.EMR="emr"}(re||(re={}));var fe=t(28347),pe=t(42305),he=t(24224),ve=t(33766),me=t(96510),be=t(99497);var ge=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,v=e.setRunningBlocks,b=e.updatePipelineMetadata,x=(0,s.useContext)(m.ThemeContext),C=c||{},S=C.alive,_=C.usage,E=(0,s.useState)(!1),I=E[0],T=E[1],D=(0,s.useState)(""),M=D[0],R=D[1],F=(0,s.useState)(re.EMR),H=F[0],U=(F[1],(0,s.useState)(!1)),z=U[0],V=U[1],G=(0,s.useState)(!1),q=G[0],J=G[1],X=(0,s.useRef)(null),$=ue.ZP.clusters.detail(H,{},{revalidateOnFocus:!1}),ne=$.data,te=$.mutate,ie=(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,he.sE)(ie,(function(e){return e.is_active}))}),[ie]),xe=(0,d.Db)(ue.ZP.clusters.useUpdate(H),{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&&R(u.uuid)}),[null===u||void 0===u?void 0:u.uuid]),n=a?"Unsaved changes":o?"Saving changes...":f?"Last saved ".concat((0,pe.JX)(Number(f)/1e3)):"All changes saved";var ye="KernelStatus",ke=(0,Q.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(N.Uq)&&String(t[1])!==String(N.zX)&&((null===u||void 0===u?void 0:u.uuid)===M?e.target.blur():(b(M),T(!1)))}),[I,M,T,b]);var Pe=(0,s.useMemo)((function(){return null===_||void 0===_?void 0:_.pid}),[null===_||void 0===_?void 0:_.pid]),Ce=(0,se.Z)(Pe),we=(0,s.useMemo)((function(){if(null!==_&&void 0!==_&&_.kernel_memory){var e=_.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===_||void 0===_?void 0:_.kernel_memory]),Se=(0,be.dd)((function(){return(0,w.jsx)(le.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*P.iI})}),{},[],{background:!0,uuid:"restart_kernel_warning"}),_e=(0,l.Z)(Se,2),Ee=_e[0],Ie=_e[1];(0,s.useEffect)((function(){var e=(0,L.U2)(L.DU,0);Pe!==Ce&&i&&!e&&(Ee(),v([]))}),[i,Pe,Ce,v,Ee]);var Te=(0,s.useMemo)((function(){return(0,w.jsx)("div",{ref:X,style:{position:"relative"},children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(null===u||void 0===u?void 0:u.type)===B.qL.PYSPARK&&(0,w.jsxs)(Z.Z,{mr:1,children:[(0,w.jsxs)(k.Z,{muted:!!ge,onClick:function(){return V(!0)},preventDefault:!0,sameColorAsText:!ge,underline:!ge,children:[ge&&ge.id,!ge&&"Select cluster"]}),(0,w.jsx)(W.Z,{disableEscape:!0,onClickOutside:function(){return V(!1)},open:z,children:(0,w.jsx)(K.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select cluster"},uuid:"select_cluster"}].concat((0,r.Z)(ie.map((function(e){var n=e.id,t=e.is_active,i=e.status;return{label:function(){return(0,w.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,w.jsx)(j.Z,{flex:1,children:(0,w.jsx)(O.ZP,{muted:!t&&ee.WAITING!==i,children:n})}),t&&(0,w.jsx)(de.Jr,{size:2*P.iI,success:!0}),!t&&(0,w.jsx)(O.ZP,{monospace:!0,muted:!0,children:i})]})},onClick:t||ee.WAITING!==i?null:function(){return je({cluster:{id:n,is_active:!0}})},uuid:n}})))),onClickCallback:function(){return V(!1)},open:z,parentRef:X,uuid:"KernelStatus/select_cluster",width:40*P.iI})})]}),(0,w.jsx)(A.ZP,{beforeElement:(0,w.jsx)(g.Z,{color:i?(x||ae.Z).borders.info:S?(x||ae.Z).borders.success:(x||ae.Z).borders.danger,size:P.iI}),blackBorder:!0,compact:!0,inline:!0,onClick:function(){return J(!0)},uuid:"Pipeline/KernelStatus/kernel",children:(null===u||void 0===u?void 0:u.type)||B.qL.PYTHON}),(0,w.jsx)(W.Z,{disableEscape:!0,onClickOutside:function(){return J(!1)},open:q,children:(0,w.jsx)(K.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select kernel"},uuid:"select_kernel"}].concat((0,r.Z)(Object.keys(B.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 J(!1)},open:q,parentRef:X,uuid:"KernelStatus/select_kernel",width:25*P.iI})})]})})}),[S,ie,i,u,ge,V,J,z,q,x,je,b]);return(0,w.jsx)(fe.rK,{relativePosition:!0,children:(0,w.jsxs)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"flex-start",children:[(0,w.jsxs)(Z.Z,{px:P.cd,children:[p&&(0,w.jsx)(k.Z,{noHoverUnderline:!0,noOutline:!0,onClick:p?function(){return(0,ve.u7)({file_path:null})}:null,preventDefault:!0,children:t}),!p&&(0,w.jsxs)(y.Z,{alignItems:"center",children:[t,I&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(k.Z,{onClick:function(){b(M),T(!1)},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]})]}),_&&(0,w.jsx)(Z.Z,{mr:P.cd,children:(0,w.jsxs)(j.Z,{flexDirection:"column",children:[(0,w.jsxs)(O.ZP,{monospace:!0,muted:!0,xsmall:!0,children:["CPU: ",null===_||void 0===_?void 0:_.kernel_cpu,"undefined"!==typeof(null===_||void 0===_?void 0:_.kernel_cpu)&&"%"]}),(0,w.jsxs)(O.ZP,{monospace:!0,muted:!0,xsmall:!0,children:["Memory: ",we]})]})})]}),(0,w.jsx)(Z.Z,{px:P.cd,children:(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(ce.Z,{appearBefore:!0,block:!0,description:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(O.ZP,{default:!0,inline:!0,children:"Press"}),"\xa0",(0,w.jsx)(oe.Z,{inline:!0,keyText:(0,Y.V5)()?N.RJ:N.hE}),"\xa0",(0,w.jsx)(O.ZP,{default:!0,inline:!0,children:"+"}),"\xa0",(0,w.jsx)(oe.Z,{inline:!0,keyText:N.SS}),"\xa0",(0,w.jsx)(O.ZP,{default:!0,inline:!0,children:"to save changes."}),(0,w.jsx)("br",{})]}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(O.ZP,{default:!0,children:["Or, go to ",(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,children:"File"})," \u203a ",(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,children:"Save pipeline"}),"."]})})]}),size:null,widthFitContent:!0,children:(0,w.jsx)(O.ZP,{muted:!0,children:n})}),(0,w.jsx)(Z.Z,{ml:2}),Te]})})]})})},xe=t(82635),je=t(17717),ye=t(16910),ke=t(65701),Ze=t(1254),Oe=t(42201),Pe=t(89949),Ce=t(25717),we=t(73942),Se=t(37391),_e=t(90880),Ee=6.25*P.iI,Ie=(P.iI,100*P.iI),Te=m.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%);",""],we.n_,Ie,(function(e){return"\n box-shadow: ".concat((e.theme||ae.Z).shadow.window,";\n background-color: ").concat((e.theme||ae.Z).background.panel,";\n ")})),De=(0,m.css)(["display:flex;align-items:center;justify-content:space-between;height:","px;padding:","px ","px;",""],Ee,P.iI,P.cd*P.iI,(function(e){return"\n background-color: ".concat((e.theme||ae.Z).background.output,";\n ")})),Ae=m.default.div.withConfig({displayName:"indexstyle__WindowHeaderStyle",componentId:"sc-g0cszf-1"})([""," border-top-left-radius:","px;border-top-right-radius:","px;",""],De,we.n_,we.n_,(function(e){return"\n border-bottom: ".concat(we.YF,"px ").concat(we.M8," ").concat((e.theme||ae.Z).borders.medium,";\n ")})),Me=m.default.div.withConfig({displayName:"indexstyle__WindowContentStyle",componentId:"sc-g0cszf-2"})(["overflow:auto;padding:","px 0;"," "," "," ",""],P.iI,Se.w5,(0,_e.eR)(),(function(e){return e.minMaxHeight&&"\n max-height: ".concat(7*P.iI,"px;\n ")}),(function(e){return!e.minMaxHeight&&"\n max-height: calc(100vh - ".concat(6.5*Ee,"px);\n ")})),Be=m.default.div.withConfig({displayName:"indexstyle__WindowFooterStyle",componentId:"sc-g0cszf-3"})([""," justify-content:flex-end;border-bottom-left-radius:","px;border-bottom-right-radius:","px;",""],De,we.n_,we.n_,(function(e){return"\n border-top: ".concat(we.YF,"px ").concat(we.M8," ").concat((e.theme||ae.Z).borders.medium,";\n ")})),Re=m.default.div.withConfig({displayName:"indexstyle__InputRowStyle",componentId:"sc-g0cszf-4"})(["padding:","px ","px;",""],.75*P.iI,2*P.iI,(function(e){return"\n border-bottom: ".concat(we.YF,"px ").concat(we.M8," ").concat((e.theme||ae.Z).borders.medium,";\n ")}));function Ne(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 Fe(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ne(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ne(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Le=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],m=(0,s.useMemo)((function(){var e,n,t=null===(e=(0,he.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(Fe(Fe({},e),{},{children:t}))})),i}),[r]),b=(0,s.useMemo)((function(){return(0,he.HK)(n,(function(e){return e.configuration.file_path}))}),[n]);return(0,w.jsxs)(Te,{children:[(0,w.jsxs)(Ae,{children:[(0,w.jsx)(j.Z,{alignItems:"center",children:(0,w.jsx)(O.ZP,{disableWordBreak:!0,monospace:!0,children:t?"Create new dbt model":"Select dbt model or snapshot file"})}),(0,w.jsx)(T.Z,{iconOnly:!0,onClick:o,children:(0,w.jsx)(de.x8,{muted:!0})})]}),t&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Re,{children:(0,w.jsx)(Ce.Z,{dynamicSizing:!0,inputValue:i,label:"Model name (cannot be changed):",labelColor:ae.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(v.t6.SQL),value:!a&&i})}),(0,w.jsxs)(Re,{children:[(0,w.jsx)(O.ZP,{bold:!0,color:ae.Z.accent.dbt,children:"Select folder location:"}),(0,w.jsx)(O.ZP,{bold:!0,muted:!p,children:p?"dbt".concat(je.sep).concat(p):"Choose folder below"})]})]}),(0,w.jsx)(Me,{children:(0,w.jsx)(z.Z,{allowSelectingFolders:t,disableContextMenu:!0,files:m,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(v.t6.SQL,"$")))},openFile:l,selectFile:h,uncollapsed:!0,useRootFolder:!0})}),t&&(0,w.jsx)(Be,{children:(0,w.jsx)(T.Z,{backgroundColor:i&&p?ae.Z.accent.dbt:ae.Z.monotone.grey500,disabled:!i||!p,onClick:function(){return l(p)},padding:"6px 8px",children:"Create model"})})]})},He=t(73828),Ue=t(10975),ze=t(14567),Ve=t(18283),We=t(93005),Ke=t(75968),Ge=t(87323);function Ye(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 qe(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ye(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ye(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Qe(e,n){var t,i=e.block,r=e.blocks,o=e.onClick,c=e.onDrop,u=i.type,a=(0,Ue.c)((function(){return{collect:function(e){return{isDragging:!!e.isDragging()}},item:i,type:We.vT}}),[i]),d=(0,l.Z)(a,3),f=d[0],p=d[1],h=(d[2],(0,ze.L)((function(){return{accept:We.vT,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)(m.ThemeContext),S=(0,C.qn)(u,{blockColor:i.color,theme:x}).accent,_=(0,Ge.cU)([i],r)[0],E=_.dynamic,I=_.dynamicUpstreamBlock,T=_.reduceOutput,D=_.reduceOutputUpstreamBlock,A=(0,s.useMemo)((function(){return(0,Ke._o)({block:i,dynamic:E,dynamicUpstreamBlock:I,reduceOutput:T,reduceOutputUpstreamBlock:D})}),[i,E,I,T,D]).borderColorShareProps,M=(0,s.useMemo)((function(){return v.tf.DBT===(null===i||void 0===i?void 0:i.type)}),[i]);return(0,w.jsx)(Z.Z,{pb:1,ref:b,children:(0,w.jsx)(C.PY,qe(qe({},qe(qe({},A),f)),{},{ref:p,children:(0,w.jsx)(k.Z,{noHoverUnderline:!0,noOutline:!0,onClick:function(){return o()},preventDefault:!0,ref:n,children:(0,w.jsx)(Z.Z,{p:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{alignItems:"center",flex:1,children:[(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(Ve.Z,{monospace:!0,children:v.dO[i.language]}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(g.Z,{color:S,size:1.5*P.iI,square:!0}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(O.ZP,{color:S,monospace:!0,children:null===(t=M?v.tf.DBT:v.V4[i.type])||void 0===t?void 0:t.toUpperCase()})]}),(0,w.jsx)(Z.Z,{mr:P.cd}),(0,w.jsx)(de.iU,{size:1.5*P.iI}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(O.ZP,{monospace:!0,muted:!0,children:null===i||void 0===i?void 0:i.uuid})]}),(0,w.jsx)(ce.Z,{appearAbove:!0,appearBefore:!0,block:!0,label:"Show ".concat(null===i||void 0===i?void 0:i.uuid," block"),size:2*P.iI,widthFitContent:!0,children:(0,w.jsx)(de.Db,{muted:!0,size:2*P.iI})})]})})})}))})}var Je,Xe,$e,en,nn=s.forwardRef(Qe),tn=t(4804),rn=t(65730),on=t(87372);!function(e){e.FULL_TABLE="FULL_TABLE",e.INCREMENTAL="INCREMENTAL",e.LOG_BASED="LOG_BASED"}(Xe||(Xe={})),function(e){e.IGNORE="IGNORE",e.UPDATE="UPDATE"}($e||($e={})),function(e){e.DATE_TIME="date-time",e.UUID="uuid"}(en||(en={}));var ln,cn="datetime",un=(Je={},(0,o.Z)(Je,en.DATE_TIME,cn),(0,o.Z)(Je,en.UUID,en.UUID),Je);!function(e){e.ARRAY="array",e.BOOLEAN="boolean",e.INTEGER="integer",e.NULL="null",e.NUMBER="number",e.OBJECT="object",e.STRING="string"}(ln||(ln={}));var an,sn,dn,fn,pn,hn=[ln.ARRAY,ln.BOOLEAN,cn,ln.INTEGER,ln.NULL,ln.NUMBER,ln.OBJECT,ln.STRING,en.UUID];!function(e){e.PROPERTIES="properties"}(an||(an={})),function(e){e.AUTOMATIC="automatic",e.AVAILABLE="available",e.UNSUPPORTED="unsupported"}(sn||(sn={})),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"}(dn||(dn={})),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"}(fn||(fn={})),function(e){e.BIGQUERY="bigquery",e.DELTA_LAKE_S3="delta_lake_s3",e.MYSQL="mysql",e.POSTGRESQL="postgresql",e.SNOWFLAKE="snowflake"}(pn||(pn={}));var vn=t(26304),mn=t(79891),bn=t(55378),gn=t(87815),xn=t(70902),jn=t(85307),yn=t(7715);function kn(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 Zn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?kn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):kn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var On="4px",Pn=[pn.BIGQUERY,pn.DELTA_LAKE_S3];var Cn=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,v=e.updateSchemaProperty,m=e.updateStream,g=(0,s.useRef)(null),x=a.bookmark_properties,k=a.destination_table,C=void 0===k?"":k,S=a.key_properties,_=a.metadata,E=a.partition_keys,I=a.replication_method,D=a.run_in_parallel,A=a.schema.properties,B=a.tap_stream_id,N=a.unique_constraints,F=a.unique_conflict_method,L=(0,s.useState)(C),H=L[0],U=L[1],z=(0,s.useState)(!1),V=z[0],W=z[1],K=(0,s.useState)(null),G=K[0],Y=K[1],Q=(0,s.useState)(!1),J=Q[0],X=Q[1],$=(0,s.useState)((0,o.Z)({},B,n||{})),ee=$[0],ne=$[1],te=(0,se.Z)(B);(0,s.useEffect)((function(){te!==B&&(U(C),Y(null))}),[C,I,B,te,F]),(0,s.useEffect)((function(){var e=null===ee||void 0===ee?void 0:ee[B];(null===x||void 0===x?void 0:x.length)>0&&((0,yn.Qr)(e)||!(0,yn.Xy)(n,e))&&ne((function(e){return Zn(Zn({},e),{},(0,o.Z)({},B,n))}))}),[null===x||void 0===x?void 0:x.length,ee,n,B]);var ie=(0,s.useMemo)((function(){return(0,he.HK)(_,(function(e){return e.breadcrumb.join("/")}))}),[_]),re=(0,s.useMemo)((function(){var e;return null===(e=(0,he.sE)(_,(function(e){return 0===e.breadcrumb.length})))||void 0===e?void 0:e.metadata}),[_]),oe=(0,s.useMemo)((function(){return re[dn.KEY_PROPERTIES]||[]}),[re]),le=(0,s.useMemo)((function(){return re[dn.REPLICATION_KEYS]||[]}),[re]),ue=Pn.includes(t),ae=d.length>1,de=(0,s.useCallback)((function(e){var n=Zn({},null===ee||void 0===ee?void 0:ee[B]);n.hasOwnProperty(e)&&delete n[e],ne((function(e){return Zn(Zn({},e),{},(0,o.Z)({},B,Zn({},n)))})),p({block:{bookmark_values:n,destination_table:H,tap_stream_id:B}})}),[ee,H,B,p]),fe=(0,s.useMemo)((function(){var e=[],n=[],i=(0,he.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 _=Array.from(k);d&&C.add(d);var I=(ie["properties/".concat(c)]||{}).metadata,D=(I.inclusion,I.selected);e.push(D),n.push(c);var A=hn.reduce((function(e,n){return _.indexOf(n)>=0||cn===String(n)&&en.DATE_TIME===d||en.UUID===String(n)&&en.UUID===d?e:e.concat((0,w.jsx)("option",{value:n,children:n},n))}),[]),M=_.findIndex((function(e){return e===ln.STRING})),R=[(0,w.jsx)(b.Z,{checked:D,onClick:function(){h(B,[c],{selected:!D})}},"".concat(B,"/").concat(c,"/selected")),(0,w.jsx)(O.ZP,{children:c},"".concat(B,"/").concat(c,"/name")),(0,w.jsxs)(y.Z,{children:[(0,w.jsx)(j.Z,{flex:1,children:(0,w.jsx)(y.Z,{alignItems:"center",flexWrap:"wrap",fullWidth:!0,children:_.map((function(e,n){return(0,w.jsx)(Z.Z,{mb:1,mr:1,children:(0,w.jsx)(mn.Z,{border:!0,label:d&&ln.STRING===e&&M===n?un[d]:e,onClick:function(){var n={format:d,type:_.filter((function(n){return n!==e}))};en.DATE_TIME!==d&&en.UUID!==d||ln.STRING!==e||(n.format=null),v(B,c,n)},small:!0})},"".concat(B,"/").concat(c,"/").concat(e,"/").concat(n,"/chip"))}))})}),A.length>=1&&(0,w.jsxs)(bn.Z,{compact:!0,onChange:function(e){var n=e.target.value,t={format:d,type:_};cn===String(n)?(t.format=en.DATE_TIME,t.type.push(ln.STRING)):en.UUID===String(n)?(t.format=en.UUID,t.type.push(ln.STRING)):t.type.push(n),v(B,c,t)},primary:!0,small:!0,value:"",width:10*P.iI,children:[(0,w.jsx)("option",{value:""}),A]})]},"".concat(B,"/").concat(c,"/type")),(0,w.jsx)(b.Z,{checked:!(null===N||void 0===N||!N.includes(c)),disabled:oe.length>=1&&!oe.includes(c),onClick:oe.length>=1&&!oe.includes(c)?null:function(){return m(B,(function(e){var n;return null!==(n=e.unique_constraints)&&void 0!==n&&n.includes(c)?e.unique_constraints=(0,he.Od)(e.unique_constraints,(function(e){return c===e})):e.unique_constraints=[c].concat(e.unique_constraints||[]),e}))}},"".concat(B,"/").concat(c,"/unique")),(0,w.jsx)(b.Z,{checked:!(null===x||void 0===x||!x.includes(c)),disabled:le.length>=1&&!le.includes(c),onClick:le.length>=1&&!le.includes(c)?null:function(){return m(B,(function(e){var n;return null!==(n=e.bookmark_properties)&&void 0!==n&&n.includes(c)?(de(c),e.bookmark_properties=(0,he.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),e}))}},"".concat(B,"/").concat(c,"/bookmark")),(0,w.jsx)(b.Z,{checked:!(null===S||void 0===S||!S.includes(c)),onClick:function(){return m(B,(function(e){var n;return null!==(n=e.key_properties)&&void 0!==n&&n.includes(c)?e.key_properties=(0,he.Od)(e.key_properties,(function(e){return c===e})):e.key_properties=[c].concat(e.key_properties||[]),e}))}},"".concat(B,"/").concat(c,"/key_property"))];if(ue){var F=t!==pn.DELTA_LAKE_S3,L=F&&(oe.includes(c)||!C.has(en.DATE_TIME));R.push((0,w.jsx)(b.Z,{checked:!(null===E||void 0===E||!E.includes(c)),disabled:L,onClick:L?null:function(){return m(B,(function(e){var n,t;null!==(n=e.partition_keys)&&void 0!==n&&n.includes(c)?e.partition_keys=(0,he.Od)(e.partition_keys,(function(e){return c===e})):F&&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(B,"/").concat(c,"/partition_key")))}if(ae){var H=G===r;R.push((0,w.jsx)(T.Z,{compact:!0,disabled:H,onClick:function(){Y(r),setTimeout((function(){return Y(null)}),2e3),f((function(e){var n,t;if((null===e||void 0===e?void 0:e.tap_stream_id)!==B&&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:_};var h=null===(i=(0,he.sE)((null===e||void 0===e?void 0:e.metadata)||[],(function(e){return 0===e.breadcrumb.length})))||void 0===i?void 0:i.metadata,v=h[dn.REPLICATION_KEYS]||[],m=h[dn.KEY_PROPERTIES]||[];null===N||void 0===N||!N.includes(c)||null!==e&&void 0!==e&&null!==(r=e.unique_constraints)&&void 0!==r&&r.includes(c)||!m.includes(c)?null!==N&&void 0!==N&&N.includes(c)||null===e||void 0===e||null===(o=e.unique_constraints)||void 0===o||!o.includes(c)||(e.unique_constraints=(0,he.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)||!v.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,he.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),null===S||void 0===S||!S.includes(c)||null!==e&&void 0!==e&&null!==(a=e.key_properties)&&void 0!==a&&a.includes(c)?null!==S&&void 0!==S&&S.includes(c)||null===e||void 0===e||null===(s=e.key_properties)||void 0===s||!s.includes(c)||(e.key_properties=(0,he.Od)(e.key_properties,(function(e){return c===e}))):e.key_properties=[c].concat(e.key_properties||[]),null===E||void 0===E||!E.includes(c)||null!==e&&void 0!==e&&null!==(f=e.partition_keys)&&void 0!==f&&f.includes(c)?null!==E&&void 0!==E&&E.includes(c)||null===e||void 0===e||null===(p=e.partition_keys)||void 0===p||!p.includes(c)||(e.partition_keys=(0,he.Od)(e.partition_keys,(function(e){return c===e}))):e.partition_keys=[c].concat(e.partition_keys||[])}return Zn({},e)}))},pill:!0,secondary:!0,children:(0,w.jsx)(O.ZP,{success:H,children:H?"Applied!":"Apply"})}))}return R})),r=e.every((function(e){return e})),o=[null,2,1,null,null,null],c=[{label:function(){return(0,w.jsx)(b.Z,{checked:r,onClick:function(){h(B,n,{selected:!r})}})},uuid:"Selected"},{uuid:"Name"},{uuid:"Type"},{uuid:"Unique"},{uuid:"Bookmark"},{uuid:"Key prop"}];return ue&&(o.push(null),c.push({uuid:"Partition key"})),ae&&(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,w.jsx)(jn.cl,{children:(0,w.jsx)(gn.Z,{alignTop:!0,columnFlex:o,columns:c,rows:i,stickyHeader:!0})})}),[x,t,ae,G,S,ie,E,A,de,ue,B,N,f,h,v,m,oe,le]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(on.Z,{condensed:!0,level:4,spacingBelow:!0,children:[(0,w.jsx)(on.Z,{condensed:!0,inline:!0,level:4,monospace:!0,children:B})," schema"]}),(0,w.jsx)(Z.Z,{mb:3,children:(0,w.jsx)(M.Z,{headerTitle:"Output",overflowVisible:!0,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(O.ZP,{children:"Destination table name"}),(0,w.jsx)(Z.Z,{ml:On}),(0,w.jsx)(ce.Z,{label:(0,w.jsxs)(O.ZP,{children:["By default, this stream will be saved to your destination under the table named ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:B}),". To change the table name, enter in a different value."]}),lightBackground:!0,primary:!0}),(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(R.Z,{compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;U(n),clearTimeout(g.current),g.current=setTimeout((function(){m(B,(function(e){return Zn(Zn({},e),{},{destination_table:n})}))}),300)},value:H||"",width:45*P.iI})]})})}),(0,w.jsx)(Z.Z,{mb:3,children:(0,w.jsx)(M.Z,{headerTitle:"Usage",overflowVisible:!0,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(O.ZP,{children:"Replication method"}),(0,w.jsx)(Z.Z,{ml:On}),(0,w.jsx)(ce.Z,{label:(0,w.jsxs)(O.ZP,{children:["Do you want to synchronize the entire stream (",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Xe.FULL_TABLE}),") on each integration pipeline run or only new records (",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Xe.INCREMENTAL}),")?",u===fn.POSTGRESQL&&(0,w.jsxs)(O.ZP,{children:["Log-based incremental replication (",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Xe.LOG_BASED}),") is also available for PostgreSQL sources."]})]}),lightBackground:!0,primary:!0}),(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsxs)(bn.Z,{compact:!0,onChange:function(e){m(B,(function(n){return Zn(Zn({},n),{},{replication_method:e.target.value})}))},primary:!0,value:I,children:[(0,w.jsx)("option",{value:""}),Object.values(Xe).filter((function(e){return u===fn.POSTGRESQL||e!==Xe.LOG_BASED})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))]}),(0,w.jsx)(Z.Z,{ml:3}),(0,w.jsx)(O.ZP,{children:"Unique conflict method"}),(0,w.jsx)(Z.Z,{ml:On}),(0,w.jsx)(ce.Z,{label:(0,w.jsxs)(O.ZP,{wordBreak:!0,children:["If a new record has the same value as an existing record in the ",(0,q._6)("column",null===N||void 0===N?void 0:N.length),(null===N||void 0===N?void 0:N.length)>0&&(0,w.jsx)(w.Fragment,{children:"\xa0"}),null===N||void 0===N?void 0:N.sort().map((function(e,n){return(0,w.jsxs)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:[1!==(null===N||void 0===N?void 0:N.length)&&n===(null===N||void 0===N?void 0:N.length)-1?(0,w.jsx)(O.ZP,{inline:!0,children:" and "},e):n>=1&&(0,w.jsx)(w.Fragment,{children:",\xa0"}),e]},e)})),", how do you want to resolve the conflict? The conflict method ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:$e.IGNORE})," will skip the new record if it\u2019s a duplicate of an existing record. The conflict method ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:$e.UPDATE})," will not save the new record and instead update the existing record with the new record\u2019s properties."]}),lightBackground:!0,primary:!0}),(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsxs)(bn.Z,{compact:!0,inputWidth:11*P.iI,onChange:function(e){m(B,(function(n){return Zn(Zn({},n),{},{unique_conflict_method:e.target.value})}))},primary:!0,value:F,children:[(0,w.jsx)("option",{value:""}),(0,w.jsx)("option",{value:$e.IGNORE,children:$e.IGNORE}),(0,w.jsx)("option",{value:$e.UPDATE,children:$e.UPDATE})]})]}),ae&&(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(O.ZP,{default:!0,children:"All streams"}),(0,w.jsx)(Z.Z,{ml:On}),(0,w.jsx)(ce.Z,{appearBefore:!0,label:(0,w.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,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(T.Z,{compact:!0,disabled:V,onClick:function(){W(!0),setTimeout((function(){return W(!1)}),2e3),f((function(e){return Zn(Zn({},e),{},{replication_method:I,unique_conflict_method:F})}))},pill:!0,secondary:!0,children:(0,w.jsx)(O.ZP,{bold:!V,success:V,children:V?"Applied!":"Apply"})})]})]})})}),(0,w.jsx)(M.Z,{headerTitle:"Features",noPadding:!0,children:fe}),(0,w.jsx)(Z.Z,{mt:2,children:(0,w.jsx)(T.Z,{loading:i,onClick:function(){return c(B)},primary:!0,small:!0,children:"Load sample data"})}),(0,w.jsxs)(Z.Z,{mt:5,children:[(0,w.jsx)(on.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Settings"}),(0,w.jsx)(Z.Z,{mb:5,children:(0,w.jsxs)(Z.Z,{mb:1,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Run stream in parallel"}),(0,w.jsx)(O.ZP,{default:!0,children:"Parallel streams will be run at the same time, so make sure there are no dependencies between them."}),(0,w.jsx)(Z.Z,{mb:1}),(0,w.jsx)(xn.Z,{checked:D,onCheck:function(){return m(B,(function(e){return e.run_in_parallel=!D,e}))}},"".concat(B,"/run_in_parallel"))]})}),Xe.INCREMENTAL===I&&(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsxs)(Z.Z,{mb:1,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Bookmark properties"}),(0,w.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,w.jsx)("br",{}),"On the next run, the synchronization will start after the bookmarked record."]})]}),(0,w.jsxs)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==x&&void 0!==x&&x.length)&&(0,w.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.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,w.jsx)(Z.Z,{mb:1,mr:1,children:(0,w.jsx)(mn.Z,{label:e,onClick:function(){de(e),m(B,(function(n){return Zn(Zn({},n),{},{bookmark_properties:(0,he.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,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{my:2,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(Z.Z,{mr:2,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Manually edit bookmark property values"}),(0,w.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,w.jsx)(xn.Z,{checked:J,disabled:!t,onCheck:function(){return X((function(e){return!e}))}})]})}),J&&!!t&&(0,w.jsx)(M.Z,{header:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsx)(O.ZP,{bold:!0,default:!0,children:"Bookmark property values"}),(0,w.jsx)(T.Z,{compact:!0,loading:r,onClick:function(){p({block:{bookmark_values:(null===ee||void 0===ee?void 0:ee[B])||{},destination_table:H,tap_stream_id:B}})},pill:!0,secondary:!0,children:"Save"})]}),headerPaddingVertical:P.iI,noPadding:!0,overflowVisible:!0,children:(0,w.jsx)(gn.Z,{columnBorders:!0,columnFlex:[null,1],columns:[{uuid:"Bookmark property"},{uuid:"Value"}],rows:x.map((function(e){var n;return[(0,w.jsx)(O.ZP,{default:!0,monospace:!0,children:e},e),(0,w.jsx)(R.Z,{borderless:!0,monospace:!0,onChange:function(n){n.preventDefault(),ne((function(t){return Zn(Zn({},t),{},(0,o.Z)({},B,Zn(Zn({},t[B]),{},(0,o.Z)({},e,n.target.value))))}))},paddingHorizontal:0,placeholder:"Enter value",value:null===ee||void 0===ee||null===(n=ee[B])||void 0===n?void 0:n[e]},"".concat(e,"_value"))]}))})})]})]}),(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsxs)(Z.Z,{mb:1,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Unique constraints"}),(0,w.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,w.jsxs)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==N&&void 0!==N&&N.length)&&(0,w.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Unique"})," to use a specific column as a unique constraint."]}),null===N||void 0===N?void 0:N.sort().map((function(e){return(0,w.jsx)(Z.Z,{mb:1,mr:1,children:(0,w.jsx)(mn.Z,{label:e,onClick:function(){m(B,(function(n){return Zn(Zn({},n),{},{unique_constraints:(0,he.Od)(n.unique_constraints||[],(function(n){return n===e}))})}))},primary:!0})},"unique_constraints/".concat(e))}))]})]}),(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsxs)(Z.Z,{mb:1,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Key properties"}),(0,w.jsx)(O.ZP,{default:!0,children:"Key properties are used as the primary key for the destination table."})]}),(0,w.jsxs)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==S&&void 0!==S&&S.length)&&(0,w.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Key prop"})," to use a specific column as a key property."]}),null===S||void 0===S?void 0:S.sort().map((function(e){return(0,w.jsx)(Z.Z,{mb:1,mr:1,children:(0,w.jsx)(mn.Z,{label:e,onClick:function(){m(B,(function(n){return Zn(Zn({},n),{},{key_properties:(0,he.Od)(n.key_properties||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]}),ue&&(0,w.jsxs)(Z.Z,{mb:3,children:[(0,w.jsxs)(Z.Z,{mb:1,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Partition keys"}),(0,w.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,w.jsxs)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==E&&void 0!==E&&E.length)&&(0,w.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Partition key"})," to use a specific column as a partition key."]}),null===E||void 0===E?void 0:E.sort().map((function(e){return(0,w.jsx)(Z.Z,{mb:1,mr:1,children:(0,w.jsx)(mn.Z,{label:e,onClick:function(){m(B,(function(n){return Zn(Zn({},n),{},{partition_keys:(0,he.Od)(n.partition_keys||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]})]})]})},wn=["catalog","pipeline","setErrors","setSelectedStream"];function Sn(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 _n(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Sn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Sn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var En,In=function(e){var n,t=e.catalog,i=e.pipeline,r=e.setErrors,o=e.setSelectedStream,c=(0,vn.Z)(e,wn),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,he.YC)(p,"stream").map((function(e){return{uuid:e.stream}}))}),[p]),m=(0,s.useMemo)((function(){return(0,he.HK)(p,(function(e){return e.stream}))}),[p]),b=(0,s.useMemo)((function(){return m[null===a||void 0===a?void 0:a.uuid]}),[a,m]),g=(0,s.useMemo)((function(){return(0,he.sE)((null===i||void 0===i?void 0:i.blocks)||[],(function(e){var n=e.type;return v.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),P=ue.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=P.data,S=P.mutate,_=null===C||void 0===C||null===(n=C.block)||void 0===n?void 0:n.bookmarks,E=(0,d.Db)(ue.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===S||void 0===S||S()},onErrorCallback:function(e,n){return null===r||void 0===r?void 0:r({errors:n,response:e})}})}}),I=(0,l.Z)(E,2),T=I[0],A=I[1].isLoading;(0,s.useEffect)((function(){h.length>0&&(a&&(0,he.sE)(h,(function(e){var n=e.uuid;return a.uuid===n}))||f(h[0]))}),[a,f,h]);var M=(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,w.jsx)(jn.cl,{children:(0,w.jsx)(gn.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,w.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,w.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,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D.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,w.jsx)(Z.Z,{mt:1,children:(0,w.jsx)(jn.dE,{children:(0,w.jsx)(Cn,_n(_n({},c),{},{bookmarkValues:_,isLoadingUpdateDestinationBlockState:A,stream:b,streams:p,updateDestinationBlockState:T}))})}),p.length>=1&&(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(jn.dE,{children:[(0,w.jsx)(on.Z,{level:4,children:"Streams Summary"}),(0,w.jsx)(Z.Z,{mt:1}),M]})})]})},Tn=t(30264),Dn=t(18776);function An(e){return Object.values(e).filter((function(e){return null!==e})).map((function(e){return e.tap_stream_id}))}function Mn(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 Bn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Mn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Mn(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"}(En||(En={}));var Rn=45*P.iI,Nn=Rn-4*P.iI;var Fn=function(e){var n=e.catalog,t=e.isLoading,i=e.onActionCallback,r=e.streams,l=(0,he.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 Bn(Bn({},e),{},{isMissingStream:!0})}))}),[l,r]),u=Bn({},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],v=p[1],m=(0,s.useState)(!1),g=m[0],j=m[1],k=(0,s.useState)(En.ALL),C=k[0],S=k[1],_=(0,s.useRef)(null),E=An(d),I=(0,s.useMemo)((function(){var e=r;return e=e.filter((function(e){var n=e.tap_stream_id;return C===En.SELECTED?E.includes(n):C!==En.NOT_SELECTED||!E.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,E,r]),D=(0,s.useMemo)((function(){return r.every((function(e){var n=e.stream;return!!d[n]}))}),[d,r]);return(0,w.jsxs)(Dn.Z,{children:[(0,w.jsx)(jn.cv,{rounded:!0,children:(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Select streams to sync"})}),(0,w.jsx)(jn.cv,{padding:1.25*P.iI,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsx)(R.Z,{beforeIcon:(0,w.jsx)(de.HN,{}),compact:!0,noBackground:!0,noBorder:!0,onChange:function(e){return v(e.target.value)},placeholder:"Search",value:h}),(0,w.jsx)(Z.Z,{pr:1,children:(0,w.jsx)(Tn.Z,{items:[{label:function(){return En.ALL},onClick:function(){return S(En.ALL)},uuid:"all_streams"},{label:function(){return En.SELECTED},onClick:function(){return S(En.SELECTED)},uuid:"selected"},{label:function(){return En.NOT_SELECTED},onClick:function(){return S(En.NOT_SELECTED)},uuid:"unselected"}],onClickCallback:function(){return j(!1)},onClickOutside:function(){return j(!1)},open:g,parentRef:_,uuid:"SelectStreams/filter",children:(0,w.jsx)(T.Z,{beforeIcon:(0,w.jsx)(de.wn,{}),noBackground:!0,onClick:function(){return j((function(e){return!e}))},ref:_,children:(0,w.jsx)(O.ZP,{children:C})})})})]})}),(0,w.jsx)(jn.cl,{height:"55vh",hideHorizontalScrollbar:!0,width:"".concat(Rn,"px"),children:(0,w.jsx)(gn.Z,{borderCollapseSeparate:!0,columnFlex:[1,6],columns:[{label:function(){return(0,w.jsx)(b.Z,{checked:D,onClick:function(){var e=(0,he.HK)(r||[],(function(e){return e.stream}));f(D?{}:e)}})},uuid:"Selected"},{uuid:"Stream name"}],rows:I.concat(c).map((function(e){var n=e.isMissingStream,t=e.stream,i=!!d[t];return[(0,w.jsx)(b.Z,{checked:i,disabled:!i&&n,onClick:function(){f((function(n){return Bn(Bn({},n),{},(0,o.Z)({},t,i?null:e))}))}},"selected-".concat(t)),(0,w.jsxs)(O.ZP,{danger:n,title:t,width:Rn-48-32,children:[t,n?" (no longer available)":""]},"stream-".concat(t))]})),stickyHeader:!0})}),(0,w.jsx)(x.Z,{medium:!0}),(0,w.jsxs)(Z.Z,{p:2,children:[(null===E||void 0===E?void 0:E.length)>50&&(0,w.jsx)(Z.Z,{pb:2,children:(0,w.jsxs)(O.ZP,{danger:!0,maxWidth:Nn,rightAligned:!0,whiteSpaceNormal:!0,children:["WARNING: Selecting too many streams (e.g. >50)",(0,w.jsx)("br",{}),"may cause app performance issues."]})}),0===(null===r||void 0===r?void 0:r.length)&&(0,w.jsx)(Z.Z,{pb:2,children:(0,w.jsx)(O.ZP,{bold:!0,maxWidth:Nn,warning:!0,whiteSpaceNormal:!0,children:"If you can successfully connect to the data source but no streams are displayed, check if the user has proper database/schema permissions."})}),(0,w.jsx)(y.Z,{justifyContent:"flex-end",children:(0,w.jsx)(T.Z,{loading:t,onClick:function(){return i(d)},primary:!0,children:"Confirm ".concat(An(d).length," streams")})})]})]})},Ln=t(57722),Hn=t(54283);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 zn(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 Vn=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,tn.Pz)(null===i||void 0===i?void 0:i.config))}),[a,i]);var p=(0,s.useState)(null),h=p[0],m=p[1],b=(0,s.useState)(),g=b[0],x=b[1],j=(0,d.Db)(ue.ZP[n].useCreate(),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){var t,i,r=(0,q.C5)(n);m(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),P=k[0],C=k[1].isLoading;return t?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(jn.$W,{children:(0,w.jsx)(Ln.Z,{autoHeight:!0,language:v.t6.YAML,onChange:function(e){f(e),r(t.type,t.uuid,(0,tn.Pz)(zn(zn({},i),{},{config:(0,tn.Qc)(e)})))},tabSize:2,value:a||void 0,width:"100%"})}),(0,w.jsxs)(Z.Z,{mt:1,children:[(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{onClick:function(){P((0,o.Z)({},(0,q.C5)(n),{action_type:"test_connection",config:a,pipeline_uuid:c.uuid})),x(null)},small:!0,success:!0,children:"Test connection"}),(0,w.jsx)(Z.Z,{ml:1,children:C?(0,w.jsx)(Hn.Z,{color:"white",small:!0}):(0,w.jsxs)(w.Fragment,{children:[h&&(0,w.jsx)(O.ZP,{small:!0,success:!0,children:"Connected successfully!"}),!1===h&&(0,w.jsx)(O.ZP,{small:!0,warning:!0,children:"Failed to connect, see error below."})]})})]}),g&&(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsx)(O.ZP,{small:!0,warning:!0,children:g})})]})]}):null},Wn=t(60701);function Kn(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 Gn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Kn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Kn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Yn=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,m=e.openSidekickView,b=e.pipeline,g=e.savePipelineContent,x=e.setErrors,j=e.setIntegrationStreams,C=e.setOutputBlocks,S=e.setSelectedBlock,_=e.setSelectedOutputBlock,E=e.setSelectedStream,I=(0,s.useState)(!0),D=I[0],A=I[1],M=(0,s.useState)(!0),B=M[0],R=M[1],N=(0,s.useState)(!0),F=N[0],L=N[1],H=ue.ZP.integration_sources.list({},{revalidateOnFocus:!1}).data,U=(0,s.useMemo)((function(){return(null===H||void 0===H?void 0:H.integration_sources)||[]}),[H]),z=(0,s.useMemo)((function(){return(0,he.HK)(U,(function(e){return e.uuid}))}),[U]),V=ue.ZP.integration_destinations.list({},{revalidateOnFocus:!1}).data,W=(0,s.useMemo)((function(){return(null===V||void 0===V?void 0:V.integration_destinations)||[]}),[V]),K=(0,s.useMemo)((function(){return(0,he.HK)(W,(function(e){return e.uuid}))}),[W]),G=(0,s.useMemo)((function(){return(0,he.sE)(o,(function(e){var n=e.type;return v.tf.DATA_LOADER===n}))}),[o]),Y=(0,s.useMemo)((function(){return G?(0,tn.Qc)(G.content):{}}),[G]),q=(0,s.useMemo)((function(){return(0,w.jsx)(Vn,{api:"integration_sources",block:G,blockContent:Y,onChangeCodeBlock:h,pipeline:b})}),[G,Y,h,b]),Q=(0,s.useMemo)((function(){return(0,he.sE)(o,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n}))}),[o]),J=(0,s.useMemo)((function(){return Q?(0,tn.Qc)(Q.content):{}}),[Q]),X=(0,s.useMemo)((function(){return(0,w.jsx)(Vn,{api:"integration_destinations",block:Q,blockContent:J,onChangeCodeBlock:h,pipeline:b})}),[Q,J,h,b]),$=(0,s.useMemo)((function(){return(0,he.sE)(o,(function(e){var n=e.type;return v.tf.TRANSFORMER===n}))}),[o]),ee=(0,s.useMemo)((function(){var e;return(0,yn.Qr)(null===Y||void 0===Y?void 0:Y.catalog)?null===b||void 0===b||null===(e=b.data_integration)||void 0===e?void 0:e.catalog:null===Y||void 0===Y?void 0:Y.catalog}),[Y,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,se.Z)(ee);(0,s.useEffect)((function(){!ie&&ee&&(C((function(){return _(G),[G]})),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],ce=(0,d.Db)(ue.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 _(G),[G]})),t.length>0&&E(t[0]),j((function(e){var n=(e||[]).concat(t);return Array.from(new Set(n)).sort()})),m(Wn.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})}})}}),ae=(0,l.Z)(ce,2),fe=ae[0],pe=ae[1].isLoading,ve=(0,d.Db)(ue.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(sn.UNSUPPORTED!==i.inclusion){var r;if(e.replication_method||(e.replication_method=Xe.FULL_TABLE),e.unique_conflict_method||(e.unique_conflict_method=$e.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]=Gn(Gn({},n),{},{metadata:Gn(Gn({},i),{},{selected:!0})})}}))}));var c={streams:r.concat(l)};j(Re.map((function(e){return e.tap_stream_id})));var s=null===Y||void 0===Y?void 0:Y.catalog;(0,yn.Qr)(s)||h(G.type,G.uuid,(0,tn.Pz)(Gn(Gn({},Y),{},{catalog:{}})));var d={pipeline:Gn(Gn({},b),{},{data_integration:Gn(Gn({},(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)(ve,2),xe=ge[0],je=ge[1].isLoading,ye=(0,s.useState)(null),ke=ye[0],Ze=ye[1],Pe=(0,d.Db)(ue.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})}})}}),Ce=(0,l.Z)(Pe,2),we=Ce[0],Se=Ce[1].isLoading,_e=(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=Gn(Gn({},ee),{},{streams:r.concat(n(i))}),l=null===Y||void 0===Y?void 0:Y.catalog;(0,yn.Qr)(l)||h(G.type,G.uuid,(0,tn.Pz)(Gn(Gn({},Y),{},{catalog:{}})));var c={pipeline:Gn(Gn({},b),{},{data_integration:Gn(Gn({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:o})})};g(c).then((function(){return a()}))}),[ee,G,Y,a,h,b,g]),Ee=(0,s.useCallback)((function(e){if(null!==ee&&void 0!==ee&&ee.streams){var n=Gn(Gn({},ee),{},{streams:ee.streams.map((function(n){return e(n)}))}),t=null===Y||void 0===Y?void 0:Y.catalog;(0,yn.Qr)(t)||h(G.type,G.uuid,(0,tn.Pz)(Gn(Gn({},Y),{},{catalog:{}})));var i={pipeline:Gn(Gn({},b),{},{data_integration:Gn(Gn({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:n})})};g(i).then((function(){return a()}))}}),[ee,G,Y,a,h,b,g]),Ie=(0,s.useCallback)((function(e,n,t){_e(e,(function(e){return e.schema.properties[n]=t,e}))}),[_e]),Te=(0,s.useCallback)((function(e,n,t){_e(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=Gn(Gn({},o),t)}})),e}))}),[_e]),De=(0,d.Db)(ue.ZP.blocks.pipelines.useUpdate(null===b||void 0===b?void 0:b.uuid,null===Q||void 0===Q?void 0:Q.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)(De,1)[0],Me=(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,w.jsx)(O.ZP,{monospace:!0,children:t},"variable-uuid-".concat(t)),(0,w.jsx)(O.ZP,{monospace:!0,children:i},"variable-uuid-".concat(t,"-{value}")),(0,w.jsx)(O.ZP,{monospace:!0,children:r},"variable-uuid-".concat(t,"-{value}-code")),(0,w.jsx)(rn.Z,{copiedText:r,monospace:!0,withCopyIcon:!0},"variable-uuid-".concat(t,"-{value}-code-copy"))])}))})),(0,w.jsx)(gn.Z,{alignTop:!0,columnFlex:[null,null,1],columns:[{uuid:"Key"},{uuid:"Value"},{uuid:"Code"}],rows:e})}),[p]),Be=(0,s.useCallback)((function(e){return(0,w.jsxs)(Z.Z,{mt:2,children:[(0,w.jsxs)(O.ZP,{default:!0,children:["Use the following variables to interpolate sensitive or dynamic information into the configuration.",(0,w.jsx)("br",{}),"You can also access values from your environment variables by using the following syntax: ",(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,children:"\"{{ env_var('MY_ENV_VARIABLE_NAME') }}\""}),(0,w.jsx)("br",{}),"For more information, check out the ",(0,w.jsx)(k.Z,{href:e,openNewWindow:!0,primary:!0,children:"documentation"}),"."]}),(0,w.jsx)(Z.Z,{mt:1,children:Me})]})}),[Me]),Re=(0,s.useMemo)((function(){return(null===ke||void 0===ke?void 0:ke.streams)||[]}),[ke]),Ne=(0,be.dd)((function(){return(0,w.jsx)(Fn,{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}}),He();else{var t=null===Y||void 0===Y?void 0:Y.catalog;(0,yn.Qr)(t)||h(G.type,G.uuid,(0,tn.Pz)(Gn(Gn({},Y),{},{catalog:{}}))),g({pipeline:Gn(Gn({},b),{},{data_integration:Gn(Gn({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:null})})}).then((function(){return a()})),He()}},streams:Re})}),{},[ee,G,Y,a,je,h,g,Re],{background:!0,uuid:"select_streams"}),Fe=(0,l.Z)(Ne,2),Le=Fe[0],He=Fe[1];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{iconOnly:!0,onClick:function(){return R((function(e){return!e}))},children:(0,w.jsxs)(w.Fragment,{children:[B&&(0,w.jsx)(de.Kh,{size:1.5*P.iI}),!B&&(0,w.jsx)(de._M,{size:1.5*P.iI})]})}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(on.Z,{children:"Source"}),!B&&(0,w.jsxs)(on.Z,{default:!0,inline:!0,children:["\xa0",null===(t=z[null===Y||void 0===Y?void 0:Y.source])||void 0===t?void 0:t.name]})]})]})}),B&&(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsxs)(jn.dE,{children:[(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsx)(on.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select source"}),(null===U||void 0===U?void 0:U.length)>0?(0,w.jsxs)(bn.Z,{onChange:function(e){var n,t,i=e.target.value;if(i){var o=null===(n=z[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})),G?h(G.type,G.uuid,(0,tn.Pz)(Gn(Gn({},Y),{},{catalog:{},config:o,source:i}))):r({content:(0,tn.Pz)({config:o,source:i}),language:v.t6.YAML,type:v.tf.DATA_LOADER},0,S),Ze(null),g().then((function(){a()}))}},primary:!0,value:null===Y||void 0===Y?void 0:Y.source,children:[(0,w.jsx)("option",{value:""}),U.map((function(e){var n=e.name,t=e.uuid;return(0,w.jsx)("option",{value:t,children:n},t)}))]}):(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(Hn.Z,{inverted:!0}),(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(on.Z,{level:5,primary:!0,children:"Loading sources..."})]})]}),G&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsx)(on.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===Y||void 0===Y?void 0:Y.source)&&(0,w.jsxs)(Z.Z,{mb:2,children:[(0,w.jsxs)(O.ZP,{default:!0,children:["For more information on how to configure this source, read the ",(0,w.jsxs)(k.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/sources/".concat(Y.source,"/README.md"),openNewWindow:!0,primary:!0,children:[Y.source," documentation"]})]}),Be("https://docs.mage.ai/guides/data-integration-pipeline#configure-source")]}),q]}),(0,w.jsxs)("div",{children:[(0,w.jsx)(on.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select stream"}),(0,w.jsx)(T.Z,{loading:Se,onClick:function(){g().then((function(){we().then((function(){return Le()})),a()}))},primary:!0,small:!0,children:"View and select streams"})]}),oe&&(0,w.jsx)(O.ZP,{warning:!0,children:oe})]})]}),je&&(0,w.jsx)(Z.Z,{p:2,children:(0,w.jsx)(Hn.Z,{})}),!je&&(0,w.jsx)(Z.Z,{mt:3,children:(0,w.jsx)(In,{catalog:ee,destination:null===J||void 0===J?void 0:J.destination,isLoadingLoadSampleData:pe,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:E,source:null===Y||void 0===Y?void 0:Y.source,updateAllStreams:Ee,updateMetadataForColumns:Te,updateSchemaProperty:Ie,updateStream:_e})})]}),(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{disabled:!G,iconOnly:!0,onClick:function(){return L((function(e){return!e}))},children:(0,w.jsxs)(w.Fragment,{children:[F&&G&&(0,w.jsx)(de.Kh,{size:1.5*P.iI}),(!F||!G)&&(0,w.jsx)(de._M,{disabled:!G,size:1.5*P.iI})]})}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(y.Z,{alignItems:"center",children:(0,w.jsx)(on.Z,{children:"Transformers"})})]})}),F&&G&&(0,w.jsx)(Z.Z,{mb:5,children:(0,w.jsxs)(jn.dE,{children:[c.length>0&&(0,w.jsx)(Z.Z,{mb:1,children:c.map((function(e,n){return(0,w.jsx)(Z.Z,{mb:1,children:e},n)}))}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsx)(Oe.Z,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=[];return G&&i.push(G.uuid),r(Gn(Gn({},e),{},{configuration:t,content:n,upstream_blocks:i}),o.length-1,(function(e){Q&&(Ae({block:Gn(Gn({},Q),{},{upstream_blocks:[e.uuid]})}),S(e))}))},compact:!0,hideCustom:!0,hideDataExporter:!0,hideDataLoader:!0,hideDbt:!0,hideMarkdown:!0,hideScratchpad:!0,hideSensor:!0,hideTransformer:!!$,hideTransformerDataSources:!0,pipeline:b})})]})}),(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{disabled:!G,iconOnly:!0,onClick:function(){return A((function(e){return!e}))},children:(0,w.jsxs)(w.Fragment,{children:[D&&G&&(0,w.jsx)(de.Kh,{size:1.5*P.iI}),(!D||!G)&&(0,w.jsx)(de._M,{disabled:!G,size:1.5*P.iI})]})}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(on.Z,{children:"Destination"}),!D&&(0,w.jsxs)(on.Z,{default:!0,inline:!0,children:["\xa0",null===(i=K[null===J||void 0===J?void 0:J.destination])||void 0===i?void 0:i.name]})]})]})}),D&&G&&(0,w.jsxs)(jn.dE,{children:[(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsx)(on.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select destination"}),(null===W||void 0===W?void 0:W.length)>0?(0,w.jsxs)(bn.Z,{onChange:function(e){var n=e.target.value;if(n){if(Q)h(Q.type,Q.uuid,(0,tn.Pz)(Gn(Gn({},J),{},{destination:n})));else{var t,i,l=null===(t=K[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===G||void 0===G?void 0:G.uuid)!==n}));u&&c.push(u.uuid)}else G&&c.push(G.uuid);r({content:(0,tn.Pz)({config:l,destination:n}),language:v.t6.YAML,type:v.tf.DATA_EXPORTER,upstream_blocks:c},1,S)}g().then((function(){a()}))}},primary:!0,value:null===J||void 0===J?void 0:J.destination,children:[(0,w.jsx)("option",{value:""}),W.map((function(e){var n=e.name,t=e.uuid;return(0,w.jsx)("option",{value:t,children:n},t)}))]}):(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(Hn.Z,{inverted:!0}),(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(on.Z,{level:5,primary:!0,children:"Loading destinations..."})]})]}),Q&&(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsx)(on.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===J||void 0===J?void 0:J.destination)&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(Z.Z,{mb:2,children:[(0,w.jsxs)(O.ZP,{default:!0,children:["For more information on how to configure this destination, read the ",(0,w.jsxs)(k.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/destinations/".concat(J.destination,"/README.md"),openNewWindow:!0,primary:!0,children:[J.destination," documentation"]}),".",(0,w.jsx)("br",{}),(0,w.jsx)("br",{}),"If your configuration contains a key named ",(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,children:"table"}),", it\u2019s optional.",(0,w.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,w.jsx)(O.ZP,{bold:!0,inline:!0,children:"Table name"})," in a previous section."]}),Be("https://docs.mage.ai/guides/data-integration-pipeline#configure-destination")]})}),X,(0,w.jsx)(Z.Z,{mt:3,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(Z.Z,{mr:2,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Automatically add new fields"}),(0,w.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,w.jsx)(xn.Z,{checked:!!ne,disabled:!(null!==ee&&void 0!==ee&&ee.streams),onCheck:function(){return Ee((function(e){return Gn(Gn({},e),{},{auto_add_new_fields:!ne})}))}})]})}),(0,w.jsx)(Z.Z,{mt:3,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(Z.Z,{mr:2,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Disable column type check"}),(0,w.jsxs)(O.ZP,{default:!0,children:["By default, the value for each column is validated according to the schema property for that column.",(0,w.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,w.jsx)("br",{}),"Turn this toggle on if you want to disable this strict type checking."]})]}),(0,w.jsx)(xn.Z,{checked:!!te,disabled:!(null!==ee&&void 0!==ee&&ee.streams),onCheck:function(){return Ee((function(e){return Gn(Gn({},e),{},{disable_column_type_check:!te})}))}})]})})]})]})]})},qn=t(42451),Qn=t(84212);function Jn(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 Xn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Jn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Jn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var $n=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,m=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,S=e.interruptKernel,_=e.mainContainerRef,E=e.mainContainerWidth,I=e.messages,T=e.onChangeCallbackBlock,D=e.onChangeCodeBlock,A=e.openSidekickView,M=e.pipeline,R=e.pipelineContentTouched,F=e.restartKernel,L=e.runBlock,U=e.runningBlocks,z=void 0===U?[]:U,V=e.savePipelineContent,K=e.selectedBlock,G=e.setAnyInputFocused,Y=e.setDisableShortcuts,J=e.setEditingBlock,X=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,ce=e.showBrowseTemplates,ae=e.textareaFocused,de=e.widgets,pe=(0,s.useState)(!1),ve=pe[0],be=pe[1],ge=(0,s.useState)(!1),Ce=ge[0],we=ge[1],Se=(0,s.useState)(!0),_e=Se[0],Ee=Se[1],Ie=(0,s.useState)(null),Te=Ie[0],De=Ie[1],Ae=(0,s.useState)(null),Me=Ae[0],Be=Ae[1],Re=(0,s.useState)(!1),Ne=Re[0],Fe=Re[1],Ue=(0,s.useState)(""),ze=Ue[0],Ve=Ue[1],We=(0,s.useMemo)((function(){return z.reduce((function(e,n,t){return Xn(Xn({},e),{},(0,o.Z)({},n.uuid,Xn(Xn({},n),{},{priority:t})))}),{})}),[z]),Ge=(0,se.Z)(K),Ye=(0,s.useMemo)((function(){return h.length}),[h]),qe=(0,s.useMemo)((function(){return B.qL.INTEGRATION===(null===M||void 0===M?void 0:M.type)}),[M]),Qe=(0,s.useMemo)((function(){return B.qL.STREAMING===(null===M||void 0===M?void 0:M.type)}),[M]),Je=ue.ZP.block_templates.list({},{revalidateOnFocus:!1}).data,Xe=(0,s.useMemo)((function(){return(null===Je||void 0===Je?void 0:Je.block_templates)||[]}),[Je]),$e="PipelineDetail/index",en=(0,Q.y)(),tn=en.disableGlobalKeyboardShortcuts,rn=en.registerOnKeyDown,on=en.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){on($e)}}),[on,$e]),rn($e,(function(e,n,t){if(R&&(0,H.y)([N.zX,N.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&&!tn)if((0,H.y)([N.zX,N.Um],n)||(0,H.y)([N.PQ,N.Um],n))e.preventDefault(),V();else if(ae)n[N.vP]?le(!1):R||N.Z1.find((function(e){return n[e]}))||te(!0);else if(!qe){if(K){var i=h.findIndex((function(e){var n=e.uuid;return K.uuid===n}));if(n[N.vP])ie(null);else if(t[0]===N.xD&&t[1]===N.xD)S();else if(t[0]===N.l1&&t[1]===N.l1&&-1!==i)b(K).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[N.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[N.kD]&&i<=Ye-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,H.y)([N.Uq],n)&&le(!0)}else Ge&&n[N.Uq]&&ie(Ge);u||t[0]!==N.OC||t[1]!==N.OC||F()}}),[n,u,f.current,h,S,qe,Ye,R,F,V,K,Ge,te,ie,le,ae]),(0,s.useEffect)((function(){var e=setInterval((function(){R&&V()}),1e4);return function(){clearInterval(e)}}),[R,V]),(0,s.useEffect)((function(){setTimeout((function(){return we(!0)}),2*fe.zn)}),[M]);var ln=(0,d.Db)((function(e){var n=e.block,t=e.upstreamBlocks;return ue.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===X||void 0===X?void 0:X({errors:n,response:e})}})}}),cn=(0,l.Z)(ln,1)[0],un=(0,s.useCallback)((function(e){be(!0),Be(e),Y(!0)}),[be,Y,Be]),an=(0,s.useCallback)((function(){be(!1),Fe(!1),Ve(""),Y(!1)}),[Y]),sn=(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,he.oM)(h,i);return r=(0,he.Hk)(n,Math.max(t,0),r),V({pipeline:{blocks:r,uuid:null===M||void 0===M?void 0:M.uuid}})}),[h,M,V]),dn=(0,s.useMemo)((function(){var e=[];return h.filter((function(e){var n=e.type;return!qe||v.tf.TRANSFORMER===n})).forEach((function(l,u){var d,p=l.type,y=l.uuid,k=(null===K||void 0===K?void 0:K.uuid)===y,Z=We[y],O=Z?0===Z.priority?xe.uF.BUSY:xe.uF.QUEUED:xe.uF.IDLE,P="".concat(p,"s/").concat(y,".py");f.current[P]=(0,s.createRef)();var B=p===v.tf.MARKDOWN,R=p===v.tf.TRANSFORMER,N=!(null===C||void 0===C||!C[y]),F=u===Ye-1||qe,H=f.current[P];d=N?(0,w.jsx)(nn,{block:l,blocks:h,onClick:function(){return ee((function(e){return Xn(Xn({},e),{},(0,o.Z)({},y,!N))}))},onDrop:sn,ref:H},y):(0,w.jsx)(Pe.Z,{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)||[];cn({block:{uuid:o},upstreamBlocks:[e.uuid].concat((0,r.Z)(l))})}null===ie||void 0===ie||ie(e)}))},addNewBlockMenuOpenIdx:Te,addWidget:t,allBlocks:i,allowCodeBlockShortcuts:c,autocompleteItems:a,block:l,blockIdx:u,blockRefs:f,blockTemplates:Xe,blocks:h,dataProviders:m,defaultValue:l.content,deleteBlock:function(e){b(e),G(!1)},disableShortcuts:g,executionState:O,fetchFileTree:x,fetchPipeline:j,hideRunButton:Qe||B||qe&&R,interruptKernel:S,mainContainerRef:_,mainContainerWidth:E,messages:I[y],noDivider:F,onCallbackChange:function(e){return T(p,y,e)},onChange:function(e){return D(p,y,e)},onClickAddSingleDBTModel:un,onDrop:sn,openSidekickView:A,pipeline:M,ref:H,runBlock:L,runningBlocks:z,savePipelineContent:V,selected:k,setAddNewBlockMenuOpenIdx:De,setAnyInputFocused:G,setCreatingNewDBTModel:Fe,setEditingBlock:J,setErrors:X,setOutputBlocks:ne,setSelected:function(e){return ie(!0===e?l:null)},setSelectedBlock:ie,setSelectedOutputBlock:re,setTextareaFocused:le,showBrowseTemplates:ce,textareaFocused:k&&ae,widgets:de},y),e.push(d)})),e}),[n,Te,t,i,c,a,f,Xe,h,m,b,g,x,j,C,S,qe,Qe,_,E,I,Ye,T,D,un,sn,A,M,L,z,We,V,K,De,G,J,X,ee,ne,ie,re,le,ce,ae,cn,de]),fn=(0,s.useMemo)((function(){return(0,w.jsx)(Yn,{addNewBlockAtIndex:n,blocks:h,codeBlocks:dn,fetchFileTree:x,fetchPipeline:j,fetchSampleData:y,globalVariables:O,onChangeCodeBlock:D,openSidekickView:A,pipeline:M,savePipelineContent:V,setErrors:X,setIntegrationStreams:$,setOutputBlocks:ne,setSelectedBlock:ie,setSelectedOutputBlock:re,setSelectedStream:oe})}),[n,h,dn,x,j,y,O,D,A,M,V,X,$,ne,ie,re,oe]),pn=(0,s.useMemo)((function(){return(0,w.jsx)(Oe.Z,{addNewBlock:function(e){var t=h[h.length-1],i=null,r=e.configuration||{},o=t?(0,Ke.eY)(t,e):[];t&&([v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(t.type)&&v.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")),v.t6.SQL===t.language&&(r=Xn(Xn({},(0,yn.GL)(t.configuration,[qn.cH,qn.Sv,qn.sc,qn.BD,qn.nq])),r))),v.t6.SQL===e.language&&(i=(0,Qn.SF)(i)),i=(0,Qn.X7)(e,i),n(Xn(Xn({},e),{},{configuration:r,content:i,upstream_blocks:o}),Ye,ie),le(!0)},blockTemplates:Xe,hideCustom:qe||Qe,hideDataExporter:qe,hideDataLoader:qe,hideDbt:qe||Qe,hideScratchpad:qe,hideSensor:qe,onClickAddSingleDBTModel:un,pipeline:M,setCreatingNewDBTModel:Fe,showBrowseTemplates:ce})}),[n,Xe,h,qe,Qe,Ye,un,M,ie,le,ce]);return(0,w.jsxs)(ke.W,{backend:Ze.PD,children:[(0,w.jsx)(fe.lO,{children:_e&&(0,w.jsx)(ye.Z,{classNames:"pipeline-detail",in:Ce,onEntered:function(){return setTimeout((function(){return Ee(!1)}),fe.zn)},timeout:1,children:(0,w.jsx)(fe.fm,{})})}),(0,w.jsxs)(Z.Z,{mt:1,px:P.cd,children:[qe&&fn,!qe&&(0,w.jsxs)(w.Fragment,{children:[dn,(0,w.jsx)(Z.Z,{mt:P.cd,children:pn})]}),ve&&(0,w.jsx)(W.Z,{onClickOutside:an,open:!0,children:(0,w.jsx)(Le,{blocks:h,creatingNewDBTModel:Ne,dbtModelName:ze,files:k,onClose:an,onOpenFile:function(e){var t=e;if(Ne){var i=(0,q.RA)(ze||(0,q.Y6)()),r=".".concat(He.Lu.SQL);i.endsWith(r)&&(i=i.slice(0,-4)),t="".concat(e).concat(je.sep).concat(i,".").concat(He.Lu.SQL)}var o={configuration:{file_path:t,limit:Pe.z},language:v.t6.SQL,name:(0,q.wE)(t),type:v.tf.DBT};Ne&&(o.content="--Docs: https://docs.mage.ai/dbt/sources\n");var l="undefined"===typeof Me||null===Me,c=h[l?h.length-1:Me],u=c?(0,Ke.eY)(c,o):[];n(Xn(Xn({},o),{},{upstream_blocks:u}),l?Ye:Me+1,ie),an(),le(!0)},setDbtModelName:Ve})})]})]})},et=t(49894),nt=t(41424),tt=t(32063),it=t(82386),rt=t(70543),ot=t(24141);function lt(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 ct(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?lt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):lt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ut=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,v=e.errors,m=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,P=(0,ot.i)().width,C=(0,s.useState)((0,L.U2)(L.L8,it.Zt)),S=C[0],_=C[1],E=(0,s.useState)((0,L.U2)(L.J3,it.ve)),I=E[0],T=E[1],D=(0,s.useState)(!!(0,L.U2)(L.Uu)),A=D[0],M=D[1],B=(0,s.useState)(!1),R=B[0],N=B[1],F=(0,s.useState)(!1),H=F[0],U=F[1],z=r,V=y;if(!V){var K=(0,s.useState)(!!(0,L.U2)(L.zg)),G=(0,l.Z)(K,2);z=G[0],V=G[1]}(0,s.useEffect)((function(){null===g||void 0===g||!g.current||R||H||null===O||void 0===O||O(g.current.getBoundingClientRect().width)}),[R,H,z,S,A,I,g,O,P]),(0,s.useEffect)((function(){R||(null===k||void 0===k||k(S),(0,L.t8)(L.L8,S))}),[R,S,k]),(0,s.useEffect)((function(){H||(0,L.t8)(L.J3,I)}),[H,I]);var Y=ue.ZP.projects.list({},{revalidateOnFocus:!1}).data,Q=null===Y||void 0===Y?void 0:Y.projects,J=(0,s.useMemo)((function(){var e,n=[{label:function(){return"Pipelines"},linkProps:{as:"/pipelines",href:"/pipelines"}}];return j&&(n.push.apply(n,[{bold:rt.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]"}}]),rt.b7===x&&n.push.apply(n,[{bold:!0,label:function(){return(0,q.kC)(x)}}])),(0,w.jsx)(nt.Z,{breadcrumbs:n,project:null===Q||void 0===Q?void 0:Q[0],version:null===Q||void 0===Q||null===(e=Q[0])||void 0===e?void 0:e.version})}),[x,j,Q]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ie.Z,{title:null===j||void 0===j?void 0:j.name}),(0,w.jsx)(tt.Z,{after:n,afterHeader:t,afterHeightOffset:i,afterHidden:z,afterMousedownActive:R,afterNavigationItems:o,afterOverflow:c,afterSubheader:u,afterWidth:S,before:a,beforeHeader:d,beforeHeightOffset:f,beforeHidden:A,beforeMousedownActive:H,beforeNavigationItems:p,beforeWidth:I,header:J,headerOffset:m,mainContainerHeader:b,mainContainerRef:g,navigationShowMore:!0,setAfterHidden:V,setAfterMousedownActive:N,setAfterWidth:_,setBeforeHidden:M,setBeforeMousedownActive:U,setBeforeWidth:T,children:h}),v&&(0,w.jsx)(W.Z,{disableClickOutside:!0,isOpen:!0,onClickOutside:function(){return Z(null)},children:(0,w.jsx)(et.Z,ct(ct({},v),{},{onClose:function(){return Z(null)}}))})]})},at=t(41788),st=t(18221),dt=t(9728);function ft(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 pt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ft(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ft(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ht=function(e){var n=e.block,t=e.fetchFileTree,i=e.fetchPipeline,r=e.pipeline,o=e.setSelectedBlock,c=(0,s.useRef)(null),u=(0,s.useRef)(null),a=(0,s.useMemo)((function(){return null===r||void 0===r?void 0:r.uuid}),[r]),f=(0,s.useMemo)((function(){return(null===r||void 0===r?void 0:r.retry_config)||{}}),[r]),p=(0,dt.VI)(null,{},[],{uuid:"BlockSettings/index"}),h=(0,l.Z)(p,1)[0],m=n.type,g=n.uuid,x=(0,s.useState)(null),j=x[0],C=x[1],S=(0,s.useState)(!1),_=S[0],E=S[1],I=(0,s.useState)(!1),D=I[0],A=I[1],M=(0,se.Z)(n);(0,s.useEffect)((function(){(null===M||void 0===M?void 0:M.uuid)!==(null===n||void 0===n?void 0:n.uuid)&&C(n)}),[n,M]);var B=(0,s.useMemo)((function(){return(null===j||void 0===j?void 0:j.retry_config)||{}}),[j]),N=(0,s.useCallback)((function(e){E(!0),C(e)}),[]),F=(0,s.useMemo)((function(){return null===j||void 0===j?void 0:j.executor_type}),[j]);(0,s.useEffect)((function(){D||!F||st.R.find((function(e){return e===F}))||A(!0)}),[D,F]);var L=ue.ZP.blocks.pipelines.detail(a,encodeURIComponent(g),{_format:"with_settings",block_type:m}).data,H=(0,s.useMemo)((function(){return(null===L||void 0===L?void 0:L.block)||{}}),[L]),U=(0,s.useMemo)((function(){return null!==H&&void 0!==H&&H.pipelines?Object.values(null===H||void 0===H?void 0:H.pipelines):[]}),[H]),z=(0,d.Db)(ue.ZP.blocks.pipelines.useUpdate(a,g),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){E(!1),t(),i(),null!==e&&void 0!==e&&e.block&&o(null===e||void 0===e?void 0:e.block)},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),V=(0,l.Z)(z,2),W=V[0],K=V[1].isLoading,G=(0,s.useMemo)((function(){return(null===U||void 0===U?void 0:U.length)>=1&&(0,w.jsx)(gn.Z,{columnFlex:[null,1],columns:[{uuid:"Name"},{uuid:"Description"}],rows:U.map((function(e){var n=e.pipeline,t=n.description,i=n.name,o=n.uuid;return[(null===r||void 0===r?void 0:r.uuid)===o?(0,w.jsx)(O.ZP,{monospace:!0,muted:!0,children:i||o},"name"):(0,w.jsx)(k.Z,{href:"/pipelines/".concat(o,"/edit"),monospace:!0,openNewWindow:!0,sameColorAsText:!0,children:i||o},"name"),(0,w.jsx)(O.ZP,{default:!0,monospace:!0,children:t||"-"},"description")]})),uuid:"git-branch-blockPipelines"})}),[U,r]),Y=(0,s.useMemo)((function(){return f&&"undefined"!==typeof f&&!(0,yn.Qr)(f)&&("undefined"!==typeof(null===f||void 0===f?void 0:f.delay)&&"undefined"===typeof(null===B||void 0===B?void 0:B.delay)||"undefined"!==typeof(null===f||void 0===f?void 0:f.exponential_backoff)&&"undefined"===typeof(null===B||void 0===B?void 0:B.exponential_backoff)||"undefined"!==typeof(null===f||void 0===f?void 0:f.max_delay)&&"undefined"===typeof(null===B||void 0===B?void 0:B.max_delay)||"undefined"!==typeof(null===f||void 0===f?void 0:f.retries)&&"undefined"===typeof(null===B||void 0===B?void 0:B.retries))}),[B,f]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{mb:P.HN,children:(0,w.jsxs)(Z.Z,{p:P.cd,children:[(0,w.jsxs)(Z.Z,{mb:P.HN,children:[(0,w.jsx)(R.Z,{label:"Name",onChange:function(e){return N((function(n){return pt(pt({},n),{},{name:e.target.value})}))},primary:!0,setContentOnMount:!0,value:(null===j||void 0===j?void 0:j.name)||""}),v.tf.CUSTOM===(null===n||void 0===n?void 0:n.type)&&(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(bn.Z,{label:"Color",onChange:function(e){return N((function(n){return pt(pt({},n),{},{color:e.target.value})}))},primary:!0,value:(null===j||void 0===j?void 0:j.color)||"",children:Object.values(v.Lq).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))})})]}),(0,w.jsxs)(Z.Z,{mb:P.HN,children:[(0,w.jsx)(on.Z,{children:"Executor type"}),(0,w.jsxs)(O.ZP,{muted:!0,children:["For more information on this setting, please read the ",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/compute-resource#2-set-executor-type-and-customize-the-compute-resource-of-the-mage-executor",openNewWindow:!0,children:"documentation"}),"."]}),(0,w.jsxs)(Z.Z,{mt:1,children:[!D&&(0,w.jsx)(bn.Z,{label:"Executor type",onChange:function(e){return N((function(n){return pt(pt({},n),{},{executor_type:e.target.value})}))},primary:!0,ref:c,value:(null===j||void 0===j?void 0:j.executor_type)||"",children:st.R.map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))}),D&&(0,w.jsx)(R.Z,{label:"Executor type",monospace:!0,onChange:function(e){return N((function(n){return pt(pt({},n),{},{executor_type:e.target.value})}))},primary:!0,ref:u,setContentOnMount:!0,value:(null===j||void 0===j?void 0:j.executor_type)||""}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsx)(k.Z,{muted:!0,onClick:function(){D?(N((function(e){return pt(pt({},e),{},{executor_type:null})})),setTimeout((function(){var e;return null===c||void 0===c||null===(e=c.current)||void 0===e?void 0:e.focus()}),1)):setTimeout((function(){var e;return null===u||void 0===u||null===(e=u.current)||void 0===e?void 0:e.focus()}),1),A(!D)},preventDefault:!0,small:!0,children:D?"Select a preset executor type":"Enter a custom executor type"})})]})]}),(0,w.jsxs)(Z.Z,{mb:P.HN,children:[(0,w.jsx)(on.Z,{children:"Retry configuration"}),(0,w.jsxs)(O.ZP,{muted:!0,children:[Y&&(0,w.jsxs)(w.Fragment,{children:["This block is currently using the retry configuration from the pipeline. You can override the pipeline\u2019s retry configuration for this block.",(0,w.jsx)("br",{})]}),"For more information on this setting, please read the ",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/orchestration/pipeline-runs/retrying-block-runs",openNewWindow:!0,children:"documentation"}),"."]}),(0,w.jsxs)(Z.Z,{mt:1,children:[(0,w.jsxs)(y.Z,{children:[(0,w.jsx)(R.Z,{label:"Retries",monospace:!0,onChange:function(e){return N((function(n){var t;return pt(pt({},n),{},{retry_config:pt(pt({},null===n||void 0===n?void 0:n.retry_config),{},{retries:"undefined"!==typeof e.target.value&&null!==e.target.value&&(null===(t=e.target.value)||void 0===t?void 0:t.length)>=1?Number(e.target.value):null})})}))},primary:!0,required:"undefined"===typeof(null===f||void 0===f?void 0:f.retries),setContentOnMount:!0,type:"number",value:"undefined"!==typeof(null===B||void 0===B?void 0:B.retries)?null===B||void 0===B?void 0:B.retries:(null===f||void 0===f?void 0:f.retries)||""}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(R.Z,{label:"Delay",monospace:!0,onChange:function(e){return N((function(n){var t;return pt(pt({},n),{},{retry_config:pt(pt({},null===n||void 0===n?void 0:n.retry_config),{},{delay:"undefined"!==typeof e.target.value&&null!==e.target.value&&(null===(t=e.target.value)||void 0===t?void 0:t.length)>=1?Number(e.target.value):null})})}))},primary:!0,required:"undefined"===typeof(null===f||void 0===f?void 0:f.delay),setContentOnMount:!0,type:"number",value:"undefined"!==typeof(null===B||void 0===B?void 0:B.delay)?null===B||void 0===B?void 0:B.delay:(null===f||void 0===f?void 0:f.delay)||""}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(R.Z,{label:"Max delay",monospace:!0,onChange:function(e){return N((function(n){var t;return pt(pt({},n),{},{retry_config:pt(pt({},null===n||void 0===n?void 0:n.retry_config),{},{max_delay:"undefined"!==typeof e.target.value&&null!==e.target.value&&(null===(t=e.target.value)||void 0===t?void 0:t.length)>=1?Number(e.target.value):null})})}))},primary:!0,required:"undefined"===typeof(null===f||void 0===f?void 0:f.max_delay),setContentOnMount:!0,type:"number",value:"undefined"!==typeof(null===B||void 0===B?void 0:B.max_delay)?null===B||void 0===B?void 0:B.max_delay:(null===f||void 0===f?void 0:f.max_delay)||""})]}),(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(b.Z,{checked:"undefined"===typeof(null===B||void 0===B?void 0:B.exponential_backoff)&&"undefined"!==typeof(null===f||void 0===f?void 0:f.exponential_backoff)?!(null===f||void 0===f||!f.exponential_backoff):!(null===B||void 0===B||!B.exponential_backoff),label:"Exponential backoff",onClick:function(){return N((function(e){var n;return pt(pt({},e),{},{retry_config:pt(pt({},null===e||void 0===e?void 0:e.retry_config),{},{exponential_backoff:"undefined"===typeof(null===B||void 0===B?void 0:B.exponential_backoff)&&"undefined"!==typeof(null===f||void 0===f?void 0:f.exponential_backoff)?!(null!==f&&void 0!==f&&f.exponential_backoff):!(null!==e&&void 0!==e&&null!==(n=e.retry_config)&&void 0!==n&&n.exponential_backoff)})})}))}})})]})]}),(0,w.jsx)(T.Z,{disabled:!_,loading:K,onClick:function(){return W({block:{color:null===j||void 0===j?void 0:j.color,executor_type:null===j||void 0===j?void 0:j.executor_type,name:null===j||void 0===j?void 0:j.name,retry_config:B}})},primary:!0,children:"Update block settings"})]})}),(0,w.jsxs)(Z.Z,{mb:P.HN,children:[!L&&(0,w.jsx)(Z.Z,{p:P.cd,children:(0,w.jsx)(Hn.Z,{inverted:!0})}),L&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Z.Z,{p:P.cd,children:[(0,w.jsx)(on.Z,{children:"Pipelines"}),(0,w.jsx)(O.ZP,{default:!0,children:"Here are all the pipelines that are using this block."})]}),G]})]})]})},vt=t(92083),mt=t.n(vt),bt=t(26226),gt=t(84969),xt=t(90948),jt=t(65743),yt=t(39048),kt=t(79487),Zt=t(29989),Ot=t(61655),Pt=t(16853),Ct=t(65376),wt=t(52359),St=t(2005),_t=t(48072),Et=t(24903),It=t(98677),Tt=t(84181),Dt=t(73899),At=t(31012);function Mt(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 Bt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Mt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Mt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Rt={bottom:P.iI*(3+P.cd),left:P.iI*P.cd,right:P.iI*P.cd,top:P.iI*P.cd};function Nt(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function Ft(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)(m.ThemeContext),v=(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?At.iD:At.J5,x=Bt(Bt({},Rt),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,Et.Z)({domain:y,range:[Dt.a$,Dt.Ej,Dt.hM,Dt.ZA,Dt.$R,Dt.X_,Dt.er,Dt.hl,Dt.nQ]}),Z=(0,s.useMemo)((function(){return j.map(v)}),[j,v]),O=(0,It.Z)({domain:Z,padding:.1}),P=(0,It.Z)({domain:y,padding:.1}),C=(0,Tt.Z)({domain:[0,Nt(j,(function(e){return Nt(y,(function(n){return Number(e[n])}))}))]}),w={active:(null===h||void 0===h?void 0:h.content.default)||ae.Z.content.default,backgroundPrimary:(null===h||void 0===h?void 0:h.chart.backgroundPrimary)||ae.Z.chart.backgroundPrimary,backgroundSecondary:(null===h||void 0===h?void 0:h.chart.backgroundSecondary)||ae.Z.chart.backgroundSecondary,muted:(null===h||void 0===h?void 0:h.content.muted)||ae.Z.content.muted,primary:(null===h||void 0===h?void 0:h.chart.primary)||ae.Z.chart.primary,tooltipBackground:(null===h||void 0===h?void 0:h.background.navigation)||ae.Z.background.navigation},S=Z;a&&(S=j.reduce((function(e,n){return e.concat(y.map((function(e){var t=n[e];return(0,q.HW)(t)?parseInt(String(t)):t})))}),[]));var _=Math.min(Math.max.apply(Math,(0,r.Z)(S.map((function(e){return String(e).length})))),20);x.left+=7*_;var E=f-(x.left+x.right),I=t-(x.top+x.bottom);a?(O.rangeRound([0,E]),C.rangeRound([I,0])):(O.rangeRound([I,0]),C.rangeRound([0,E])),P.rangeRound([0,O.bandwidth()]);var T=j.map(v).length,D=0;a||(D=O(S[T-1]));var A=(0,s.useCallback)((function(e){var n=(0,_t.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-D/2)/(E-D):1-(o-D/2)/(I-D);var c=Math.floor(l*T),u=j[c];"undefined"===typeof u&&(u=j[c-1]),a?r>D&&r<E+x.left-D&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i}):o>D&&o<I-D&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i})}),[j,T,x.left,x.top,a,d,D,E,I]);return{colorScale:k,colors:w,data:j,fontSize:g,handleTooltip:A,margin:x,tempScale:C,tickValues:S,xKeys:y,xMax:E,y1Scale:P,yLabelFormat:b,yMax:I,yScale:O,ySerialize:v}}var Lt=["height","width","xAxisLabel","yAxisLabel"];function Ht(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 Ut(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ht(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ht(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var zt=3*P.iI,Vt=(P.iI,P.iI,P.iI,(0,Ot.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,v=e.tooltipOpen,m=e.tooltipTop,b=e.width,g=e.xAxisLabel,x=e.xNumTicks,j=e.yLabelFormat,y=Ft({data:n,height:t,keyForYData:o,large:c,margin:a,showTooltip:f,width:b,yLabelFormat:j}),k=y.colorScale,Z=y.colors,P=y.data,C=y.fontSize,S=y.handleTooltip,_=y.margin,E=y.tempScale,I=y.tickValues,T=y.xKeys,D=y.xMax,A=y.y1Scale,M=y.yLabelFormat,B=y.yMax,R=y.yScale,N=y.ySerialize,F=[],L=Math.floor((null===I||void 0===I?void 0:I.length)/Math.floor(t/zt));return null===I||void 0===I||I.forEach((function(e,n){n%L===0&&F.push(e)})),b<10?null:(0,w.jsxs)("div",{children:[(0,w.jsxs)("svg",{height:t,width:b,children:[s&&!(null!==P&&void 0!==P&&P.length)&&(0,w.jsx)("text",{fill:Z.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:St.ry,fontSize:C,x:"50%",y:"50%",children:s()}),(0,w.jsx)(jt.Z,{fill:"transparent",height:t-(_.top+_.bottom),onMouseLeave:function(){return i()},onMouseMove:S,onTouchMove:S,onTouchStart:S,rx:14,width:b-(_.left+_.right),x:_.left,y:_.top}),(null===P||void 0===P?void 0:P.length)&&(0,w.jsxs)(Zt.Z,{left:_.left,top:_.top,children:[(0,w.jsx)(yt.Z,{color:k,data:P,keys:T,width:D,xScale:E,y0:N,y0Scale:R,y1Scale:A,children:function(e){return e.map((function(e){return(0,w.jsx)(Zt.Z,{top:e.y0,children:e.bars.map((function(n){return(0,w.jsx)("g",{children:(0,w.jsx)(w.Fragment,{children:(0,w.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,w.jsx)(gt.Z,{hideTicks:!0,scale:R,stroke:Z.muted,tickFormat:function(e){return M(e)},tickLabelProps:function(){return{fill:Z.active,fontFamily:St.ry,fontSize:C,style:{width:"10px"},textAnchor:"end"}},tickStroke:Z.muted,tickValues:F,top:2}),(0,w.jsx)(xt.Z,{label:g,labelProps:{fill:Z.muted,fontFamily:St.ry,fontSize:C,textAnchor:"middle"},numTicks:x,scale:E,stroke:Z.muted,tickLabelProps:function(){return{fill:Z.active,fontFamily:St.ry,fontSize:C,textAnchor:"middle"}},tickStroke:Z.muted,top:B})]}),p&&(0,w.jsx)("g",{children:(0,w.jsx)(kt.Z,{from:{x:_.left,y:m},pointerEvents:"none",stroke:Z.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:D+_.left,y:m}})})]}),v&&p&&(0,w.jsxs)(Pt.Z,{left:h,style:Ut(Ut({},Ct.j),{},{backgroundColor:Z.tooltipBackground}),top:m,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,q.HW)(r)&&String(r).split(".").length>=2&&(r=r.toFixed(4)),(0,w.jsxs)(O.ZP,{inverted:!0,small:!0,children:[t,": ",r]},t)}}))]})]})})));var Wt=function(e){var n,t=e.height,i=e.width,r=e.xAxisLabel,o=e.yAxisLabel,l=(0,vn.Z)(e,Lt);return n="undefined"===typeof i?"100%":o?0===i?i:i-28:i,(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{style:{display:"flex",height:t,marginBottom:r?P.iI:null,width:"100%"},children:[o&&(0,w.jsx)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,w.jsx)(wt.Z,{children:(0,w.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:o})})}),(0,w.jsx)("div",{style:{height:t,width:n},children:(0,w.jsx)(bt.Z,{children:function(e){var n=e.width,t=e.height;return(0,w.jsx)(Vt,Ut(Ut({},l),{},{height:t,width:n}))}})})]}),r&&(0,w.jsx)("div",{style:{paddingLeft:o?36:0,paddingTop:4},children:(0,w.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:r})})]})},Kt=t(95422),Gt=["keyForYData"],Yt=["height","width","xAxisLabel","yAxisLabel"];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 Qt(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 Jt=6*P.iI,Xt=(0,Ot.Z)((function(e){var n=e.keyForYData,t=void 0===n?"__y":n,i=(0,vn.Z)(e,Gt),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,v=i.xNumTicks,m=i.yNumTicks,b=Ft(Qt(Qt({},i),{},{keyForYData:t,orientationVertical:!0})),g=b.colorScale,x=b.colors,j=b.data,y=b.fontSize,k=b.handleTooltip,Z=b.margin,P=b.tempScale,C=(b.tickValues,b.xKeys),S=(b.xMax,b.y1Scale),_=b.yLabelFormat,E=b.yMax,I=b.yScale,T=b.ySerialize,D=Math.min(v,p/Jt);return p<10?null:(0,w.jsxs)("div",{children:[(0,w.jsxs)("svg",{height:r,width:p,children:[c&&!(null!==j&&void 0!==j&&j.length)&&(0,w.jsx)("text",{fill:x.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:St.ry,fontSize:y,x:"50%",y:"50%",children:c()}),(null===j||void 0===j?void 0:j.length)&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(jt.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,w.jsxs)(Zt.Z,{top:Z.top,children:[(0,w.jsx)(Kt.Z,{color:g,data:j,height:E,keys:C,x0:T,x0Scale:I,x1Scale:S,yScale:P,children:function(e){return e.map((function(e){return(0,w.jsx)(Zt.Z,{left:e.x0+Z.left,top:Z.top,children:e.bars.map((function(n){return(0,w.jsx)("g",{children:(0,w.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,w.jsx)(gt.Z,{left:Z.left,numTicks:m,scale:P,stroke:x.muted,tickFormat:function(e){return _(e)},tickLabelProps:function(){return{fill:x.active,fontFamily:St.ry,fontSize:y,textAnchor:"end",transform:"translate(-2,2.5)"}},tickStroke:x.muted,top:Z.top}),(0,w.jsx)(xt.Z,{hideTicks:!0,left:Z.left,numTicks:D,scale:I,stroke:x.muted,tickFormat:h,tickLabelProps:function(){return{fill:x.active,fontFamily:St.ry,fontSize:y,textAnchor:"middle"}},tickStroke:x.muted,top:E+Z.top})]})]}),a&&(0,w.jsx)("g",{children:(0,w.jsx)(kt.Z,{from:{x:s,y:2*Z.top},pointerEvents:"none",stroke:x.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:s,y:E+2*Z.top}})})]}),d&&a&&(0,w.jsxs)(Pt.Z,{left:s,style:Qt(Qt({},Ct.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,q.HW)(o)&&String(o).split(".").length>=2&&(o=o.toFixed(4)),(0,w.jsxs)(O.ZP,{inverted:!0,small:!0,children:[i,": ",o]},i)}})),(0,w.jsx)("br",{}),(0,w.jsxs)(O.ZP,{inverted:!0,small:!0,children:[h&&h(T(a)),!h&&T(a)]})]})]})}));var $t=function(e){var n=e.height,t=e.width,i=e.xAxisLabel,r=e.yAxisLabel,o=(0,vn.Z)(e,Yt);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{style:{display:"flex",height:n,marginBottom:i?P.iI:null,width:"100%"},children:[r&&(0,w.jsx)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,w.jsx)(wt.Z,{children:(0,w.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:r})})}),(0,w.jsx)("div",{style:{height:n,width:r?0===t?t:t-28:t},children:(0,w.jsx)(bt.Z,{children:function(e){var n=e.height,t=e.width;return(0,w.jsx)(Xt,Qt(Qt({},o),{},{height:n,width:t}))}})})]}),i&&(0,w.jsx)("div",{style:{paddingLeft:r?36:0,paddingTop:4},children:(0,w.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:i})})]})},ei=t(62976),ni=t(66872),ti=t(68735),ii=t(320),ri=40*P.iI,oi=m.default.div.withConfig({displayName:"indexstyle__ChartBlockStyle",componentId:"sc-1c3ufnj-0"})(["border-radius:","px;margin-left:","px;margin-right:","px;margin-top:","px;",""],we.n_,.5*P.iI,.5*P.iI,1*P.iI,(function(e){return"\n background-color: ".concat((e.theme.background||ae.Z.background).codeArea,";\n ")})),li=m.default.div.withConfig({displayName:"indexstyle__ConfigurationOptionsStyle",componentId:"sc-1c3ufnj-1"})(["flex:4;padding-left:","px;padding-right:","px;"],1*P.iI,1*P.iI),ci=m.default.div.withConfig({displayName:"indexstyle__CodeStyle",componentId:"sc-1c3ufnj-2"})(["padding-top:","px;",""],P.iI/2,(function(e){return"\n background-color: ".concat((e.theme.background||ae.Z.background).codeTextarea,";\n ")})),ui=m.default.div.withConfig({displayName:"indexstyle__CodeHelperStyle",componentId:"sc-1c3ufnj-3"})(["margin-bottom:","px;padding-bottom:","px;padding-left:","px;",""],P.cd*P.iI,P.iI,P.iI,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.borders||ae.Z.borders).medium,";\n ")}));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 si(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}var di=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[qn.JJ]||ri,h=(null===u||void 0===u||null===(n=u[qn.bE])||void 0===n?void 0:n.map((function(e){return(0,qn.c0)(e)})))||[],v=pe.n1,m=u[qn.Yg];if([qn.aE.HOUR,qn.aE.MINUTE,qn.aE.SECOND].includes(m)&&(v=pe.OC),qn.oV.BAR_CHART===d||qn.oV.TIME_SERIES_BAR_CHART===d){var b=i.x,g=i.y,x=qn.oV.TIME_SERIES_BAR_CHART===d;if(b&&g&&Array.isArray(b)&&Array.isArray(g)){var j,y=null===(j=u[qn.eN])||void 0===j?void 0:j.join(", "),k=null===h||void 0===h?void 0:h.join(", ");h.length||h.push(qn.rj);var Z=h[0],C=b.map((function(e,n){return si({__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:si(si({},e),{},(0,o.Z)({},t,l))}),{}))}));qn.MP.ASCENDING===f?C=(0,he.YC)(C,(function(e){return e[Z]}),{ascending:!1}):qn.MP.DESCENDING===f&&(C=(0,he.YC)(C,(function(e){return e[Z]}),{ascending:!0}));var S={data:C,height:p,renderNoDataText:function(){return"No data matching query"},width:r,xNumTicks:3};return qn.JT.HORIZONTAL===s?(0,w.jsx)(Wt,si(si({},S),{},{xAxisLabel:k||u[qn.rj],yAxisLabel:y||u[qn.a3]})):(0,w.jsx)($t,si(si({},S),{},{xAxisLabel:y,xLabelFormat:function(e){return x?mt()(1e3*e).format(pe.n1):e},xNumTicks:C.length,yAxisLabel:k,yNumTicks:5}))}}else if(qn.oV.HISTOGRAM===d){var _,E=i.x,I=i.y,T=null===(_=u[qn.eN])||void 0===_?void 0:_.join(", ");if(E&&I&&Array.isArray(E))return(0,w.jsx)(ni.Z,{data:E.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*P.iI,right:1*P.iI,top:3*P.iI},noPadding:!0,renderTooltipContent:function(e){var n=(0,l.Z)(e,3),t=n[0],i=n[1],r=n[2];return(0,w.jsxs)(O.ZP,{inverted:!0,monospace:!0,small:!0,children:["Count : ",i,(0,w.jsx)("br",{}),"Bucket: ",r,"-",t]})},showAxisLabels:!0,showYAxisLabels:!0,showZeroes:!0,sortData:function(e){return(0,he.YC)(e,"[0]")},xAxisLabel:T||u[qn.a3],yAxisLabel:T?"count(".concat(T,")"):u[qn.rj]})}else if(qn.oV.LINE_CHART===d||qn.oV.TIME_SERIES_LINE_CHART===d){var D=i.x,A=i.y,M=qn.oV.TIME_SERIES_LINE_CHART===d;if(D&&A&&Array.isArray(D)&&Array.isArray(A)&&Array.isArray(null===A||void 0===A?void 0:A[0])){var B,R=h;u[qn.e]&&(R=u[qn.e].split(",").map((function(e){return e.trim()})));var N=D.map((function(e,n){return{x:e,y:(0,he.w6)(A.length).map((function(e,t){var i=A[t][n];return"undefined"===typeof i||null===i?0:i}))}})),F=null===(B=u[qn.eN])||void 0===B?void 0:B.join(", "),L=h.join(", ");return(0,w.jsx)(ti.Z,{data:N,height:p,lineLegendNames:R,margin:{bottom:8*P.iI,left:5*P.iI},noCurve:!0,renderXTooltipContent:function(e){e.index;var n=e.x,t=u[qn.a3],i=n;return u[qn.eN]&&(t=u[qn.eN].map(String).join(", ")),M&&(i=mt()(1e3*n).format(v)),(0,w.jsxs)(O.ZP,{inverted:!0,small:!0,children:[t,": ",i]})},renderYTooltipContent:function(e,n){var t=e.y;return(0,w.jsxs)(O.ZP,{inverted:!0,small:!0,children:[R&&R[n]&&"".concat(R[n],": "),t&&(0,q.x6)((0,q.QV)(t[n],4))]})},width:r?r-3*P.iI:r,xAxisLabel:F||String(u[qn.a3]),xLabelFormat:function(e){return M?mt()(1e3*e).format(pe.n1):e},yAxisLabel:L||String(u[qn.rj]),yLabelFormat:function(e){return e}})}}else if(qn.oV.PIE_CHART===d){var H,U=i[String(u[qn.a3])],z=null===(H=u[qn.eN])||void 0===H?void 0:H.join(", ");if(U)return(0,w.jsx)(ii.Z,{data:Object.entries(U),getX:function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];return"".concat(t," (").concat((0,q.x6)(i),")")},getY:function(e){return(0,l.Z)(e,2)[1]},height:p,width:r,xAxisLabel:z||String(u[qn.a3])})}else if(qn.oV.TABLE===d){var V=i.index,W=i.x,K=i.y;return Array.isArray(W)&&Array.isArray(K)&&Array.isArray(K[0])&&(0,w.jsx)(ei.Z,{columns:W,index:V,height:u[qn.JJ]?null:p,maxHeight:u[qn.JJ]?p:null,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,rows:K,width:r})}return(0,w.jsx)("div",{})},fi=t(65051),pi=t(76096);var hi=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,w.jsx)(y.Z,{children:s.Children.map(n,(function(e,n){return(0,w.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))}))})},vi=t(59582),mi=t(78759);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}function xi(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,S=e.messages,_=void 0===S?[]:S,E=e.onChangeContent,I=e.pipeline,T=e.runBlock,D=e.runningBlocks,M=e.savePipelineContent,B=e.selected,F=e.setAnyInputFocused,L=e.setErrors,H=e.setSelectedBlock,U=e.setTextareaFocused,z=e.textareaFocused,V=e.updateWidget,W=e.width,K=(0,s.useRef)(null),G=(0,s.useContext)(m.ThemeContext),Y=ue.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,J=(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)||[],X=(0,s.useState)(null),$=X[0],ee=X[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],le=re[1],fe=(0,s.useState)(a.content),pe=fe[0],ve=fe[1],be=(0,s.useState)(!te||0===J.length),ge=be[0],je=be[1],ye=(0,s.useState)(!1),ke=ye[0],Ze=ye[1],Oe=(0,s.useState)(null),Pe=Oe[0],we=Oe[1],Se=(0,s.useState)(null===a||void 0===a?void 0:a.upstream_blocks),_e=Se[0],Ee=Se[1],Ie=(0,s.useState)((null===J||void 0===J?void 0:J.length)||0),Te=Ie[0],De=Ie[1],Ae=(0,s.useState)(a.uuid),Me=Ae[0],Be=Ae[1],Re=mi.G8[te],Ne=mi.x8[te],Fe=(0,s.useMemo)((function(){return null===p||void 0===p?void 0:p.filter((function(e){var n=e.type;return[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(n)}))}),[p]),Le=(0,s.useMemo)((function(){return(0,he.HK)(Fe,(function(e){return e.uuid}))}),[Fe]),He=!!D.find((function(e){return e.uuid===a.uuid}))||(null===_||void 0===_?void 0:_.length)>=1&&b!==xe.uF.IDLE,Ue=(0,s.useMemo)((function(){return null===_||void 0===_?void 0:_.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[_]),ze=!!Ue.find((function(e){return e.error})),Ve=Ue.length>=1,We=(0,s.useMemo)((function(){return{blockType:a.type,hasError:ze,selected:B}}),[a.type,ze,B]);if(null!==Ue&&void 0!==Ue&&Ue.length){var Ke,Ge,Ye=Ue.length-1;c=null===Ue||void 0===Ue||null===(Ke=Ue[Ye])||void 0===Ke||null===(Ge=Ke.data)||void 0===Ge?void 0:Ge[0]}c?(c=(c=c.slice(1,c.length-1)).replaceAll('\\"','"').replaceAll("\\'","'"),(0,q.Pb)(c)&&(r=JSON.parse(c))):(null===J||void 0===J?void 0:J.length)>=1&&(r={},J.forEach((function(e){var n=e||{},t=n.text_data,i=n.type,o=n.variable_uuid;xe.Gi.TEXT===i&&(0,q.Pb)(t)&&(r[o]=JSON.parse(t))})));var qe=(0,s.useCallback)((function(e){var n=gi(gi(gi({},a),e),{},{configuration:gi(gi({},a.configuration),e.configuration)});M().then((function(){T({block:n,code:pe,ignoreAlreadyRunning:!0,runUpstream:!!_e.find((function(e){var n;return![v.DA.EXECUTED,v.DA.UPDATED].includes(null===(n=Le[e])||void 0===n?void 0:n.status)}))})})),De((function(e){return e+1}))}),[a,Le,pe,De,_e]),Qe=(0,s.useCallback)((function(e){ve(e),E(e)}),[E,ve]),Je=(0,s.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.autoRun;le((function(n){return gi(gi({},n),e)}));var i=gi(gi({},a),{},{configuration:gi(gi(gi({},oe),e),{},{chart_type:te})});V(i),Te&&t&&qe(i)}),[a,te,oe,Te,qe,le,V]);(0,s.useEffect)((function(){ee({python:(0,vi.Z)({autocompleteItems:u,block:a,blocks:p,pipeline:I})})}),[u,a,p,I]);var Xe=(0,s.useMemo)((function(){return(0,w.jsx)(Ln.Z,{autoHeight:!0,autocompleteProviders:$,onChange:Qe,selected:B,setSelected:function(e){return H(!0===e?a:null)},setTextareaFocused:U,showLineNumbers:!1,textareaFocused:z||qn.oV.TABLE===te&&!ge,value:pe,width:"100%"})}),[$,a,te,pe,ge,B,H,U,z,Qe]),$e=(0,s.useMemo)((function(){return(ze||Ve)&&(0,w.jsx)(fi.Z,gi(gi({},We),{},{block:a,contained:!1,hideExtraInfo:!0,isInProgress:He,messages:Ue,selected:B}))}),[a,We,ze,Ve,He,Ue,B]),en=(0,se.Z)(ge),nn=(0,se.Z)(W);(0,s.useEffect)((function(){var e,n=null===K||void 0===K||null===(e=K.current)||void 0===e?void 0:e.getBoundingClientRect();en!==ge||nn!==W?(we(0),setTimeout((function(){var e,n,t=null===K||void 0===K||null===(e=K.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.width;t&&we(t)}),100)):n&&we(n.width)}),[ge,en,K,we,W,nn]);var tn=(0,s.useMemo)((function(){var e=[];return _e.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:G}).accent;e.push((0,w.jsxs)(Z.Z,{ml:2,children:[(0,w.jsxs)(O.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:["df_",t+1]})," ",(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,w.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,w.jsx)(O.ZP,{color:r,monospace:!0,small:!0,children:n})})]},n))})),e}),[f,Le,G,_e]),rn=(0,s.useMemo)((function(){var e,n=[],t=null===Re||void 0===Re||null===(e=Re.code)||void 0===e?void 0:e.reduce((function(e,n){var t=n.uuid;return qn.Tv.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=mi.SR[te])||void 0===i||null===(r=i[e])||void 0===r?void 0:r.call(i);n.push((0,w.jsxs)(Z.Z,{ml:2,children:[(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:t})," ",o&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,w.jsx)(O.ZP,{default:!0,inline:!0,small:!0,children:o})]})]},t))}})),n}),[te,oe,Re]),on=(0,se.Z)(te),ln=(0,se.Z)(_e);(0,s.useEffect)((function(){if((!on&&te&&null!==_e&&void 0!==_e&&_e.length||(null===ln||void 0===ln||!ln.length)&&(null===_e||void 0===_e?void 0:_e.length)>=1&&te)&&!pe&&(0,yn.Qr)(oe)&&Ne){var e=gi(gi({},a),{},{upstream_blocks:_e});Ne.configuration&&Je(Ne.configuration(e)),Ne.content&&Qe(Ne.content(e))}}),[a,te,on,oe,pe,Ne,Je,Qe,_e,ln]);var cn=(0,s.useMemo)((function(){return oe[qn.v8]||1}),[oe]),un=(0,s.useMemo)((function(){return Object.entries(Re||{}).reduce((function(e,n){var t=(0,l.Z)(n,2),i=t[0],r=t[1];return gi(gi({},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,q.kC)(i()),monospace:r,onBlur:function(){return H(a)},onChange:function(e){return Je((0,o.Z)({},d,e.target.value),{autoRun:t})},onFocus:function(){return H(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(mi.VR.COLUMNS===s){var h=oe[d]||[];n=(0,w.jsxs)(w.Fragment,{children:[(!u.maxValues||h.length<u.maxValues)&&(0,w.jsx)(bn.Z,gi(gi({},f),{},{onChange:function(e){var n=oe[d]||[],i=e.target.value;n.includes(i)?n=(0,he.Od)(n,(function(e){return e===i})):n.push(i),Je((0,o.Z)({},d,n),{autoRun:t})},value:null,children:(0,he.YC)(p.filter((function(e){return!h.includes(e)})),(function(e){return e})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))})),h.map((function(e){return(0,w.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,w.jsx)(mn.Z,{label:e,onClick:function(){Je((0,o.Z)({},d,(0,he.Od)(h,(function(n){return n===e}))),{autoRun:t})}})},e)}))]})}else if(mi.VR.METRICS===s){var v=oe[d]||[];n=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.ZP,{bold:!0,children:"Metrics"}),(0,w.jsx)(O.ZP,{muted:!0,small:!0,children:"Select a column and an aggregation function."}),(0,w.jsxs)(hi,{onChange:function(e,n){var i=n.resetValues,r=n.setValues;2===e.filter((function(e){return!!e})).length&&(v.find((function(n){var t=n.aggregation;return n.column===e[1]&&t===e[0]}))||(Je((0,o.Z)({},d,v.concat({aggregation:e[0],column:e[1]})),{autoRun:t}),r([null,null]),i()))},children:[(0,w.jsx)(bn.Z,gi(gi({},f),{},{label:"aggregation",children:(0,he.YC)(qn.bn,(function(e){return e})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))})),(0,w.jsx)(bn.Z,gi(gi({},f),{},{label:"column",children:(0,he.YC)(p,(function(e){return e})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))}))]}),v.map((function(e){var n=e.aggregation,i=e.column;return(0,w.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,w.jsx)(mn.Z,{label:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(O.ZP,{inline:!0,monospace:!0,children:[n,"("]}),i,(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,children:")"})]}),onClick:function(){Je((0,o.Z)({},d,(0,he.Od)(v,(function(e){var t=e.aggregation,r=e.column;return n===t&&i===r}))),{autoRun:t})}})},"".concat(n,"(").concat(i,")"))}))]})}else n=l?(0,w.jsx)(bn.Z,gi(gi({},f),{},{children:l.map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))})):(0,w.jsx)(R.Z,gi(gi({},f),{},{type:s}));return(0,w.jsx)(Z.Z,{mb:1,children:n},d)}))))}),{noCode:[]})}),[a,oe,Re,Y,H,Je]),an=un.code,sn=un.noCode,dn=(0,d.Db)(ue.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===L||void 0===L?void 0:L({errors:n,response:e})}})}}),fn=(0,l.Z)(dn,1)[0],pn="ChartBlock/".concat(a.uuid),hn=(0,Q.y)(),vn=hn.registerOnKeyDown,gn=hn.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){gn(pn)}}),[gn,pn]),vn(pn,(function(e,n,t){ke&&String(t[0])===String(N.Uq)&&String(t[1])!==String(N.zX)&&fn({widget:gi(gi({},a),{},{name:Me})})}),[a,ke,Me,fn]),(0,w.jsx)(pi.Z,{sm:12,md:12*cn,children:(0,w.jsxs)(oi,{ref:n,children:[(0,w.jsx)(Z.Z,{mt:1,pt:1,px:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{flex:1,style:{position:"relative"},children:[(0,w.jsx)(Ce.Z,{bold:!1,fullWidth:!0,inputValue:Me,notRequired:!0,onBlur:function(){return setTimeout((function(){return Ze(!1)}),300)},onChange:function(e){Be(e.target.value),e.preventDefault()},onClick:function(){F(!0),Ze(!0)},onFocus:function(){F(!0),Ze(!0)},small:!0,stacked:!0,value:!ke&&a.uuid}),ke&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(k.Z,{noWrapping:!0,onClick:function(){return fn({widget:gi(gi({},a),{},{name:Me})})},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update chart name"})]})]}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(bn.Z,{compact:!0,onChange:function(e){var n=[e.target.value],t=gi(gi({},a),{},{upstream_blocks:n});V(t),qe(t),Ee(n)},placeholder:"Source block",small:!0,value:(null===_e||void 0===_e?void 0:_e[0])||"",children:null===Fe||void 0===Fe?void 0:Fe.map((function(e){var n=e.uuid;return(0,w.jsx)("option",{value:n,children:n},n)}))}),(0,w.jsx)(Z.Z,{mr:1}),!He&&(0,w.jsx)(ce.Z,{appearBefore:!0,default:!0,label:"Run chart block",size:null,widthFitContent:!0,children:(0,w.jsx)(A.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return qe(a)},uuid:"ChartBlock/run/".concat(a.uuid),children:(0,w.jsx)(de.Py,{size:2*P.iI})})}),xe.uF.QUEUED===b&&(0,w.jsx)(Hn.Z,{color:(G||ae.Z).content.active,small:!0,type:"cylon"}),xe.uF.BUSY===b&&(0,w.jsx)(Hn.Z,{color:(G||ae.Z).content.active,small:!0}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(ce.Z,{appearBefore:!0,default:!0,label:"Edit chart",size:null,widthFitContent:!0,children:(0,w.jsx)(A.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return je((function(e){return!e}))},selected:ge,uuid:"ChartBlock/edit/".concat(a.uuid),children:(0,w.jsx)(de.I8,{size:2*P.iI})})}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(ce.Z,{appearBefore:!0,default:!0,label:"Delete chart",size:null,widthFitContent:!0,children:(0,w.jsx)(A.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return h(a)},uuid:"ChartBlock/delete/".concat(a.uuid),children:(0,w.jsx)(de.rF,{size:2*P.iI})})})]})]})}),(0,w.jsx)(Z.Z,{mt:1}),(0,w.jsxs)(y.Z,{fullWidth:!0,justifyContent:"space-between",children:[(0,w.jsx)(j.Z,{flex:6,ref:K,children:r&&!(0,yn.Qr)(r)&&(0,w.jsx)(Z.Z,{pb:3,children:(0,w.jsx)(di,{block:gi(gi({},a),{},{configuration:gi(gi({},a.configuration),oe)}),data:r,width:Pe})})}),ge&&(0,w.jsx)(li,{children:(0,w.jsxs)(y.Z,{flexDirection:"column",fullWidth:!0,children:[(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsx)(bn.Z,{onChange:function(e){var n=e.target.value,t=gi(gi({},a),{},{configuration:gi(gi({},oe),{},{chart_type:n})});V(t),qe(t),ie(n)},placeholder:"Select chart type",value:te,children:qn.CK.map((function(e){return(0,w.jsx)("option",{value:e,children:(0,q.kC)(e)},e)}))})}),(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsx)(bn.Z,{onChange:function(e){return Je((0,o.Z)({},qn.v8,e.target.value))},placeholder:"Chart width",value:(null===oe||void 0===oe?void 0:oe[qn.v8])||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,w.jsx)("option",{value:i,children:t},t)}))})}),sn]})})]}),ge&&!(null===an||void 0===an||!an.length)&&v.t6.SQL!==a.language&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Z.Z,{my:1,px:1,children:[(0,w.jsx)(O.ZP,{bold:!0,children:"Custom chart code"}),(0,w.jsxs)(O.ZP,{muted:!0,children:["Write custom logic mapping data to input values for your chart.",(0,w.jsx)("br",{}),"This code is only executed if you don\u2019t have any columns or metrics selected."]})]}),(0,w.jsxs)(ci,{children:[_e.length>=1&&(0,w.jsxs)(ui,{children:[(0,w.jsxs)(O.ZP,{muted:!0,small:!0,children:["Variables you can use in your code: ",tn]}),(0,w.jsxs)(O.ZP,{muted:!0,small:!0,children:["Variables that you must define: ",rn]})]}),Xe]})]}),$e&&(0,w.jsx)(Z.Z,{px:1,children:$e})]})})}var ji=s.forwardRef(xi),yi=t(97361),ki=["blockRefs","blocks","chartRefs","deleteWidget","messages","onChangeChartBlock","runBlock","runningBlocks","savePipelineContent","selectedBlock","setAnyInputFocused","setErrors","setSelectedBlock","setTextareaFocused","textareaFocused","updateWidget","widgets","width"];function Zi(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 Oi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Zi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Zi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Pi=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,v=e.setSelectedBlock,m=e.setTextareaFocused,b=e.textareaFocused,g=e.updateWidget,x=e.widgets,j=e.width,k=(0,vn.Z)(e,ki),Z=(0,s.useMemo)((function(){return a.reduce((function(e,n,t){return Oi(Oi({},e),{},(0,o.Z)({},n.uuid,Oi(Oi({},n),{},{priority:t})))}),{})}),[a]);return(0,w.jsxs)(y.Z,{flexDirection:"column",fullWidth:!0,children:[(0,w.jsx)(yi.Z,{fullHeight:!0,style:{marginLeft:.5*P.iI,marginRight:.5*P.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?xe.uF.BUSY:xe.uF.QUEUED:xe.uF.IDLE;return i.current[o]=(0,s.createRef)(),(0,s.createElement)(ji,Oi(Oi({},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:v,setTextareaFocused:m,textareaFocused:b,updateWidget:g,width:j}))}))}),(0,w.jsx)("div",{style:{height:"80vh"}})]})},Ci=t(48952),wi=m.default.svg.withConfig({displayName:"EmptyCharts__SVGStyle",componentId:"sc-ttsjrp-0"})([""]),Si=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,w.jsxs)(wi,{height:t*(305/358),viewBox:r,width:t,children:[(0,w.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,w.jsx)("path",{fill:"#000",d:"M118 46h1v216h-1zM178 46h1v216h-1zM238 46h1v216h-1z"}),(0,w.jsx)("path",{fill:"#000",d:"M59 208.25v-1h239v1zM59 154.5v-1h239v1zM59 100.75v-1h239v1z"}),(0,w.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,w.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,w.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,w.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,w.jsx)("circle",{cx:"55.2178",cy:"34.6274",r:"5.2954",fill:"#8ADE00"}),(0,w.jsx)("circle",{cx:"113.818",cy:"106.582",r:"5.2954",fill:"#8ADE00"}),(0,w.jsx)("circle",{cx:"84.2832",cy:"80.6953",r:"5.2954",fill:"#8ADE00"}),(0,w.jsx)("circle",{cx:"117.115",cy:"43.6274",r:"5.2954",fill:"#8ADE00"}),(0,w.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,w.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,w.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,w.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,w.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,w.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,w.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,w.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 _i,Ei=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 v.tf.DBT===n})))||[]}),[n]),(0,w.jsx)(w.Fragment,{})};!function(e){e.DBT="dbt",e.GREAT_EXPECTATIONS="great_expectations"}(_i||(_i={}));var Ii=t(66653);function Ti(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?Ti(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ti(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ai=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)(m.ThemeContext),v=(0,s.useState)(""),k=v[0],S=v[1],_=(0,s.useState)(!1),E=_[0],I=_[1],D=(0,s.useState)(null),A=D[0],M=D[1],B=(0,s.useMemo)((function(){return(0,he.HK)(o,(function(e){return e.uuid}))}),[o]);(0,s.useEffect)((function(){A||M((0,he.HK)((null===i||void 0===i?void 0:i.upstream_blocks)||[],(function(e){return e})))}),[i,A]);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]),F=(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,w.jsx)(x.Z,{light:!0},"divider-".concat(l)));var u=!(null===A||void 0===A||!A[l]),a=null!==d&&"undefined"!==typeof d&&!(null!==d&&void 0!==d&&d.includes(r));e.push((0,w.jsx)(Z.Z,{px:2,py:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(g.Z,{color:c,size:1.5*P.iI,square:!0}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(O.ZP,{monospace:!0,muted:a,small:!0,children:l})]}),a&&(0,w.jsxs)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:[r," support coming soon"]}),!a&&(0,w.jsx)(b.Z,{checked:!a&&u,disabled:a,onClick:function(){M((function(e){var n=Di({},e);return u?delete n[l]:n[l]=l,n}))}})]})},"option-".concat(l)))})),e}),[N,h,A]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(W.Z,{onClickOutside:function(){return I(!1)},open:!0,children:[(0,w.jsx)(R.Z,{beforeIcon:(0,w.jsx)(de.HN,{}),borderless:!0,compact:!0,onChange:function(e){return S(e.target.value)},onClick:function(e){(0,Ii.j)(e),I(!0)},onFocus:function(e){(0,Ii.j)(e),I(!0)},placeholder:l,small:!0,value:k}),E&&(0,w.jsxs)(w.Fragment,{children:[F,(0,w.jsx)(Z.Z,{mx:1,children:(0,w.jsx)(y.Z,{justifyContent:"flex-end",children:(0,w.jsx)(T.Z,{compact:!0,loading:c,onClick:function(){return p({block:i,upstream_blocks:Object.keys(A)}).then((function(){return I(!1)}))},small:!0,children:"Save selected blocks"})})})]})]}),!E&&(null===i||void 0===i||null===(n=i.upstream_blocks)||void 0===n?void 0:n.length)>=1&&(0,w.jsxs)(Z.Z,{pb:1,pr:1,children:[r&&(0,w.jsx)(Z.Z,{mt:1,pl:1,children:(0,w.jsx)(O.ZP,{muted:!0,small:!0,children:r})}),(0,w.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,w.jsx)("div",{},e);var t=n.color,r=n.type,o=(0,C.qn)(r,{blockColor:t,theme:h}).accentLight;return(0,w.jsx)(Z.Z,{ml:1,mt:1,children:(0,w.jsx)(T.Z,{backgroundColor:o,compact:!0,disabled:!a,onClick:function(e){(0,Ii.j)(e),u?u(n):null===a||void 0===a||a({block:Di(Di({},i),{},{upstream_blocks:[null===n||void 0===n?void 0:n.uuid]})})},small:!0,children:(0,w.jsx)(O.ZP,{monospace:!0,small:!0,children:e})})},e)}))})]})]})},Mi=t(19140);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 Ri(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 Ni=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,m=e.messages,b=e.onChangeCallbackBlock,g=e.onChangeCodeBlock,x=e.pipeline,j=e.runBlock,y=e.runningBlocks,C=e.savePipelineContent,S=e.selectedBlock,_=e.setAnyInputFocused,E=e.setErrors,I=e.setSelectedBlock,T=e.setTextareaFocused,D=e.showBrowseTemplates,M=e.textareaFocused,B=(0,s.useRef)(null),R=(0,s.useState)(!1),F=R[0],L=R[1],U=(a||{}).uuid,z=(x||{}).extensions,V=(0,s.useMemo)((function(){return(null===a||void 0===a?void 0:a.templates)||[]}),[a]),K=(0,s.useMemo)((function(){return null===z||void 0===z?void 0:z[U]}),[U,z]),G=(0,s.useMemo)((function(){return(null===K||void 0===K?void 0:K.blocks)||[]}),[K]),Y=(0,s.useMemo)((function(){return(0,he.HK)(G,(function(e){return e.uuid}))}),[G]),q=(0,s.useMemo)((function(){return U===(null===S||void 0===S?void 0:S.extension_uuid)&&Y[null===S||void 0===S?void 0:S.uuid]}),[Y,U,S]),J=(0,s.useMemo)((function(){return y.reduce((function(e,n,t){return Ri(Ri({},e),{},(0,o.Z)({},n.uuid,Ri(Ri({},n),{},{priority:t})))}),{})}),[y]),X=(0,d.Db)((function(e){var n=e.block,t=e.upstream_blocks;return ue.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===E||void 0===E?void 0:E({errors:n,response:e})}})}}),$=(0,l.Z)(X,2),ee=$[0],ne=$[1].isLoading,te=(0,s.useMemo)((function(){return G.map((function(e,n){var o=Ri(Ri({},e),{},{extension_uuid:U}),l=o.type,a=o.uuid,d=(null===S||void 0===S?void 0:S.uuid)===a,k=J[a],O=k?0===k.priority?xe.uF.BUSY:xe.uF.QUEUED:xe.uF.IDLE,D="".concat(l,"s/").concat(a,".py");return i.current[D]=(0,s.createRef)(),(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(Pe.Z,{allBlocks:r,autocompleteItems:t,block:o,blockIdx:n,blockRefs:i,blocks:r,defaultValue:o.content,deleteBlock:function(e){u(Ri(Ri({},e),{},{extension_uuid:U})),_(!1)},executionState:O,extraContent:(0,w.jsx)(Ai,{block:o,blockActionDescription:"Click a block name to run expectations on it.",blocks:c,inputPlaceholder:"Select blocks to run expectations on",loading:ne,supportedUpstreamBlockLanguages:[v.t6.PYTHON],supportedUpstreamBlockTypes:[v.tf.DATA_EXPORTER,v.tf.DATA_LOADER,v.tf.DBT,v.tf.TRANSFORMER],updateBlock:ee}),fetchFileTree:f,fetchPipeline:p,hideRunButton:!0,interruptKernel:h,messages:m[a],noDivider:!0,onCallbackChange:function(e){return b(l,a,e)},onChange:function(e){return g(l,a,e)},pipeline:x,ref:i.current[D],runBlock:j,runningBlocks:y,savePipelineContent:C,selected:d,setAnyInputFocused:_,setErrors:E,setSelected:function(e){return I(!0===e?o:null)},setTextareaFocused:T,textareaFocused:d&&M})},a)}))}),[t,i,r,c,u,G,U,f,p,h,ne,m,b,g,x,j,y,J,C,S,_,E,I,T,M,ee]),ie="Extensions/GreatExpectations/index",re=(0,Q.y)(),oe=re.disableGlobalKeyboardShortcuts,le=re.registerOnKeyDown,ce=re.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){ce(ie)}}),[ce,ie]),le(ie,(function(e,n){!oe&&q&&((0,H.y)([N.zX,N.Um],n)||(0,H.y)([N.PQ,N.Um],n))&&(e.preventDefault(),C())}),[q,C]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsx)(O.ZP,{default:!0,children:"Add an extension block to start writing expectations for blocks in the current pipeline."}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.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,w.jsx)(k.Z,{href:"https://docs.mage.ai/development/testing/great-expectations",openNewWindow:!0,children:"Great Expectation power up"}),"."]})}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(O.ZP,{default:!0,children:["For all available expectations, read Great Expectation\u2019s ",(0,w.jsx)(k.Z,{href:"https://greatexpectations.io/expectations/",openNewWindow:!0,children:"documentation"}),"."]})})]}),te,(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(W.Z,{onClickOutside:function(){return L(!1)},open:!0,children:(0,w.jsx)(Tn.Z,{disableKeyboardShortcuts:!0,items:null===V||void 0===V?void 0:V.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:v.tf.EXTENSION},(null===G||void 0===G?void 0:G.length)||0)},tooltip:function(){return t},uuid:e.uuid}})).concat((0,Qn.hr)((function(e){return n(Ri(Ri({},e),{},{extension_uuid:U,type:v.tf.EXTENSION}),(null===G||void 0===G?void 0:G.length)||0)}),v.tf.EXTENSION,null,{onlyCustomTemplate:!0,showBrowseTemplates:D})),onClickCallback:function(){return L(!1)},open:F,parentRef:B,uuid:"Extension",children:(0,w.jsx)(A.ZP,{beforeElement:(0,w.jsx)(Mi.Wx,{teal:!0,children:(0,w.jsx)(de.mm,{size:Mi.ZG})}),inline:!0,onClick:function(e){e.preventDefault(),L(!0)},uuid:"AddNewBlocks/Extension",children:"Extension block"})})})})]})},Fi=t(59e3),Li=["pipeline"];function Hi(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 Ui(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Hi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Hi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var zi=function(e){var n=e.pipeline,t=(0,vn.Z)(e,Li),i=(0,f.useRouter)(),r=ue.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,he.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 Ui(Ui({},t),{},{pipeline:n})}),[n,t]);(0,s.useEffect)((function(){var e;a(null===(e=(0,Fi.iV)())||void 0===e?void 0:e.extension)}),[i.asPath]);var h=(0,s.useMemo)((function(){return n?(_i.GREAT_EXPECTATIONS===u?e=Ni:_i.DBT===u&&(e=Ei),e?(0,w.jsx)(e,Ui(Ui({},p),{},{extensionOption:d})):void 0):null;var e}),[d,n,u,p]);return(0,w.jsx)(ke.W,{backend:Ze.PD,children:(0,w.jsxs)(Z.Z,{p:P.cd,children:[!u&&(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsxs)(O.ZP,{default:!0,children:["Power up your pipeline with extensions. Learn more about ",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/design/blocks/extension",openNewWindow:!0,children:"extension blocks"}),"."]}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(O.ZP,{default:!0,children:["Click on a power up below to add and configure it for the ",(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,children:null===n||void 0===n?void 0:n.uuid})," pipeline."]})})]}),!r&&!u&&(0,w.jsx)(Hn.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,w.jsx)(Z.Z,{mt:n>=1?P.cd:0,children:(0,w.jsx)(k.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,ve.u7)({extension:r},{pushHistory:!0})},preventDefault:!0,children:(0,w.jsx)(M.Z,{dark:!0,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(Dn.Z,{fullWidth:!1,children:(0,w.jsx)(Z.Z,{p:P.cd,children:(0,w.jsx)(y.Z,{alignItems:"center",children:(0,w.jsx)("img",{alt:i,height:3*P.iI,src:"/images/extensions/".concat(r,"/logo.png"),width:3*P.iI})})})}),(0,w.jsx)(Z.Z,{mr:P.cd}),(0,w.jsxs)(j.Z,{flexDirection:"column",children:[(0,w.jsx)(O.ZP,{bold:!0,children:i}),(0,w.jsx)(O.ZP,{default:!0,small:!0,children:t})]})]}),(0,w.jsx)(de._Q,{})]})})})},r)})))]})})},Vi=t(23351),Wi=t(21764),Ki=t(22673),Gi=t(52769),Yi=t(9468),qi=(P.iI,Yi.O$,P.iI,At.dN,m.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-cr39lf-0"})(["height:calc(100vh - ","px - ","px);width:fit-content;",""],it.Wi,Se.nn,(function(e){return e.fullWidth&&"\n width: 100%;\n "})),m.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-cr39lf-1"})(["padding:","px;",""],2*P.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "})),m.default.table.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-cr39lf-2"})(["",""],(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}))),Qi=m.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*P.iI,"px;\n ")})),Ji=t(19963);var Xi=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),v=h[0],m=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),S=C[0],_=C[1],E=(0,d.Db)(ue.ZP.variables.pipelines.useUpdate(c,a),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){_(!1),i()}})}}),I=(0,l.Z)(E,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&&_(!1)}),[g,k]);(0,s.useEffect)((function(){var e;S&&(null===p||void 0===p||null===(e=p.current)||void 0===e||e.focus())}),[S,p]);var D=n||"kwargs['".concat(a,"']");return(0,w.jsx)("div",{onMouseEnter:function(){return m(!0)},onMouseLeave:function(){return m(!1)},children:(0,w.jsxs)(yi.Z,{children:[(0,w.jsx)(pi.Z,{md:1,hiddenSmDown:!0,children:(0,w.jsx)(Qi,{noPadding:!0,children:(0,w.jsx)(A.ZP,{backgroundColor:Ji.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(D),Wi.Am.success("Successfully copied to clipboard.",{position:Wi.Am.POSITION.BOTTOM_RIGHT,toastId:a})},small:!0,uuid:"Sidekick/GlobalVariables/".concat(a),withIcon:!0,children:(0,w.jsx)(de.CK,{size:2.5*P.iI})})})}),(0,w.jsx)(pi.Z,{md:4,children:S?(0,w.jsx)(Qi,{children:(0,w.jsx)(R.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,w.jsx)(Qi,{children:(0,w.jsx)(O.ZP,{color:Dt.Or,monospace:!0,small:!0,textOverflow:!0,children:a})})}),(0,w.jsx)(pi.Z,{md:7,children:S?(0,w.jsx)(Qi,{children:(0,w.jsx)(R.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,w.jsxs)(Qi,{children:[o?(0,w.jsx)(O.ZP,{monospace:!0,small:!0,children:"********"}):(0,w.jsx)(O.ZP,{monospace:!0,small:!0,children:f}),(0,w.jsxs)(j.Z,{children:[!r&&v&&(0,w.jsx)(A.ZP,{backgroundColor:Ji.qJ,borderless:!0,inline:!0,muted:!0,onClick:function(){_(!0)},small:!0,uuid:"Sidekick/GlobalVariables/edit_".concat(a),withIcon:!0,children:(0,w.jsx)(de.I8,{size:2.5*P.iI})}),t&&v&&(0,w.jsx)(A.ZP,{backgroundColor:Ji.qJ,borderless:!0,inline:!0,muted:!0,onClick:t,small:!0,uuid:"Sidekick/GlobalVariables/delete_".concat(a),withIcon:!0,children:(0,w.jsx)(de.rF,{size:2.5*P.iI})})]})]})})]})})},$i=t(93348),er=t(58122);var nr=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],m=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)(ue.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}))}})}}),S=(0,l.Z)(C,1)[0],_=(0,d.Db)((function(e){return ue.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)}))}})}}),E=(0,l.Z)(_,1)[0],I=(0,s.useCallback)((function(e){if("Enter"===e.key){var t=g;try{t=JSON.parse(g)}catch(i){}S({variable:{name:h,value:t}}).then((function(){n(),m(null),x(null)})),f(!1)}else"Escape"===e.key&&f(!1)}),[S,n,h,g]),T=(0,s.useMemo)((function(){return c-4*P.iI}),[c]),D=(0,s.useMemo)((function(){return(0,er.wx)(o,(function(e){return e.uuid===Gi.C}))}),[o]),M=(0,s.useMemo)((function(){return(0,er.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,w.jsxs)(qi,{width:T,children:[a&&(0,w.jsxs)(yi.Z,{children:[(0,w.jsx)(pi.Z,{md:1,children:(0,w.jsx)(Qi,{noPadding:!0,children:(0,w.jsx)(A.ZP,{backgroundColor:Ji.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(h),Wi.Am.success("Successfully copied to clipboard.",{position:Wi.Am.POSITION.BOTTOM_RIGHT,toastId:h})},uuid:"Sidekick/GlobalVariables/".concat(h),withIcon:!0,children:(0,w.jsx)(de.CK,{size:2.5*P.iI})})})}),(0,w.jsx)(pi.Z,{md:4,children:(0,w.jsx)(Qi,{children:(0,w.jsx)(R.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){m(e.target.value),e.preventDefault()},onKeyDown:I,paddingHorizontal:0,placeholder:"variable",small:!0,value:h})})}),(0,w.jsx)(pi.Z,{md:7,children:(0,w.jsx)(Qi,{children:(0,w.jsx)(R.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,w.jsx)(Xi,{deleteVariable:function(){return E(e.uuid)},fetchVariables:n,pipelineUUID:j,variable:e},e.uuid)}))]})}),[E,D,h,g,j,m,x,f,a,T]),N=(0,s.useMemo)((function(){return(0,w.jsx)(qi,{width:T,children:null===M||void 0===M?void 0:M.map((function(e){return(0,w.jsx)(Xi,{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}))})}),[M,i,T]);return(0,w.jsxs)(Z.Z,{p:P.cd,children:[(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(on.Z,{level:4,monospace:!0,children:"Global Variables"}),(0,w.jsx)(Z.Z,{ml:2}),(0,w.jsx)(A.ZP,{Icon:de.mm,blackBorder:!0,inline:!0,onClick:function(){return f((function(e){return!e}))},uuid:"Sidekick/GlobalVariables/addNewVariable",children:"New"})]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(O.ZP,{muted:!0,children:["Press ",(0,w.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,w.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:B}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.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,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsxs)(O.ZP,{bold:!0,large:!0,children:["For Python (",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/runtime-variable",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,w.jsx)(Ki.Z,{language:"python",small:!0,source:"\n var = kwargs['variable_name']\n"})]}),(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsxs)(O.ZP,{bold:!0,large:!0,children:["For SQL (",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/guides/sql-blocks#variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,w.jsx)(Ki.Z,{language:"sql",small:!0,source:"\n {{ variable_name }}\n"})]}),(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsxs)(O.ZP,{bold:!0,large:!0,children:["For R (",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/guides/r-blocks#runtime-variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,w.jsx)(Ki.Z,{language:"r",small:!0,source:"\n var <- global_vars['variable_name']\n"})]}),(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsx)(on.Z,{level:4,monospace:!0,children:"Trigger Runtime Variables"}),(0,w.jsx)(Z.Z,{mb:P.cd}),(0,w.jsx)(O.ZP,{children:"Depending on what kind of trigger you use for this pipeline, some default runtime variables will be provided."})]}),Object.values($i.Xm).map((function(e,n){var t;return(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(O.ZP,{large:!0,monospace:!0,children:(0,q.vg)(null===(t=$i.Z4[e])||void 0===t?void 0:t.call($i.Z4))})}),(0,er.JZ)([],e).map((function(n,t){return(0,w.jsx)(Xi,{hideEdit:!0,pipelineUUID:j,variable:n},"var_".concat(e,"_").concat(t))}))]},"".concat(e,"_").concat(n))})),M&&M.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{my:2,children:(0,w.jsx)(on.Z,{level:4,monospace:!0,children:"Block Output Variables"})}),(0,w.jsx)(Z.Z,{mb:2,children:N}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(O.ZP,{children:["Output variables can be used in any ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,warning:!0,children:v.tf.SCRATCHPAD})," block. They are for scratchpad blocks, specifically. To get upstream block outputs inside of other blocks, use the positional arguments."]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(O.ZP,{children:"To load the variable in a scratchpad block, use the following syntax:"})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(Ki.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"})})]})]})},tr=t(89565),ir=t.n(tr),rr=t(22782),or=m.default.div.withConfig({displayName:"indexstyle__OutputContainerStyle",componentId:"sc-wkjnrg-0"})([""," overflow-y:scroll;"," ",""],Se.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 lr(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 cr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?lr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):lr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ur=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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{children:[(0,w.jsx)(T.Z,{beforeIcon:(0,w.jsx)(de.JM,{inverted:!0,size:2*P.iI}),compact:r,disabled:r,loading:r,onClick:i,success:!0,children:(0,w.jsx)(O.ZP,{bold:!0,inverted:!0,primary:!1,children:"Execute pipeline"})}),(0,w.jsx)(Z.Z,{ml:1}),r&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(T.Z,{beforeIcon:(0,w.jsx)(de.x8,{inverted:!0,size:2*P.iI}),onClick:n,success:!0,children:(0,w.jsx)(O.ZP,{bold:!0,inverted:!0,primary:!1,children:"Cancel pipeline"})}),(0,w.jsx)(Z.Z,{ml:1})]}),(0,w.jsx)(T.Z,{onClick:t,secondary:!0,children:"Running status"})]}),(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(O.ZP,{children:"Hide"}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(xn.Z,{checked:o,onCheck:d})]})]}),!o&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{mb:1}),(0,w.jsx)(or,{noScrollbarTrackBackground:!0,children:(0,w.jsx)(rr.Nk,{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 xe.jU.includes(i)?r=(0,w.jsx)(rr.T5,cr(cr({},l),{},{children:(0,w.jsx)(O.ZP,{monospace:!0,preWrap:!0,children:(0,w.jsx)(ir(),{children:e})})})):i===xe.Gi.IMAGE_PNG&&(r=(0,w.jsx)("div",{style:{backgroundColor:"white"},children:(0,w.jsx)("img",{alt:"Image ".concat(n," from code output"),src:"data:image/png;base64, ".concat(e)})})),(0,w.jsx)("div",{children:r},"code-output-".concat(n,"-").concat(t))}))}))})})]})]})};var ar=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],v=(0,s.useState)(),m=v[0],b=v[1],g=(0,s.useMemo)((function(){return o-P.cd*P.iI*2}),[o]),x=(0,d.Db)(ue.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 ue.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],S=(0,s.useCallback)((function(e){"Enter"===e.key?(j({secret:{name:p,value:m}}).then((function(){n(),h(null),b(null)})),a(!1)):"Escape"===e.key&&a(!1)}),[j,n,p,m]);return(0,w.jsxs)(Z.Z,{p:P.cd,children:[(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(on.Z,{level:4,monospace:!0,children:"Secrets"}),(0,w.jsx)(Z.Z,{ml:2}),(0,w.jsx)(A.ZP,{Icon:de.mm,blackBorder:!0,inline:!0,onClick:function(){return a((function(e){return!e}))},uuid:"Sidekick/Secrets/addNewSecret",children:"New"})]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(O.ZP,{children:[(0,w.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,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(O.ZP,{muted:!0,children:["Press ",(0,w.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,w.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(qi,{width:g,children:[u&&(0,w.jsxs)(yi.Z,{children:[(0,w.jsx)(pi.Z,{md:1,children:(0,w.jsx)(Qi,{noPadding:!0,children:(0,w.jsx)(A.ZP,{backgroundColor:Ji.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText("{{ mage_secret_var(".concat(p,") }}")),Wi.Am.success("Successfully copied to clipboard.",{position:Wi.Am.POSITION.BOTTOM_RIGHT,toastId:p})},uuid:"Sidekick/Secrets/".concat(p),withIcon:!0,children:(0,w.jsx)(de.CK,{size:2.5*P.iI})})})}),(0,w.jsx)(pi.Z,{md:4,children:(0,w.jsx)(Qi,{children:(0,w.jsx)(R.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){h(e.target.value),e.preventDefault()},onKeyDown:S,paddingHorizontal:0,placeholder:"secret name",small:!0,value:p})})}),(0,w.jsx)(pi.Z,{md:7,children:(0,w.jsx)(Qi,{children:(0,w.jsx)(R.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){b(e.target.value),e.preventDefault()},onKeyDown:S,paddingHorizontal:0,placeholder:"secret value",small:!0,value:m})})})]}),null===i||void 0===i?void 0:i.map((function(e){return(0,w.jsx)(Xi,{copyText:e.name,deleteVariable:function(){return C(e.name)},fetchVariables:n,hideEdit:!0,obfuscate:!0,pipelineUUID:t,variable:{uuid:e.name,value:e.value}},e.name)}))]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.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,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(Ki.Z,{language:"yaml",small:!0,source:"\n \"{{ mage_secret_var('<secret_name>') }}\"\n ",maxWidth:g})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(O.ZP,{children:"To reference a secret in code, you can import the `get_secret_value` helper method:"})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(Ki.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})})]})},sr=t(33699),dr=t(72454),fr=t(64155),pr=t(91835);function hr(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 vr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?hr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):hr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var mr=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,m=e.fetchPipeline,b=e.interruptKernel,g=e.messages,x=(e.onChangeCallbackBlock,e.onChangeCodeBlock),j=e.onSelectBlockFile,y=e.pipeline,C=e.runBlock,S=e.runningBlocks,_=e.savePipelineContent,E=e.selectedBlock,I=e.setAnyInputFocused,T=e.setErrors,D=e.setHiddenBlocks,M=e.setSelectedBlock,B=e.setTextareaFocused,R=e.showBrowseTemplates,F=e.textareaFocused,L=(0,s.useRef)(null),U=(0,s.useState)(!1),z=U[0],V=U[1],K=(0,Fi.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&&(E&&(null===e||void 0===e?void 0:e.uuid)===(null===E||void 0===E?void 0:E.uuid)||(D((function(n){return vr(vr({},n),{},(0,o.Z)({},e.uuid,!1))})),j(e.uuid,e.type,null)))}),[K,u,j,E,D]);var G=(y||{}).type,Y=(0,s.useMemo)((function(){return(0,he.HK)(t||[],(function(e){return e.uuid}))}),[t]),J=ue.ZP.block_templates.list({},{revalidateOnFocus:!1}).data,X=(0,s.useMemo)((function(){return(null===J||void 0===J?void 0:J.block_templates)||[]}),[J]),$=(0,s.useCallback)((function(e){return n(e,(null===Y||void 0===Y?void 0:Y.length)||0)}),[n,Y]),ee=(0,s.useMemo)((function(){return(0,Qn.oM)(X,$)}),[$,X]),ne=(0,s.useMemo)((function(){return(0,Qn.hr)($,i,G,{blockTemplatesByBlockType:ee,languages:[v.t6.PYTHON],showBrowseTemplates:R})}),[$,i,ee,G]),te=(0,s.useMemo)((function(){return null===Y||void 0===Y?void 0:Y[null===E||void 0===E?void 0:E.uuid]}),[Y,E]),ie=(0,s.useMemo)((function(){return S.reduce((function(e,n,t){return vr(vr({},e),{},(0,o.Z)({},n.uuid,vr(vr({},n),{},{priority:t})))}),{})}),[S]),re=(0,d.Db)((function(e){var n=e.block,t=e.upstream_blocks;return ue.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(){m()},onErrorCallback:function(e,n){return null===T||void 0===T?void 0:T({errors:n,response:e})}})}}),oe=(0,l.Z)(re,2),le=oe[0],ce=oe[1].isLoading,ae=(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===E||void 0===E?void 0:E.uuid)===i,d=ie[i],k=d?0===d.priority?xe.uF.BUSY:xe.uF.QUEUED:xe.uF.IDLE,O="".concat(t,"s/").concat(i,".py");return c.current[O]=(0,s.createRef)(),(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(Pe.Z,{allBlocks:u,autocompleteItems:r,block:e,blockIdx:n,blockRefs:c,blocks:u,defaultValue:e.content,deleteBlock:function(e){f(vr({},e)),I(!1)},executionState:k,extraContent:(0,w.jsx)(Ai,{block:e,blocks:a,inputPlaceholder:"Select blocks to add ".concat((0,q._6)(p,null)," to"),loading:ce,onClickTag:function(e){D((function(n){return vr(vr({},n),{},(0,o.Z)({},e.uuid,!1))})),j(e.uuid,e.type,null)},supportedUpstreamBlockTypes:[v.tf.CUSTOM,v.tf.DATA_EXPORTER,v.tf.DATA_LOADER,v.tf.DBT,v.tf.SCRATCHPAD,v.tf.SENSOR,v.tf.TRANSFORMER],updateBlock:le}),fetchFileTree:h,fetchPipeline:m,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:S,savePipelineContent:_,selected:l,setAnyInputFocused:I,setErrors:T,setSelected:function(n){return M(!0===n?e:null)},setTextareaFocused:B,textareaFocused:l&&F})},i)}))}),[t,r,c,u,a,f,p,h,m,b,ce,g,x,j,y,C,S,ie,_,E,I,T,D,M,B,F,le]),se="".concat(p,"/index"),fe=(0,Q.y)(),pe=fe.disableGlobalKeyboardShortcuts,ve=fe.registerOnKeyDown,be=fe.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){be(se)}}),[be,se]),ve(se,(function(e,n){!pe&&te&&((0,H.y)([N.zX,N.Um],n)||(0,H.y)([N.PQ,N.Um],n))&&(e.preventDefault(),_())}),[te,_]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsxs)(O.ZP,{default:!0,children:["Run 1 or more ",(0,q.wX)(p)," block functions whenever another block succeeds or fails."]}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(O.ZP,{default:!0,children:["Learn more about ",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/development/blocks/".concat((0,q.wX)((0,q._6)(p,null)),"/overview"),openNewWindow:!0,children:(0,q.wX)((0,q._6)(p,null))}),"."]})})]}),ae,(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(W.Z,{onClickOutside:function(){return V(!1)},open:!0,children:(0,w.jsx)(Tn.Z,{disableKeyboardShortcuts:!0,items:ne,onClickCallback:function(){return V(!1)},open:z,parentRef:L,uuid:p,children:(0,w.jsxs)(A.ZP,{beforeElement:(0,w.jsx)(Mi.Wx,{rose:i===v.tf.CALLBACK,children:(0,w.jsx)(de.mm,{size:Mi.ZG})}),inline:!0,onClick:function(e){e.preventDefault(),V(!0)},uuid:"AddNewBlocks/".concat(p),children:[(0,q.kC)(p)," block"]})})})})]})},br=t(45419);function gr(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 xr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?gr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):gr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var jr=[{Icon:de.AQ,name:"Callbacks",uuid:br.Q.CALLBACK},{Icon:de.hW,name:"Conditionals",uuid:br.Q.CONDITIONAL}];var yr=function(e){var n=(0,pr.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,Fi.iV)())||void 0===e?void 0:e.addon)}),[t.asPath]);var l=(0,s.useMemo)((function(){var e,t;if(br.Q.CALLBACK===r)e={addOnBlockType:v.tf.CALLBACK,addOnBlocks:null===(t=n.pipeline)||void 0===t?void 0:t.callbacks,displayBlockName:"callback"};else if(br.Q.CONDITIONAL===r){var i;e={addOnBlockType:v.tf.CONDITIONAL,addOnBlocks:null===(i=n.pipeline)||void 0===i?void 0:i.conditionals,displayBlockName:"conditional"}}if(e)return(0,w.jsx)(mr,xr(xr({},e),n))}),[n,r]);return(0,w.jsx)(ke.W,{backend:Ze.PD,children:(0,w.jsxs)(Z.Z,{p:P.cd,children:[l,!r&&(null===jr||void 0===jr?void 0:jr.map((function(e,n){var t=e.name,i=e.uuid,r=e.Icon;return(0,w.jsx)(Z.Z,{mt:n>=1?P.cd:0,children:(0,w.jsx)(k.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,ve.u7)({addon:i},{pushHistory:!0})},preventDefault:!0,children:(0,w.jsx)(M.Z,{dark:!0,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(Dn.Z,{fullWidth:!1,children:(0,w.jsx)(Z.Z,{p:P.cd,children:(0,w.jsx)(y.Z,{alignItems:"center",children:(0,w.jsx)(r,{fill:"#885EFF",size:2*P.iI})})})}),(0,w.jsx)(Z.Z,{mr:P.cd}),(0,w.jsx)(j.Z,{flexDirection:"column",children:(0,w.jsx)(O.ZP,{bold:!0,children:t})})]}),(0,w.jsx)(de._Q,{})]})})})},i)})))]})})};function kr(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 Zr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?kr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):kr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Or=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,v=e.deleteWidget,m=e.editingBlock,b=e.executePipeline,g=e.fetchFileTree,x=e.fetchPipeline,j=e.fetchSecrets,k=e.fetchVariables,C=e.globalVariables,S=e.insights,_=e.interruptKernel,E=e.isPipelineExecuting,I=e.lastTerminalMessage,D=e.messages,A=e.metadata,M=e.onChangeCallbackBlock,R=e.onChangeChartBlock,N=e.onChangeCodeBlock,F=e.onSelectBlockFile,H=e.pipeline,U=e.pipelineMessages,z=e.runBlock,V=e.runningBlocks,W=e.sampleData,K=e.savePipelineContent,G=e.secrets,Y=e.selectedBlock,q=e.selectedFilePath,Q=e.sendTerminalMessage,J=e.setAllowCodeBlockShortcuts,X=e.setAnyInputFocused,$=e.setDepGraphZoom,ee=e.setDisableShortcuts,ne=e.setEditingBlock,te=e.setErrors,ie=e.setHiddenBlocks,re=e.setSelectedBlock,oe=e.setTextareaFocused,le=e.showBrowseTemplates,ce=e.statistics,ue=e.textareaFocused,ae=e.treeRef,se=e.updateWidget,fe=e.widgets,pe=(0,ot.i)().height,ve=it.uX,me=(0,s.useState)([]),be=me[0],ge=me[1],xe=(0,s.useState)(!!(0,L.U2)(L.Q9)),je=xe[0],ye=xe[1],ke=(0,s.useMemo)((function(){return i-(dr.k1+1)}),[i]),Ze=((null===m||void 0===m?void 0:m.upstreamBlocks)||{}).block,Oe=((null===W||void 0===W?void 0:W.columns)||[]).slice(0,100),Pe=(0,s.useMemo)((function(){return(null===W||void 0===W?void 0:W.rows)||[]}),[W]),Ce=(0,s.useMemo)((function(){return(null===A||void 0===A?void 0:A.column_types)||{}}),[A]),we=(0,s.useMemo)((function(){return(null===S||void 0===S?void 0:S[1])||{}}),[S]),_e=(0,s.useMemo)((function(){return(0,he.HK)((null===S||void 0===S?void 0:S[0])||[],(function(e){return e.feature.uuid}))}),[S]),Ee=!!W,Ie=(0,s.useMemo)((function(){return B.qL.INTEGRATION===(null===H||void 0===H?void 0:H.type)}),[H]),Te=B.qL.STREAMING!==(null===H||void 0===H?void 0:H.type)?-70:je?-16:300,De=(0,s.useCallback)((0,Yi.Fk)({columnTypes:Ce,columns:Oe,insightsByFeatureUUID:_e,insightsOverview:we,noColumnLinks:!0,statistics:ce}),[Ce,Oe,_e,we,ce]),Ae=(0,s.useMemo)((function(){return(0,w.jsx)(nr,{blocks:c,fetchVariables:k,pipeline:H,selectedBlock:Y,setErrorMessages:ge,variables:C,width:ke})}),[ke,c,k,C,H,Y]),Me=(0,s.useMemo)((function(){return(0,w.jsx)(Vi.Z,{selectedBlock:Y,selectedFilePath:q,setErrors:te,width:ke>Se.nn?ke-Se.nn:ke})}),[ke,Y,q,te]),Be=(0,s.useMemo)((function(){return(0,w.jsx)(ar,{fetchSecrets:j,pipelineUUID:null===H||void 0===H?void 0:H.uuid,secrets:G,setErrorMessages:ge,width:ke})}),[ke,j,H,G]),Re=(0,s.useMemo)((function(){return{addNewBlockAtIndex:t,autocompleteItems:r,blockRefs:l,blocks:c,blocksInNotebook:u,deleteBlock:h,fetchFileTree:g,fetchPipeline:x,interruptKernel:_,messages:D,onChangeCallbackBlock:M,onChangeCodeBlock:N,onSelectBlockFile:F,pipeline:H,runBlock:z,runningBlocks:V,savePipelineContent:K,selectedBlock:Y,setAnyInputFocused:X,setErrors:te,setHiddenBlocks:ie,setSelectedBlock:re,setTextareaFocused:oe,showBrowseTemplates:le,textareaFocused:ue}}),[t,r,l,c,u,h,g,x,_,D,M,N,F,H,z,V,K,Y,X,te,ie,re,oe,le,ue]),Ne=(0,s.useMemo)((function(){return Oe.length>0&&(0,w.jsx)(ei.Z,{columnHeaderHeight:(0,yn.Qr)(Ce)&&(0,yn.Qr)(_e)&&(0,yn.Qr)(we)?0:fr.Eh,columns:Oe,height:pe-ve-it.OM,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,renderColumnHeader:De,rows:Pe,width:ke})}),[ke,Ce,Oe,ve,pe,_e,we,De,Pe]),Fe=(0,s.useMemo)((function(){return fe.length>0&&(0,w.jsx)(Pi,{autocompleteItems:r,blockRefs:l,blocks:c,chartRefs:d,deleteWidget:v,fetchFileTree:g,fetchPipeline:x,messages:D,onChangeChartBlock:R,pipeline:H,runBlock:z,runningBlocks:V,savePipelineContent:K,selectedBlock:Y,setAnyInputFocused:X,setErrors:te,setSelectedBlock:re,setTextareaFocused:oe,textareaFocused:ue,updateWidget:se,widgets:fe,width:ke})}),[ke,r,l,c,d,v,g,x,D,R,H,z,V,K,Y,X,te,re,oe,ue,se,fe]),Le=(0,s.useMemo)((function(){return(0,w.jsx)("div",{style:{height:"100%",position:"relative",width:ke},children:(0,w.jsx)(sr.Z,{lastMessage:I,onFocus:function(){return re(null)},sendMessage:Q,width:ke})})}),[ke,I,Q,re]),He=(0,s.useMemo)((function(){return(0,w.jsx)(zi,Zr({},Re))}),[Re]),Ue=(0,s.useMemo)((function(){return(0,w.jsx)(yr,Zr({},Re))}),[Re]),ze=(0,s.useMemo)((function(){return H&&Y&&(0,w.jsx)(ht,{block:Y,fetchFileTree:g,fetchPipeline:x,pipeline:H,setSelectedBlock:re})}),[g,x,H,Y,re]);return(0,w.jsxs)(w.Fragment,{children:[(null===be||void 0===be?void 0:be.length)>=1&&(0,w.jsxs)(Z.Z,{mb:3,mt:2,mx:2,children:[(0,w.jsxs)(y.Z,{justifyContent:"space-between",children:[(0,w.jsx)(O.ZP,{bold:!0,danger:!0,children:"Errors"}),(0,w.jsx)(T.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return ge([])},transparent:!0,children:(0,w.jsx)(de.x8,{muted:!0})})]}),null===be||void 0===be?void 0:be.map((function(e){return(0,w.jsx)(Z.Z,{pb:1,children:(0,w.jsx)(O.ZP,{monospace:!0,xsmall:!0,children:e})},e)}))]}),(0,w.jsxs)(fr.t0,{fullWidth:!0,heightOffset:Wn.cH.TERMINAL===n?0:Se.nn,onBlur:function(){q||ee(!1),null===J||void 0===J||J(!1)},onFocus:function(){ee(!0),n===Wn.cH.TREE&&(null===J||void 0===J||J(!0))},children:[n===Wn.cH.TREE&&(0,w.jsx)(p.Z,{uuid:"PipelineDetail/".concat(null===H||void 0===H?void 0:H.uuid),children:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Ci.Z,{blocks:c,blockRefs:l,editingBlock:m,enablePorts:!Ie,fetchPipeline:x,height:pe-ve-Te,messages:D,onClickNode:function(e){var n=e.block.uuid;return ie((function(e){var t=!(null===e||void 0===e||!e[n]);return t?Zr(Zr({},e),{},(0,o.Z)({},n,!t)):e}))},pipeline:H,runningBlocks:V,selectedBlock:Y,setEditingBlock:ne,setErrors:te,setSelectedBlock:re,setZoom:$,treeRef:ae}),!Ze&&B.qL.STREAMING===(null===H||void 0===H?void 0:H.type)&&(0,w.jsx)(Z.Z,{p:1,children:(0,w.jsx)(ur,{cancelPipeline:a,checkIfPipelineRunning:f,executePipeline:b,isPipelineExecuting:E,pipelineExecutionHidden:je,pipelineMessages:U,setPipelineExecutionHidden:ye})})]})}),n===Wn.cH.DATA&&Ne,Wn.cH.SECRETS===n&&Be,Wn.cH.VARIABLES===n&&Ae,Wn.cH.FILE_VERSIONS===n&&(0,w.jsx)(p.Z,{uuid:"FileVersions/".concat(q?decodeURIComponent(q):""),children:Me}),Ie||Y&&Ee||!Y&&Ee&&n===Wn.cH.DATA?null:Wn.du.includes(n)&&(0,w.jsx)(y.Z,{alignItems:"center",justifyContent:"center",verticalHeight:Wn.fp,verticalHeightOffset:ve,width:ke,children:(0,w.jsx)(O.ZP,{center:!0,default:!0,disableWordBreak:!0,large:!0,monospace:!0,children:Y?!Ee&&"No data or insights available":"Select a block for insights"})}),Wn.cH.CHARTS===n&&(fe.length>0?Fe:(0,w.jsxs)(y.Z,{alignItems:"center",flexDirection:"column",justifyContent:"center",verticalHeight:Wn.fp,verticalHeightOffset:ve,width:ke,children:[(0,w.jsx)(Z.Z,{px:1,children:(0,w.jsx)(y.Z,{flexDirection:"row",children:(0,w.jsxs)(O.ZP,{center:!0,default:!0,children:["Add a chart by clicking the chart icon \xa0",(0,w.jsx)(de.GQ,{size:1.5*P.iI}),"\xa0in",(0,w.jsx)("br",{}),"the top right corner of a block (if applicable)."]})})}),(0,w.jsx)(Z.Z,{mt:P.cd,px:1,children:(0,w.jsx)(Si,{size:40*P.iI})})]})),Wn.cH.TERMINAL===n&&Le,Wn.cH.EXTENSIONS===n&&He,Wn.cH.ADDON_BLOCKS===n&&Ue,Wn.cH.BLOCK_SETTINGS===n&&(Y?ze:(0,w.jsx)(y.Z,{alignItems:"center",flexDirection:"column",justifyContent:"center",verticalHeight:Wn.fp,verticalHeightOffset:ve,width:ke,children:(0,w.jsx)(Z.Z,{px:1,children:(0,w.jsx)(y.Z,{flexDirection:"row",children:(0,w.jsxs)(O.ZP,{center:!0,default:!0,children:["Please select a block and then click the settings icon \xa0",(0,w.jsx)(de.JG,{size:1.5*P.iI}),"\xa0",(0,w.jsx)("br",{}),"in the top right corner of a block (if applicable)."]})})})}))]})]})},Pr=t(12691),Cr=t.n(Pr),wr=t(35438);function Sr(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 _r(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Sr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Sr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Er=function(e){var n,t=e.activeView,i=e.depGraphZoom,r=e.pipeline,o=e.secrets,l=e.selectedBlock,c=e.treeRef,u=e.variables,a=null===r||void 0===r?void 0:r.uuid,d=(0,Fi.iV)(),f=(0,er.wx)(u,(function(e){return e.uuid===Gi.C})),p=Wn.Qq[t],h=(null===p||void 0===p||null===(n=p.buildLabel)||void 0===n?void 0:n.call(p,{pipeline:r,secrets:o,variables:f}))||(null===p||void 0===p?void 0:p.label);Wn.cH.BLOCK_SETTINGS===t&&null!==l&&void 0!==l&&l.uuid&&(h=(0,w.jsxs)(w.Fragment,{children:["Block settings for ",(0,w.jsx)(O.ZP,{bold:!0,color:(0,C.qn)(null===l||void 0===l?void 0:l.type).accent,inline:!0,monospace:!0,children:null===l||void 0===l?void 0:l.uuid})]}));var v=(0,w.jsx)(O.ZP,{bold:!0,children:h}),m=Wn.cH.EXTENSIONS===t&&(null===d||void 0===d?void 0:d.extension),b=ue.ZP.extension_options.list({},{},{pauseFetch:!m}).data,g=(0,s.useMemo)((function(){return(null===b||void 0===b?void 0:b.extension_options)||[]}),[b]),x=(0,s.useMemo)((function(){return(0,he.HK)(g,(function(e){return e.uuid}))}),[g]),P=Wn.cH.ADDON_BLOCKS===t&&(null===d||void 0===d?void 0:d.addon);if(!t)return(0,w.jsx)("div",{});if(c&&Wn.cH.TREE===t)v=(0,w.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[v,(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,_r(_r({},wr.Ai),{},{onClick:function(){var e,n;null===c||void 0===c||null===(e=c.current)||void 0===e||null===(n=e.zoomIn)||void 0===n||n.call(e)},children:(0,w.jsx)(O.ZP,{noWrapping:!0,children:"Zoom in"})})),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(T.Z,_r(_r({},wr.Ai),{},{onClick:function(){var e,n;null===c||void 0===c||null===(e=c.current)||void 0===e||null===(n=e.zoomOut)||void 0===n||n.call(e)},children:(0,w.jsx)(O.ZP,{noWrapping:!0,children:"Zoom out"})})),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(ce.Z,{appearAbove:!0,appearBefore:!0,default:!0,label:"Shortcut: Double-click canvas",lightBackground:!0,size:null,widthFitContent:!0,children:(0,w.jsx)(T.Z,_r(_r({},wr.Ai),{},{onClick:function(){var e,n;null===c||void 0===c||null===(e=c.current)||void 0===e||null===(n=e.fitCanvas)||void 0===n||n.call(e)},children:(0,w.jsx)(O.ZP,{noWrapping:!0,children:"Reset"})}))}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsxs)(O.ZP,{bold:!0,children:[null===i||void 0===i?void 0:i.toFixed(2),"x"]})]})]});else if(m){var S=x[null===d||void 0===d?void 0:d.extension];v=(0,w.jsxs)(y.Z,{children:[(0,w.jsx)(Cr(),{as:"/pipelines/".concat(a,"/edit?").concat(Wn.uM,"=").concat(Wn.cH.EXTENSIONS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,w.jsx)(k.Z,{default:!0,children:h})}),(0,w.jsx)(O.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,w.jsx)(O.ZP,{bold:!0,children:null===S||void 0===S?void 0:S.name})]})}else P&&(v=(0,w.jsxs)(y.Z,{children:[(0,w.jsx)(Cr(),{as:"/pipelines/".concat(a,"/edit?").concat(Wn.uM,"=").concat(Wn.cH.ADDON_BLOCKS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,w.jsx)(k.Z,{default:!0,children:h})}),(0,w.jsx)(O.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,w.jsx)(O.ZP,{bold:!0,children:(0,q.vg)(null===d||void 0===d?void 0:d.addon)})]}));return(0,w.jsx)(it.ym,{children:v})},Ir=t(35033),Tr=t(3055),Dr=t(27337),Ar=t(94353),Mr=t(59920),Br=t(36405);function Rr(e){var n=e.activeView,t=e.pipeline,i=e.secrets,r=e.setActiveSidekickView,o=e.variables,l=(0,er.wx)(o,(function(e){return e.uuid===Gi.C}));return Wn.j5.map((function(e){var o=e.buildLabel,c=e.key,u=e.label;return{Icon:Wn.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 Nr=t(43482),Fr=t(32821),Lr=t(28799);function Hr(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?Hr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Hr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function zr(e){var n,t,i=e.page,c=e.pipeline,u=(0,f.useRouter)(),m=(0,ot.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],S=O[1],_=(0,s.useState)(null),M=_[0],R=_[1],N=(0,s.useState)(null),H=N[0],W=N[1],K=(0,s.useState)(null),G=K[0],Y=K[1],Q=(0,s.useState)(null),J=Q[0],X=Q[1],$=(0,s.useState)([]),ee=$[0],re=$[1],oe=(0,s.useState)({}),ce=oe[0],ae=oe[1],je=(0,s.useState)(!1),ye=je[0],ke=je[1],Ze=(0,s.useState)(!1),Oe=Ze[0],Pe=Ze[1],Ce=(0,s.useState)(!1),we=Ce[0],Se=Ce[1],_e=(0,s.useState)(!1),Ee=_e[0],Ie=_e[1],Te=(0,s.useState)(1),De=Te[0],Ae=Te[1],Me="".concat(F.H8,"_").concat(g),Be=(0,L.U2)(Me),Re=(0,s.useState)((0,he.sE)(rt.NR,(function(e){return e.uuid===Be}))||rt.NR[0]),Ne=Re[0],Fe=Re[1],Le=(0,s.useCallback)((function(e){Fe(e),(0,L.t8)(Me,null===e||void 0===e?void 0:e.uuid)}),[Me,Fe]),Ue="".concat(F.g6,"_").concat(g),ze=(0,s.useState)({}),Ve=ze[0],We=ze[1],Ke=(0,s.useCallback)((function(e){We((function(n){var t=e(n);return(0,L.t8)(Ue,JSON.stringify(t)),t}))}),[Ue,We]);(0,s.useEffect)((function(){var e=(0,L.U2)(Ue);e&&(0,q.Pb)(e)&&We(JSON.parse(e))}),[Ue,We]);var Ge=(0,s.useRef)(null),Ye=ue.ZP.statuses.list({},{revalidateOnFocus:!1}).data,qe=(0,s.useMemo)((function(){var e,n;return null===Ye||void 0===Ye||null===(e=Ye.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.disable_pipeline_edit_access}),[Ye]),Qe=(0,s.useMemo)((function(){var e,n;return null===Ye||void 0===Ye||null===(e=Ye.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.max_print_output_lines}),[Ye]),Je=(0,s.useState)({}),Xe=Je[0],$e=Je[1],en=(0,s.useState)([]),nn=en[0],tn=en[1],rn=ue.ZP.kernels.list({},{refreshInterval:5e3,revalidateOnFocus:!0}),on=rn.data,ln=rn.mutate,cn=null===on||void 0===on?void 0:on.kernels,un=(null===cn||void 0===cn?void 0:cn.find((function(e){return e.name===B.a_[null===bn||void 0===bn?void 0:bn.type]})))||(null===cn||void 0===cn?void 0:cn[0]),an=(0,se.Z)(g),sn=ue.ZP.pipelines.detail(g,{include_block_pipelines:!0,includes_outputs:(0,yn.Qr)(Xe)},{refreshInterval:6e4}),dn=sn.data,fn=sn.mutate,pn=ue.ZP.files.list(),hn=pn.data,vn=pn.mutate,mn=(0,s.useMemo)((function(){return(null===hn||void 0===hn?void 0:hn.files)||[]}),[hn]),bn=null===dn||void 0===dn?void 0:dn.pipeline,gn=(0,s.useMemo)((function(){return B.qL.INTEGRATION===(null===bn||void 0===bn?void 0:bn.type)}),[bn]),xn=(0,s.useState)(null),jn=xn[0],kn=xn[1],Zn=(0,s.useState)((0,pe.Tz)({dateObj:!0})),On=Zn[0],Pn=Zn[1],Cn=(0,s.useState)(!1),wn=Cn[0],Sn=Cn[1],_n=(0,be.dd)((function(){return(0,w.jsx)(le.Z,{centerOnScreen:!0,neutral:!0,onClick:Tn,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*P.iI})}),{},[],{background:!0,uuid:"stale_pipeline_message"}),En=(0,l.Z)(_n,2),In=En[0],Tn=En[1];(0,s.useEffect)((function(){var e,n;null!==dn&&void 0!==dn&&null!==(e=dn.pipeline)&&void 0!==e&&e.updated_at&&(null===jn||void 0===jn?void 0:jn.toISOString())!==new Date(null===dn||void 0===dn||null===(n=dn.pipeline)||void 0===n?void 0:n.updated_at).toISOString()&&kn(new Date(dn.pipeline.updated_at)),jn&&Number(jn)>Number(On)&&In()}),[null===dn||void 0===dn||null===(n=dn.pipeline)||void 0===n?void 0:n.updated_at,jn,On,In]);var Dn=(0,Fi.iV)(),An=Dn[Wn.uM],Mn=Dn.block_uuid,Bn=Dn.file_path,Rn=(0,s.useMemo)((function(){var e=Dn["file_paths[]"]||[];return Array.isArray(e)||(e=[e]),e}),[Dn]),Nn=(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)({},Wn.uM,e);null!==t&&void 0!==t&&t.addon&&(i.addon=null===t||void 0===t?void 0:t.addon),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.extension&&(i.extension=null===t||void 0===t?void 0:t.extension),(0,ve.u7)(i,{preserveParams:["addon","block_uuid","file_path","file_paths[]"],pushHistory:n,replaceParams:!0})}),[]);(0,s.useEffect)((function(){An||Nn(Wn.cH.TREE,!1)}),[An,Nn]);var Fn=(0,s.useCallback)((function(e,n,t){k(!1),setTimeout((function(){return Nn(e,n,t)}),1)}),[Nn]),Ln=(0,s.useRef)({}),Hn=(0,s.useRef)({}),Un=(0,s.useRef)(null),zn=(0,s.useRef)({}),Vn=(0,s.useRef)({}),Kn=(0,s.useRef)({}),Gn=(0,s.useCallback)((function(e,n,t){var i=zn.current||{};zn.current=Ur(Ur({},i),{},(0,o.Z)({},e,Ur(Ur({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[zn]),Yn=(0,s.useCallback)((function(e,n,t){var i=Vn.current||{};Vn.current=Ur(Ur({},i),{},(0,o.Z)({},e,Ur(Ur({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[Vn]),qn=(0,s.useCallback)((function(e,n,t){Gn(e,n,t),Sn(!0)}),[Gn,Sn]),Qn=(0,s.useCallback)((function(e,n,t){Yn(e,n,t),Sn(!0)}),[Yn,Sn]),Jn=(0,s.useCallback)((function(e){Kn.current=Ur(Ur({},Kn.current),e)}),[Kn]),Xn=(0,s.useCallback)((function(e,n){Jn((0,o.Z)({},e,n)),Sn(!0)}),[Jn,Sn]),et=(0,s.useState)(null),nt=et[0],tt=et[1],it=ue.ZP.data_providers.list({},{revalidateOnFocus:!1}).data,lt=null===it||void 0===it?void 0:it.data_providers;(0,s.useEffect)((function(){var e=dn;null!==dn&&void 0!==dn&&dn.hasOwnProperty("error")||null===it||void 0===it||!it.hasOwnProperty("error")||(e=it),(0,me.bB)(e,W)}),[dn,it]);var ct=ue.ZP.variables.pipelines.list(g,{},{revalidateOnFocus:!1}),at=ct.data,st=ct.mutate,ft=null===at||void 0===at?void 0:at.variables,pt=ue.ZP.secrets.list({},{revalidateOnFocus:!1}),ht=pt.data,vt=pt.mutate,mt=null===ht||void 0===ht?void 0:ht.secrets,bt=(0,s.useState)([]),gt=bt[0],xt=bt[1],jt=(0,s.useState)([]),yt=jt[0],kt=jt[1],Zt=(0,s.useRef)({}),Ot=(0,s.useCallback)((function(e){var n;Sn(!0);var t=Zt.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),Zt.current[e.uuid]=Ur(Ur(Ur({},t),e),{},{configuration:Ur(Ur({},t.configuration),e.configuration),upstream_blocks:i})}),[Sn,Zt]),Pt=(0,s.useState)(!1),Ct=Pt[0],wt=Pt[1],St=(0,s.useState)({upstreamBlocks:null}),_t=St[0],Et=St[1],It=(0,s.useState)([]),Tt=It[0],Dt=It[1],At=(0,s.useState)(null),Mt=At[0],Bt=At[1],Rt=(0,Nr.Dp)(g),Nt=(0,Nr.Q9)(Rt,gt),Ft=(0,s.useState)(Nt),Lt=Ft[0],Ht=Ft[1],Ut=(0,s.useState)(),zt=Ut[0],Vt=Ut[1],Wt=(0,s.useState)(),Kt=Wt[0],Gt=Wt[1],Yt=(0,s.useState)(null),qt=Yt[0],Qt=Yt[1],Jt=(0,se.Z)(Lt),Xt=(0,s.useCallback)((function(){Et({upstreamBlocks:{block:null,values:[]}}),$e({}),Sn(!1),Dt([]),Bt(null)}),[]);(0,s.useEffect)((function(){g!==an&&(zn.current={},Vn.current={})}),[g,an]);var $t=ue.ZP.block_outputs.detail((null===qt||void 0===qt?void 0:qt.type)!==v.tf.SCRATCHPAD&&(null===qt||void 0===qt?void 0:qt.type)!==v.tf.CHART&&(null===qt||void 0===qt?void 0:qt.uuid)&&encodeURIComponent(null===qt||void 0===qt?void 0:qt.uuid),{pipeline_uuid:!j&&g}),ei=$t.data,ni=$t.mutate,ti=(0,s.useMemo)((function(){return null===ei||void 0===ei?void 0:ei.block_output}),[ei]),ii=(0,s.useMemo)((function(){var e,n,t;return gn?null===(e=(0,he.sE)(null===ti||void 0===ti?void 0:ti.outputs,(function(e){return e.variable_uuid==="output_sample_data_".concat((0,q.kE)(Kt))})))||void 0===e?void 0:e.sample_data:null===ti||void 0===ti||null===(n=ti.outputs)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.sample_data}),[ti,gn,Kt]),ri=ue.ZP.blocks.pipelines.analyses.detail(!j&&g,(null===qt||void 0===qt?void 0:qt.type)!==v.tf.SCRATCHPAD&&(null===qt||void 0===qt?void 0:qt.type)!==v.tf.CHART&&(null===qt||void 0===qt?void 0:qt.uuid)&&encodeURIComponent(null===qt||void 0===qt?void 0:qt.uuid)),oi=ri.data,li=ri.mutate,ci=(null===oi||void 0===oi||null===(t=oi.analyses)||void 0===t?void 0:t[0])||{},ui=ci.insights,ai=void 0===ui?{}:ui,si=ci.metadata,di=void 0===si?{}:si,fi=ci.statistics,pi=void 0===fi?{}:fi;(0,s.useEffect)((function(){0===Tt.length&&(li(),ni(),st())}),[li,ni,st,Tt]),(0,s.useEffect)((function(){if(0===Lt.length)Qt(null);else if((null===Jt||void 0===Jt?void 0:Jt.length)!==(null===Lt||void 0===Lt?void 0:Lt.length)&&(null===Lt||void 0===Lt?void 0:Lt.length)<(null===Jt||void 0===Jt?void 0:Jt.length)){var e=Jt.findIndex((function(e){return e.uuid===(null===qt||void 0===qt?void 0:qt.uuid)})),n=Jt.length-1===e?e-1:e+1;Qt(Jt[Math.max(0,n)])}}),[Lt,Jt,null===qt||void 0===qt?void 0:qt.uuid]),(0,s.useEffect)((function(){var e;null!==(e=_t.upstreamBlocks)&&void 0!==e&&e.block&&(k(!1),Nn(Wn.cH.TREE))}),[_t.upstreamBlocks,Nn]);var hi=ue.ZP.autocomplete_items.list({},{refreshInterval:!1,revalidateOnFocus:!1}),vi=hi.data,mi=hi.mutate,bi=null===vi||void 0===vi?void 0:vi.autocomplete_items;(0,s.useEffect)((function(){Bn||Se(!1),X(Bn)}),[Bn]),(0,s.useEffect)((function(){(0,he.fS)(Rn,ee)||re(Rn)}),[Rn,ee]);var gi=(0,d.Db)(ue.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")),vn()},onErrorCallback:function(e,n){return R({errors:n,response:e})}})}}),xi=(0,l.Z)(gi,1)[0],ji=(0,d.Db)(ue.ZP.pipelines.useUpdate(g,{update_content:!0}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){Sn(!1),fn()},onErrorCallback:function(e,n){return R({errors:n,response:e})}})}}),yi=(0,l.Z)(ji,2),ki=yi[0],Zi=yi[1].isLoading,Oi=(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(!(jn&&Number(jn)>Number(On))){var u=(0,pe.Tz)({dateObj:!0}),a=(0,pe.Tz)();Pn(u);var s={},d={},f={},p={};gt.forEach((function(e){var n,t,r,o=e.extension_uuid,u=e.type,a=e.uuid,h=null===(n=Vn.current[u])||void 0===n?void 0:n[a];"undefined"===typeof h&&(h=e.content);var m,b=null===(t=zn.current[u])||void 0===t?void 0:t[a];"undefined"===typeof b&&(b=e.callback_content);var g=null===(r=Xe[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;(v.tf.SCRATCHPAD===e.type||x||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(Ir.Lz)?e:e.concat(n)}),[]),i===xe.Gi.TEXT_PLAIN&&(y+=(null===t||void 0===t?void 0:t.length)||0)),(!Qe||y<Qe+5)&&j.push(n))})),m=j.map((function(e,n){return{text_data:JSON.stringify(e),variable_uuid:"".concat(a,"_").concat(n)}}))}var k=Ur(Ur({},e),{},{callback_content:b,content:h,outputs:m});(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}:[v.tf.EXTENSION].includes(u)?(s[o]||(s[o]=[]),s[o].push(k)):v.tf.CALLBACK===u?f[k.uuid]=k:v.tf.CONDITIONAL===u?p[k.uuid]=k:d[k.uuid]=k}));var h=Ur(Ur({},null===bn||void 0===bn?void 0:bn.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 m=[],b=[],g=[];return((null===o||void 0===o?void 0:o.blocks)||gt).forEach((function(e){var n=e.uuid,t=d[n],i=f[n],r=p[n];"undefined"!==typeof t?m.push(t):"undefined"!==typeof i?b.push(i):"undefined"!==typeof r&&g.push(r)})),ki({pipeline:Ur(Ur(Ur({},bn),o),{},{blocks:m,callbacks:b,conditionals:g,extensions:h,updated_at:a,widgets:yt.map((function(e){var n,t,i=Kn.current[e.uuid],r=Zt.current[e.uuid]||{};"undefined"===typeof i&&(i=e.content);var o=null===(n=Xe[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;(v.tf.SCRATCHPAD===e.type||l||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(Ir.Lz)?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 Ur(Ur(Ur({},e),r),{},{configuration:Ur(Ur({},e.configuration),r.configuration),content:i,outputs:t})}))})})}In()}),[gt,Qe,Xe,bn,jn,On,In,ki,yt]),Pi=(0,s.useCallback)((function(e){Oi();var n=encodeURIComponent(e),t=(0,Fi.iV)()["file_paths[]"]||[];Array.isArray(t)||(t=[t]),t.includes(n)||t.push(n);var i=(0,Fr.IO)(e,gt);if(i){if(Bt(i),null!==Ln&&void 0!==Ln&&Ln.current){var r,o=Ln.current["".concat(i.type,"s/").concat(i.uuid,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}}else(0,ve.u7)({file_path:n,"file_paths[]":t})}),[Ln,gt,Oi]),Ci=(0,s.useMemo)((function(){var e=[],n=[];return gt.forEach((function(t){v.M5.includes(t.type)?n.push(t):e.push(t)})),{blocksInNotebook:e,blocksInSidekick:n}}),[gt]),wi=Ci.blocksInNotebook,Si=Ci.blocksInSidekick,_i=(0,s.useCallback)((function(e,n){return Oi({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"):(vn(),n!==(null===bn||void 0===bn?void 0:bn.type)&&fn(),(0,Nr.k1)(wi,g,r),(0,Nr.k1)(Si,g,r))}else null!==e&&void 0!==e&&null!==(i=e.data)&&void 0!==i&&i.error&&R((function(e){return Ur(Ur({},e),{},{links:[{label:"Check pipeline configuration",onClick:function(){Pi("pipelines/".concat(g,"/").concat(He.dT.METADATA_YAML)),R(null)}}]})}))}))}),[wi,Si,vn,fn,Pi,null===bn||void 0===bn?void 0:bn.type,g,Oi]),Ei=(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),ue.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;xt((function(e){return(0,he.oM)(e,e.findIndex((function(e){var n=e.type,r=e.uuid;return t===n&&i===r})))})),fn(),Bt(null),t===v.tf.SCRATCHPAD&&vn()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;R({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&$e((function(e){return Ur(Ur({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:xe.Gi.TEXT_PLAIN}}))))}))}})}}),Ii=(0,l.Z)(Ei,1)[0],Ti=(0,d.Db)((function(e){var n=e.uuid;return ue.ZP.widgets.pipelines.useDelete(g,n)()}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(e){var n=e.widget.uuid;kt((function(e){return(0,he.oM)(e,e.findIndex((function(e){var t=e.uuid;return n===t})))})),fn(),vn()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;R({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&$e((function(e){return Ur(Ur({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:xe.Gi.TEXT_PLAIN}}))))}))}})}}),Di=(0,l.Z)(Ti,1)[0],Ai=(0,be.dd)((function(e){return(0,w.jsx)(le.Z,{centerOnScreen:!0,neutral:!0,onCancel:Ri,onClick:function(){return Li(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*P.iI})})),Mi=(0,l.Z)(Ai,2),Bi=Mi[0],Ri=Mi[1],Ni=(0,d.Db)((function(e){var n=e.language,t=e.type,i=e.uuid,r="".concat(t,"/").concat(i);return n&&He.JD[n]&&(r="".concat(r,".").concat(He.JD[n].toLowerCase())),ue.ZP.blocks.useDelete(encodeURIComponent(r))()}),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){mi(),fn(),vn()},onErrorCallback:function(e,n){Bi(),R({displayMessage:e.exception,errors:n,response:e})}})}}),Li=(0,l.Z)(Ni,1)[0],Hi=(0,d.Db)(ue.ZP.kernels.useUpdate(null===un||void 0===un?void 0:un.id),{onSuccess:function(e){return(0,me.wD)(e,{callback:function(){return ln()},onErrorCallback:function(e,n){return R({errors:n,response:e})}})}}),Ui=(0,l.Z)(Hi,1)[0],zi=(0,s.useCallback)((function(){return Ui({kernel:{action_type:"restart"}})}),[Ui]),Vi=(0,s.useCallback)((function(){Ui({kernel:{action_type:"interrupt"}}),Dt([])}),[Ui]),Wi=(0,d.Db)(ue.ZP.blocks.pipelines.useCreate(g)),Ki=(0,l.Z)(Wi,1)[0],Gi=(0,s.useCallback)((function(e,n,t){var i,o,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,q.Y6)();e.converted_from_type&&e.converted_from_uuid&&(i=null===(o=Vn.current[e.converted_from_type])||void 0===o?void 0:o[e.converted_from_uuid]);var u=e.language,a=e.type;if(gn){var s=(0,he.HK)((null===bn||void 0===bn?void 0:bn.blocks)||[],(function(e){return e.type})),d=s[v.tf.DATA_EXPORTER],f=s[v.tf.DATA_LOADER],p=s[v.tf.TRANSFORMER];if(v.tf.DATA_LOADER===a){if(v.t6.YAML!==u)return void R({displayMessage:"The source you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(f)return void R({displayMessage:"Pipeline ".concat(null===bn||void 0===bn?void 0:bn.uuid," already has a source: ").concat(null===f||void 0===f?void 0:f.uuid,".")})}else if(v.tf.TRANSFORMER===a){if(p)return void R({displayMessage:"Pipeline ".concat(null===bn||void 0===bn?void 0:bn.uuid," already has a transformer: ").concat(null===p||void 0===p?void 0:p.uuid,".")})}else if(v.tf.DATA_EXPORTER===a){if(v.t6.YAML!==u)return void R({displayMessage:"The destination you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(d)return void R({displayMessage:"Pipeline ".concat(null===bn||void 0===bn?void 0:bn.uuid," already has a destination: ").concat(null===d||void 0===d?void 0:d.uuid,".")})}}return Ki({block:Ur({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),vn(),fn().then((function(e){var n=e.pipeline,t=n.blocks,i=n.extensions;return xt((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 Ur(Ur({},e),{},{extension_uuid:i})}))))}));var o=(0,he.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 R({errors:n,response:e})}})}))}),[Ki,vn,fn,gn,xt,R,bn]),Yi=(0,s.useState)(!1),qi=Yi[0],Qi=Yi[1];(0,s.useEffect)((function(){Qi(!!(0,L.U2)(F.kY))}),[]);var Ji=(0,be.dd)((function(e){var n=e.block,t=e.idx,i=e.name,r=void 0===i?(0,q.Y6)():i,o=e.onCreateCallback;return(0,w.jsx)(U,{block:n,defaultName:r,onClose:er,onSave:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Gi(n,t,o,null===e||void 0===e?void 0:e.name).then((function(){return er()}))},pipeline:bn})}),{},[Gi,bn],{background:!0,uuid:"configure_block_name_and_create"}),Xi=(0,l.Z)(Ji,2),$i=Xi[0],er=Xi[1],nr=(0,d.Db)(ue.ZP.widgets.pipelines.useCreate(g)),tr=(0,l.Z)(nr,1)[0],ir=(0,s.useCallback)((function(e,n,t){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,q.Y6)();return tr({widget:Ur({name:i,priority:n,type:v.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),vn(),fn(),Nn(Wn.cH.CHARTS),Y(n)},onErrorCallback:function(e,n){return R({errors:n,response:e})}})}))}),[vn,fn,tr,Nn]);(0,s.useEffect)((function(){if(G){var e,n=null===(e=Hn.current[G.uuid])||void 0===e?void 0:e.current;n&&(n.scrollIntoView(),Y(null))}}),[G,Y]),(0,s.useEffect)((function(){an!==g&&(xt([]),kt([]),Ht([]),tn([]))}),[g,an]),(0,s.useEffect)((function(){if("undefined"!==typeof(null===bn||void 0===bn?void 0:bn.blocks)||"undefined"!==typeof(null===bn||void 0===bn?void 0:bn.extensions)){var e=[];"undefined"!==typeof(null===bn||void 0===bn?void 0:bn.blocks)&&e.push.apply(e,(0,r.Z)(null===bn||void 0===bn?void 0:bn.blocks)),"undefined"!==typeof(null===bn||void 0===bn?void 0:bn.callbacks)&&e.push.apply(e,(0,r.Z)(null===bn||void 0===bn?void 0:bn.callbacks)),"undefined"!==typeof(null===bn||void 0===bn?void 0:bn.conditionals)&&e.push.apply(e,(0,r.Z)(null===bn||void 0===bn?void 0:bn.conditionals)),"undefined"!==typeof(null===bn||void 0===bn?void 0:bn.extensions)&&Object.entries((null===bn||void 0===bn?void 0:bn.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 Ur(Ur({},e),{},{extension_uuid:i})}))))})),xt(e)}}),[null===bn||void 0===bn?void 0:bn.blocks,null===bn||void 0===bn?void 0:bn.callbacks,null===bn||void 0===bn?void 0:bn.conditionals,null===bn||void 0===bn?void 0:bn.extensions]),(0,s.useEffect)((function(){"undefined"!==typeof(null===bn||void 0===bn?void 0:bn.widgets)&&kt(bn.widgets)}),[null===bn||void 0===bn?void 0:bn.widgets]),(0,s.useEffect)((function(){(null===Nt||void 0===Nt?void 0:Nt.length)>0&&0===(null===Lt||void 0===Lt?void 0:Lt.length)&&(Ht(Nt),Qt(Nt[0]))}),[Lt,Nt]);var rr=(0,se.Z)(gt);(0,s.useEffect)((function(){if("undefined"!==typeof(null===bn||void 0===bn?void 0:bn.blocks)&&(!gt.length||!(0,he.fS)(null===rr||void 0===rr?void 0:rr.map((function(e){return e.uuid})).sort(),null===gt||void 0===gt?void 0:gt.map((function(e){return e.uuid})).sort()))){var e=(0,Nr.Rt)(bn.blocks),n=e.content,t=e.messages;Vn.current=n,$e((function(e){return Ur(Ur({},t),e)}))}}),[gt,rr,null===bn||void 0===bn?void 0:bn.blocks,$e]),(0,s.useEffect)((function(){if(!yt.length&&"undefined"!==typeof(null===bn||void 0===bn?void 0:bn.widgets)){var e=(0,Nr.Rt)(bn.widgets),n=e.content,t=e.messages;Kn.current=n,$e((function(e){return Ur(Ur({},t),e)}))}}),[null===bn||void 0===bn?void 0:bn.widgets,$e,yt]);var or=(0,s.useCallback)((function(e,n,t){var i=gt.find((function(t){var i=t.type,r=t.uuid;return i===n&&r===e}));if(i){if(Bt(i),null!==Ln&&void 0!==Ln&&Ln.current){var r,o=Ln.current["".concat(i.type,"s/").concat(i.uuid,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}(0,ve.u7)({block_uuid:null,file_path:null,"file_paths[]":[]})}else if(n===v.tf.CHART){var l=yt.find((function(n){return n.uuid===e}));if(l&&(Bt(l),null!==Hn&&void 0!==Hn&&Hn.current)){var c,u=Hn.current[l.uuid];null===u||void 0===u||null===(c=u.current)||void 0===c||c.scrollIntoView()}}else t&&Pi(t)}),[gt,Pi,yt]);(0,s.useEffect)((function(){if(Mn&&!Mt){var e=gt.find((function(e){var n,t=e.uuid;return(null===Mn||void 0===Mn||null===(n=Mn.split(":"))||void 0===n?void 0:n[0])===t}));e&&(Ke((function(n){return Ur(Ur({},n),{},(0,o.Z)({},e.uuid,!1))})),or(e.uuid,e.type,null))}else(null===rr||void 0===rr?void 0:rr.length)!==(null===gt||void 0===gt?void 0:gt.length)&&Mt&&(Ke((function(e){return Ur(Ur({},e),{},(0,o.Z)({},Mt.uuid,!1))})),or(Mt.uuid,Mt.type,null))}),[Mn,gt,null===rr||void 0===rr?void 0:rr.length,or,Mt,Ke]);var lr=(0,s.useMemo)((function(){return new h.Z}),[]),cr=(0,s.useMemo)((function(){return{api_key:Ar.l,token:lr.decodedToken.token}}),[lr]),ur=(0,a.ZP)((0,Lr.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=gt.find((function(e){var n=e.type,i=e.uuid;return t===n&&u===i}));"stream_pipeline"!==l?$e((function(e){var t=e[u]||[];return Ur(Ur({},e),{},(0,o.Z)({},u,t.concat(n)))})):(tn((function(e){return[].concat((0,r.Z)(e),[n])})),xe.uF.IDLE===i&&(Dt([]),fn(),u||wt(!1))),xe.uF.BUSY===i?Dt((function(e){return e.find((function(e){var n=e.uuid;return u===n}))||!a?e:e.concat(a)})):xe.uF.IDLE===i&&Dt((function(e){return e.filter((function(e){var n=e.uuid;return u!==n}))})),qe||Sn(!0)}},onOpen:function(){return console.log("socketUrlPublish opened")},reconnectAttempts:10,reconnectInterval:3e3,shouldReconnect:function(){return console.log("Attempting to reconnect..."),!0}}).sendMessage,ar=(0,s.useCallback)((function(){Oi().then((function(){wt(!0),tn([]),ur(JSON.stringify(Ur(Ur({},cr),{},{execute_pipeline:!0,pipeline_uuid:g})))}))}),[g,Oi,ur,cr]),sr=(0,s.useCallback)((function(){ur(JSON.stringify(Ur(Ur({},cr),{},{cancel_pipeline:!0,pipeline_uuid:g})))}),[g,ur,cr]),dr=(0,s.useCallback)((function(){ur(JSON.stringify(Ur(Ur({},cr),{},{cancel_pipeline:!0,pipeline_uuid:g,skip_publish_message:!0})))}),[g,ur,cr]),fr=(0,s.useCallback)((function(){ur(JSON.stringify(Ur(Ur({},cr),{},{check_if_pipeline_running:!0,pipeline_uuid:g})))}),[g,ur,cr]);(0,s.useEffect)((function(){var e;return window.addEventListener("pagehide",dr),null===u||void 0===u||null===(e=u.events)||void 0===e||e.on("routeChangeStart",dr),function(){var e;null===u||void 0===u||null===(e=u.events)||void 0===e||e.off("routeChangeStart",dr),window.removeEventListener("pagehide",dr)}}),[dr,null===u||void 0===u?void 0:u.events]);var pr=(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.runIncompleteUpstream,c=void 0!==l&&l,u=e.runSettings,a=void 0===u?{}:u,s=e.runTests,d=void 0!==s&&s,f=e.runUpstream,p=n.extension_uuid,h=n.upstream_blocks,v=n.uuid;if(!Tt.find((function(e){var n=e.uuid;return v===n}))||i){var m="".concat(F.vF,"_").concat(null===bn||void 0===bn?void 0:bn.uuid);ur(JSON.stringify(Ur(Ur({},cr),{},{code:t,extension_uuid:p,output_messages_to_logs:!!(0,L.U2)(m),pipeline_uuid:null===bn||void 0===bn?void 0:bn.uuid,run_downstream:o,run_incomplete_upstream:c,run_settings:a,run_tests:d,run_upstream:f,type:n.type,upstream_blocks:h,uuid:v}))),$e((function(e){return delete e[v],e})),ke(!1),Dt((function(e){return e.find((function(e){var n=e.uuid;return v===n}))?e:e.concat(n)}))}fn()}),[fn,bn,Tt,ur,$e,Dt,ke,cr]),hr=(0,s.useCallback)((function(e){var n=e.block;return qe?pr(e):Oi({block:{outputs:[],uuid:n.uuid}},{contentOnly:!0}).then((function(){return pr(e)}))}),[qe,pr,Oi]),vr=(0,a.ZP)((0,Lr.Ib)("terminal"),{queryParams:cr,shouldReconnect:function(){return!0}}),mr=vr.lastMessage,br=vr.sendMessage,gr=(0,be.dd)((function(e){var n=e.addNew,t=e.addNewBlock,i=e.blockType;return(0,w.jsx)(dt.BC,{children:(0,w.jsx)(I.Z,{contained:!0,defaultLinkUUID:i,onClickCustomTemplate:function(e){t({config:{custom_template_uuid:null===e||void 0===e?void 0:e.template_uuid}}),yr()},showAddingNewTemplates:!!n,showBreadcrumbs:!0,tabs:[Dr.n9]})})}),{},[],{background:!0,uuid:"browse_templates"}),xr=(0,l.Z)(gr,2),jr=xr[0],yr=xr[1],kr=(0,s.useMemo)((function(){return(0,w.jsx)(Or,{activeView:An,addNewBlockAtIndex:function(e,n,t,i){return new Promise((function(){return $i({block:e,idx:n,name:i,onCreateCallback:t})}))},afterWidth:C,autocompleteItems:bi,blockRefs:Ln,blocks:gt,blocksInNotebook:wi,cancelPipeline:sr,chartRefs:Hn,checkIfPipelineRunning:fr,deleteBlock:Ii,deleteWidget:Di,editingBlock:_t,executePipeline:ar,fetchFileTree:vn,fetchPipeline:fn,fetchSecrets:vt,fetchVariables:st,globalVariables:ft,insights:ai,interruptKernel:Vi,isPipelineExecuting:Ct,isPipelineUpdating:Zi,lastTerminalMessage:mr,messages:Xe,metadata:di,onChangeCallbackBlock:qn,onChangeChartBlock:Xn,onChangeCodeBlock:Qn,onSelectBlockFile:or,pipeline:bn,pipelineMessages:nn,runBlock:hr,runningBlocks:Tt,sampleData:ii,savePipelineContent:Oi,secrets:mt,selectedBlock:Mt,selectedFilePath:J,sendTerminalMessage:br,setActiveSidekickView:Nn,setAllowCodeBlockShortcuts:Ie,setAnyInputFocused:Pe,setDepGraphZoom:Ae,setDisableShortcuts:Se,setEditingBlock:Et,setErrors:R,setHiddenBlocks:Ke,setSelectedBlock:Bt,setTextareaFocused:ke,showBrowseTemplates:jr,statistics:pi,textareaFocused:ye,treeRef:Un,updatePipelineMetadata:_i,updateWidget:Ot,widgets:yt})}),[An,C,bi,Ln,gt,wi,sr,fr,Ii,Di,_t,ar,vn,fn,vt,st,ft,ai,Vi,Ct,Zi,mr,Xe,di,qn,Xn,Qn,or,bn,nn,hr,Tt,ii,Oi,mt,Mt,J,br,Nn,Pe,Et,R,Ke,ke,$i,jr,pi,ye,_i,Ot,yt]),Zr=(0,s.useMemo)((function(){return(0,w.jsx)($n,{addNewBlockAtIndex:qi?Gi:function(e,n,t,i){return new Promise((function(r,o){v.tf.DBT===(null===e||void 0===e?void 0:e.type)&&v.t6.SQL===(null===e||void 0===e?void 0:e.language)?Gi(e,n,t,i):$i({block:e,idx:n,name:i,onCreateCallback:t})}))},addWidget:function(e,n){var t=n.onCreateCallback;return ir(e,yt.length,t)},allBlocks:gt,allowCodeBlockShortcuts:Ee,anyInputFocused:Oe,autocompleteItems:bi,blockRefs:Ln,blocks:wi,dataProviders:lt,deleteBlock:Ii,disableShortcuts:we,fetchFileTree:vn,fetchPipeline:fn,fetchSampleData:ni,files:mn,globalVariables:ft,hiddenBlocks:Ve,interruptKernel:Vi,mainContainerRef:Ge,mainContainerWidth:nt,messages:Xe,onChangeCallbackBlock:qn,onChangeCodeBlock:Qn,openSidekickView:Fn,pipeline:bn,pipelineContentTouched:wn,restartKernel:zi,runBlock:hr,runningBlocks:Tt,savePipelineContent:Oi,selectedBlock:Mt,setAnyInputFocused:Pe,setDisableShortcuts:Se,setEditingBlock:Et,setErrors:R,setHiddenBlocks:Ke,setIntegrationStreams:Vt,setOutputBlocks:Ht,setPipelineContentTouched:Sn,setSelectedBlock:Bt,setSelectedOutputBlock:Qt,setSelectedStream:Gt,setTextareaFocused:ke,showBrowseTemplates:jr,textareaFocused:ye,widgets:yt})}),[Gi,ir,Ee,Oe,bi,qi,Ln,gt,wi,lt,Ii,we,vn,fn,ni,mn,ft,Ve,Vi,Ge,nt,Xe,qn,Qn,Fn,bn,wn,zi,hr,Tt,Oi,Mt,Pe,Et,R,Ke,Sn,Bt,ke,$i,jr,ye,yt]),Pr=(0,s.useMemo)((function(){if(i===rt.b7)return(0,w.jsx)(ne,{cancelPipeline:sr,createPipeline:xi,executePipeline:ar,interruptKernel:Vi,isPipelineExecuting:Ct,pipeline:bn,restartKernel:zi,savePipelineContent:Oi,setActiveSidekickView:Nn,setMessages:$e,children:J&&(0,w.jsx)(Z.Z,{ml:1,children:(0,w.jsx)(y.Z,{alignItems:"center",fullHeight:!0,children:(0,w.jsx)(T.Z,{compact:!0,onClick:function(){return X(null)},small:!0,children:"View pipeline"})})})})}),[sr,xi,ar,Vi,Ct,i,bn,zi,Oi,J,Nn,$e,X]),Cr=(0,s.useMemo)((function(){if(i===rt.b7)return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ge,{filePaths:ee,filesTouched:ce,isBusy:Tt.length>=1,isPipelineUpdating:Zi,kernel:un,pipeline:bn,pipelineContentTouched:wn,pipelineLastSaved:jn,restartKernel:zi,savePipelineContent:Oi,selectedFilePath:J,setErrors:R,setRunningBlocks:Dt,updatePipelineMetadata:_i,children:Pr}),(null===ee||void 0===ee?void 0:ee.length)>0&&(0,w.jsx)(fe.rK,{relativePosition:!0,secondary:!0,children:(0,w.jsx)(te.Z,{filePaths:ee,filesTouched:ce,savePipelineContent:Oi,selectedFilePath:J})})]})}),[Pr,ce,Zi,un,i,bn,wn,jn,zi,Tt,Oi,J,ee,R,_i]),wr=(0,s.useMemo)((function(){var e;return null===zt||void 0===zt||null===(e=zt.filter((function(e){return(0,he.sE)(null===ti||void 0===ti?void 0:ti.outputs,(function(n){return n.variable_uuid==="output_sample_data_".concat((0,q.kE)(e))}))})))||void 0===e?void 0:e.map((function(e){return(0,w.jsx)(Z.Z,{pl:1,children:(0,w.jsx)(A.ZP,{blackBorder:!0,compact:!0,muted:!0,onClick:function(){return Gt(e)},selected:Kt===e,uuid:e,children:e})},e)}))}),[ti,zt,Kt]),Sr=(0,s.useRef)(null),_r=(0,s.useMemo)((function(){return(0,w.jsx)(z.Z,{addNewBlock:function(e,n){Gi(e,gt.length,n,e.name),(null===Rn||void 0===Rn?void 0:Rn.length)>=1&&u.push("/pipelines/".concat(g,"/edit"))},blocks:gt,deleteWidget:Di,fetchAutocompleteItems:mi,fetchFileTree:vn,fetchPipeline:fn,files:mn,onSelectBlockFile:or,openFile:Pi,openPipeline:function(e){Xt(),u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(e,"/edit"))},openSidekickView:Fn,pipeline:bn,ref:Sr,setErrors:R,setSelectedBlock:Bt,widgets:yt})}),[Gi,gt,Di,mi,vn,fn,null===Rn||void 0===Rn?void 0:Rn.length,mn,or,Pi,Fn,bn,g,Xt,u,R,Bt,yt]),Hr=(0,s.useMemo)((function(){return(0,w.jsx)(E,{blockRefs:Ln,hiddenBlocks:Ve,pipeline:bn,setHiddenBlocks:Ke})}),[Ln,Ve,bn,Ke]),zr=(0,s.useMemo)((function(){return rt.Jf.uuid===(null===Ne||void 0===Ne?void 0:Ne.uuid)?_r:rt.IY.uuid===(null===Ne||void 0===Ne?void 0:Ne.uuid)?Hr:null}),[_r,Hr,Ne]),Vr=(0,s.useMemo)((function(){return(0,w.jsx)(Z.Z,{px:1,children:(0,w.jsx)(D.Z,{noPadding:!0,onClickTab:function(e){Le(e)},selectedTabUUID:null===Ne||void 0===Ne?void 0:Ne.uuid,small:!0,tabs:rt.NR})})}),[Le,Ne]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ie.Z,{title:null===bn||void 0===bn?void 0:bn.name}),(0,w.jsxs)(ut,{after:kr,afterHeader:(0,w.jsx)(Er,{activeView:An,depGraphZoom:De,pipeline:bn,secrets:mt,selectedBlock:Mt,treeRef:Un,variables:ft}),afterHeightOffset:Tr.Mz,afterHidden:j,afterNavigationItems:Rr({activeView:An,pipeline:bn,secrets:mt,setActiveSidekickView:Nn,variables:ft}),afterOverflow:Wn.cH.DATA===An?"hidden":null,afterSubheader:(null===Lt||void 0===Lt?void 0:Lt.length)>0&&An===Wn.cH.DATA&&(0,w.jsxs)(y.Z,{alignItems:"center",fullHeight:!0,fullWidth:!0,children:[!gn&&Lt.map((function(e){var n=e.uuid,t=(null===qt||void 0===qt?void 0:qt.uuid)===n;return(0,w.jsx)(Z.Z,{pl:1,children:(0,w.jsx)(A.ZP,{afterElement:t?(0,w.jsx)(T.Z,{basic:!0,highlightOnHover:!0,onClick:function(){(0,Nr.h8)(g,e.uuid),Ht((function(e){return e.filter((function(e){return e.uuid!==n}))}))},padding:"2px",transparent:!0,children:(0,w.jsx)(de.x8,{muted:!0,size:1.25*P.iI})}):null,blackBorder:!0,compact:!0,muted:!0,onClick:function(){return Qt(e)},selected:t,uuid:n,children:n})},n)})),gn&&wr]}),before:zr,beforeHeader:Vr,beforeHeightOffset:Tr.Mz,beforeNavigationItems:(0,Br.H)(Mr.M.EDIT,bn),errors:H||M,headerOffset:(null===ee||void 0===ee?void 0:ee.length)>0?36:0,mainContainerHeader:Cr,mainContainerRef:Ge,page:i,pipeline:bn,setAfterHidden:k,setAfterWidthForChildren:S,setErrors:H?W:R,setMainContainerWidth:tt,children:[(0,w.jsx)("div",{style:{height:J?0:null,opacity:J?0:null,visibility:J?"hidden":null},children:(0,w.jsx)(p.Z,{uuid:"PipelineDetail/".concat(g),children:Zr})}),null===Rn||void 0===Rn?void 0:Rn.map((function(e){return(0,w.jsx)("div",{style:{display:J===e?null:"none"},children:(0,w.jsx)(p.Z,{uuid:"FileEditor/".concat(decodeURIComponent(e)),children:(0,w.jsx)(V.Z,{active:J===e,addNewBlock:function(e,n){Gi(e,gt.length,n,e.name),u.push("/pipelines/".concat(g,"/edit"))},fetchPipeline:fn,fetchVariables:st,filePath:e,openSidekickView:Fn,pipeline:bn,selectedFilePath:J,sendTerminalMessage:br,setDisableShortcuts:Se,setErrors:R,setFilesTouched:ae,setSelectedBlock:Bt})})},e)})),(0,w.jsx)(Z.Z,{pb:Bn?0:Math.max(Math.floor(m*(2/3)/P.iI),0)})]})]})}zr.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=rt.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 Vr=(0,at.Z)(zr)},11366:function(e,n,t){"use strict";t.d(n,{H8:function(){return r},g6:function(){return o},kY:function(){return i},vF:function(){return l}});var i="automatically_name_blocks",r="pipeline_edit_before_tab_selected",o="pipeline_edit_hidden_blocks",l="pipeline_edit_block_output_logs"},37958:function(e,n,t){"use strict";t.d(n,{j:function(){return i}});var i=(0,t(44152).r)({apiReloads:{}}).useGlobalState},42305:function(e,n,t){"use strict";t.d(n,{A5:function(){return x},AY:function(){return j},BP:function(){return g},JX:function(){return b},OC:function(){return d},Pc:function(){return y},Ro:function(){return k},Tz:function(){return m},Y_:function(){return O},d$:function(){return v},jV:function(){return Z},lJ:function(){return P},n1:function(){return p},s8:function(){return a},vk:function(){return o},yD:function(){return s}});var i,r,o,l=t(82394),c=t(92083),u=t.n(c);!function(e){e.TODAY="today",e.WEEK="week",e.MONTH="month"}(o||(o={}));var a=(i={},(0,l.Z)(i,o.TODAY,"today"),(0,l.Z)(i,o.WEEK,"last 7 days"),(0,l.Z)(i,o.MONTH,"last 30 days"),i),s=(r={},(0,l.Z)(r,o.TODAY,0),(0,l.Z)(r,o.WEEK,6),(0,l.Z)(r,o.MONTH,29),r),d="YYYY-MM-DD HH:mm:ss",f="YYYY-MM-DD HH:mm",p="YYYY-MM-DD",h="MMMM D, YYYY";function v(e,n){var t=n.dayAgo,i=n.includeSeconds,r=n.utcFormat,o=u()(e),l=f;return r&&(o=o.utc()),t&&(o=o.subtract(1,"days")),i&&(l=d),o.format(l)}function m(e){var n=v((new Date).toISOString(),{includeSeconds:!0,utcFormat:!0});return null!==e&&void 0!==e&&e.dateObj?new Date(n):n}function b(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u().unix(e).format(null!==n&&void 0!==n&&n.withSeconds?d:f)}function g(e,n,t){return u()(e).utc().hours(+n).minutes(+t).format()}function x(e){return u()(e).unix()}function j(e,n,t,i){var r="".concat(e.toISOString().split("T")[0]," ").concat(n,":").concat(t);return i?"".concat(r,":").concat(i):r}function y(e){var n=u().unix(+e).utc();return{date:n.toDate(),hour:String(n.hour()),minute:String(n.minute())}}function k(e,n){var t=u().utc(),i=u().utc();null!==n&&void 0!==n&&n.localTime&&(t=u()().local(),i=u()().local());var r=(t=t.subtract(e,"days")).format(h),o=i.format(h);return null!==n&&void 0!==n&&n.endDateOnly?o:"".concat(r," - ").concat(o)}function Z(e,n){var t=null!==n&&void 0!==n&&n.localTime?u()().local():u().utc();if(e===o.WEEK){var i=s[o.WEEK];t=t.subtract(i,"days")}else if(e===o.MONTH){var r=s[o.MONTH];t=t.subtract(r,"days")}return null!==n&&void 0!==n&&n.isoString?t.startOf("day").toISOString():t.startOf("day").format(d)}function O(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:90,n=new Date,t=[],i=0;i<e;i++)t.unshift(n.toISOString().split("T")[0]),n.setDate(n.getDate()-1);return t}function P(e){return e.padStart(2,"0")}},76419:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/pipelines/[pipeline]/edit",function(){return t(14623)}])}},function(e){e.O(0,[3662,844,9902,426,1774,8792,8789,4259,5896,7849,3215,2714,7011,5872,2991,1424,1005,7815,3654,8952,7722,4822,1484,2485,6299,437,9774,2888,179],(function(){return n=76419,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
|