mage-ai 0.8.12__py3-none-any.whl → 0.8.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mage-ai might be problematic. Click here for more details.
- mage_ai/api/policies/BackfillPolicy.py +4 -1
- mage_ai/io/export_utils.py +1 -0
- mage_ai/io/postgres.py +46 -4
- 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/UuQKenirO2LDcepWvj6S9/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{1830-c3f709c7ca7f32ab.js → 1830-fbc03130dc8507d5.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2626-74904ade5b462127.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/3573-9b7b57411a327efa.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/434-b1cbc39e987f22cd.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/4846-688b5f0a015a543a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/5477-4d9bab807c386355.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/7281-99f836e410857a68.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/7400-26ce25ec46728ef7.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/9767-30e239ed26aa848a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{_app-77b4b367fdb247d6.js → _app-169f9cc923ae39a5.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{manage-14c743a0e2549486.js → manage-91c4fd203b4ac0e2.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{pipeline-runs-21fe37061bdaaaea.js → pipeline-runs-10d54d54bfd9b39c.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-971ea5bb26d66155.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills-393cec015b843dd8.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-2963c971fdefd159.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/logs-d1490dc3ea4f2e61.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/{block-runs-8f23f7ca9efcb069.js → block-runs-f513df1d43ba48f0.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-393fa626a8873f74.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{monitors-8b08ec1aef4af4f2.js → monitors-d45f982e19978552.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs/[run]-463347405cafa133.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs-a33f6fd5d91cd123.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/syncs-d4df695d51e01232.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-d83cf90749c8cd56.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers-f6ee40bebf427cfa.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{pipelines-1c0627627c21667f.js → pipelines-db2903bdeeeae791.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/account/profile-19a5aa2de681b54a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-e1b34b9a44fc4688.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/sync_data-4ae244876881cfe1.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{users-439adeb06fca8436.js → users-b8aeca222449e041.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{terminal-6feb9848233a6c6e.js → terminal-482bd79cb26b8f73.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/triggers-81b7327ed8e015a4.js +1 -0
- mage_ai/server/frontend_dist/index.html +2 -2
- mage_ai/server/frontend_dist/manage.html +4 -4
- mage_ai/server/frontend_dist/pipeline-runs.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills/[...slug].html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/edit.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/logs.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runs.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runtime.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs/[run].html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/syncs.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers/[...slug].html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline].html +2 -2
- mage_ai/server/frontend_dist/pipelines.html +5 -5
- mage_ai/server/frontend_dist/settings/account/profile.html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/preferences.html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/sync_data.html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/users.html +5 -5
- mage_ai/server/frontend_dist/settings.html +2 -2
- mage_ai/server/frontend_dist/sign-in.html +4 -4
- mage_ai/server/frontend_dist/terminal.html +5 -5
- mage_ai/server/frontend_dist/test.html +3 -3
- mage_ai/server/frontend_dist/triggers.html +5 -5
- mage_ai/server/websocket_server.py +1 -1
- {mage_ai-0.8.12.dist-info → mage_ai-0.8.13.dist-info}/METADATA +1 -1
- {mage_ai-0.8.12.dist-info → mage_ai-0.8.13.dist-info}/RECORD +73 -75
- mage_ai/server/frontend_dist/_next/static/BJSgpMeWTfdkZw_YRDpOz/_buildManifest.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2249-70929b8c547bbc18.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2426-115f8871a2e28f8c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/434-69ddfacd3e93f2db.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/4846-b4ced91dc0e9fba9.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/5477-d76f7f4b9d329116.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/5944-757b7898608a65e1.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6579-2b5d8d39472d85c0.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/7400-1430ec3874c1fdee.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/8961-697fe5d4db44d909.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9767-e89f3e19764e4f24.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-678569cf24a2e10d.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills-0ed0d70bc659c236.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-51fe31916670195c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/logs-5ccc75887776efb0.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-f83ab9de4094e1b0.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs/[run]-73ced07cc98a4968.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs-67d23509a0c9a1b8.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/syncs-4084a44baf91f30e.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-ae970171cfe98c51.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers-b0b91245d3299bdf.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/account/profile-88bc8c5e21f7e493.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-4c05a269e02f2208.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/sync_data-f1f47e503c490758.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/triggers-e0172c422c95eda9.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{BJSgpMeWTfdkZw_YRDpOz → UuQKenirO2LDcepWvj6S9}/_middlewareManifest.js +0 -0
- /mage_ai/server/frontend_dist/_next/static/{BJSgpMeWTfdkZw_YRDpOz → UuQKenirO2LDcepWvj6S9}/_ssgManifest.js +0 -0
- {mage_ai-0.8.12.dist-info → mage_ai-0.8.13.dist-info}/LICENSE +0 -0
- {mage_ai-0.8.12.dist-info → mage_ai-0.8.13.dist-info}/WHEEL +0 -0
- {mage_ai-0.8.12.dist-info → mage_ai-0.8.13.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.8.12.dist-info → mage_ai-0.8.13.dist-info}/top_level.txt +0 -0
mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-51fe31916670195c.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2551],{7432:function(e,n,t){var i={"./Active4D.json":[266,266],"./All Hallows Eve.json":[4450,4450],"./Amy.json":[88849,8849],"./Birds of Paradise.json":[78097,8097],"./Blackboard.json":[88018,6115],"./Brilliance Black.json":[73835,3835],"./Brilliance Dull.json":[6507,6507],"./Chrome DevTools.json":[22508,2508],"./Clouds Midnight.json":[49566,9566],"./Clouds.json":[57951,7951],"./Cobalt.json":[80826,826],"./Cobalt2.json":[98256,8256],"./Dawn.json":[76958,6958],"./Dominion Day.json":[89307,9307],"./Dracula.json":[33453,3453],"./Dreamweaver.json":[19363,9363],"./Eiffel.json":[82481,2481],"./Espresso Libre.json":[44776,4776],"./GitHub Dark.json":[792,792],"./GitHub Light.json":[61450,1450],"./GitHub.json":[10739,739],"./IDLE.json":[67947,7947],"./Katzenmilch.json":[81240,1240],"./Kuroir Theme.json":[4388,4388],"./LAZY.json":[25164,5164],"./MagicWB (Amiga).json":[76443,6443],"./Merbivore Soft.json":[99361,9361],"./Merbivore.json":[86042,6042],"./Monokai Bright.json":[14883,4883],"./Monokai.json":[34454,4454],"./Night Owl.json":[60261,261],"./Nord.json":[59785,9785],"./Oceanic Next.json":[58920,8920],"./Pastels on Dark.json":[38901,8901],"./Slush and Poppies.json":[26434,6434],"./Solarized-dark.json":[36116,6116],"./Solarized-light.json":[5008,5008],"./SpaceCadet.json":[20440,440],"./Sunburst.json":[68018,8018],"./Textmate (Mac Classic).json":[15824,5824],"./Tomorrow-Night-Blue.json":[81150,1150],"./Tomorrow-Night-Bright.json":[8762,8762],"./Tomorrow-Night-Eighties.json":[82545,2545],"./Tomorrow-Night.json":[99855,9855],"./Tomorrow.json":[34092,4092],"./Twilight.json":[93898,3898],"./Upstream Sunburst.json":[98807,8807],"./Vibrant Ink.json":[89927,9927],"./Xcode_default.json":[64042,4042],"./Zenburnesque.json":[33467,3467],"./iPlastic.json":[88277,8277],"./idleFingers.json":[5104,5104],"./krTheme.json":[9633,9633],"./monoindustrial.json":[15729,5729],"./themelist.json":[79437,9437]};function r(e){if(!t.o(i,e))return Promise.resolve().then((function(){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=i[e],r=n[0];return t.e(n[1]).then((function(){return t.t(r,19)}))}r.keys=function(){return Object.keys(i)},r.id=7432,e.exports=r},5677:function(e,n,t){"use strict";t.d(n,{M4:function(){return d},S0:function(){return a},S_:function(){return u},Yn:function(){return f},rW:function(){return s}});var i=t(82394),r=t(21831),o=t(75582);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,i.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,n){return Object.entries(n).map((function(n){var t=(0,o.Z)(n,2),i=t[0],r=t[1];return e.languages.registerCompletionItemProvider(i,{provideCompletionItems:r(e)})}))}function a(e){var n=function(e){var n="[\\w.]+",t=["import ".concat(n," as ").concat(n),"import ".concat(n),"from ".concat(n," import ").concat(n," as ").concat(n),"from ".concat(n," import ").concat(n)],i=new RegExp("(".concat(t.join("|"),")"),"g");return(0,r.Z)(e.matchAll(i)).map((function(e){return e[1]}))}(e),t="[\\w.]+",o=["from ".concat(t," import ").concat(t," as (").concat(t,")"),"from ".concat(t," import (").concat(t,")"),"import ".concat(t," as (").concat(t,")"),"import (".concat(t,")")],l=new RegExp("(".concat(o.join("|"),")"));return n.reduce((function(e,n){var t=n.match(l);if(!t)return e;var o=(0,r.Z)(t),u=o[2],a=o[3],s=o[4],d=o[5],f=u||a||s||d;return c(c({},e),{},(0,i.Z)({},f,n))}),{})}function s(e,n){var t=e;n&&(t=t.split(" as ".concat(n))[0]);var i="[\\w.]+",l=["from ".concat(i," import (").concat(i,")"),"import (".concat(i,")")],c=new RegExp("(".concat(l.join("|"),")"),"g"),u=(0,r.Z)(t.matchAll(c))[0];if(u){var a=(0,o.Z)(u,4),s=a[2],d=a[3];return s||d}}function d(e,n){return function(e,n){return e.split("\n")[n.startLineNumber-1]}(e,n).slice(0,n.startColumn-1)}function f(e){var n=new RegExp("([\\w_]+)[ ]*=[ ]*([\\w_]+)","g");return(0,r.Z)(e.matchAll(n)).map((function(e){return{assignmentValue:e[2],variableName:e[1]}}))}},32365:function(e,n,t){"use strict";t.d(n,{Ep:function(){return l},KT:function(){return a},Nk:function(){return u},aU:function(){return c}});var i=t(9518),r=t(23831),o=t(49125),l=2,c=21,u=i.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-w2hta3-0"})(["",""],(function(e){return e.padding&&"\n padding-top: ".concat(2*o.iI,"px;\n background-color: ").concat((e.theme.background||r.Z.background).codeTextarea,";\n ")})),a=i.default.div.withConfig({displayName:"indexstyle__PlaceholderStyle",componentId:"sc-w2hta3-1"})(["padding-left:67px;position:absolute;z-index:1;"])},57722:function(e,n,t){"use strict";t.d(n,{Z:function(){return g}});var i=t(82684),r=t(85202),o=t(38789),l=t(19711),c=t(66166),u="twilight",a=t(2005),s=t(31012),d=t(32365),f=t(5677);var p=t(75582),h={"all-hallows-eve":"All Hallows Eve","birds-of-paradise":"Birds of Paradise","brilliance-black":"Brilliance Black","brilliance-dull":"Brilliance Dull","chrome-devtools":"Chrome DevTools","clouds-midnight":"Clouds Midnight","espresso-libre":"Espresso Libre","kuroir-theme":"Kuroir Theme","magicwb--amiga-":"MagicWB (Amiga)","merbivore-soft":"Merbivore Soft","monokai-bright":"Monokai Bright","night-owl":"Night Owl","oceanic-next":"Oceanic Next","pastels-on-dark":"Pastels on Dark","slush-and-poppies":"Slush and Poppies","solarized-dark":"Solarized-dark","solarized-light":"Solarized-light","textmate--mac-classic-":"Textmate (Mac Classic)","tomorrow-night":"Tomorrow-Night","tomorrow-night-blue":"Tomorrow-Night-Blue","tomorrow-night-bright":"Tomorrow-Night-Bright","tomorrow-night-eighties":"Tomorrow-Night-Eighties","upstream-sunburst":"Upstream Sunburst","vibrant-ink":"Vibrant Ink","xcode-default":"Xcode_default",active4d:"Active4D",amy:"Amy",blackboard:"Blackboard",clouds:"Clouds",cobalt:"Cobalt",dawn:"Dawn",dreamweaver:"Dreamweaver",eiffel:"Eiffel",github:"GitHub",idle:"IDLE",idlefingers:"idleFingers",iplastic:"iPlastic",katzenmilch:"Katzenmilch",krtheme:"krTheme",lazy:"LAZY",merbivore:"Merbivore",monoindustrial:"monoindustrial",monokai:"Monokai",spacecadet:"SpaceCadet",sunburst:"Sunburst",tomorrow:"Tomorrow",twilight:"Twilight",zenburnesque:"Zenburnesque"};var m=t(80636),v=t(28598);var g=function(e){var n=e.autocompleteProviders,g=e.autoHeight,b=e.autoSave,x=e.fontSize,j=void 0===x?s.i3:x,y=e.height,k=e.language,Z=e.onChange,_=e.onDidChangeCursorPosition,C=e.onSave,O=e.padding,w=e.placeholder,S=e.readOnly,E=e.selected,P=e.setSelected,T=e.setTextareaFocused,I=e.shortcuts,A=e.showLineNumbers,R=void 0===A||A,D=e.tabSize,M=void 0===D?4:D,N=e.textareaFocused,B=e.theme,L=e.value,F=e.width,U=void 0===F?"100%":F,H=(0,i.useRef)(null),z=(0,i.useRef)(null),G=(0,i.useRef)(null),W=(0,i.useState)([]),Q=W[0],q=W[1],Y=(0,i.useState)(null),V=Y[0],K=Y[1],X=(0,i.useState)(!1),J=X[0],$=X[1],ee=(0,i.useState)(y),ne=(ee[0],ee[1],(0,i.useState)(B||u)),te=ne[0],ie=ne[1],re=(0,i.useCallback)((function(e){e.languages.typescript.javascriptDefaults.setEagerModelSync(!0),K(e)}),[]),oe=(0,i.useCallback)((function(e,n){H.current=e,z.current=n;var t=[];null===I||void 0===I||I.forEach((function(i){t.push(i(n,e))})),C&&t.push((0,m.e)(n,(function(){C(e.getValue())}))),function(e,n,t){t.forEach((function(e){n.addAction(e)}))}(0,e,t),e.getModel().updateOptions({tabSize:M}),g&&!y&&(e._domElement.style.height="".concat(((L||"").split("\n").length+d.Ep)*d.aU,"px")),e.onDidFocusEditorWidget((function(){null===P||void 0===P||P(!0),null===T||void 0===T||T(!0)})),e.onDidContentSizeChange((function(n){var t=n.contentHeight,i=n.contentHeightChanged;g&&i&&(e._domElement.style.height="".concat(t+2*d.aU,"px"))})),E&&N&&setTimeout((function(){e.focus()}),1),_&&e.onDidChangeCursorPosition((function(n){var t=n.position.lineNumber,i=e._domElement.getBoundingClientRect(),r=i.height,o=i.top;_({editorRect:{height:Number(r),top:Number(o)},position:{lineNumber:Number(t)}})})),$(!0)}),[g,y,_,C,E,$,P,T,I,M,N,L]);(0,i.useEffect)((function(){(function(e){return new Promise((function(n){Promise.all([o._m.init(),t(7432)("./".concat(h[e],".json"))]).then((function(t){var i=(0,p.Z)(t,2),r=i[0],o=i[1];o.colors["editor.background"]="#000000",o.colors["editor.foreground"]="#FFFFFF",r.editor.defineTheme(e,o),n()}))}))})(u).then((function(){ie(u)}))}),[]),(0,i.useEffect)((function(){var e;return b&&C&&(e=setInterval((function(){C(H.current.getValue())}),5e3)),function(){b&&e&&clearInterval(e)}}),[b,H,C]);var le=(0,c.Z)(E),ce=(0,c.Z)(N);return(0,i.useEffect)((function(){null!==H&&void 0!==H&&H.current&&(E&&N?setTimeout((function(){H.current.focus()}),1):r.findDOMNode(H.current._domElement).getElementsByClassName("inputarea")[0].blur())}),[H,E,le,N,ce]),(0,i.useEffect)((function(){return function(){Q.map((function(e){return e.dispose()}))}}),[Q]),(0,i.useEffect)((function(){V&&n&&(0===Q.length&&N||!ce&&N?q((0,f.S_)(V,n)):ce&&!N&&Q.map((function(e){return e.dispose()})))}),[n,Q,V,N,ce]),(0,v.jsxs)(d.Nk,{padding:O,style:{display:J?null:"none"},children:[w&&!(null!==L&&void 0!==L&&L.length)&&(0,v.jsx)(d.KT,{children:(0,v.jsx)(l.ZP,{monospace:!0,muted:!0,children:w})}),(0,v.jsx)(o.ZP,{beforeMount:re,height:y,language:k||"python",onChange:function(e){null===Z||void 0===Z||Z(e)},onMount:oe,options:{domReadOnly:S,fontFamily:a.Vp,fontLigatures:!0,fontSize:j,hideCursorInOverviewRuler:!0,lineNumbers:R,minimap:{enabled:!1},overviewRulerBorder:!1,readOnly:S,renderLineHighlightOnlyWhenFocus:!0,scrollBeyondLastLine:!1,scrollbar:{alwaysConsumeMouseWheel:!1,vertical:"hidden"},wordBasedSuggestions:!1},theme:te,value:L,width:U}),(0,v.jsx)("div",{ref:G})]})}},80636:function(e,n,t){"use strict";function i(e,n){return{contextMenuGroupId:"navigation",contextMenuOrder:1.5,id:"saveCode",keybindingContext:null,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.KeyS],label:"Save",precondition:null,run:function(e){n()}}}function r(e,n){return{contextMenuGroupId:"navigation",contextMenuOrder:1.5,id:"executeCode",keybindingContext:null,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.Enter],label:"Run selected block",precondition:null,run:function(){return n()}}}t.d(n,{Q:function(){return r},e:function(){return i}})},62976:function(e,n,t){"use strict";t.d(n,{Z:function(){return D}});var i=t(82394),r=t(21831),o=t(82684),l=t(10919),c=t(12691),u=t.n(c),a=t(34376),s=t.n(a),d=t(9518),f=t(63068),p=t(44628),h=t(6508),m=t(67971),v=t(19711),g=t(23831),b=t(31969),x=function(){var e=document.createElement("div");e.setAttribute("style","width: 100px; height: 100px; overflow: scroll; position:absolute; top:-9999px;"),document.body.appendChild(e);var n=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),n},j=t(2005),y=t(31012),k=t(37391),Z=t(6753),_=t(49125),C=t(20567),O=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(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}var P=2*_.iI+y.dN,T=20*_.iI,I=d.default.div.withConfig({displayName:"DataTable__Styles",componentId:"sc-1arr863-0"})([""," "," "," .body > div{","}.table{border-spacing:0;display:inline-block;"," "," "," "," .tr{.td.td-index-column{","}}.th{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;","}.th,.td{"," font-family:",";margin:0;","}.td{padding:","px;}&.sticky{overflow:auto;}.header{overflow:hidden;}}"],(function(e){return e.disableScrolling&&"\n overflow: hidden;\n "}),(function(e){return e.height&&"\n height: ".concat(e.height,"px;\n ")}),(function(e){return e.maxHeight&&"\n max-height: ".concat(e.maxHeight,"px;\n ")}),k.w5,(function(e){return!e.noBorderBottom&&"\n border-bottom: 1px solid ".concat((e.theme.borders||b.Z.borders).medium,";\n ")}),(function(e){return!e.noBorderLeft&&"\n border-left: 1px solid ".concat((e.theme.borders||b.Z.borders).medium,";\n ")}),(function(e){return!e.noBorderRight&&"\n border-right: 1px solid ".concat((e.theme.borders||b.Z.borders).medium,";\n ")}),(function(e){return!e.noBorderTop&&"\n border-top: 1px solid ".concat((e.theme.borders||b.Z.borders).medium,";\n ")}),(function(e){return"\n color: ".concat((e.theme.content||b.Z.content).default,";\n ")}),(function(e){return"\n height: ".concat(e.columnHeaderHeight||P,"px;\n ")}),y.iD,j.ry,(function(e){return"\n background-color: ".concat((e.theme.background||b.Z.background).table,";\n border-bottom: 1px solid ").concat((e.theme.borders||b.Z.borders).medium,";\n border-right: 1px solid ").concat((e.theme.borders||b.Z.borders).medium,";\n ")}),1*_.iI);function A(e){var n=e.original,t=8.5*Math.max.apply(Math,(0,r.Z)(n.map((function(e){return(null===e||void 0===e?void 0:e.length)||0})))),i=Math.ceil(t/(T-2*_.iI));return Math.max(i,1)*y.dN+2*_.iI}function R(e){var n=e.columnHeaderHeight,t=e.columns,i=e.data,c=e.disableScrolling,a=e.height,k=e.index,S=e.invalidValues,I=e.maxHeight,R=e.numberOfIndexes,D=e.previewIndexes,M=e.renderColumnHeader,N=e.width,B=(0,o.useContext)(d.ThemeContext),L=(0,o.useRef)(null),F=(0,o.useRef)(null);(0,o.useEffect)((function(){var e=function(e){var n;null===L||void 0===L||null===(n=L.current)||void 0===n||n.scroll(e.target.scrollLeft,0)};return F&&F.current.addEventListener("scroll",e),function(){var n;null===F||void 0===F||null===(n=F.current)||void 0===n||n.removeEventListener("scroll",e)}}),[L,F]);var U=(0,o.useMemo)((function(){return k&&i&&k.length===i.length}),[i,k]),H=(0,o.useMemo)((function(){var e=[];return(0,O.w6)(R).forEach((function(n,t){var o=8.7*String(null===i||void 0===i?void 0:i.length).length;if(U){var l=k.map((function(e){return R>=2?String(e[t]).length:String(e).length}));o=8.7*Math.max.apply(Math,(0,r.Z)(l))}e.push(o+2*_.iI)})),e}),[i,k,R,U]),z=t.map((function(e){return null===e||void 0===e?void 0:e.Header})).slice(1),G=(0,o.useMemo)((function(){return x()}),[]),W=(0,o.useMemo)((function(){var e=N-(Math.max.apply(Math,(0,r.Z)(H))+1.5*_.iI+G),n=t.length-1,i=T;return i*n<e&&(i=e/n),{width:i}}),[t,H,G,N]),Q=(0,p.useTable)({columns:t,data:i,defaultColumn:W},p.useBlockLayout,h.useSticky),q=Q.getTableBodyProps,Y=Q.getTableProps,V=Q.headerGroups,K=Q.prepareRow,X=Q.rows,J=s().query.slug,$=void 0===J?[]:J,ee=new Set((null===D||void 0===D?void 0:D.removedRows)||[]),ne=(0,o.useCallback)((function(e){var n=e.index,t=e.style,i=X[n];K(i);var r=i.original,c=ee.has(n);return(0,w.jsx)("div",E(E({},i.getRowProps({style:E(E({},t),{},{width:"auto"})})),{},{className:"tr",children:i.cells.map((function(e,t){var i,a=t<=R-1,s=e.getCellProps(),d=e.column.id,f=null===S||void 0===S||null===(i=S[d])||void 0===i?void 0:i.includes(n),p=E({},s.style);a&&(p.fontFamily=j.Vp,p.left=0,p.position="sticky",p.textAlign=k?"right":"center",p.width=H[t]);var h,g=r[t-R],x=z.indexOf(d);if(f&&(p.color=b.Z.interactive.dangerBorder),c&&(p.backgroundColor=b.Z.background.danger),Array.isArray(g)||"object"===typeof g)try{g=JSON.stringify(g)}catch(y){g="Error: cannot display value"}return a&&(U?(h=k[n],Array.isArray(h)&&(h=h[t])):h=e.render("Cell")),(0,o.createElement)("div",E(E({},s),{},{className:"td ".concat(a?"td-index-column":""),key:"".concat(t,"-").concat(g),style:p}),h,!a&&(0,w.jsxs)(m.Z,{justifyContent:"space-between",children:[(0,w.jsxs)(v.ZP,{danger:f,default:!0,wordBreak:!0,children:[!0===g&&"true",!1===g&&"false",(null===g||"null"===g)&&"null",!0!==g&&!1!==g&&null!==g&&"null"!==g&&g]}),f&&(0,w.jsx)(u(),{as:(0,C.o_)(Z.mW,x),href:"/datasets/[...slug]",passHref:!0,children:(0,w.jsx)(l.Z,{danger:!0,children:"View all"})})]}))}))}))}),[k,S,H,R,K,X,$]),te=(0,o.useMemo)((function(){var e;return I?(e=(0,O.Sm)(X.map(A)),e+=n||P-y.dN):(e=a,e-=n||P),e}),[n,A,a,I,X]),ie=(0,o.useMemo)((function(){return(0,w.jsx)(f.S_,{estimatedItemSize:P,height:te,itemCount:null===X||void 0===X?void 0:X.length,itemSize:function(e){return A(X[e])},outerRef:F,style:{maxHeight:I,pointerEvents:c?"none":null},children:ne})}),[te,F,ne,X]);return(0,w.jsx)("div",E(E({},Y()),{},{className:"table sticky",style:{width:N},children:(0,w.jsxs)("div",E(E({},q()),{},{className:"body",children:[(0,w.jsx)("div",{className:"header",ref:L,children:V.map((function(e,n){return(0,o.createElement)("div",E(E({},e.getHeaderGroupProps()),{},{className:"tr",key:"".concat(e.id,"_").concat(n)}),e.headers.map((function(e,n){var t,i=n<=R-1,r=e.getHeaderProps(),l=E({},r.style);return i?(l.fontFamily=j.Vp,l.left=0,l.position="sticky",l.textAlign="center",l.width=H[n],l.minWidth=H[n]):M?t=M(e,n-R,{width:W.width}):(t=e.render("Header"),l.color=(B||g.Z).content.default,l.padding=1*_.iI,l.minWidth=W.width),(0,o.createElement)("div",E(E({},r),{},{className:"th",key:e.id,style:l,title:i?"Row number":void 0}),t)})))}))}),ie]}))}))}var D=function(e){var n=e.columnHeaderHeight,t=e.columns,r=e.disableScrolling,l=e.height,c=e.index,u=e.invalidValues,a=e.maxHeight,s=e.noBorderBottom,d=e.noBorderLeft,f=e.noBorderRight,p=e.noBorderTop,h=e.previewIndexes,m=e.renderColumnHeader,v=e.rows,g=e.width,b=(0,o.useMemo)((function(){return null!==c&&void 0!==c&&c.length&&Array.isArray(c[0])?c[0].length:1}),[c]),x=(0,o.useMemo)((function(){return(0,O.w6)(b).map((function(e,n){return{Header:(0,O.w6)(n+1).map((function(){return" "})).join(" "),accessor:function(e,n){return n},sticky:"left"}})).concat(null===t||void 0===t?void 0:t.map((function(e){return{Header:String(e),accessor:String(e)}})))}),[t,b]);return(0,o.useMemo)((function(){return null===v||void 0===v?void 0:v.map((function(e){return e.reduce((function(e,n,r){return E(E({},e),{},(0,i.Z)({},t[r],n))}),{})}))}),[t,v]),(0,w.jsx)(I,{columnHeaderHeight:n,disableScrolling:r,height:l,maxHeight:(a||0)+37,noBorderBottom:s,noBorderLeft:d,noBorderRight:f,noBorderTop:p,children:(0,w.jsx)(R,{columnHeaderHeight:n,columns:x,data:v,disableScrolling:r,height:l,index:c,invalidValues:u,maxHeight:a,numberOfIndexes:b,previewIndexes:h,renderColumnHeader:m,width:g})})}},55106:function(e,n,t){"use strict";t.d(n,{Z:function(){return g}});var i=t(82394),r=t(75582),o=t(82684),l=t(83455),c=t(9518),u=t(77011),a=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 d(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){(0,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}var f=c.default.div.withConfig({displayName:"MultiFileInput__DropzoneStyle",componentId:"sc-1l6yd2y-0"})(["&:hover{cursor:pointer;}"]);var p=function(e){var n=e.children,t=e.inputOnChange,i=e.inputProps,r=e.onDragActiveChange,l=e.setFiles,c=(0,o.useCallback)((function(e){l(e)}),[l]),s=(0,u.uI)({onDrop:c}),p=s.getInputProps,h=s.getRootProps,m=s.isDragActive,v=p(),g=v.accept,b=v.autoComplete,x=v.multiple,j=v.onChange,y=v.onClick,k=v.ref,Z=v.style,_=v.tabIndex,C=v.type,O=d(d({},i),{},{accept:g,autoComplete:b,multiple:x,onChange:function(e){null===t||void 0===t||t(e),null===i||void 0===i||i.onChange(e),j(e)},onClick:y,ref:k,style:Z,tabIndex:_,type:C});return(0,o.useEffect)((function(){null===r||void 0===r||r(m)}),[m,r]),(0,a.jsxs)(f,d(d({},h()),{},{children:[(0,a.jsx)("input",d(d({},O),{},{directory:"",webkitdirectory:""})),n]}))},h=t(82531);function m(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function v(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?m(Object(t),!0).forEach((function(n){(0,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 g=function(e){var n=e.children,t=e.directoryPath,c=e.onDragActiveChange,u=e.setFileUploadProgress,s=e.setUploadedFiles,d=(0,l.Db)(h.ZP.files.useCreate({onUploadProgress:function(e,n){var t,r=n.body,o=[null===r||void 0===r?void 0:r.dir_path,null===r||void 0===r||null===(t=r.file)||void 0===t?void 0:t.name].filter((function(e){return(null===e||void 0===e?void 0:e.length)>=1})).join("/");null===u||void 0===u||u((function(n){return v(v({},n),{},(0,i.Z)({},o,e.loaded/e.total))}))}})),f=(0,r.Z)(d,1)[0],m=(0,o.useCallback)((function(e){e.forEach((function(e){var n=e.name,r=e.path,o=[t],l=r.split("/").filter((function(e){return e&&e!==n})).join("/");l&&o.push(l);var c=[],a=o.join("/");(null===a||void 0===a?void 0:a.length)>=1&&o.push(a),c.push(n);var d=c.join("/");f({dir_path:a,file:e,overwrite:!1}).then((function(e){var n=e.data,t=n.error,r=n.file;s((function(e){return v(v({},e),{},(0,i.Z)({},d,r||t))}))})),u((function(e){return v(v({},e),{},(0,i.Z)({},d,0))}))}))}),[f,t,u,s]);return(0,a.jsx)(p,{onDragActiveChange:c,setFiles:m,children:n})}},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(9518),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 ")}))},64155:function(e,n,t){"use strict";t.d(n,{Eh:function(){return u},ht:function(){return s},t0:function(){return a}});var i=t(9518),r=t(82386),o=t(1286),l=t(31012),c=t(49125),u=(c.iI,o.O$+3*c.iI+l.dN),a=i.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-15ofupc-0"})(["position:relative;width:fit-content;"," ",""],(function(e){return"\n height: calc(100vh - ".concat(r.uX,"px - ").concat(e.heightOffset,"px);\n ")}),(function(e){return e.fullWidth&&"\n width: 100%;\n "})),s=i.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-15ofupc-1"})(["padding:","px;",""],2*c.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "}))},33699:function(e,n,t){"use strict";t.d(n,{y:function(){return R},Z:function(){return D}});var i=t(89565),r=t.n(i),o=t(56085),l=t(82684),c=t(35490),u=t(47999),a=t(67971),s=t(82635),d=t(86673),f=t(54283),p=t(19711),h=t(9518),m=t(23831),v=t(49125),g=t(37391),b=(0,h.css)([""," ",""],(function(e){return!e.width&&"\n width: 100%;\n "}),(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")})),x=h.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-11d4rgl-0"})([""," "," height:100%;overflow:auto;position:absolute;",""],b,g.w5,(function(e){return"\n background-color: ".concat((e.theme.background||m.Z.background).codeTextarea,";\n ")})),j=h.default.div.withConfig({displayName:"indexstyle__InnerStyle",componentId:"sc-11d4rgl-1"})([""," padding:","px;"],b,v.cd*v.iI),y=h.default.div.withConfig({displayName:"indexstyle__LineStyle",componentId:"sc-11d4rgl-2"})(["height:","px;"],20),k=(0,h.css)(["@keyframes cursor-blink{0%{opacity:0;}}::before{","}::after{","}"],(function(e){return e.focusBeginning&&"\n position: absolute;\n background-color: ".concat((e.theme.accent||m.Z.accent).warning,';\n content: "";\n display: inline-block;\n height: ').concat(20,"px;\n width: ").concat(v.iI,"px;\n opacity: 0.3;\n ")}),(function(e){return e.focused&&"\n background-color: ".concat((e.theme.accent||m.Z.accent).warning,';\n content: "";\n display: inline-block;\n height: ').concat(20,"px;\n width: ").concat(v.iI,"px;\n opacity: 0.3;\n ")})),Z=h.default.div.withConfig({displayName:"indexstyle__InputStyle",componentId:"sc-11d4rgl-3"})(["align-items:center;display:flex;gap:2px;",""],k),_=h.default.span.withConfig({displayName:"indexstyle__CharacterStyle",componentId:"sc-11d4rgl-4"})([""," ::after{","}"],k,(function(e){return e.focused&&"\n position: absolute;\n "})),C=t(16115),O=t(94353),w=t(28799),S=t(51504),E=t(66653),P=t(41150),T=t(28598);function I(e,n){var t="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(!e)return;if("string"===typeof e)return A(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return A(e,n)}(e))||n&&e&&"number"===typeof e.length){t&&(e=t);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,c=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return l=e.done,e},e:function(e){c=!0,o=e},f:function(){try{l||null==t.return||t.return()}finally{if(c)throw o}}}}function A(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}var R="terminal";var D=function(e){var n=e.interruptKernel,t=e.onFocus,i=e.uuid,h=void 0===i?R:i,m=e.width,v=(0,l.useRef)(null),g=(0,l.useRef)(null),b=(0,l.useState)(!1),k=b[0],A=b[1],D=(0,l.useState)(""),M=D[0],N=D[1],B=(0,l.useState)(0),L=B[0],F=B[1],U=(0,l.useState)(""),H=U[0],z=U[1],G=(0,l.useState)(0),W=G[0],Q=G[1],q=(0,l.useState)([]),Y=q[0],V=q[1],K=(0,l.useState)(!1),X=K[0],J=K[1],$=(0,l.useState)([]),ee=$[0],ne=$[1],te=(0,o.ZP)((0,w.Ib)(),{shouldReconnect:function(){return!0}}),ie=te.lastMessage,re=(te.readyState,te.sendMessage);(0,l.useEffect)((function(){if(ie){var e=null!==ie&&void 0!==ie&&ie.data?JSON.parse(ie.data):null;(null===e||void 0===e?void 0:e.uuid)===h&&(s.uF.BUSY===(null===e||void 0===e?void 0:e.execution_state)?A(!0):s.uF.IDLE===(null===e||void 0===e?void 0:e.execution_state)&&A(!1),ne((function(n){return e?n.concat(e):n})))}}),[ie,A,ne,h]),(0,l.useEffect)((function(){if(v.current&&g.current){var e=g.current.getBoundingClientRect().height;v.current.scrollTo(0,e)}}),[ee,v,g]);var oe=(0,P.y)(),le=oe.registerOnKeyDown,ce=oe.setDisableGlobalKeyboardShortcuts,ue=oe.unregisterOnKeyDown;(0,l.useEffect)((function(){return function(){ue(h)}}),[ue,h]);var ae=(0,l.useCallback)((function(){Q((function(e){return e>0?e-1:e}))}),[]),se=(0,l.useCallback)((function(){Q((function(e){return e<=M.length?e+1:e}))}),[M]),de=(0,l.useCallback)((function(e){var n=(null===e||void 0===e?void 0:e.split(/\n/))||[];if(n.length>1){var t=n.slice(0,-1);t[0]=M+t[0];var i=t.map((function(e,n){return{command:0===n,data:e,type:s.Gi.TEXT}}));F(Y.length+t.length),V((function(e){return e.concat(t)})),ne((function(e){return e.concat(i)})),z((function(e){return e+t.join("\n")}));var r=(n.slice(-1)[0]||"").trim();N(r),Q(r.length)}else N((function(n){return n+e})),Q(M.length+e.length)}),[M,Y]);return le(h,(function(e,t,i){var r=e.code,o=e.key;if(X)if((0,E.j)(e),(0,S.y)([C.PQ,C.VS],t))A(!1),ne((function(e){var n;return e.concat({command:!0,data:(null===M||void 0===M||null===(n=M.trim())||void 0===n?void 0:n.length)>=1?M:"\n",type:s.Gi.TEXT})})),N(""),n();else if(!k)if(C.Qj!==r||t[C.zX])if((0,S.y)([C.QK],t))ae();else if((0,S.y)([C.DY],t))se();else if((0,S.y)([C.Bu],t)){if(Y.length>=1){var l,u=Math.max(0,L-1);N(Y[u]),F(u),Q((null===(l=Y[u])||void 0===l?void 0:l.length)||0)}}else if((0,S.y)([C.kD],t)){if(Y.length>=1){var a=Math.min(Y.length,L+1),d=Y[a]||"";N(d),F(a),Q(d.length)}}else if((0,S.y)([C.Uq],t)){var f=H+M;(null===f||void 0===f?void 0:f.length)>=1&&(A(!0),re(JSON.stringify({api_key:O.l,code:"!".concat(f),token:(new c.Z).decodedToken.token,uuid:h})),F(Y.length+1),V((function(e){return e.concat(M)})),Q(0)),ne((function(e){var n;return e.concat({command:!0,data:(null===M||void 0===M||null===(n=M.trim())||void 0===n?void 0:n.length)>=1?M:"\n",type:s.Gi.TEXT})})),z(""),N("")}else if((0,S.y)([C.zX,C.VS],t))navigator.clipboard.writeText(window.getSelection().toString());else if((0,S.y)([C.zX,C.Pd],t)||(0,S.y)([C.PQ,C.Pd],t)){var p,m,v;"undefined"===typeof(null===(p=navigator)||void 0===p?void 0:p.clipboard)?alert('Clipboard pasting is not allowed in insecure contexts. If your Mage deployment is not secure but you still want to use clipboard paste, you can override this setting (which should only be done temporarily) on Chrome browsers by going to "chrome://flags/#unsafely-treat-insecure-origin-as-secure", adding your origin to "Insecure origins treated as secure", and enabling that setting.'):null!==(m=navigator)&&void 0!==m&&null!==(v=m.clipboard)&&void 0!==v&&v.readText?navigator.clipboard.readText().then(de).catch((function(e){return alert("".concat(e,'\n For Chrome, users need to allow clipboard permissions for this site under "Privacy and security" -> "Site settings".\n For Safari, users need to allow the clipboard paste by clicking "Paste" in the context menu that appears.'))})):navigator.clipboard.read().then((function(e){var n,t=I(e);try{for(t.s();!(n=t.n()).done;){var i,r=n.value,o=I(r.types);try{for(o.s();!(i=o.n()).done;){var l=i.value;if("text/plain"===l)return r.getType(l)}}catch(c){o.e(c)}finally{o.f()}}}catch(c){t.e(c)}finally{t.f()}})).then((function(e){return e.text()})).then(de).catch((function(e){return alert("".concat(e,'\n For Firefox, users need to allow clipboard paste by setting the "dom.events.asyncClipboard.read" preference in "about:config" to "true" and clicking "Paste" in the context menu that appears.'))}))}else t[C.zX]||t[C.PQ]||1!==o.length||(N((function(e){return e.slice(0,W)+o+e.slice(W)})),se());else{var g=Math.max(0,W-1);N((function(e){return e.slice(0,g)+e.slice(W)})),Q((function(e){return Math.max(0,e-1)}))}}),[k,M,Y,L,X,n,A,N,V,F,ne,h]),(0,T.jsx)(x,{ref:v,width:m,children:(0,T.jsx)(u.Z,{isOpen:!0,onClick:function(){null===t||void 0===t||t(),J(!0),ce(!0)},onClickOutside:function(){J(!1),ce(!1)},style:{minHeight:"100%"},children:(0,T.jsxs)(j,{ref:g,width:m,children:[null===ee||void 0===ee?void 0:ee.reduce((function(e,n,t){var i=n||{},o=i.command,l=i.data,c=i.type,u=[];u=(u=Array.isArray(l)?l:[l]).filter((function(e){return e}));var d=[];return u.forEach((function(e,n){var i;if(s.jU.includes(c)&&(i=(0,T.jsxs)(p.ZP,{monospace:!0,noWrapping:!0,pre:!0,children:[e&&(0,T.jsx)(r(),{children:e}),!e&&(0,T.jsx)(T.Fragment,{children:"\xa0"})]})),i){var l="command-".concat(t,"-").concat(n,"-").concat(e);o?d.push((0,T.jsx)(y,{children:(0,T.jsxs)(a.Z,{alignItems:"center",children:[(0,T.jsx)(p.ZP,{inline:!0,monospace:!0,warning:!0,children:"\u2192\xa0"}),i]})},l)):d.push((0,T.jsx)(y,{children:i},l))}})),e.concat(d)}),[]),k&&(0,T.jsx)(d.Z,{mt:1,children:(0,T.jsx)(f.Z,{})}),!k&&(0,T.jsx)(Z,{focused:X&&(0===M.length||W>M.length),children:(0,T.jsxs)(p.ZP,{monospace:!0,children:[(0,T.jsx)(p.ZP,{inline:!0,monospace:!0,warning:!0,children:"\u2192\xa0"}),null===M||void 0===M?void 0:M.split("").map((function(e,n){return(0,T.jsxs)(_,{focusBeginning:X&&0===W&&0===n,focused:X&&W===n+1,children:[" "===e&&(0,T.jsx)(T.Fragment,{children:"\xa0"})," "!==e&&e]},"command-".concat(n,"-").concat(e))}))]})})]})})})}},76096:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(33591)),l=t(28598),c=["children","fullHeight","gutter","style"];function u(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?u(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.fullHeight,i=e.gutter,u=e.style,s=void 0===u?{}:u,d=(0,r.Z)(e,c),f=a({},s);return i&&(f.paddingLeft=i,f.paddingRight=f.paddingLeft),t&&(f.height="100%"),(0,l.jsx)(o.Col,a(a({},d),{},{style:f,children:n}))}},97361:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=t(82684),l=t(33591),c=t(28598),u=["children","fullHeight","gutter","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.style,d=void 0===a?{}:a,f=(0,r.Z)(e,u),p=s({},d);return i&&(p.marginLeft=-1*i,p.marginRight=p.marginLeft),t&&(p.height="100%"),(0,c.jsx)(l.Row,s(s({},f),{},{style:p,children:o.Children.map(n,(function(e,n){return e&&o.cloneElement(e,{gutter:i,key:n})}))}))}},82635:function(e,n,t){"use strict";var i,r;t.d(n,{Gi:function(){return r},jU:function(){return l},uF:function(){return i}}),function(e){e.BUSY="busy",e.IDLE="idle",e.QUEUED="queued"}(i||(i={})),function(e){e.IMAGE_PNG="image/png",e.PROGRESS="progress",e.TABLE="table",e.TEXT="text",e.TEXT_HTML="text/html",e.TEXT_PLAIN="text/plain"}(r||(r={}));var o,l=[r.TEXT,r.TEXT_PLAIN];!function(e){e.DISPLAY_DATA="display_data",e.STATUS="status",e.STREAM="stream",e.STREAM_PIPELINE="stream_pipeline"}(o||(o={}))},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)},30264:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(47999)),l=t(62084),c=t(28598),u=["children","items","open","onClickCallback","onClickOutside","parentRef","uuid"];function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.items,i=e.open,a=e.onClickCallback,d=e.onClickOutside,f=e.parentRef,p=e.uuid,h=(0,r.Z)(e,u),m=(0,c.jsxs)("div",{style:{position:"relative",zIndex:d?3:2},children:[(0,c.jsx)("div",{ref:f,children:n}),(0,c.jsx)(l.Z,s(s({},h),{},{items:t,onClickCallback:a,open:i,parentRef:f,uuid:p}))]});return d?(0,c.jsx)(o.Z,{onClickOutside:d,open:!0,children:m}):m}},29237:function(e,n,t){"use strict";var i=t(9518),r=t(67971),o=t(86673),l=t(19711),c=t(31969),u=t(73942),a=t(37391),s=t(49125),d=t(28598),f=1.75,p=(0,i.css)(["padding:","px;padding-bottom:","px;padding-top:","px;"],f*s.iI,1.5*s.iI,1.5*s.iI),h=i.default.div.withConfig({displayName:"Panel__PanelStyle",componentId:"sc-1ct8cgl-0"})(["border-radius:","px;overflow:hidden;width:100%;"," "," "," "," "," ",""],u.n_,(function(e){return"\n background-color: ".concat((e.theme.background||c.Z.background).panel,";\n border: 1px solid ").concat((e.theme.interactive||c.Z.interactive).defaultBorder,";\n ")}),(function(e){return!e.fullHeight&&"\n height: fit-content;\n "}),(function(e){return e.maxHeight&&"\n max-height: ".concat(e.maxHeight,";\n ")}),(function(e){return e.minWidth&&"\n min-width: ".concat(e.minWidth,"px;\n\n @media (max-width: ").concat(e.minWidth,"px) {\n min-width: 0;\n }\n ")}),(function(e){return e.borderless&&"\n border: none;\n "}),(function(e){return e.overflowVisible&&"\n overflow: visible;\n "})),m=i.default.div.withConfig({displayName:"Panel__HeaderStyle",componentId:"sc-1ct8cgl-1"})(["border-top-left-radius:","px;border-top-right-radius:","px;"," "," ",""],u.n_,u.n_,(function(e){return"\n background-color: ".concat((e.theme.background||c.Z.background).chartBlock,";\n border-bottom: 1px solid ").concat((e.theme.interactive||c.Z.interactive).defaultBorder,";\n ")}),(function(e){return e.height&&"\n height: ".concat(e.height,"px;\n ")}),p),v=i.default.div.withConfig({displayName:"Panel__ContentStyle",componentId:"sc-1ct8cgl-2"})(["overflow-y:auto;padding:","px;height:100%;"," "," "," "," ",""],f*s.iI,a.w5,(function(e){return e.height&&"\n height: ".concat(e.height,"px;\n ")}),(function(e){return e.maxHeight&&"\n max-height: calc(".concat(e.maxHeight," - ").concat(15*s.iI,"px);\n ")}),(function(e){return e.noPadding&&"\n padding: 0;\n "}),(function(e){return e.overflowVisible&&"\n overflow: visible;\n "})),g=i.default.div.withConfig({displayName:"Panel__FooterStyle",componentId:"sc-1ct8cgl-3"})(["border-style:",";border-top-width:","px;padding:","px;"],u.M8,u.YF,f*s.iI);n.Z=function(e){var n=e.borderless,t=e.children,i=e.containerRef,c=e.contentContainerRef,u=e.footer,a=e.fullHeight,s=void 0===a||a,f=e.header,p=e.headerHeight,b=e.headerIcon,x=e.headerTitle,j=e.maxHeight,y=e.noPadding,k=e.overflowVisible,Z=e.subtitle,_=e.minWidth;return(0,d.jsxs)(h,{borderless:n,fullHeight:s,maxHeight:j,minWidth:_,overflowVisible:k,ref:i,children:[(f||x)&&(0,d.jsxs)(m,{height:p,children:[f&&f,x&&(0,d.jsx)(r.Z,{alignItems:"center",justifyContent:"space-between",children:(0,d.jsxs)(r.Z,{alignItems:"center",children:[b&&b,(0,d.jsx)(o.Z,{ml:b?1:0,children:(0,d.jsx)(l.ZP,{bold:!0,default:!0,children:x})})]})})]}),(0,d.jsxs)(v,{maxHeight:j,noPadding:y,overflowVisible:k,ref:c,children:[Z&&(0,d.jsx)(o.Z,{mb:2,children:(0,d.jsx)(l.ZP,{default:!0,children:Z})}),t]}),u&&(0,d.jsx)(g,{children:u})]})}},32316:function(e,n,t){"use strict";t.d(n,{Z:function(){return m}});var i=t(82684),r=t(60328),o=t(67971),l=t(882),c=t(86673),u=t(99994),a=t(9518),s=t(49125),d=t(37391),f=a.default.div.withConfig({displayName:"indexstyle__TabsContainerStyle",componentId:"sc-segf7l-0"})(["padding-left:","px;padding-right:","px;"," "," ",""],s.cd*s.iI,s.cd*s.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "}),(function(e){return e.allowScroll&&"\n overflow: auto;\n "}),d.w5),p=t(66653),h=t(28598);var m=function(e){var n=e.allowScroll,t=e.contained,a=e.noPadding,d=e.onClickTab,m=e.selectedTabUUID,v=e.small,g=e.tabs,b=(0,i.useMemo)((function(){var e=g.length,n=[];return g.forEach((function(t,i){var a=t.Icon,f=t.IconSelected,g=t.label,b=t.uuid,x=b===m,j=x&&f||a,y=g?g():b,k=(0,h.jsxs)(o.Z,{alignItems:"center",children:[j&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{default:!x,size:2*s.iI}),(0,h.jsx)(c.Z,{mr:1})]}),y]});i>=1&&e>=2&&n.push((0,h.jsx)("div",{style:{marginLeft:1.5*s.iI}},"spacing-".concat(b))),x?n.push((0,h.jsx)(l.Z,{backgroundGradient:u.yr,backgroundPanel:!0,borderLess:!0,borderWidth:2,compact:v,onClick:function(e){(0,p.j)(e),d(t)},paddingUnitsHorizontal:2,paddingUnitsVertical:1.25,small:v,children:k},b)):n.push((0,h.jsx)("div",{style:{padding:4},children:(0,h.jsx)(r.Z,{borderLess:!0,compact:v,default:!0,onClick:function(e){(0,p.j)(e),d(t)},outline:!0,small:v,children:k},"button-tab-".concat(b))}))})),n}),[d,m,g]),x=(0,h.jsx)(o.Z,{alignItems:"center",children:b});return t?x:(0,h.jsx)(f,{allowScroll:n,noPadding:a,children:x})}},82944:function(e,n,t){"use strict";var i=t(82394),r=t(91835),o=t(82684),l=t(9518),c=t(69898),u=t(28598);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}var d=l.default.input.withConfig({displayName:"TextInput__TextInputStyle",componentId:"sc-1ii4qtc-0"})(["",""],c.p),f=function(e,n){var t=(0,r.Z)({},e);return(0,u.jsx)(c.Z,s(s({},t),{},{input:(0,u.jsx)(d,s({},t)),ref:n}))};n.Z=o.forwardRef(f)},51438:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Tc}});var i,r=t(77837),o=t(21831),l=t(75582),c=t(82394),u=t(38860),a=t.n(u),s=t(56085),d=t(82684),f=t(83455),p=t(34376),h=t(86422),m=t(62084),v="buckets",g="chart_style",b="group_by",x="height",j="index",y="legend_labels",k="limit",Z="metrics",_="time_interval",C="width_percentage",O="x",w="y",S="y_sort_order",E="data_provider",P="data_provider_database",T="data_provider_profile",I="data_provider_schema",A="data_provider_table",R="dbt_project_name",D="dbt_profile_target",M="export_write_policy",N="limit",B="use_raw_sql",L=[O,w];!function(e){e.BAR_CHART="bar chart",e.HISTOGRAM="histogram",e.LINE_CHART="line chart",e.PIE_CHART="pie chart",e.TABLE="table",e.TIME_SERIES_BAR_CHART="time series bar chart",e.TIME_SERIES_LINE_CHART="time series line chart"}(i||(i={}));var F,U,H=[i.BAR_CHART,i.HISTOGRAM,i.LINE_CHART,i.PIE_CHART,i.TABLE,i.TIME_SERIES_BAR_CHART,i.TIME_SERIES_LINE_CHART];!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(F||(F={})),function(e){e.AVERAGE="average",e.COUNT="count",e.COUNT_DISTINCT="count_distinct",e.MAX="max",e.MEDIAN="median",e.MIN="min",e.MODE="mode",e.SUM="sum"}(U||(U={}));var z,G,W,Q,q,Y,V,K,X,J=[U.AVERAGE,U.COUNT,U.COUNT_DISTINCT,U.MAX,U.MEDIAN,U.MIN,U.MODE,U.SUM];!function(e){e.ASCENDING="ascending",e.DESCENDING="descending"}(z||(z={})),function(e){e.DAY="day",e.HOUR="hour",e.MINUTE="minute",e.MONTH="month",e.ORIGINAL="original",e.SECOND="second",e.WEEK="week",e.YEAR="year"}(G||(G={})),function(e){e.COLUMNS="columns",e.METRICS="metrics",e.NUMBER="number"}(X||(X={}));var $={noCode:[{label:function(){return"time column"},settings:{maxValues:1},type:X.COLUMNS,uuid:b},{label:function(){return"time interval"},options:[G.ORIGINAL,G.SECOND,G.MINUTE,G.HOUR,G.DAY,G.WEEK,G.MONTH,G.YEAR],uuid:_},{label:function(){return"metrics"},type:X.METRICS,uuid:Z}]},ee=(W={},(0,c.Z)(W,i.BAR_CHART,{noCode:[{label:function(){return"group by columns"},type:X.COLUMNS,uuid:b},{label:function(){return"metrics"},type:X.METRICS,uuid:Z},{autoRun:!0,label:function(){return"chart style"},options:[F.HORIZONTAL,F.VERTICAL],uuid:g},{autoRun:!0,label:function(){return"sort direction"},options:[null,z.ASCENDING,z.DESCENDING],uuid:S}],code:[{label:function(){return"variable name of x-axis values"},monospace:!0,uuid:O},{label:function(){return"variable name of y-axis values"},monospace:!0,uuid:w}]}),(0,c.Z)(W,i.HISTOGRAM,{noCode:[{label:function(){return"number column for chart"},settings:{maxValues:1},type:X.COLUMNS,uuid:b},{autoRun:!0,label:function(){return"Number of buckets"},type:X.NUMBER,uuid:v}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:O}]}),(0,c.Z)(W,i.LINE_CHART,{noCode:[{label:function(){return"group by columns"},settings:{maxValues:1},type:X.COLUMNS,uuid:b},{label:function(){return"metrics"},type:X.METRICS,uuid:Z}],code:[{label:function(){return"variable name of x-axis values"},monospace:!0,uuid:O},{label:function(){return"variable name of y-axis values"},monospace:!0,uuid:w},{label:function(){return"labels of lines in chart (comma separated)"},uuid:y}]}),(0,c.Z)(W,i.PIE_CHART,{noCode:[{label:function(){return"column for chart"},settings:{maxValues:1},type:X.COLUMNS,uuid:b},{autoRun:!0,label:function(){return"Number of slices"},type:X.NUMBER,uuid:v}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:O}]}),(0,c.Z)(W,i.TABLE,{noCode:[{label:function(){return"columns"},type:X.COLUMNS,uuid:b},{label:function(){return"max number of rows"},type:X.NUMBER,uuid:k}],code:[{label:function(){return"variable name of columns"},monospace:!0,uuid:O},{label:function(){return"variable name of rows"},monospace:!0,uuid:w}]}),(0,c.Z)(W,i.TIME_SERIES_BAR_CHART,$),(0,c.Z)(W,i.TIME_SERIES_LINE_CHART,$),W),ne=(Q={},(0,c.Z)(Q,i.BAR_CHART,{configuration:function(e){var n;return n={},(0,c.Z)(n,O,"x"),(0,c.Z)(n,w,"y"),(0,c.Z)(n,g,F.VERTICAL),n},content:function(e){return"columns = df_1.columns\nx = df_1.columns[:7]\ny = [[v] for v in [len(df_1[col].unique()) for col in x]]\n"}}),(0,c.Z)(Q,i.HISTOGRAM,{configuration:function(e){var n;return n={},(0,c.Z)(n,v,10),(0,c.Z)(n,O,"x"),n},content:function(e){return"columns = df_1.columns\ncol = list(filter(lambda x: df_1[x].dtype == float or df_1[x].dtype == int, columns))[0]\nx = df_1[col]\n"}}),(0,c.Z)(Q,i.LINE_CHART,{configuration:function(e){var n;return n={},(0,c.Z)(n,O,"x"),(0,c.Z)(n,w,"y"),n},content:function(e){return"columns = df_1.columns\ncols = list(filter(lambda x: df_1[x].dtype == float or df_1[x].dtype == int, columns))\nx = df_1[cols[0]]\ny = [df_1[cols[1]]]\n"}}),(0,c.Z)(Q,i.PIE_CHART,{configuration:function(e){var n;return n={},(0,c.Z)(n,v,7),(0,c.Z)(n,O,"x"),n},content:function(e){return"x = df_1[df_1.columns[0]]"}}),(0,c.Z)(Q,i.TABLE,{configuration:function(e){var n;return n={},(0,c.Z)(n,k,10),(0,c.Z)(n,O,"x"),(0,c.Z)(n,w,"y"),n},content:function(e){return"x = df_1.columns\ny = df_1.to_numpy()"}}),(0,c.Z)(Q,i.TIME_SERIES_BAR_CHART,{configuration:function(e){return(0,c.Z)({},_,G.ORIGINAL)}}),(0,c.Z)(Q,i.TIME_SERIES_LINE_CHART,{configuration:function(e){return(0,c.Z)({},_,G.ORIGINAL)}}),Q),te=(K={},(0,c.Z)(K,i.BAR_CHART,(q={},(0,c.Z)(q,O,(function(){return"must be a list of booleans, dates, integers, floats, or strings."})),(0,c.Z)(q,w,(function(){return"must be a list of lists containing integers or floats."})),q)),(0,c.Z)(K,i.HISTOGRAM,(0,c.Z)({},O,(function(){return"must be a list of integers or floats."}))),(0,c.Z)(K,i.LINE_CHART,(Y={},(0,c.Z)(Y,O,(function(){return"must be a list of integers or floats."})),(0,c.Z)(Y,w,(function(){return"must be a list of lists containing integers or floats. Each list is a single line in the chart."})),Y)),(0,c.Z)(K,i.PIE_CHART,(0,c.Z)({},O,(function(){return"must be a list of booleans, dates, integers, floats, or strings."}))),(0,c.Z)(K,i.TABLE,(V={},(0,c.Z)(V,O,(function(){return"must be a list of strings."})),(0,c.Z)(V,w,(function(){return"must be a list of lists containing booleans, dates, integers, floats, or strings."})),V)),K),ie=[{label:function(){return"% of missing values"},widgetTemplate:function(e){var n,t=e.block;return{name:"missing values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,c.Z)(n,O,"columns_with_mising_values"),(0,c.Z)(n,w,"percentage_of_missing_values"),(0,c.Z)(n,g,F.HORIZONTAL),(0,c.Z)(n,S,z.DESCENDING),(0,c.Z)(n,"chart_type",i.BAR_CHART),n),content:"number_of_rows = len(df_1.index)\ncolumns_with_mising_values = []\npercentage_of_missing_values = []\nfor col in df_1.columns:\n missing = df_1[col].isna().sum()\n if missing > 0:\n columns_with_mising_values.append(col)\n percentage_of_missing_values.append(100 * missing / number_of_rows)\n"}}},{label:function(){return"Unique values"},widgetTemplate:function(e){var n,t=e.block;return{name:"unique values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,c.Z)(n,O,"columns"),(0,c.Z)(n,w,"number_of_unique_values"),(0,c.Z)(n,g,F.HORIZONTAL),(0,c.Z)(n,S,z.DESCENDING),(0,c.Z)(n,"chart_type",i.BAR_CHART),n),content:"columns = df_1.columns\nnumber_of_unique_values = [df_1[col].nunique() for col in columns]\n"}}},{label:function(){return"Most frequent values"},widgetTemplate:function(e){var n,t=e.block;return{name:"most frequent values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,c.Z)(n,x,3e3),(0,c.Z)(n,j,"column_index"),(0,c.Z)(n,O,"columns"),(0,c.Z)(n,w,"rows"),(0,c.Z)(n,"chart_type",i.TABLE),n),content:"columns = ['mode value', 'frequency', '% of values']\n\ncolumn_index = []\nrows = []\nfor col in df_1.columns:\n value_counts = df_1[col].value_counts()\n if len(value_counts.index) == 0:\n continue\n column_value = value_counts.index[0]\n value = value_counts[column_value]\n number_of_rows = df_1[col].count()\n column_index.append(col)\n rows.append([\n column_value,\n f'{round(100 * value / number_of_rows, 2)}%',\n value,\n ])\n"}}},{label:function(){return"Summary overview"},widgetTemplate:function(e){var n,t=e.block;return{name:"summary overview for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,c.Z)(n,x,3e3),(0,c.Z)(n,j,"stats"),(0,c.Z)(n,O,"headers"),(0,c.Z)(n,w,"rows"),(0,c.Z)(n,"chart_type",i.TABLE),n),content:"from mage_ai.data_cleaner.column_types.column_type_detector import infer_column_types\n\n\nheaders = ['value']\nstats = ['Columns', 'Rows']\nrows = [[len(df_1.columns)], [len(df_1.index)]]\n\ncol_counts = {}\nfor col, col_type in infer_column_types(df_1).items():\n col_type_name = col_type.value\n if not col_counts.get(col_type_name):\n col_counts[col_type_name] = 0\n col_counts[col_type_name] += 1\n\nfor col_type, count in sorted(col_counts.items()):\n stats.append(f'# of {col_type}')\n rows.append([count])\n"}}},{label:function(){return"Feature profiles"},widgetTemplate:function(e){var n,t=e.block;return{name:"feature profiles for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,c.Z)(n,x,3e3),(0,c.Z)(n,j,"stats"),(0,c.Z)(n,O,"columns"),(0,c.Z)(n,w,"rows"),(0,c.Z)(n,"chart_type",i.TABLE),n),content:"from mage_ai.data_cleaner.column_types.column_type_detector import infer_column_types\nimport statistics\n\n\ncolumns_and_types = infer_column_types(df_1).items()\ncolumns = [t[0] for t in columns_and_types]\nstats = ['Type', 'Missing values', 'Unique values', 'Min', 'Max', 'Mean', 'Median', 'Mode']\nrows = [[] for _ in stats]\n\nfor col, col_type in columns_and_types:\n series = df_1[col]\n min_value = None\n max_value = None\n mean = None\n median = None\n\n not_null = series[series.notnull()]\n\n if col_type.value in ['number', 'number_with_decimals']:\n count = len(not_null.index)\n if count >= 1:\n mean = round(not_null.sum() / count, 2)\n median = sorted(not_null)[int(count / 2)]\n min_value = round(series.min(), 2)\n max_value = round(series.max(), 2)\n else:\n min_value = not_null.astype(str).min()\n max_value = not_null.astype(str).max()\n\n _, mode = sorted(\n [(v, k) for k, v in not_null.value_counts().items()],\n reverse=True,\n )[0]\n\n for idx, value in enumerate([\n col_type.value,\n len(series[series.isna()].index),\n len(series.unique()),\n min_value,\n max_value,\n mean,\n median,\n mode,\n ]):\n rows[idx].append(value)\n"}}}],re=t(49125),oe=t(90211),le=t(28598);function ce(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 ue(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ce(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ce(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ae=function(e){var n=e.addWidget,t=e.block,i=e.left,r=e.rightOffset,l=e.onClickCallback,c=e.open,u=e.parentRef,a=e.runBlock,s=e.topOffset,f=(0,d.useMemo)((function(){return H.map((function(e){var i,r,o={configuration:{chart_type:e},language:t.language,type:h.tf.CHART,upstream_blocks:t?[t.uuid]:null},l=ne[e],c=(null===l||void 0===l||null===(i=l.configuration)||void 0===i?void 0:i.call(l,o))||{},u=h.t6.SQL===(null===t||void 0===t?void 0:t.language)?null:(null===l||void 0===l||null===(r=l.content)||void 0===r?void 0:r.call(l,o))||null,s=e;return t&&(s="".concat(s," for ").concat(t.uuid)),{label:function(){return(0,oe.vg)(e)},onClick:function(){return n(ue(ue({},o),{},{name:"".concat(s," ").concat((0,oe.Mp)()),configuration:ue(ue({},o.configuration),c),content:u}),{onCreateCallback:function(e){t&&h.t6.SQL!==t.language&&([h.DA.EXECUTED,h.DA.UPDATED].includes(t.status)?a({block:e,code:u,disableReset:!0}):a({block:t,runDownstream:!0}))}})},uuid:e}}))}),[H,t,a]),p=(0,d.useMemo)((function(){return ie.map((function(e){var i=e.label,r=ue(ue({},(0,e.widgetTemplate)({block:t})),{},{language:t.language,type:h.tf.CHART,upstream_blocks:t?[t.uuid]:null});return{label:i,onClick:function(){return n(r,{onCreateCallback:function(e){t&&h.t6.SQL!==t.language&&([h.DA.EXECUTED,h.DA.UPDATED].includes(t.status)?a({block:e,code:e.content,disableReset:!0}):a({block:t,runDownstream:!0}))}})},uuid:i()}}))}),[ie,n,t,a]),v=[{isGroupingTitle:!0,label:function(){return"Custom charts"},uuid:"custom_charts"}].concat((0,o.Z)(f));return h.t6.SQL!==t.language&&v.push.apply(v,[{isGroupingTitle:!0,label:function(){return"Templates"},uuid:"chart_templates"}].concat((0,o.Z)(p))),(0,le.jsx)(m.Z,{items:v,left:i,onClickCallback:l,open:c,parentRef:u,rightOffset:r,topOffset:s,uuid:"CommandButtons/add_charts",width:25*re.iI})},se=t(35490),de=t(60328),fe=t(47999),pe=t(38341),he=t(67971),me=t(11135),ve=t(29237),ge=t(98781),be=t(86673),xe=t(19711),je=t(82944),ye=t(16115),ke=t(11366),Ze=t(91427),_e=t(51504);var Ce,Oe,we,Se,Ee=function(e){var n=e.block,t=e.defaultName,i=e.onClose,r=e.onSave,o=e.pipeline,l=(0,d.useRef)(null),c=(0,d.useState)(t),u=c[0],a=c[1],s=(0,d.useState)(!!(0,Ze.U2)(ke.k)),f=s[0],p=s[1];(0,d.useEffect)((function(){var e;null===l||void 0===l||null===(e=l.current)||void 0===e||e.focus()}),[]);var m=(0,d.useMemo)((function(){return ge.q.INTEGRATION===(null===o||void 0===o?void 0:o.type)}),[o]),v=(0,d.useMemo)((function(){var e=null===n||void 0===n?void 0:n.type;if(m){if(h.tf.DATA_LOADER===e)return"Source";if(h.tf.DATA_EXPORTER===e)return"Destination"}return h.V4[e]}),[n,m]);return(0,le.jsxs)(ve.Z,{children:[(0,le.jsxs)(xe.ZP,{bold:!0,children:[v," block name"]}),(0,le.jsx)(be.Z,{mt:1,children:(0,le.jsx)(je.Z,{monospace:!0,onChange:function(e){return a(e.target.value)},ref:l,value:u})}),(0,le.jsx)(be.Z,{mt:2,children:(0,le.jsx)(he.Z,{alignItems:"center",children:(0,le.jsx)(pe.Z,{checked:f,label:(0,le.jsxs)(xe.ZP,{muted:!0,small:!0,children:["Automatically use randomly generated name",(0,le.jsx)("br",{}),"for blocks created in the future"]}),onClick:function(){p(!f),(0,Ze.t8)(ke.k,!f)}})})}),(0,le.jsx)(be.Z,{mt:3,children:(0,le.jsxs)(he.Z,{children:[(0,le.jsx)(me.ZP,{bold:!0,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,_e.y)([ye.Uq],n)},onClick:function(){return r({name:u||t})},primary:!0,tabIndex:0,uuid:"ConfigureBlock/SaveAndAddBlock",children:"Save and add block"}),(0,le.jsx)(be.Z,{ml:1,children:(0,le.jsx)(de.Z,{onClick:i,tabIndex:0,children:"Cancel"})})]})})]})},Pe=t(26304),Te=t(9518),Ie=t(16634);!function(e){e.JSON="json",e.PY="py",e.R="r",e.SQL="sql",e.TXT="txt",e.YAML="yaml",e.YML="yml"}(we||(we={})),function(e){e.INIT_PY="__init__.py",e.METADATA_YAML="metadata.yaml",e.REQS_TXT="requirements.txt"}(Se||(Se={}));var Ae,Re,De=[we.PY,we.SQL],Me=[we.JSON,we.PY,we.R,we.SQL,we.TXT,we.YAML,we.YML],Ne=new RegExp(Me.map((function(e){return".".concat(e,"$")})).join("|")),Be=Me.concat(we.PY),Le=new RegExp(Be.map((function(e){return".".concat(e,"$")})).join("|")),Fe="charts",Ue="pipelines",He=(Ce={},(0,c.Z)(Ce,we.JSON,we.JSON),(0,c.Z)(Ce,we.PY,h.t6.PYTHON),(0,c.Z)(Ce,we.R,h.t6.R),(0,c.Z)(Ce,we.SQL,h.t6.SQL),(0,c.Z)(Ce,we.TXT,"text"),(0,c.Z)(Ce,we.YAML,h.t6.YAML),(0,c.Z)(Ce,we.YML,h.t6.YAML),Ce),ze=(Oe={},(0,c.Z)(Oe,h.t6.PYTHON,we.PY),(0,c.Z)(Oe,h.t6.R,we.R),(0,c.Z)(Oe,h.t6.SQL,we.SQL),(0,c.Z)(Oe,h.t6.YAML,we.YAML),(0,c.Z)(Oe,"text",we.TXT),Oe),Ge=t(10503),We=t(43032),Qe="sideview";!function(e){e.CHARTS="charts",e.DATA="data",e.GRAPHS="graphs",e.REPORTS="reports",e.SECRETS="secrets",e.TERMINAL="terminal",e.TREE="tree",e.VARIABLES="variables"}(Re||(Re={}));var qe=[Re.CHARTS,Re.DATA,Re.REPORTS,Re.TREE],Ye=[Re.DATA,Re.REPORTS,Re.GRAPHS],Ve=[{key:Re.TREE,label:"Tree"},{key:Re.CHARTS,label:"Charts"},{key:Re.VARIABLES,label:"Variables"},{key:Re.SECRETS,label:"Secrets"},{key:Re.DATA,label:"Data"},{key:Re.TERMINAL,label:"Terminal"}],Ke=(Ae={},(0,c.Z)(Ae,Re.CHARTS,Ge.er),(0,c.Z)(Ae,Re.DATA,Ge.t1),(0,c.Z)(Ae,Re.GRAPHS,Ge.er),(0,c.Z)(Ae,Re.REPORTS,Ge.Do),(0,c.Z)(Ae,Re.SECRETS,Ge.EK),(0,c.Z)(Ae,Re.TREE,Ge.BJ),(0,c.Z)(Ae,Re.VARIABLES,Ge.KJ),Ae),Xe=t(44162);function Je(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=n||(t?null:null===e||void 0===e?void 0:e.name);if(null!==e&&void 0!==e&&e.parent){var r=[e.parent.name];return(null===i||void 0===i?void 0:i.length)>=1&&r.push(i),Je(e.parent,r.join("/"))}return i}function $e(e){return null===e||void 0===e?void 0:e.split("/").slice(1).join("/")}function en(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=Je(e,n,t);return $e(i)}function nn(e){var n,t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=Je(e,i).split("/");if(!r)return null;if(1===r.length)(r=null===e||void 0===e||null===(t=e.path)||void 0===t?void 0:t.split("/"))&&(n=r[0]===h.tf.CUSTOM?r[0]:(0,oe.C5)(r[0]||""));else if(r[1]===h.tf.CUSTOM)n=r[1];else{var o=r[1];n=h.tf.DBT===o?o:(0,oe.C5)(o||"")}if(!r)return null;var l="";l=r.length>=3?r.slice(2,r.length).join("/"):r[r.length-1];var c=["\\.".concat(we.PY),"\\.".concat(we.R),"\\.".concat(we.SQL),"\\.".concat(we.YAML),"\\.".concat(we.YML)].join("|"),u=new RegExp("".concat(c,"$"));if(h.$W.concat(h.tf.DBT).includes(n)&&l.match(u)){var a=l.split("."),s=a[1];return{language:He[s],type:n,uuid:a[0]}}}function tn(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=Je(e,n).split("/");if(t[1]){var i=(0,oe.C5)(t[n?0:1]);t[1]===h.tf.DBT&&(i=h.tf.DBT);var r=t[t.length-1],o=new RegExp(".".concat(we.YAML,"$")),l=new RegExp(".".concat(we.R,"$")),c=new RegExp(".".concat(we.SQL,"$"));if(r.match(o)&&h.VZ.includes(i))return{type:i,uuid:r.replace(o,"")};if(r.match(l)&&h.J8.includes(i))return{type:i,uuid:r.replace(l,"")};if(r.match(c)&&h.HX.includes(i)){var u=r.replace(/[.]/g,"_"),a=i===h.tf.DBT?t.slice(2,-1).join("_").concat("_".concat(u)):r.replace(c,"");return{type:i,uuid:a}}}}var rn=t(24224);function on(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 ln(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?on(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):on(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var cn="default_repo";var un=function e(n){var t=n.allowSelectingFolders,i=n.containerRef,r=n.disableContextMenu,o=n.file,l=n.isFileDisabled,c=n.level,u=n.onSelectBlockFile,a=n.onlyShowChildren,s=n.openFile,f=n.openPipeline,p=n.openSidekickView,m=n.pipelineBlockUuids,v=n.selectFile,g=n.setContextItem,b=n.setCoordinates,x=n.setDraggingFile,j=n.setSelectedFile,y=n.theme,k=n.timeout,Z=n.uncollapsed,_=n.useRootFolder,C=o.children,O=o.disabled,w=o.name,S=o.parent;w||(o.name=cn);var E,P=_?Je(o):en(o),T=(null===S||void 0===S?void 0:S.name)===Ue,I=(0,d.useMemo)((function(){return C?(0,rn.YC)(C,(function(e){return e.children?0:1})):C}),[C]),A=l?l(P,I):O||"__init__.py"===w||!(null===w||void 0===w||!w.match(/^\./))||!w.match(Le)&&!C,R="".concat(c,"/").concat(w),D=(m.includes(function(e){var n=e.name.split("."),t=n[n.length-1];return De.includes(t)&&n.pop(),n.join("")}(o)),(0,d.useState)("undefined"===typeof Z?(0,Ze.U2)(R,!1):!Z)),M=D[0],N=D[1],B=Ge.iU;1===c&&w===Ue?B=Ge.B_:w===Fe?B=Ge.er:I&&(B=Ge.gt),I&&h.$W.includes((0,oe.C5)(w))&&(0,oe.C5)(w)!==h.tf.CHART&&(E=(0,Xe.qn)((0,oe.C5)(w),{theme:y}).accent);var L=(0,d.useMemo)((function(){return null===I||void 0===I?void 0:I.map((function(n){return(0,le.jsx)(e,{allowSelectingFolders:t,containerRef:i,disableContextMenu:r,file:ln(ln({},n),{},{parent:o}),isFileDisabled:l,level:a?c:c+1,onSelectBlockFile:u,openFile:s,openPipeline:f,openSidekickView:p,pipelineBlockUuids:m,selectFile:v,setContextItem:g,setCoordinates:b,setDraggingFile:x,setSelectedFile:j,theme:y,timeout:k,uncollapsed:Z,useRootFolder:_},"".concat(R,"/").concat((null===n||void 0===n?void 0:n.name)||cn))}))}),[t,i,I,r,o,l,c,u,a,s,f,p,m,v,g,y,k,Z,_,R]);return(0,le.jsxs)(le.Fragment,{children:[!a&&(0,le.jsxs)("div",{className:"row",onClick:function(e){if(e.preventDefault(),!A){if((null===S||void 0===S?void 0:S.name)===Fe){null===p||void 0===p||p(Re.CHARTS);var n=nn(o);n&&(null===u||void 0===u||u(n.uuid,n.type,en(o)))}var i=tn(o);if(I)t?v(P):N((function(e){return(0,Ze.t8)(R,!e),!e}));else if(i)null===u||void 0===u||u(i.uuid,i.type,en(o));else if(w.match(Ne))s(P);else{var r=nn(o);r&&(null===u||void 0===u||u(r.uuid,r.type,en(o)))}}},onContextMenu:function(e){var n;clearTimeout(k.current),null!==i&&void 0!==i&&null!==(n=i.current)&&void 0!==n&&n.contains(e.target)&&!r&&(e.preventDefault(),b({x:e.pageX,y:e.pageY}),x(null),j(o))},onMouseDown:function(e){var n,t=o?nn(o):null;null===i||void 0===i||null===(n=i.current)||void 0===n||!n.contains(e.target)||!t||(null===I||void 0===I?void 0:I.length)>=1||r||A||T||(e.preventDefault(),clearTimeout(k.current),k.current=setTimeout((function(){b({x:e.pageX,y:e.pageY}),x(o),j(null)}),300))},style:{alignItems:"center",cursor:"default",display:"flex",minWidth:c*We.Cl+o.name.length*re.Fo+2*re.iI,paddingBottom:re.iI/4,paddingLeft:re.iI/4+We.Cl*c,paddingRight:re.iI/4,paddingTop:re.iI/4},children:[I&&!M&&(0,le.jsx)(Ge._M,{muted:!0,size:We.ZG}),I&&M&&(0,le.jsx)(Ge._Q,{muted:!0,size:We.ZG}),!I&&(0,le.jsx)("div",{style:{width:We.ZG}}),(0,le.jsxs)("div",{style:{marginLeft:re.iI/2,marginRight:re.iI/2},children:[!E&&(0,le.jsx)(B,{disabled:A,size:We.ZG}),E&&(0,le.jsx)(Ie.Z,{color:E,size:We.ZG,square:!0})]}),(0,le.jsx)(xe.ZP,{color:E,default:!E&&!A,disabled:A,monospace:!0,small:!0,children:w})]}),(0,le.jsx)("div",{style:{display:M?"none":"block"},children:L})]})},an=t(82531),sn=t(7715),dn=t(96510);var fn=function(e){var n=e.fetchFileTree,t=e.file,i=e.onCancel,r=e.selectedFolder,o=e.setErrors,c=(0,d.useRef)(null),u=(0,sn.Qr)(t)?null:t,a=(0,d.useState)(u?en(u,null,!0):""),s=a[0],p=a[1],h=(0,d.useState)(u?null===u||void 0===u?void 0:u.name:""),m=h[0],v=h[1];(0,d.useEffect)((function(){var e;null===c||void 0===c||null===(e=c.current)||void 0===e||e.focus()}),[]),(0,d.useEffect)((function(){r&&p(en(r))}),[r]);var g=(0,f.Db)(an.ZP.files.useCreate(),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){null===n||void 0===n||n(),i()},onErrorCallback:function(e,n){return o({errors:n,response:e})}})}}),b=(0,l.Z)(g,1)[0],x=(0,f.Db)(an.ZP.files.useUpdate(u&&encodeURIComponent(en(u))),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){null===n||void 0===n||n(),i()},onErrorCallback:function(e,n){return o({errors:n,response:e})}})}}),j=(0,l.Z)(x,1)[0];return(0,le.jsxs)(ve.Z,{footer:(0,le.jsxs)(he.Z,{children:[(0,le.jsxs)(me.ZP,{bold:!0,disabled:!m,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,_e.y)([ye.Uq],n)},onClick:function(){return u?j({file:{dir_path:s,name:m},file_json_only:!0}):b({file:{dir_path:s,name:m,overwrite:!1},file_json_only:!0})},primary:!0,tabIndex:0,uuid:"NewFile/create_file",children:[u?"Rename":"Create"," file"]}),(0,le.jsx)(be.Z,{ml:1,children:(0,le.jsx)(de.Z,{onClick:function(){return i()},tabIndex:0,children:"Cancel"})})]}),headerTitle:u?"Rename file":"New file",children:[(0,le.jsx)(je.Z,{disabled:!!u,label:"Directory",monospace:!0,onChange:function(e){return p(e.target.value)},setContentOnMount:!0,value:s}),(0,le.jsx)(be.Z,{mt:2,children:(0,le.jsx)(je.Z,{label:"Filename",monospace:!0,onChange:function(e){return v(e.target.value)},ref:c,required:!0,value:m})})]})},pn=t(55106),hn=t(66176),mn=t(87815),vn=t(23831),gn=t(73942),bn=(re.iI,Te.default.div.withConfig({displayName:"indexstyle__DropZoneStyle",componentId:"sc-1g3zz7z-0"})(["border-radius:","px;padding:","px;max-width:","px;min-width:","px;",""],gn.n_,8*re.iI,100*re.iI,55*re.iI,(function(e){return"\n border: 1px dashed ".concat((e.theme.borders||vn.Z.borders).contrast,";\n ")}))),xn=Te.default.div.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-1g3zz7z-1"})(["max-width:","px;min-width:","px;"],100*re.iI,55*re.iI);var jn=function(e){var n=e.fetchFileTree,t=e.onCancel,i=e.selectedFolder,r=(0,d.useState)(!1),o=r[0],c=r[1],u=(0,d.useState)({}),a=u[0],s=u[1],f=(0,d.useState)({}),p=f[0],h=f[1],m=!(0,sn.Qr)(a),v=(0,d.useMemo)((function(){var e=[];return(0,rn.YC)(Object.entries(a),(function(e){var n=(0,l.Z)(e,2),t=n[0];n[1];return t})).forEach((function(n){var t=(0,l.Z)(n,2),i=t[0],r=t[1],o=p[i],c=null===o||void 0===o?void 0:o.message;e.push([(0,le.jsxs)("div",{children:[(0,le.jsx)(xe.ZP,{overflowWrap:!0,preWrap:!0,children:i}),c&&(0,le.jsx)(be.Z,{mt:1,children:(0,le.jsx)(xe.ZP,{danger:!0,small:!0,children:c})})]},"name-".concat(i)),(0,le.jsx)(hn.Z,{danger:!!c,progress:100*r},"progress-".concat(i))])})),(0,le.jsx)(mn.Z,{columnFlex:[1,4],columns:[{uuid:"Filename"},{uuid:"Upload progress"}],rows:e,uuid:"block-runs"})}),[a,p]);return(0,le.jsxs)(ve.Z,{footer:(0,le.jsxs)(he.Z,{fullWidth:!0,children:[(0,le.jsx)(de.Z,{onClick:function(){return t()},children:"Close"}),m&&(0,le.jsx)(be.Z,{ml:1,children:(0,le.jsx)(de.Z,{onClick:function(){s({}),h({})},children:"Clear files and retry"})})]}),headerTitle:"Upload files",children:[m&&(0,le.jsx)(xn,{children:v}),!m&&(0,le.jsx)(pn.Z,{directoryPath:i?en(i):"",onDragActiveChange:c,setFileUploadProgress:s,setUploadedFiles:function(e){h(e),null===n||void 0===n||n()},children:(0,le.jsx)(bn,{children:(0,le.jsxs)(xe.ZP,{center:!0,children:[o&&"Drop to upload",!o&&"Click or drop files and folders to upload"]})})})]})},yn=t(86585),kn=function(e){var n=e[0];return n===h.tf.DBT||n===h.tf.CUSTOM?n:e[0].slice(0,-1)};function Zn(){return new RegExp(Object.keys(He).map((function(e){return".(".concat(e,")$")})).join("|"))}function _n(e,n,t){var i,r,l=null===e||void 0===e||null===(i=e.path.match(Zn())[0])||void 0===i?void 0:i.split(".")[1],c=t.type===ge.q.INTEGRATION,u=(0,rn.sE)(null===t||void 0===t?void 0:t.blocks,(function(e){var n=e.type;return h.tf.DATA_EXPORTER===n})),a=e.path.replace(n,"").split("/"),s=e.path.split("/")[0]===h.tf.DBT,d=(r=a)[0]===h.tf.DBT?r.slice(1).join("/"):function(e){return e.at(-1)}(r).split(".")[0];if(a.length>=3&&!s){var f=a.slice(1,a.length-1).join("/");d="".concat(f,"/").concat(d)}var p=kn(e.path.split("/")),m={configuration:{file_path:s?d:null},language:He[l],name:(0,oe.wE)(d),type:p};if(p===h.tf.CUSTOM&&(m.color=h.Lq.TEAL),c){var v=(0,rn.sE)(t.blocks,(function(e){var n=e.type;return h.tf.DATA_LOADER===n})),g=(0,rn.sE)(t.blocks,(function(e){var n=e.type;return h.tf.TRANSFORMER===n})),b=[];g?b.push(g.uuid):null!==u&&void 0!==u&&u.upstream_blocks?b.push.apply(b,(0,o.Z)(u.upstream_blocks)):v&&b.push(v.uuid),m.upstream_blocks=b}return m}var Cn=t(83608),On=["addNewBlock","blocks","deleteBlockFile","deleteWidget","fetchFileTree","fetchPipeline","files","pipeline","setErrors","setSelectedBlock","widgets"];function wn(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 Sn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?wn(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):wn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var En,Pn=20*re.iI;function Tn(e,n){var t=e.addNewBlock,i=e.blocks,r=void 0===i?[]:i,o=e.deleteBlockFile,c=e.deleteWidget,u=e.fetchFileTree,a=e.fetchPipeline,s=e.files,p=e.pipeline,v=e.setErrors,g=e.setSelectedBlock,b=e.widgets,x=void 0===b?[]:b,j=(0,Pe.Z)(e,On),y=(0,d.useRef)(null),k=(0,d.useContext)(Te.ThemeContext),Z=(0,d.useState)(null),_=Z[0],C=Z[1],O=(0,d.useState)(null),w=O[0],S=O[1],E=(0,d.useState)(null),P=E[0],T=E[1],I=an.ZP.status.list().data,A=(0,d.useMemo)((function(){var e;return null===I||void 0===I||null===(e=I.status)||void 0===e?void 0:e.repo_path}),[I]),R=(0,f.Db)((function(e){return an.ZP.files.useDelete(e)()}),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){null===u||void 0===u||u()},onErrorCallback:function(e,n){return v({errors:n,response:e})}})}}),D=(0,l.Z)(R,1)[0],M=(0,rn.sE)(null===p||void 0===p?void 0:p.blocks,(function(e){var n=e.type;return h.tf.DATA_EXPORTER===n})),N=(0,f.Db)(an.ZP.blocks.pipelines.useUpdate(null===p||void 0===p?void 0:p.uuid,null===M||void 0===M?void 0:M.uuid),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){null===a||void 0===a||a()},onErrorCallback:function(e,n){return v({errors:n,response:e})}})}}),B=(0,l.Z)(N,1)[0],L=(0,d.useCallback)((function(){return T(null)}),[T]);(0,d.useEffect)((function(){var e,i,r,o=function(e){if(clearTimeout(y.current),S(null),w&&p&&t){var i,r,o=(null===n||void 0===n||null===(i=n.current)||void 0===i||null===(r=i.getBoundingClientRect)||void 0===r?void 0:r.call(i))||{},l=o.width,c=o.x;if(e.pageX>c+l){var u=(null===p||void 0===p?void 0:p.type)===ge.q.INTEGRATION,a=_n(Sn(Sn({},w),{},{path:en(w)}),A,p);null===t||void 0===t||t(a,(function(e){u&&M&&B({block:Sn(Sn({},M),{},{upstream_blocks:[e.uuid]})}),null===g||void 0===g||g(e)}))}}},l=function(e){w&&C({x:e.pageX,y:e.pageY})};return null===(e=document)||void 0===e||e.addEventListener("click",L),null===(i=document)||void 0===i||i.addEventListener("mousemove",l),null===(r=document)||void 0===r||r.addEventListener("mouseup",o),function(){var e,n,t;null===(e=document)||void 0===e||e.removeEventListener("click",L),null===(n=document)||void 0===n||n.removeEventListener("mousemove",l),null===(t=document)||void 0===t||t.removeEventListener("mouseup",o)}}),[t,M,w,L,p,n,A,g,y,B]);var F=(0,d.useMemo)((function(){return r.concat(x).map((function(e){return e.uuid}))}),[r,x]),U=(0,d.useMemo)((function(){return null===s||void 0===s?void 0:s.map((function(e){return(0,d.createElement)(un,Sn(Sn({},j),{},{containerRef:n,file:e,key:e.name,level:0,pipelineBlockUuids:F,setCoordinates:C,setDraggingFile:S,setSelectedFile:T,theme:k,timeout:y}))}))}),[s,F,j,n,k,y]),H=(0,d.useMemo)((function(){return P&&nn(P)}),[P]),z=(0,d.useMemo)((function(){return w&&nn(w)}),[w]),G=(0,d.useMemo)((function(){return P&&"undefined"!==typeof(null===P||void 0===P?void 0:P.children)&&P}),[P]),W=(0,Cn.dd)((function(){return(0,le.jsx)(jn,{fetchFileTree:u,onCancel:Y,selectedFolder:G})}),{},[u,G],{background:!0,uuid:"upload_files"}),Q=(0,l.Z)(W,2),q=Q[0],Y=Q[1],V=(0,Cn.dd)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return(0,le.jsx)(fn,{fetchFileTree:u,file:e,onCancel:J,selectedFolder:G,setErrors:v})}),{},[u,G,v],{background:!0,disableClickOutside:!0,uuid:"new_file"}),K=(0,l.Z)(V,2),X=K[0],J=K[1],$=(0,d.useMemo)((function(){var e;if(!H&&!P&&!G)return(0,le.jsx)("div",{});var t=(null===n||void 0===n||null===(e=n.current)||void 0===e?void 0:e.getBoundingClientRect())||{},i=t.x,r=t.width,l=_||{},u=l.x,a=void 0===u?0:u,s=l.y,d=void 0===s?0:s,f=a;a+Pn>=i+r&&(f=i+r-(Pn+re.iI)),f<0&&(f=0);var p=[];return G?p.push.apply(p,[{label:function(){return"Upload files"},onClick:function(){q()},uuid:"upload_files"},{label:function(){return"New file"},onClick:function(){X({})},uuid:"new_file"}]):H?p.push({label:function(){return"Delete block file"},onClick:function(){H.type===h.tf.CHART?window.confirm("Are you sure you want to delete widget ".concat(H.uuid,"?"))&&c(H):window.confirm("Are you sure you want to delete block ".concat(H.uuid,"?"))&&o(H)},uuid:"delete_block_file"}):P&&p.push.apply(p,[{label:function(){return"Rename file"},onClick:function(){X(P)},uuid:"rename_file"},{label:function(){return"Delete file"},onClick:function(){var e=en(P);window.confirm("Are you sure you want to delete file ".concat(e,"?"))&&D(encodeURIComponent(e))},uuid:"delete_file"}]),(0,le.jsx)("div",{style:{left:f,position:"fixed",top:d+re.iI/2,zIndex:yn.bf+100},children:(0,le.jsx)(m.Z,{items:p,open:!0,parentRef:void 0,uuid:"FileBrowser/ContextMenu",width:Pn})})}),[_,o,D,c,n,q,X,H,P,G]);return(0,le.jsxs)(We.Nk,{ref:n,children:[U,(H||P||G)&&$,z&&(0,le.jsx)("div",{style:{left:(null===_||void 0===_?void 0:_.x)-re.iI,position:"fixed",top:(null===_||void 0===_?void 0:_.y)-re.iI,zIndex:yn.bf+100},children:(0,le.jsx)(xe.ZP,{cursor:"grabbing",monospace:!0,children:null===z||void 0===z?void 0:z.uuid})})]})}!function(e){e.BLOCK_FILE="block_file",e.DISABLED="disabled",e.FILE="file",e.FOLDER="folder",e.PIPELINE="pipeline"}(En||(En={}));var In=d.forwardRef(Tn),An=t(93461),Rn=Te.default.div.withConfig({displayName:"ButtonGroup__ButtonGroupStyle",componentId:"sc-15vbmc8-0"})([""]),Dn=Te.default.div.withConfig({displayName:"ButtonGroup__VerticalDivider",componentId:"sc-15vbmc8-1"})(["width:1px;"]),Mn=function(e){var n=e.children,t=e.divider,i=d.Children.toArray(n).length;return(0,le.jsx)(Rn,{children:(0,le.jsx)(he.Z,{children:d.Children.map(n,(function(e,n){return e&&(0,le.jsxs)(An.Z,{children:[n>=1&&t&&(0,le.jsx)(Dn,{}),d.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))}))})})},Nn=t(57722),Bn=t(82635),Ln=t(33699),Fn=t(94353),Un=t(28799),Hn=t(41150);function zn(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?zn(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):zn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Wn,Qn=function(e){var n,t=e.active,i=e.addNewBlock,r=e.fetchPipeline,o=e.fetchVariables,u=e.filePath,a=e.openSidekickView,p=e.pipeline,m=(e.projectName,e.selectedFilePath),v=e.setFilesTouched,g=e.setSelectedBlock,b=(0,d.useState)(null),x=b[0],j=b[1],y=(0,d.useState)(!1),k=y[0],Z=y[1],_=(0,d.useRef)(null),C=an.ZP.status.list().data,O=null===C||void 0===C||null===(n=C.status)||void 0===n?void 0:n.repo_path,w=an.ZP.file_contents.detail(u).data;(0,d.useEffect)((function(){null!==w&&void 0!==w&&w.file_content&&j(w.file_content)}),[w]);var S=(0,d.useState)(null===x||void 0===x?void 0:x.content),E=S[0],P=S[1],T=(0,d.useState)(!1),I=T[0],A=T[1];(0,d.useEffect)((function(){var e;m&&(null===_||void 0===_||null===(e=_.current)||void 0===e||e.scrollIntoView())}),[m]);var R=(0,f.Db)(an.ZP.file_contents.useUpdate(null===x||void 0===x?void 0:x.path),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){return!0},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})}}),D=(0,l.Z)(R,1)[0],M=(0,d.useCallback)((function(e,n){D({file_content:Gn(Gn({},n),{},{content:e})}).then((function(){decodeURIComponent(u).split("/").pop()===Se.METADATA_YAML&&o()})),v((function(e){return Gn(Gn({},e),{},(0,c.Z)({},null===n||void 0===n?void 0:n.path,!1))})),A(!1)}),[o,u,D]),N=(0,d.useMemo)((function(){return Zn()}),[]),B=(0,d.useMemo)((function(){var e;return null===x||void 0===x||null===(e=x.path.match(N)[0])||void 0===e?void 0:e.split(".")[1]}),[N,x]),L=(0,d.useMemo)((function(){if(null!==x&&void 0!==x&&x.path)return(0,le.jsx)(Nn.Z,{autoHeight:!0,language:He[B],onSave:function(e){M(e,x)},onChange:function(e){P(e),v((function(e){return Gn(Gn({},e),{},(0,c.Z)({},null===x||void 0===x?void 0:x.path,!0))})),A(!0)},selected:!0,textareaFocused:!0,value:(0,oe.Pb)(null===x||void 0===x?void 0:x.content)?JSON.stringify(JSON.parse(null===x||void 0===x?void 0:x.content),null,2):null===x||void 0===x?void 0:x.content,width:"100%"})}),[x,B,M,v]),F=(0,rn.sE)(null===p||void 0===p?void 0:p.blocks,(function(e){var n=e.type;return h.tf.DATA_EXPORTER===n})),U=(0,f.Db)(an.ZP.blocks.pipelines.useUpdate(null===p||void 0===p?void 0:p.uuid,null===F||void 0===F?void 0:F.uuid),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){null===r||void 0===r||r()}})}}),H=(0,l.Z)(U,1)[0],z=(B===we.PY||B===we.SQL||(B===we.YAML||B===we.R)&&tn(x,null===x||void 0===x?void 0:x.path))&&kn(x.path.split("/"))!==h.tf.SCRATCHPAD&&nn(x)&&(0,le.jsx)(de.Z,{onClick:function(){var e=p.type===ge.q.INTEGRATION,n=_n(x,O,p);i(n,(function(n){e&&F&&H({block:Gn(Gn({},F),{},{upstream_blocks:[n.uuid]})}),g(n)}))},primary:!0,children:"Add to current pipeline"}),G=(0,s.ZP)((0,Un.Ib)(),{shouldReconnect:function(){return!0}}),W=G.lastJsonMessage,Q=G.sendMessage;(0,d.useEffect)((function(){if(W){var e=W,n=null===e||void 0===e?void 0:e.execution_state;(null===e||void 0===e?void 0:e.uuid)===Ln.y&&(Bn.uF.BUSY===n?Z(!0):Bn.uF.IDLE===n&&Z(!1))}}),[W,Z]);var q=(0,le.jsx)(be.Z,{m:2,children:(0,le.jsx)(me.ZP,{disabled:!O,inline:!0,loading:k,onClick:function(){a(Re.TERMINAL),Q(JSON.stringify({api_key:Fn.l,code:"!pip install -r ".concat(O,"/requirements.txt"),token:(new se.Z).decodedToken.token,uuid:Ln.y}))},title:O?"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"})}),Y="FileEditor/".concat(null===x||void 0===x?void 0:x.path),V=(0,Hn.y)(),K=V.registerOnKeyDown,X=V.unregisterOnKeyDown;return(0,d.useEffect)((function(){return function(){X(Y)}}),[X,Y]),K(Y,(function(e,n,i){if(t)if((0,_e.y)([ye.zX,ye.Um],n)||(0,_e.y)([ye.PQ,ye.Um],n))e.preventDefault(),M(E,x);else if(I&&(0,_e.y)([ye.zX,ye.hS],n)){e.preventDefault();var r="".concat(x.path," has changes that are unsaved. ")+"Click cancel and save your changes before reloading page.";"undefined"!==typeof location&&window.confirm(r)&&location.reload()}}),[t,E,x,M,I]),(0,le.jsxs)("div",{ref:_,children:[(0,le.jsx)(be.Z,{p:2,children:(0,le.jsxs)(Mn,{children:[z,(0,le.jsx)(de.Z,{disabled:!E,onClick:function(e){e.preventDefault(),M(E,x)},title:E?null:"No changes have been made to this file.",children:"Save file content"})]})}),L,u===Se.REQS_TXT&&q]})},qn=t(64318);!function(e){e.ANDROID="Android",e.CHROME_OS="ChromeOS",e.IOS="iOS",e.LINUX="Linux",e.MAC="macOS",e.WINDOWS="Windows"}(Wn||(Wn={}));var Yn=Wn;function Vn(){return function(){var e,n,t,i,r,o,l,c=Yn.MAC,u=null===(e=window)||void 0===e||null===(n=e.navigator)||void 0===n?void 0:n.userAgent,a=(null===(t=window)||void 0===t||null===(i=t.navigator)||void 0===i||null===(r=i.userAgentData)||void 0===r?void 0:r.platform)||(null===(o=window)||void 0===o||null===(l=o.navigator)||void 0===l?void 0:l.platform);return a?["macOS","Macintosh","MacIntel","MacPPC","Mac68K"].includes(a)?c=Yn.MAC:["Win32","Win64","Windows","WinCE"].includes(a)?c=Yn.WINDOWS:["iPhone","iPad","iPod"].includes(a)&&(c=Yn.IOS):u&&(u.includes("Macintosh")?c=Yn.MAC:u.includes("Windows")?c=Yn.WINDOWS:u.includes("Linux")&&u.includes("X11")?c=Yn.LINUX:/(iPhone|iPad)/.test(u)?c=Yn.IOS:u.includes("Android")&&u.includes("Mobi")?c=Yn.ANDROID:u.includes("CrOS")&&(c=Yn.CHROME_OS)),c}()===Yn.MAC}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 Xn(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,c.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 Jn=function(e){var n=e.cancelPipeline,t=e.createPipeline,i=e.executePipeline,r=e.interruptKernel,o=e.isPipelineExecuting,l=e.restartKernel,u=e.savePipelineContent,a=e.setMessages,s=(0,d.useState)(null),f=s[0],p=s[1],h=(0,d.useRef)(null),v=(0,d.useRef)(null),g=[{label:function(){return"New standard pipeline"},onClick:function(){return t({pipeline:{name:(0,oe.Y6)()}})},uuid:"new_standard_pipeline"},{label:function(){return"New streaming pipeline"},onClick:function(){return t({pipeline:{name:(0,oe.Y6)(),type:ge.q.STREAMING}})},uuid:"new_streaming_pipeline"},{label:function(){return"Save pipeline"},keyTextGroups:[[Vn()?ye.RJ:ye.hE,ye.SS]],onClick:function(){return u()},uuid:"save_pipeline"}],b=(0,d.useMemo)((function(){var e=[{label:function(){return"Interrupt kernel"},keyTextGroups:[[ye.kA],[ye.kA]],onClick:function(){return r()},uuid:"Interrupt kernel"},{label:function(){return"Restart kernel"},keyTextGroups:[[ye.t_[ye.OC]],[ye.t_[ye.OC]]],onClick:function(){return l()},uuid:"Restart kernel"},{label:function(){return"Clear all outputs"},onClick:function(){return a((function(e){return Object.keys(e).reduce((function(e,n){return Xn(Xn({},e),{},(0,c.Z)({},n,[]))}),{})}))},uuid:"Clear all outputs"}];return o?e.push({label:function(){return"Cancel pipeline"},onClick:function(){return n()},uuid:"Cancel pipeline"}):e.push({label:function(){return"Execute pipeline"},onClick:function(){return i()},uuid:"Execute pipeline"}),e}),[o]),x="FileHeaderMenu/index",j=(0,Hn.y)(),y=j.registerOnKeyDown,k=j.unregisterOnKeyDown;return(0,d.useEffect)((function(){return function(){k(x)}}),[k,x]),y(x,(function(e,n,t){null!==f&&(n[ye.QK]?p((function(e){return 0===e?1:e-1})):n[ye.DY]&&p((function(e){return 1===e?0:e+1})))}),[f,p]),(0,le.jsx)(fe.Z,{onClickOutside:function(){return p(null)},open:!0,style:{position:"relative"},children:(0,le.jsxs)(he.Z,{children:[(0,le.jsxs)("div",{style:{position:"relative"},children:[(0,le.jsx)(qn.u,{highlighted:0===f,onClick:function(){return p((function(e){return 0===e?null:0}))},onMouseEnter:function(){return p((function(e){return null!==e?0:null}))},ref:h,children:(0,le.jsx)(xe.ZP,{children:"File"})}),(0,le.jsx)(m.Z,{items:g,onClickCallback:function(){return p(null)},open:0===f,parentRef:h,uuid:"FileHeaderMenu/file_items"})]}),(0,le.jsxs)("div",{style:{position:"relative"},children:[(0,le.jsx)(qn.u,{highlighted:1===f,onClick:function(){return p((function(e){return 1===e?null:1}))},onMouseEnter:function(){return p((function(e){return null!==e?1:null}))},ref:v,children:(0,le.jsx)(xe.ZP,{children:"Run"})}),(0,le.jsx)(m.Z,{items:b,onClickCallback:function(){return p(null)},open:1===f,parentRef:v,uuid:"FileHeaderMenu/run_items"})]})]})})},$n=t(10919),et=t(46261),nt=t(82386),tt=t(37391),it=300,rt=Te.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;}"],it,it),ot=Te.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||vn.Z.background).codeArea,";\n ")})),lt=Te.default.div.withConfig({displayName:"indexstyle__PipelineHeaderStyle",componentId:"sc-1sv9513-2"})(["height:","px;position:sticky;top:","px;width:100%;z-index:5;"," "," "," ",""],nt.Wi,nt.Wi,(function(e){return"\n background-color: ".concat((e.theme.background||vn.Z.background).panel,";\n border-bottom: 1px solid ").concat((e.theme.borders||vn.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(nt.Wi,"px;\n overflow-x: auto;\n z-index: 3;\n ")}),(0,tt.y$)()),ct=Te.default.div.withConfig({displayName:"indexstyle__FileTabStyle",componentId:"sc-1sv9513-3"})(["border-left:1px solid transparent;height:100%;padding:","px ","px;"," "," "," ",""],re.iI,re.cd*re.iI,(function(e){return"\n &:hover {\n cursor: default;\n\n p {\n color: ".concat((e.theme.content||vn.Z.content).active," !important;\n cursor: default;\n }\n }\n ")}),(function(e){return e.selected&&"\n background-color: ".concat((e.theme.interactive||vn.Z.interactive).hoverBackground,";\n ")}),(function(e){return!e.selected&&"\n border-color: ".concat((e.theme.borders||vn.Z.borders).light," !important;\n ")}),(function(e){return e.last&&"\n border-right: 1px solid transparent;\n "})),ut=t(33766);var at,st,dt=function(e){var n=e.filePaths,t=e.filesTouched,i=e.savePipelineContent,r=e.selectedFilePath,o=(0,d.useContext)(Te.ThemeContext),l=(0,d.useMemo)((function(){return n.map((function(e){return decodeURIComponent(e)}))}),[n]);return(0,le.jsx)(lt,{relativePosition:!0,secondary:!0,children:(0,le.jsx)(he.Z,{alignItems:"center",justifyContent:"flex-start",children:null===l||void 0===l?void 0:l.map((function(e,n){var c=r===encodeURIComponent(e);return(0,le.jsx)(he.Z,{flexDirection:"column",fullHeight:!0,onClick:function(n){n.preventDefault(),c||(i(),(0,ut.u)({file_path:encodeURIComponent(e)}))},children:(0,le.jsx)(ct,{last:n===l.length-1,selected:c,children:(0,le.jsxs)(he.Z,{alignItems:"center",fullHeight:!0,children:[!t[e]&&(0,le.jsx)(Ge.iU,{muted:!c,size:1.5*re.iI}),t[e]&&(0,le.jsx)(et.Z,{label:"Unsaved changes",size:null,widthFitContent:!0,children:(0,le.jsx)("div",{style:{padding:1},children:(0,le.jsx)(Ie.Z,{borderColor:(o||vn.Z).borders.danger,size:1.25*re.iI})})}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsx)(xe.ZP,{muted:!c,children:e}),(0,le.jsx)(be.Z,{mr:2}),c&&(0,le.jsx)(et.Z,{appearAbove:!0,label:"Close",size:null,widthFitContent:!0,children:(0,le.jsx)($n.Z,{autoHeight:!0,block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){var n=(0,rn.Od)(l,(function(n){return n===e})).map((function(e){return encodeURIComponent(e)}));(0,ut.u)({file_path:n[n.length-1]||null,"file_paths[]":n},{pushHistory:!0})},preventDefault:!0,children:(0,le.jsx)(Ge.x8,{size:1.25*re.iI})})}),!c&&(0,le.jsx)("div",{style:{width:1.25*re.iI}})]})})},e)}))})})},ft=t(57384);!function(e){e.CREATE_NEW_CLUSTER="create_new_cluster",e.SET_ACTIVE_CLUSTER="set_active_cluster"}(at||(at={})),function(e){e.BOOTSTRAPPING="BOOTSTRAPPING",e.STARTING="STARTING",e.WAITING="WAITING"}(st||(st={}));var pt=t(90686),ht=["bold","defaultColor","description","disableWordBreak","inputValue","inputWidth","invertedTheme","label","labelColor","menuOpen","monospace","muted","onClick","notRequired","selectedTextProps","small","stacked","tooltipProps","value"];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 vt(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,c.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 gt=Te.default.div.withConfig({displayName:"LabelWithValueClicker__LabelStyle",componentId:"sc-1hzpn4h-0"})(["margin-bottom:","px;"],.25*re.iI),bt=Te.default.div.withConfig({displayName:"LabelWithValueClicker__DescriptionStyle",componentId:"sc-1hzpn4h-1"})([""]);var xt,jt=function(e){var n=e.bold,t=void 0===n||n,i=e.defaultColor,r=e.description,o=e.disableWordBreak,l=e.inputValue,c=e.inputWidth,u=e.invertedTheme,a=e.label,s=e.labelColor,f=e.menuOpen,p=void 0!==f&&f,h=e.monospace,m=e.muted,v=e.onClick,g=e.notRequired,b=e.selectedTextProps,x=e.small,j=e.stacked,y=e.tooltipProps,k=e.value,Z=(0,Pe.Z)(e,ht),_=(0,d.useRef)(null),C=(0,d.useState)(!1),O=C[0],w=C[1],S=(0,d.useState)(!1),E=S[0],P=S[1],T=a&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(xe.ZP,{bold:t,color:s,inverted:u,lineHeight:20,monospace:h,muted:m,small:x,children:a}),y&&(0,le.jsx)(be.Z,{ml:1,children:(0,le.jsx)(et.Z,vt({muted:!0},y))})]}),I=(0,le.jsxs)(le.Fragment,{children:[k&&(0,le.jsx)($n.Z,{block:!0,danger:null===b||void 0===b?void 0:b.danger,fullWidth:!0,muted:m,onClick:function(){v(),_.current&&_.current.focus(),w(!0)},preventDefault:!0,sameColorAsText:m||!(null!==b&&void 0!==b&&b.primary)&&!(null!==b&&void 0!==b&&b.danger)&&!(null!==b&&void 0!==b&&b.warning),underline:null===b||void 0===b?void 0:b.underline,warning:null===b||void 0===b?void 0:b.warning,children:(0,le.jsx)(xe.ZP,vt(vt({inverted:u,muted:m},b),{},{disableWordBreak:o,monospace:h,small:x,width:c,children:k}))}),(0,le.jsx)(je.Z,vt(vt({},Z),{},{basic:!0,defaultColor:i,invertedTheme:u,monospace:h,onBlur:function(e){w(!1),Z.onBlur&&Z.onBlur(e),E||P(!0)},onFocus:function(e){w(!0),Z.onFocus&&Z.onFocus(e)},ref:_,small:x,value:l,visible:!k}))]}),A=r&&(0,le.jsx)(bt,{children:(0,le.jsx)(xe.ZP,{dangerouslySetInnerHTML:{__html:r},monospace:h,muted:!0,small:x})});return(0,le.jsxs)(le.Fragment,{children:[j&&(0,le.jsxs)(le.Fragment,{children:[T&&(0,le.jsxs)(gt,{children:[(0,le.jsx)(he.Z,{alignItems:"center",fullHeight:!1,fullWidth:!0,children:T}),A]}),I]}),!j&&(0,le.jsxs)(he.Z,{alignItems:"center",fullWidth:!0,children:[T&&(0,le.jsxs)(le.Fragment,{children:[T,(0,le.jsx)(be.Z,{ml:1})]}),(0,le.jsx)(An.Z,{flex:"1",children:I})]}),E&&!O&&!k&&!p&&!g&&(0,le.jsx)(xe.ZP,{danger:!0,small:x,children:"This field is required."})]})};!function(e){e.EMR="emr"}(xt||(xt={}));var yt=t(42305);var kt=function(e){e.filePaths,e.filesTouched;var n,t=e.isBusy,i=e.isPipelineUpdating,r=e.kernel,c=e.pipeline,u=e.pipelineContentTouched,a=e.pipelineLastSaved,s=(e.restartKernel,e.savePipelineContent,e.selectedFilePath),p=e.setErrors,h=e.updatePipelineMetadata,v=(0,d.useContext)(Te.ThemeContext),g=r||{},b=g.alive,x=(g.name,(0,d.useState)(!1)),j=x[0],y=x[1],k=(0,d.useState)(""),Z=k[0],_=k[1],C=(0,d.useState)(xt.EMR),O=C[0],w=(C[1],(0,d.useState)(!1)),S=w[0],E=w[1],P=(0,d.useState)(!1),T=P[0],I=P[1],A=(0,d.useRef)(null),R=an.ZP.clusters.detail(O),D=R.data,M=R.mutate,N=(0,d.useMemo)((function(){var e;return(null===D||void 0===D||null===(e=D.cluster)||void 0===e?void 0:e.clusters)||[]}),D),B=(0,rn.sE)(N,(function(e){return e.is_active})),L=(0,f.Db)(an.ZP.clusters.useUpdate(O),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(e){M()},onErrorCallback:function(e,n){return p({errors:n,response:e})}})}}),F=(0,l.Z)(L,2),U=F[0];F[1].isLoading,(0,d.useEffect)((function(){null!==c&&void 0!==c&&c.uuid&&_(c.uuid)}),[null===c||void 0===c?void 0:c.uuid]),n=u?"Unsaved changes":i?"Saving changes...":a?"Last saved ".concat((0,yt.JX)(Number(a)/1e3)):"All changes saved";var H="KernelStatus",z=(0,Hn.y)(),G=z.registerOnKeyDown,W=z.unregisterOnKeyDown;(0,d.useEffect)((function(){return function(){W(H)}}),[W,H]),G(H,(function(e,n,t){j&&String(t[0])===String(ye.Uq)&&String(t[1])!==String(ye.zX)&&((null===c||void 0===c?void 0:c.uuid)===Z?e.target.blur():(h(Z),y(!1)))}),[j,Z,y,h]);var Q=(0,d.useMemo)((function(){return(0,le.jsx)(jt,{bold:!1,inputValue:Z,notRequired:!0,onBlur:function(){return setTimeout((function(){return y(!1)}),300)},onChange:function(e){_(e.target.value),e.preventDefault()},onClick:function(){return y(!0)},onFocus:function(){return y(!0)},stacked:!0,value:j?null:(null===c||void 0===c?void 0:c.uuid)||""})}),[j,Z,c]),q=(0,d.useMemo)((function(){return(0,le.jsx)("div",{ref:A,style:{position:"relative"},children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(null===c||void 0===c?void 0:c.type)===ge.q.PYSPARK&&(0,le.jsxs)(be.Z,{mr:1,children:[(0,le.jsxs)($n.Z,{muted:!!B,onClick:function(){return E(!0)},preventDefault:!0,sameColorAsText:!B,underline:!B,children:[B&&B.id,!B&&"Select cluster"]}),(0,le.jsx)(fe.Z,{disableEscape:!0,onClickOutside:function(){return E(!1)},open:S,children:(0,le.jsx)(m.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select cluster"},uuid:"select_cluster"}].concat((0,o.Z)(N.map((function(e){var n=e.id,t=e.is_active,i=e.status;return{label:function(){return(0,le.jsxs)(he.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,le.jsx)(An.Z,{flex:1,children:(0,le.jsx)(xe.ZP,{muted:!t&&st.WAITING!==i,children:n})}),t&&(0,le.jsx)(Ge.Jr,{size:2*re.iI,success:!0}),!t&&(0,le.jsx)(xe.ZP,{monospace:!0,muted:!0,children:i})]})},onClick:t||st.WAITING!==i?null:function(){return U({cluster:{id:n,is_active:!0}})},uuid:n}})))),onClickCallback:function(){return E(!1)},open:S,parentRef:A,uuid:"KernelStatus/select_cluster",width:40*re.iI})})]}),(0,le.jsx)(me.ZP,{beforeElement:(0,le.jsx)(Ie.Z,{color:t?(v||vn.Z).borders.info:b?(v||vn.Z).borders.success:(v||vn.Z).borders.danger,size:re.iI}),blackBorder:!0,compact:!0,inline:!0,onClick:function(){return I(!0)},uuid:"Pipeline/KernelStatus/kernel",children:(null===c||void 0===c?void 0:c.type)||ge.q.PYTHON}),(0,le.jsx)(fe.Z,{disableEscape:!0,onClickOutside:function(){return I(!1)},open:T,children:(0,le.jsx)(m.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select kernel"},uuid:"select_kernel"}].concat((0,o.Z)(Object.keys(ge.a).filter((function(e){return(null===c||void 0===c?void 0:c.type)!=e})).map((function(e){return{label:function(){return e},onClick:function(){return h(null===c||void 0===c?void 0:c.name,e)},uuid:e}})))),onClickCallback:function(){return I(!1)},open:T,parentRef:A,uuid:"KernelStatus/select_kernel",width:25*re.iI})})]})})}),[b,N,t,c,B,E,I,S,T,v,U]),Y=(0,d.useMemo)((function(){return(0,le.jsxs)(An.Z,{alignItems:"center",children:[(0,le.jsxs)(xe.ZP,{children:["Pipeline:\xa0",s&&(null===c||void 0===c?void 0:c.uuid)]}),!s&&Q,(0,le.jsx)(be.Z,{mr:3})]})}),[b,t,c,Q,s,v]);return(0,le.jsx)(lt,{relativePosition:!0,children:(0,le.jsxs)(he.Z,{alignItems:"center",fullHeight:!0,justifyContent:"space-between",children:[(0,le.jsx)(he.Z,{alignItems:"center",fullHeight:!0,justifyContent:"flex-start",children:(0,le.jsxs)(be.Z,{px:re.cd,children:[s&&(0,le.jsx)($n.Z,{noHoverUnderline:!0,noOutline:!0,onClick:s?function(){return(0,ut.u)({file_path:null})}:null,preventDefault:!0,children:Y}),!s&&(0,le.jsxs)(he.Z,{alignItems:"center",children:[Y,j&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(be.Z,{ml:1}),(0,le.jsx)($n.Z,{onClick:function(){h(Z),y(!1)},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]})]})}),(0,le.jsx)(be.Z,{px:re.cd,children:(0,le.jsxs)(An.Z,{alignItems:"center",children:[q,(0,le.jsx)(be.Z,{ml:2}),(0,le.jsx)(et.Z,{appearBefore:!0,block:!0,description:(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(xe.ZP,{default:!0,inline:!0,children:"Press"}),"\xa0",(0,le.jsx)(pt.Z,{inline:!0,keyText:Vn()?ye.RJ:ye.hE}),"\xa0",(0,le.jsx)(xe.ZP,{default:!0,inline:!0,children:"+"}),"\xa0",(0,le.jsx)(pt.Z,{inline:!0,keyText:ye.SS}),"\xa0",(0,le.jsx)(xe.ZP,{default:!0,inline:!0,children:"to save changes."}),(0,le.jsx)("br",{})]}),(0,le.jsx)(be.Z,{mt:1,children:(0,le.jsxs)(xe.ZP,{default:!0,children:["Or, go to ",(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,children:"File"})," \u203a ",(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,children:"Save pipeline"}),"."]})})]}),size:null,widthFitContent:!0,children:(0,le.jsx)(xe.ZP,{muted:!0,children:n})})]})})]})})},Zt=t(16910);var _t,Ct,Ot,wt,St,Et,Pt=function(e){var n=e.size;return(0,le.jsx)("svg",{fill:"none",height:n,preserveAspectRatio:"xMidYMid",viewBox:"0 0 256 256",width:n,xmlns:"http://www.w3.org/2000/svg",children:(0,le.jsx)("path",{d:"M245.121138,10.6473813 C251.139129,16.4340053 255.074133,24.0723342 256,32.4050489 C256,35.8769778 255.074133,38.1917867 252.990862,42.5895822 C250.907876,46.9873778 225.215147,91.4286933 217.57696,103.696213 C213.179164,110.871609 210.864356,119.435947 210.864356,127.768462 C210.864356,136.3328 213.179164,144.6656 217.57696,151.840996 C225.215147,164.108516 250.907876,208.781084 252.990862,213.179164 C255.074133,217.57696 256,219.659947 256,223.131876 C255.074133,231.464676 251.370667,239.103147 245.352676,244.658347 C239.565938,250.676338 231.927751,254.611342 223.826489,255.305671 C220.35456,255.305671 218.039751,254.379804 213.873493,252.296533 C209.706951,250.213262 164.340053,225.215147 152.072249,217.57696 C151.146382,217.113884 150.220516,216.419556 149.063396,215.95648 L88.4195556,180.079502 C89.8082133,191.652693 94.9006222,202.763093 103.233138,210.864356 C104.853618,212.484551 106.473813,213.873493 108.325547,215.262151 C106.936604,215.95648 105.316409,216.651093 103.927751,217.57696 C91.6599467,225.215147 46.9873778,250.907876 42.5895822,252.990862 C38.1917867,255.074133 36.1085156,256 32.4050489,256 C24.0723342,255.074133 16.4340053,251.370667 10.8788338,245.352676 C4.86075733,239.565938 0.925858133,231.927751 0,223.594951 C0.231464676,220.123022 1.1573248,216.651093 3.00905244,213.641956 C5.09223822,209.24416 30.7848533,164.571307 38.42304,152.303787 C42.82112,145.128391 45.1356444,136.795591 45.1356444,128.231538 C45.1356444,119.6672 42.82112,111.3344 38.42304,104.159004 C30.7848533,91.4286933 4.86075733,46.75584 3.00905244,42.3580444 C1.1573248,39.3489067 0.231464676,35.8769778 0,32.4050489 C0.925858133,24.0723342 4.62930489,16.4340053 10.6473813,10.6473813 C16.4340053,4.62930489 24.0723342,0.925858133 32.4050489,0 C35.8769778,0.231464676 39.3489067,1.1573248 42.5895822,3.00905244 C46.2930489,4.62930489 78.9293511,23.6094009 96.28928,33.7939911 L100.224284,36.1085156 C101.612942,37.0343822 102.770347,37.7287111 103.696213,38.1917867 L105.547947,39.3489067 L167.348907,75.9204978 C165.960249,62.0324978 158.784853,49.3019022 147.674453,40.7378489 C149.063396,40.04352 150.683591,39.3489067 152.072249,38.42304 C164.340053,30.7848533 209.012622,4.86075733 213.410418,3.00905244 C216.419556,1.1573248 219.891484,0.231464676 223.594951,0 C231.696213,0.925858133 239.334684,4.62930489 245.121138,10.6473813 Z M131.240391,144.434062 L144.434062,131.240391 C146.285796,129.388658 146.285796,126.611342 144.434062,124.759609 L131.240391,111.565938 C129.388658,109.714204 126.611342,109.714204 124.759609,111.565938 L111.565938,124.759609 C109.714204,126.611342 109.714204,129.388658 111.565938,131.240391 L124.759609,144.434062 C126.379804,146.054258 129.388658,146.054258 131.240391,144.434062 Z",fill:"#FF694A"})})},Tt=t(30264),It=t(80906),At=re.cd*re.iI,Rt=Te.default.div.withConfig({displayName:"indexstyle__IconContainerStyle",componentId:"sc-oyfjzc-0"})(["align-items:center;border-radius:","px;border:1px solid transparent;display:flex;justify-content:center;"," "," "," "," "," ",""],gn.BG,(function(e){return e.border&&"\n border: 1px dotted ".concat((e.theme.content||vn.Z.content).active,";\n ")}),(function(e){return e.blue&&"\n background-color: ".concat((0,Xe.qn)(h.tf.DATA_LOADER,e).accent,";\n ")}),(function(e){return e.purple&&"\n background-color: ".concat((0,Xe.qn)(h.tf.TRANSFORMER,e).accent,";\n ")}),(function(e){return e.yellow&&"\n background-color: ".concat((0,Xe.qn)(h.tf.DATA_EXPORTER,e).accent,";\n ")}),(function(e){return!e.compact&&"\n height: ".concat(At+re.iI/2,"px;\n width: ").concat(At+re.iI/2,"px;\n ")}),(function(e){return e.compact&&"\n height: ".concat(At/2+re.iI,"px;\n width: ").concat(At/2+re.iI,"px;\n ")})),Dt=Te.default.div.withConfig({displayName:"indexstyle__ButtonWrapper",componentId:"sc-oyfjzc-1"})(["position:relative;margin-bottom:","px;margin-right:","px;",""],re.iI,re.iI,(function(e){return e.increasedZIndex&&"\n z-index: 3;\n "})),Mt=(It.Q0.AVERAGE,It.Q0.CLEAN_COLUMN_NAME,It.Q0.COUNT,It.Q0.COUNT_DISTINCT,It.Q0.CUSTOM,It.Q0.DIFF,It.Q0.FIRST,It.Q0.FIX_SYNTAX_ERRORS,It.Q0.IMPUTE,It.Q0.LAST,It.Q0.MAX,It.Q0.MEDIAN,It.Q0.MIN,It.Q0.NORMALIZE,It.Q0.REFORMAT,It.Q0.REMOVE,It.Q0.REMOVE_OUTLIERS,It.Q0.SELECT,It.Q0.SHIFT_DOWN,It.Q0.SHIFT_UP,It.Q0.STANDARDIZE,It.Q0.SUM,[It.Q0.DROP_DUPLICATE,It.Q0.FILTER,It.Q0.SORT,It.Q0.REMOVE]);!function(e){e.AGGREGATE="Aggregate",e.FORMATTING="Formatting",e.COLUMN_REMOVAL="Column removal",e.SHIFT_ROWS="Shift rows in a column",e.MISC="Miscellaneous",e.FEATURE_SCALING="Feature Scaling"}(Et||(Et={}));var Nt,Bt,Lt,Ft=(Ct={},(0,c.Z)(Ct,It.qs.COLUMN,(_t={},(0,c.Z)(_t,Et.AGGREGATE,[It.Q0.AVERAGE,It.Q0.COUNT,It.Q0.COUNT_DISTINCT,It.Q0.FIRST,It.Q0.LAST,It.Q0.MAX,It.Q0.MEDIAN,It.Q0.MIN,It.Q0.SUM]),(0,c.Z)(_t,Et.FORMATTING,[It.Q0.CLEAN_COLUMN_NAME,It.Q0.FIX_SYNTAX_ERRORS,It.Q0.REFORMAT]),(0,c.Z)(_t,Et.COLUMN_REMOVAL,[It.Q0.REMOVE,It.Q0.SELECT]),(0,c.Z)(_t,Et.SHIFT_ROWS,[It.Q0.SHIFT_DOWN,It.Q0.SHIFT_UP]),(0,c.Z)(_t,Et.MISC,[It.Q0.DIFF,It.Q0.IMPUTE,It.Q0.REMOVE_OUTLIERS]),(0,c.Z)(_t,Et.FEATURE_SCALING,[It.Q0.NORMALIZE,It.Q0.STANDARDIZE]),_t)),(0,c.Z)(Ct,It.qs.ROW,(0,c.Z)({},Et.MISC,[].concat(Mt))),Ct),Ut=Object.keys(Ft[It.qs.COLUMN]),Ht=[Et.MISC],zt=(St={},(0,c.Z)(St,It.qs.COLUMN,(Ot={},(0,c.Z)(Ot,It.Q0.ADD,"Add column"),(0,c.Z)(Ot,It.Q0.AVERAGE,"Aggregate by average value"),(0,c.Z)(Ot,It.Q0.CLEAN_COLUMN_NAME,"Clean column name"),(0,c.Z)(Ot,It.Q0.COUNT_DISTINCT,"Aggregate by distinct count"),(0,c.Z)(Ot,It.Q0.COUNT,"Aggregate by total count"),(0,c.Z)(Ot,It.Q0.DIFF,"Difference"),(0,c.Z)(Ot,It.Q0.FIRST,"Aggregate by first value"),(0,c.Z)(Ot,It.Q0.FIX_SYNTAX_ERRORS,"Fix syntax errors"),(0,c.Z)(Ot,It.Q0.IMPUTE,"Fill in missing values"),(0,c.Z)(Ot,It.Q0.NORMALIZE,"Normalize Data"),(0,c.Z)(Ot,It.Q0.STANDARDIZE,"Standardize Data"),(0,c.Z)(Ot,It.Q0.LAST,"Aggregate by last value"),(0,c.Z)(Ot,It.Q0.MAX,"Aggregate by maximum value"),(0,c.Z)(Ot,It.Q0.MEDIAN,"Aggregate by median value"),(0,c.Z)(Ot,It.Q0.MIN,"Aggregate by mininum value"),(0,c.Z)(Ot,It.Q0.REFORMAT,"Reformat"),(0,c.Z)(Ot,It.Q0.REMOVE_OUTLIERS,"Remove outliers"),(0,c.Z)(Ot,It.Q0.REMOVE,"Remove column(s)"),(0,c.Z)(Ot,It.Q0.SELECT,"Keep columns"),(0,c.Z)(Ot,It.Q0.SHIFT_DOWN,"Shift rows down in a column"),(0,c.Z)(Ot,It.Q0.SHIFT_UP,"Shift rows up in a column"),(0,c.Z)(Ot,It.Q0.SUM,"Aggregate by sum of values"),Ot)),(0,c.Z)(St,It.qs.ROW,(wt={},(0,c.Z)(wt,It.Q0.DROP_DUPLICATE,"Drop duplicates"),(0,c.Z)(wt,It.Q0.FILTER,"Filter"),(0,c.Z)(wt,It.Q0.SORT,"Sort"),(0,c.Z)(wt,It.Q0.REMOVE,"Remove rows"),wt)),St);!function(e){e.API="api",e.AZURE_BLOB_STORAGE="azure_blob_storage",e.AZURE_EVENT_HUB="azure_event_hub",e.BIGQUERY="bigquery",e.FILE="file",e.GENERIC="generic",e.GOOGLE_CLOUD_STORAGE="google_cloud_storage",e.KAFKA="kafka",e.KINESIS="kinesis",e.MYSQL="mysql",e.OPENSEARCH="opensearch",e.POSTGRES="postgres",e.RABBITMQ="rabbitmq",e.REDSHIFT="redshift",e.S3="s3",e.SNOWFLAKE="snowflake"}(Lt||(Lt={}));var Gt=(Nt={},(0,c.Z)(Nt,Lt.API,"API"),(0,c.Z)(Nt,Lt.AZURE_BLOB_STORAGE,"Azure Blob Storage"),(0,c.Z)(Nt,Lt.AZURE_EVENT_HUB,"Azure Event Hub"),(0,c.Z)(Nt,Lt.BIGQUERY,"Google BigQuery"),(0,c.Z)(Nt,Lt.FILE,"Local file"),(0,c.Z)(Nt,Lt.GENERIC,"Generic (no template)"),(0,c.Z)(Nt,Lt.GOOGLE_CLOUD_STORAGE,"Google Cloud Storage"),(0,c.Z)(Nt,Lt.KAFKA,"Kafka"),(0,c.Z)(Nt,Lt.KINESIS,"Kinesis"),(0,c.Z)(Nt,Lt.MYSQL,"MySQL"),(0,c.Z)(Nt,Lt.OPENSEARCH,"OpenSearch"),(0,c.Z)(Nt,Lt.POSTGRES,"PostgreSQL"),(0,c.Z)(Nt,Lt.RABBITMQ,"RabbitMQ"),(0,c.Z)(Nt,Lt.REDSHIFT,"Amazon Redshift"),(0,c.Z)(Nt,Lt.S3,"Amazon S3"),(0,c.Z)(Nt,Lt.SNOWFLAKE,"Snowflake"),Nt),Wt=(Bt={},(0,c.Z)(Bt,h.tf.DATA_LOADER,[Lt.GENERIC,Lt.FILE,Lt.API,Lt.AZURE_BLOB_STORAGE,Lt.BIGQUERY,Lt.GOOGLE_CLOUD_STORAGE,Lt.MYSQL,Lt.POSTGRES,Lt.RABBITMQ,Lt.REDSHIFT,Lt.S3,Lt.SNOWFLAKE]),(0,c.Z)(Bt,h.tf.DATA_EXPORTER,[Lt.GENERIC,Lt.FILE,Lt.AZURE_BLOB_STORAGE,Lt.BIGQUERY,Lt.GOOGLE_CLOUD_STORAGE,Lt.MYSQL,Lt.POSTGRES,Lt.REDSHIFT,Lt.S3,Lt.SNOWFLAKE]),(0,c.Z)(Bt,h.tf.TRANSFORMER,[Lt.BIGQUERY,Lt.POSTGRES,Lt.REDSHIFT,Lt.SNOWFLAKE]),Bt),Qt=Lt,qt=function(e,n,t){var i=t===ge.q.STREAMING&&(e===h.tf.DATA_LOADER||e===h.tf.DATA_EXPORTER);return function(e){var n;return e===ge.q.STREAMING?(n={},(0,c.Z)(n,h.tf.DATA_LOADER,[Qt.AZURE_EVENT_HUB,Qt.KAFKA,Qt.KINESIS,Qt.RABBITMQ]),(0,c.Z)(n,h.tf.DATA_EXPORTER,[Qt.KINESIS,Qt.OPENSEARCH]),(0,c.Z)(n,h.tf.TRANSFORMER,[Qt.GENERIC]),n):Wt}(t)[e].map((function(t){return{indent:e===h.tf.TRANSFORMER,label:function(){return Gt[t]},onClick:function(){n({config:{data_source:t===Qt.GENERIC?null:t},language:i?h.t6.YAML:h.t6.PYTHON,type:e})},uuid:"".concat(e,"/").concat(t)}}))},Yt=function(e,n){return[{label:function(){return"SQL"},onClick:function(){return e({language:h.t6.SQL,type:n})},uuid:"".concat(n,"/sql")},{label:function(){return"R"},onClick:function(){return e({language:h.t6.R,type:n})},uuid:"".concat(n,"/r")}]},Vt=function(e,n,t){var i=Object.fromEntries(h.Ut.map((function(n){return[n,qt(n,e,t)]})));return t===ge.q.PYSPARK||t===ge.q.PYTHON&&n===h.tf.TRANSFORMER||t===ge.q.STREAMING?i[n]:[{items:i[n],label:function(){return"Python"},uuid:"".concat(n,"/python")}].concat((0,o.Z)(Yt(e,n)))};function Kt(e,n,t){return e.map((function(e){return{indent:!0,label:function(){return zt[n][e]},onClick:function(){t({config:{action_type:e,axis:n},language:h.t6.PYTHON,type:h.tf.TRANSFORMER})},uuid:"".concat(n,"_").concat(e)}})).sort((function(e,n){return e.label().localeCompare(n.label())}))}function Xt(e,n,t){var i=[];return e.forEach((function(e){if(e!==Et.MISC)i.push({indent:!0,items:Kt(Ft[n][e],n,t),label:function(){return e},uuid:"".concat(n,"_grouping_").concat((0,oe.RA)(e))});else{var r=Kt(Ft[n][e],n,t);i.push.apply(i,(0,o.Z)(r))}})),i}var Jt=function(e,n,t){return Object.values(h.Lq).map((function(i){return{label:function(){return(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(Ge.mm,{fill:(0,Xe.qn)(h.tf.CUSTOM,{blockColor:i}).accent,size:16}),"\xa0",(0,le.jsx)(xe.ZP,{children:(0,oe.kC)(i)})]})},onClick:function(){e({color:i,language:t,type:n})},uuid:"".concat(t,"_").concat(i)}}))},$t=function(e){return"-- Docs: https://docs.mage.ai/guides/sql-blocks\n"+(e||"")};function ei(e,n){var t=n;return h.tf.SCRATCHPAD===e.type&&(t='"""\nNOTE: Scratchpad blocks are used only for experimentation and testing out code.\nThe code written here will not be executed as part of the pipeline.\n"""\n'+(n||"")),t}function ni(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ti(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ni(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ni(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ii=function(e){var n=e.addNewBlock,t=e.blockIdx,i=e.compact,r=e.hideCustom,l=e.hideDataExporter,c=(e.hideDataLoader,e.hideDbt),u=(e.hideRecommendations,e.hideScratchpad),a=e.hideSensor,s=e.hideTransformer,f=e.hideTransformerDataSources,p=e.onClickAddSingleDBTModel,m=e.pipeline,v=e.setAddNewBlockMenuOpenIdx,g=e.setCreatingNewDBTModel,b=(e.setRecsWindowOpenBlockIdx,(0,d.useState)(null)),x=b[0],j=b[1],y=(0,d.useRef)(null),k=(0,d.useRef)(null),Z=(0,d.useRef)(null),_=(0,d.useRef)(null),C=(0,d.useRef)(null),O={compact:i,inline:!0},w=null===m||void 0===m?void 0:m.type,S=w===ge.q.STREAMING,E=i?At/2:At,P=25*re.iI,T=Xt(Ut,It.qs.COLUMN,n),I=[{label:function(){return"Generic (no template)"},onClick:function(){n({language:h.t6.PYTHON,type:h.tf.TRANSFORMER})},uuid:"generic_transformer_action"},{bold:!0,items:Xt(Ht,It.qs.ROW,n),label:function(){return"Row actions"},uuid:"row_actions_grouping"},{isGroupingTitle:!0,label:function(){return"Column actions"},uuid:"column_actions_grouping"}].concat((0,o.Z)(T));f||I.splice(1,0,{bold:!0,items:Vt(n,h.tf.TRANSFORMER,w),label:function(){return"Data sources"},uuid:"data_sources_grouping"});var A=(0,d.useCallback)((function(){return j(null)}),[]),R=(0,d.useCallback)((function(e){return null===v||void 0===v?void 0:v((function(n){return null===n||x!==e?t:null}))}),[t,x,v]),D=ge.q.PYSPARK===w;return(0,le.jsx)(he.Z,{flexWrap:"wrap",inline:!0,children:(0,le.jsx)(fe.Z,{onClickOutside:A,open:!0,children:(0,le.jsxs)(he.Z,{flexWrap:"wrap",children:[!l&&(0,le.jsx)(Dt,{increasedZIndex:0===x,children:(0,le.jsx)(Tt.Z,{disableKeyboardShortcuts:!0,items:Vt(n,h.tf.DATA_LOADER,w),onClickCallback:A,open:0===x,parentRef:y,uuid:"data_loader_button",children:(0,le.jsx)(me.ZP,ti(ti({},O),{},{beforeElement:(0,le.jsx)(Rt,{blue:!0,compact:i,children:(0,le.jsx)(Ge.mm,{size:E})}),onClick:function(e){e.preventDefault(),j((function(e){return 0===e?null:0})),R(0)},uuid:"AddNewBlocks/Data_loader",children:"Data loader"}))})}),!s&&(0,le.jsx)(Dt,{increasedZIndex:1===x,children:(0,le.jsx)(Tt.Z,{disableKeyboardShortcuts:!0,items:D||ge.q.INTEGRATION===w?I:S?[{items:Vt(n,h.tf.TRANSFORMER,w),label:function(){return"Python"},uuid:"transformers/python"}]:[{items:I,label:function(){return"Python"},uuid:"transformers/python_all"}].concat((0,o.Z)(Yt(n,h.tf.TRANSFORMER))),onClickCallback:A,open:1===x,parentRef:k,uuid:"transformer_button",children:(0,le.jsx)(me.ZP,ti(ti({},O),{},{beforeElement:(0,le.jsx)(Rt,{compact:i,purple:!0,children:(0,le.jsx)(Ge.mm,{size:E})}),onClick:function(e){e.preventDefault(),j((function(e){return 1===e?null:1})),R(1)},uuid:"AddNewBlocks/Transformer",children:"Transformer"}))})}),!l&&(0,le.jsx)(Dt,{increasedZIndex:2===x,children:(0,le.jsx)(Tt.Z,{disableKeyboardShortcuts:!0,items:Vt(n,h.tf.DATA_EXPORTER,w),onClickCallback:A,open:2===x,parentRef:Z,uuid:"data_exporter_button",children:(0,le.jsx)(me.ZP,ti(ti({},O),{},{beforeElement:(0,le.jsx)(Rt,{compact:i,yellow:!0,children:(0,le.jsx)(Ge.mm,{inverted:!0,size:E})}),onClick:function(e){e.preventDefault(),j((function(e){return 2===e?null:2})),R(2)},uuid:"AddNewBlocks/Data_exporter",children:"Data exporter"}))})}),!c&&(0,le.jsx)(Dt,{increasedZIndex:3===x,children:(0,le.jsx)(Tt.Z,{disableKeyboardShortcuts:!0,items:[{label:function(){return"New model"},onClick:function(){null===g||void 0===g||g(!0),null===p||void 0===p||p(t)},uuid:"dbt/new_model"},{label:function(){return"Single model (from file)"},onClick:function(){return null===p||void 0===p?void 0:p(t)},uuid:"dbt/single_model"},{label:function(){return"All models (w/ optional exclusion)"},onClick:function(){return n({language:h.t6.YAML,type:h.tf.DBT})},uuid:"dbt/all_models"}],onClickCallback:A,open:3===x,parentRef:_,uuid:"dbt_button",children:(0,le.jsx)(me.ZP,ti(ti({},O),{},{beforeElement:(0,le.jsx)(Pt,{size:At*(i?.75:1.25)}),onClick:function(e){e.preventDefault(),j((function(e){return 3===e?null:3})),R(3)},uuid:"AddNewBlocks/DBT",children:"DBT model"}))})}),!r&&(0,le.jsx)(Dt,{increasedZIndex:4===x,children:(0,le.jsx)(Tt.Z,{disableKeyboardShortcuts:!0,items:[{items:Jt(n,h.tf.CUSTOM,h.t6.PYTHON),label:function(){return"Python"},uuid:"custom_block_python"},{items:Jt(n,h.tf.CUSTOM,h.t6.SQL),label:function(){return"SQL"},uuid:"custom_block_sql"}],onClickCallback:A,open:4===x,parentRef:C,uuid:"custom_block_button",children:(0,le.jsx)(et.Z,{block:!0,label:"Add a custom code block with a designated color.",maxWidth:P,size:null,children:(0,le.jsx)(me.ZP,ti(ti({},O),{},{beforeElement:(0,le.jsx)(Rt,{compact:i,children:(0,le.jsx)(Ge.I8,{size:E})}),onClick:function(e){e.preventDefault(),j((function(e){return 4===e?null:4})),R(4)},uuid:"AddNewBlocks/Scratchpad",children:"Custom"}))})})}),!u&&(0,le.jsx)(Dt,{children:(0,le.jsx)(et.Z,{block:!0,label:"Write experimental code that doesn\u2019t get executed when you run your pipeline.",maxWidth:P,size:null,children:(0,le.jsx)(me.ZP,ti(ti({},O),{},{beforeElement:(0,le.jsx)(Rt,{border:!0,compact:i,children:(0,le.jsx)(Ge.mm,{size:E})}),onClick:function(e){e.preventDefault(),n({type:h.tf.SCRATCHPAD})},uuid:"AddNewBlocks/Scratchpad",children:"Scratchpad"}))})}),!S&&(0,le.jsx)(Dt,{children:!a&&(0,le.jsx)(le.Fragment,{children:(0,le.jsx)(et.Z,{block:!0,label:"Add a sensor so that other blocks only run when sensor is complete.",maxWidth:P,size:null,children:(0,le.jsx)(me.ZP,ti(ti({},O),{},{beforeElement:(0,le.jsx)(Rt,{compact:i,children:(0,le.jsx)(Ge.LM,{pink:!0,size:At*(i?.75:1.25)})}),onClick:function(e){e.preventDefault(),n({language:h.t6.PYTHON,type:h.tf.SENSOR})},uuid:"AddNewBlocks/Sensor",children:"Sensor"}))})})})]})})})},ri=t(2005),oi=t(31012),li=["children"];function ci(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?ci(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ci(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ai=Te.default.p.withConfig({displayName:"Badge__BadgeStyle",componentId:"sc-tfqsp0-0"})(["border-radius:","px;display:inline;font-family:",";margin:0;",";"," ",";",";"," "," ",""],gn.BG,ri.ry,oi.iD,(function(e){return e.small&&"\n ".concat(oi.HC,";\n ")}),(function(e){return!e.regular&&"\n padding: 2px 4px;\n "}),(function(e){return e.regular&&"\n padding: ".concat(1*re.iI,"px ").concat(1.25*re.iI,"px;\n ")}),(function(e){return!e.disabled&&"\n background-color: ".concat((e.theme||vn.Z).background.row,";\n color: ").concat((e.theme||vn.Z).content.muted,";\n ")}),(function(e){return e.disabled&&"\n background-color: ".concat((e.theme||vn.Z).feature.disabled,";\n color: ").concat((e.theme||vn.Z).content.disabled,";\n ")}),(function(e){return e.quantifier&&"\n border-radius: 34px;\n line-height: 10px;\n padding: 4px 6px;\n "})),si=function(e){var n=e.children,t=(0,Pe.Z)(e,li);return(0,le.jsx)(ai,ui(ui({},t),{},{children:n}))},di=t(32316),fi=t(89565),pi=t.n(fi),hi=t(62976),mi=t(86532),vi=t(34744),gi=t(66166),bi=Te.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-n38rkq-0"})([""," border-left-style:solid;border-left-width:2px;border-right-style:solid;border-right-width:2px;overflow:hidden;"," "," ",""],Xe.Kf,(function(e){return e.addBottomPadding&&"\n padding-bottom: ".concat(2*re.tr,"px;\n ")}),(function(e){return"\n background-color: ".concat((e.theme.background||vn.Z.background).table,";\n ")}),(function(e){return!e.executedAndIdle&&"\n border-bottom-left-radius: ".concat(gn.n_,"px;\n border-bottom-right-radius: ").concat(gn.n_,"px;\n border-bottom-style: solid;\n border-bottom-width: 2px;\n ")})),xi=Te.default.div.withConfig({displayName:"indexstyle__OutputRowStyle",componentId:"sc-n38rkq-1"})([""," "," ",""],(function(e){return e.first&&"\n padding-top: ".concat(re.iI*re.cd,"px;\n ")}),(function(e){return e.last&&"\n padding-bottom: ".concat(re.iI*re.cd,"px;\n ")}),(function(e){return e.contained&&"\n padding-left: ".concat(Xe.oh,"px;\n padding-right: ").concat(re.iI*re.cd,"px;\n ")})),ji=Te.default.div.withConfig({displayName:"indexstyle__HTMLOutputStyle",componentId:"sc-n38rkq-2"})(["table{"," border-left-style:solid;border-left-width:2px;border-right-style:solid;border-right-width:2px;}td,th{padding:0 8px;}a{","}"],Xe.Kf,(function(e){return"\n color: ".concat((e.theme.interactive||vn.Z.interactive).linkPrimary,";\n ")})),yi=Te.default.div.withConfig({displayName:"indexstyle__ExtraInfoStyle",componentId:"sc-n38rkq-3"})([""," border-bottom-style:solid;border-bottom-width:2px;border-left-style:solid;border-left-width:2px;border-right-style:solid;border-right-width:2px;",""],Xe.Kf,(function(e){return"\n background-color: ".concat((e.theme.borders||vn.Z.borders).light,";\n border-bottom-left-radius: ").concat(gn.n_,"px;\n border-bottom-right-radius: ").concat(gn.n_,"px;\n ")})),ki=Te.default.div.withConfig({displayName:"indexstyle__ExtraInfoContentStyle",componentId:"sc-n38rkq-4"})(["padding-bottom:","px;padding-left:","px;padding-right:","px;padding-top:","px;"],re.iI,Xe.oh,re.iI*re.cd,re.iI),Zi=Te.default.div.withConfig({displayName:"indexstyle__ExtraInfoBorderStyle",componentId:"sc-n38rkq-5"})(["height:1px;width:100%;",""],(function(e){return"\n border-top: 1px solid ".concat((e.theme.borders||vn.Z.borders).medium,";\n ")})),_i=/\[__internal_output__\]/,Ci=/\[__internal_test__\]/,Oi={uuid:"Preview"},wi={uuid:"Logs"},Si={uuid:"SQL"},Ei={uuid:"Lineage"},Pi=[Oi,wi,Si,Ei];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 Ii(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,c.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}function Ai(e){var n={},t={};return null===e||void 0===e||e.forEach((function(e){var i=e.content,r=e.outputs,o=e.uuid;(null===r||void 0===r?void 0:r.length)>=1&&(n[o]=r.map((function(e){var n=e||{},t=n.sample_data,i=n.shape,r=n.text_data,o=n.type;return t?{data:Ii({shape:i},t),type:o}:r&&(0,oe.Pb)(r)?JSON.parse(r):r}))),t[o]=i})),{content:t,messages:n}}function Ri(e){return"".concat(e,"/").concat(Ze.kP)}function Di(e){return(0,Ze.U2)(Ri(e),[])}function Mi(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 Ni(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Mi(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Mi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Bi=function(e){var n=e.block,t=e.blockMetadata,i=e.buttonTabs,r=e.collapsed,l=e.contained,c=void 0===l||l,u=e.dynamicBlock,a=e.dynamicChildBlock,s=e.hasError,f=e.hasOutput,p=e.hideExtraInfo,m=e.isInProgress,v=e.mainContainerWidth,g=e.messages,b=e.openSidekickView,x=e.pipeline,j=e.runCount,y=e.runEndTime,k=e.runStartTime,Z=e.selected,_=e.selectedTab,C=e.setCollapsed,O=e.setOutputBlocks,w=e.setSelectedOutputBlock,S=e.setSelectedTab,E=n.status,P=n.type,T=(0,d.useMemo)((function(){return(null===g||void 0===g?void 0:g.length)||0}),[g]),I=h.DA.EXECUTED===E||!m&&0===j&&T>=1||!m&&j>=1&&y>=k,A=(0,d.useState)(),R=A[0],D=A[1],M=(0,d.useState)(),N=M[0],B=M[1];(0,d.useEffect)((function(){m||B(100)}),[m]);var L=function(e){return Array.isArray(e)?e.join("\n"):e},F=(0,d.useMemo)((function(){return g.reduce((function(e,n){var t=e.at(-1);return Bn.jU.includes(null===t||void 0===t?void 0:t.type)&&(null===t||void 0===t?void 0:t.type)===n.type&&!L(null===n||void 0===n?void 0:n.data).match(_i)?t.data+=L(n.data):Bn.jU.includes(null===n||void 0===n?void 0:n.type)&&!L(null===n||void 0===n?void 0:n.data).match(_i)?e.push(Ni(Ni({},n),{},{data:L(n.data)})):e.push(Ni({},n)),e}),[])}),[g]),U=(0,d.useMemo)((function(){return(0,le.jsx)(hn.Z,{progress:N})}),[N]),H=h.tf.DBT===(null===n||void 0===n?void 0:n.type),z=(0,gi.Z)(s);(0,d.useEffect)((function(){H&&!z&&s&&S(wi)}),[s,z,H,S]);var G=(0,d.useMemo)((function(){var e=function(e,n){var t=e.columns,i=e.index,r=e.rows,o=e.shape,l=n.borderTop,c=n.selected;return o&&D(o),r.length>=1&&(0,le.jsx)(hi.Z,{columns:t,disableScrolling:!c,index:i,maxHeight:60*re.iI,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!l,rows:r,width:v-(2+re.cd*re.iI*2+2+tt.nn)})},n=[],t=[],i=[];return null===F||void 0===F||F.forEach((function(r,o){var l=r.data,u=r.type;if(l&&0!==(null===l||void 0===l?void 0:l.length)){var a=[],s=(a=(a=Array.isArray(l)?l:[l]).filter((function(e){return e}))).length,d=[];a.forEach((function(n,r){var l,a={contained:c,first:0===o&&0===r,last:o===F.length-1&&r===s-1},f=o>=1;if("string"===typeof n&&n.match(Ci)){var p=n.split("\n"),h=[];p.forEach((function(e){if(e.match(Ci)){var t=e.split("[__internal_test__]"),r=t[t.length-1];(0,oe.Pb)(r)&&i.push(JSON.parse(r))}else h.push(e);n=h.length>=1?h.join("\n"):null}))}if(null!==n){if("string"===typeof n&&n.match(_i)){var m=n.split("[__internal_output__]"),v=m[m.length-1],g=v.split("FloatProgress");if(m.length>=2&&(v=g[0]),(0,oe.Pb)(v)){var b=JSON.parse(v),x=b.data,j=b.type;if(Bn.Gi.TABLE===j){!0;var y=e(x,{borderTop:f,selected:Z});t.push(y),H||(l=y)}}}else if(u===Bn.Gi.TABLE){!0;var k=e((0,oe.Pb)(n)?JSON.parse(n):n,{borderTop:f,selected:Z});t.push(k),H||(l=k)}else if(Bn.jU.includes(u)){var _,C=null===(_=n)||void 0===_?void 0:_.split("\\n");l=(0,le.jsx)(xi,Ni(Ni({},a),{},{children:C.map((function(e){return(0,le.jsx)(xe.ZP,{monospace:!0,preWrap:!0,children:(0,le.jsx)(pi(),{children:e})},e)}))}))}else if(u===Bn.Gi.TEXT_HTML)l=(0,le.jsx)(xi,Ni(Ni({},a),{},{children:(0,le.jsx)(ji,{children:(0,le.jsx)(xe.ZP,{dangerouslySetInnerHTML:{__html:n},monospace:!0})})}));else if(u===Bn.Gi.IMAGE_PNG)l=(0,le.jsx)("div",{style:{backgroundColor:"white"},children:(0,le.jsx)("img",{alt:"Image ".concat(o," from code output"),src:"data:image/png;base64, ".concat(n)})});else if(u===Bn.Gi.PROGRESS){var O=parseInt(n);B(O>90?90:O)}l&&d.push((0,le.jsx)("div",{children:l},"code-output-".concat(o,"-").concat(r)))}})),d.length>=1&&n.push(d)}})),m&&(null===x||void 0===x?void 0:x.type)===ge.q.PYSPARK&&n.unshift([(0,le.jsx)(xi,{contained:!0,children:(0,le.jsx)(be.Z,{mt:1,children:U})},"progress_bar")]),{content:n,tableContent:t,testContent:i}}),[F,c,H,m,v,x,U,Z]),W=G.content,Q=G.tableContent,q=G.testContent,Y=(null===R||void 0===R?void 0:R[1])||0,V=Y>30?" (30 out of ".concat(Y," columns displayed)"):"",K=(0,d.useMemo)((function(){var e;if(H&&_){var n=_.uuid;if(Oi.uuid===n)(null===Q||void 0===Q?void 0:Q.length)>=1?e=Q:m||(e=(0,le.jsx)(be.Z,{px:2,py:1,children:(0,le.jsx)(xe.ZP,{muted:!0,children:s?"Error, check logs.":"No preview to display yet, try running the block."})}));else if(wi.uuid===n)(null===W||void 0===W?void 0:W.length)>=1?e=W:m||(e=(0,le.jsx)(be.Z,{px:2,py:1,children:(0,le.jsx)(xe.ZP,{muted:!0,children:s?"Error, check logs.":"No logs to display yet, try running the block."})}));else if(Si.uuid===n){var r,o=null===t||void 0===t||null===(r=t.dbt)||void 0===r?void 0:r.sql;e=o?(0,le.jsx)(Nn.Z,{autoHeight:!0,language:we.SQL,padding:!0,readOnly:!0,value:o,width:"100%"}):null}else if(Ei.uuid===n){var l,c=null===t||void 0===t||null===(l=t.dbt)||void 0===l?void 0:l.lineage;e=c?(0,le.jsx)(mi.Z,{disabled:!0,enablePorts:!1,height:55*re.iI,pannable:Z,pipeline:Ni(Ni({},x),{},{blocks:c}),zoomable:Z}):null}}else e=W;return(0,le.jsxs)(le.Fragment,{children:[i,e]})}),[t,i,W,s,H,m,x,Z,_,Q]);return i||f?(0,le.jsxs)(le.Fragment,{children:[c&&(0,le.jsxs)(bi,{addBottomPadding:m&&(null===x||void 0===x?void 0:x.type)===ge.q.PYSPARK,blockType:P,dynamicBlock:u,dynamicChildBlock:a,executedAndIdle:I,hasError:s,selected:Z,children:[!r&&(null===q||void 0===q?void 0:q.length)>=1&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(be.Z,{py:2,children:(0,le.jsx)(xi,{contained:!0,children:q.map((function(e,n){var t=e.error,i=e.message,r=e.stacktrace;return(0,le.jsxs)(be.Z,{mt:n>=1?3:0,children:[(0,le.jsx)(xe.ZP,{monospace:!0,preWrap:!0,children:(0,le.jsx)(pi(),{children:"".concat(i).concat(t?" "+t:"")})}),null===r||void 0===r?void 0:r.map((function(e){return(0,le.jsx)(xe.ZP,{default:!0,monospace:!0,preWrap:!0,small:!0,children:(0,le.jsx)(pi(),{children:e})},e)}))]},i)}))})}),(0,le.jsx)(be.Z,{mb:s?2:0,children:(0,le.jsx)(vi.Z,{medium:!0})})]}),!r&&K]}),!c&&K,I&&!p&&(0,le.jsxs)(yi,{blockType:P,dynamicBlock:u,dynamicChildBlock:a,hasError:s,selected:Z,children:[(0,le.jsx)(Zi,{}),(0,le.jsxs)(he.Z,{justifyContent:"space-between",children:[C&&(0,le.jsx)(An.Z,{alignItems:"center",px:1,children:(0,le.jsx)(de.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return C(!r)},transparent:!0,children:r?(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(Ge._M,{muted:!0,size:2*re.iI}),"\xa0",(0,le.jsx)(xe.ZP,{default:!0,children:"Expand output"})]}):(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(Ge.Kh,{muted:!0,size:2*re.iI}),R&&(0,le.jsx)(be.Z,{ml:2,children:(0,le.jsx)(xe.ZP,{children:"".concat(R[0]," rows x ").concat(R[1]," columns").concat(V)})})]})})}),(0,le.jsx)(ki,{children:(0,le.jsxs)(he.Z,{alignItems:"center",fullWidth:!0,justifyContent:"flex-end",children:[(0,le.jsx)(et.Z,{appearAbove:!0,appearBefore:!0,block:!0,label:j>=1&&k?"Last run at ".concat(new Date(k.valueOf()).toLocaleString()):s?"Block executed with errors":"Block executed successfully",size:null,widthFitContent:!0,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[j>=1&&Number(y)>Number(k)&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)(xe.ZP,{small:!0,children:[(Number(y)-Number(k))/1e3,"s"]}),(0,le.jsx)(be.Z,{mr:1})]}),!s&&(0,le.jsx)(Ge.Jr,{size:2*re.iI,success:!0}),s&&(0,le.jsx)(Ie.Z,{danger:!0,size:2*re.iI,children:(0,le.jsx)(xe.ZP,{bold:!0,monospace:!0,small:!0,children:"!"})})]})}),!s&&!h.Qj.includes(P)&&(0,le.jsx)(be.Z,{pl:1,children:(0,le.jsx)(de.Z,{afterIcon:(0,le.jsx)(Ge.M0,{muted:!0,size:1.75*re.iI}),basic:!0,noPadding:!0,onClick:function(){!function(e,n){var t=Di(e);t.includes(n)||(0,Ze.t8)(Ri(e),[].concat((0,o.Z)(t),[n]))}(null===x||void 0===x?void 0:x.uuid,n.uuid),b(Re.DATA),O((function(e){return e.find((function(e){return e.uuid===n.uuid}))?e:(w(n),e.concat(n))}))},transparent:!0,children:(0,le.jsx)(xe.ZP,{default:!0,children:"Expand table"})})})]})})]})]})]}):null},Li=t(40656),Fi=Te.default.svg.withConfig({displayName:"Convert__SVGStyle",componentId:"sc-fmw0vr-0"})([""]),Ui=function(e){var n=e.fill,t=e.opacity,i=e.size,r=void 0===i?Li.C:i,o=e.style,l=e.viewBox,c=void 0===l?"0 0 12 12":l;return(0,le.jsxs)(Fi,{fill:n,height:r,opacity:t,style:o,viewBox:c,width:r,children:[(0,le.jsx)("path",{clipRule:"evenodd",d:"M2.5 1C1.67157 1 1 1.67157 1 2.5v.0625c0 .27614-.223858.5-.5.5s-.5-.22386-.5-.5V2.5C0 1.11929 1.11929 0 2.5 0h7C10.8807 0 12 1.11929 12 2.5v7c0 1.3807-1.1193 2.5-2.5 2.5h-7C1.11929 12 0 10.8807 0 9.5v-.0625c0-.27614.223858-.5.5-.5s.5.22386.5.5V9.5c0 .8284.67157 1.5 1.5 1.5h7c.8284 0 1.5-.6716 1.5-1.5v-7c0-.82843-.6716-1.5-1.5-1.5h-7z",fill:"url(#paint0_linear_1332_60037)",fillRule:"evenodd"}),(0,le.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.05806 3.55806c.24408-.24408.6398-.24408.88388 0l2 2c.24408.24408.24408.6398 0 .88388l-2 2c-.24408.24408-.6398.24408-.88388 0-.24408-.24408-.24408-.6398 0-.88388l.93306-.93306H1C.654822 6.625.375 6.34518.375 6s.279822-.625.625-.625h5.99112l-.93306-.93306c-.24408-.24408-.24408-.6398 0-.88388z",fill:"#fff"}),(0,le.jsx)("defs",{children:(0,le.jsxs)("linearGradient",{id:"paint0_linear_1332_60037",x1:"-.618557",y1:"-.000001",x2:"10.5709",y2:".83113",gradientUnits:"userSpaceOnUse",children:[(0,le.jsx)("stop",{stopColor:"#FFCC19"}),(0,le.jsx)("stop",{offset:".585938",stopColor:"#2ECDF7"}),(0,le.jsx)("stop",{offset:"1",stopColor:"#9E7BFF"})]})})]})},Hi=t(79749),zi=t(54283);function Gi(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 Wi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Gi(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Gi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Qi=function(e,n){var t=(null===n||void 0===n?void 0:n.upstream_blocks)||[];return h.tf.CHART===e.type||h.tf.SCRATCHPAD===e.type||h.tf.CHART===(null===n||void 0===n?void 0:n.type)||h.tf.SCRATCHPAD===(null===n||void 0===n?void 0:n.type)||h.tf.DATA_LOADER===(null===n||void 0===n?void 0:n.type)&&h.tf.SENSOR!==e.type||t.push(e.uuid),t},qi=function(e,n,t,i){for(var r,o=[],l=n.findIndex((function(n){return n.uuid===e.uuid}));!r&&l>=0;){var c;r=n[l-1],h.tf.SCRATCHPAD===(null===(c=r)||void 0===c?void 0:c.type)&&(r=null),l-=1}return r&&o.push(r.uuid),h.Ut.map((function(n){return{label:function(){return"Convert to ".concat((0,oe.wX)(h.V4[n]))},onClick:function(){return i({converted_from:e.uuid,type:n,upstream_blocks:o})},uuid:"".concat(t,"/convert_to/").concat(n)}}))},Yi=function(e,n,t,i,r,o){var l=e||{},c=l.configuration,u=l.downstream_blocks,a=l.has_callback,s=l.upstream_blocks,d=c||{},f=d.dynamic,p=d.reduce_output,m=h.tf.DBT===(null===e||void 0===e?void 0:e.type),v=[{label:function(){return m?"Execute and run upstream blocks":"Execute with upstream blocks"},onClick:function(){return n({block:e,runUpstream:!0})},uuid:"execute_upstream"}];m||v.push({label:function(){return"Execute block and run tests"},onClick:function(){return n({block:e,runTests:!0})},uuid:"run_tests"});var g=o||{},b=g.blocksMapping,x=g.fetchFileTree,j=g.fetchPipeline,y=g.savePipelineContent,k=g.updatePipeline,Z=[];(u.forEach((function(e){var n=null===b||void 0===b?void 0:b[e];n&&n.upstream_blocks.forEach((function(e){var n,t;null!==b&&void 0!==b&&null!==(n=b[e])&&void 0!==n&&null!==(t=n.configuration)&&void 0!==t&&t.dynamic&&Z.push(b[e])}))})),m&&v.unshift.apply(v,[{label:function(){return"Run model"},onClick:function(){return n({block:e,runSettings:{run_model:!0}})},tooltip:function(){return"Execute command dbt run."},uuid:"run_model"},{label:function(){return"Test model"},onClick:function(){return n({block:e,runSettings:{test_model:!0}})},tooltip:function(){return"Execute command dbt test."},uuid:"test_model"},{label:function(){return"Build model"},onClick:function(){return n({block:e,runSettings:{build_model:!0}})},tooltip:function(){return"Execute command dbt build."},uuid:"build_model"},{label:function(){return"Add upstream models"},onClick:function(){k({pipeline:{add_upstream_for_block_uuid:null===e||void 0===e?void 0:e.uuid}})},tooltip:function(){return"Add upstream models for this model to the pipeline."},uuid:"add_upstream_models"}]),m||!y||!f&&0!==Z.length||v.push({label:function(){return f?"Disable block as dynamic":"Set block as dynamic"},onClick:function(){return y({block:Wi(Wi({},e),{},{configuration:Wi(Wi({},c),{},{dynamic:!f})})})},uuid:"dynamic"}),b)&&((null===s||void 0===s?void 0:s.find((function(e){var n,t;return null===b||void 0===b||null===(n=b[e])||void 0===n||null===(t=n.configuration)||void 0===t?void 0:t.dynamic})))&&v.push({label:function(){return p?"Don\u2019t reduce output":"Reduce output"},onClick:function(){return y({block:Wi(Wi({},e),{},{configuration:Wi(Wi({},c),{},{reduce_output:!p})})})},uuid:"reduce_output"}));return v.push({label:function(){return a?"Remove callback":"Add callback"},onClick:function(){return y({block:Wi(Wi({},e),{},{has_callback:!a})}).then((function(){x(),j()}))},uuid:"has_callback"}),v.push({label:function(){return"Delete block"},onClick:function(){t(e),i(!1)},uuid:"delete_block"}),r?[v.pop()]:v};function Vi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ki(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Vi(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Vi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Xi,Ji=function(e){var n=e.addNewBlock,t=e.addWidget,i=e.block,r=e.blocks,o=e.deleteBlock,c=e.executionState,u=e.fetchFileTree,a=e.fetchPipeline,s=e.interruptKernel,p=e.pipeline,v=e.runBlock,g=e.savePipelineContent,b=e.setErrors,x=e.setOutputCollapsed,j=(e.visible,i.all_upstream_blocks_executed),y=void 0===j||j,k=i.color,Z=i.type,_=i.uuid,C=(0,d.useRef)(null),O=(0,d.useRef)(null),w=(0,d.useRef)(null),S=(0,d.useRef)(null),E=null===p||void 0===p?void 0:p.type,P=(0,d.useState)(!1),T=P[0],I=P[1],A=(0,d.useState)(!1),R=A[0],D=A[1],M=(0,d.useState)(!1),N=M[0],B=M[1],L=(0,d.useState)(!1),F=L[0],U=L[1],H=(0,d.useContext)(Te.ThemeContext),z=Bn.uF.IDLE!==c,G=(0,Xe.qn)(Z,{blockColor:k,theme:H}).accent,W=E===ge.q.STREAMING,Q=(0,d.useMemo)((function(){return qi(i,r,"CommandButtons",n).map((function(e){return Ki(Ki({},e),{},{onClick:function(){return g().then((function(){return e.onClick()}))}})}))}),[n,i,r,g]),q=(0,d.useMemo)((function(){return(0,rn.HK)(r,(function(e){return e.uuid}))}),[r]),Y=(0,d.useMemo)((function(){return h.tf.DBT===(null===i||void 0===i?void 0:i.type)}),[i]),V=(0,f.Db)(an.ZP.pipelines.useUpdate(null===p||void 0===p?void 0:p.uuid),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){a()},onErrorCallback:function(e,n){return b({errors:n,response:e})}})}}),K=(0,l.Z)(V,2),X=K[0];return K[1].isLoading,(0,le.jsxs)(he.Z,{alignItems:"center",children:[Bn.uF.QUEUED===c&&(0,le.jsx)(zi.Z,{color:(H||vn.Z).content.active,type:"cylon"}),Bn.uF.BUSY===c&&(0,le.jsx)(zi.Z,{color:(H||vn.Z).content.active}),!z&&!W&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(et.Z,{appearBefore:!0,default:!0,label:(0,le.jsxs)(xe.ZP,{children:[Y?"Compile and preview data":"Run block","\xa0 \xa0",(0,le.jsx)(Hi.Z,{inline:!0,keyTextGroups:[[Vn()?ye.RJ:ye.hE,ye.Lz]],monospace:!0,uuidForKey:_})]}),size:3*re.iI,widthFitContent:!0,children:(0,le.jsx)(de.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){y?v({block:i}):B(!0)},children:(0,le.jsx)(Ie.Z,{color:G,size:3*re.iI,children:(0,le.jsx)(Ge.Py,{black:!0,size:1.5*re.iI})})})}),(0,le.jsx)(fe.Z,{disableEscape:!0,onClickOutside:function(){return B(!1)},open:N,children:(0,le.jsx)(m.Z,{items:[{label:function(){return"Execute block"},onClick:function(){return v({block:i})},uuid:"execute_block"},{label:function(){return"Execute with upstream blocks"},onClick:function(){return v({block:i,runUpstream:!0})},uuid:"execute_upstream"}],onClickCallback:function(){return B(!1)},open:N,parentRef:w,rightOffset:13.25*re.iI,topOffset:4.5*re.iI,uuid:"execute_actions",width:25*re.iI})})]}),z&&(0,le.jsx)(be.Z,{ml:re.cd,children:(0,le.jsx)(et.Z,{appearBefore:!0,default:!0,label:(0,le.jsxs)(xe.ZP,{children:["Interrupt kernel \xa0 \xa0",(0,le.jsx)(Hi.Z,{inline:!0,keyTextGroups:[[ye.kA],[ye.kA]],monospace:!0,uuidForKey:_})]}),size:2.5*re.iI,widthFitContent:!0,children:(0,le.jsx)(de.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return s()},children:(0,le.jsx)(Ie.Z,{borderSize:1.5,size:2.5*re.iI,children:(0,le.jsx)(Ge.x8,{size:1*re.iI})})})})}),h.tf.SCRATCHPAD===i.type&&!W&&(0,le.jsx)(be.Z,{ml:re.cd,children:(0,le.jsx)(Tt.Z,{items:Q,onClickCallback:function(){return D(!1)},onClickOutside:function(){return D(!1)},open:R,parentRef:O,rightOffset:0,topOffset:4,uuid:"CommandButtons/convert_block",children:(0,le.jsx)(et.Z,{appearBefore:!0,default:!0,label:(0,le.jsx)(xe.ZP,{children:"Convert block"}),size:2.5*re.iI,widthFitContent:!0,children:(0,le.jsx)(de.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return D(!R)},ref:O,children:(0,le.jsx)(Ui,{size:2.5*re.iI})})})})}),[h.tf.DATA_LOADER,h.tf.TRANSFORMER].includes(i.type)&&!W&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(be.Z,{ml:re.cd,ref:C,children:(0,le.jsx)(et.Z,{appearBefore:!0,default:!0,label:"Add chart",size:2.25*re.iI,widthFitContent:!0,children:(0,le.jsx)(de.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return I((function(e){return!e}))},children:(0,le.jsx)(Ge.er,{size:2.25*re.iI})})})}),(0,le.jsx)(fe.Z,{disableEscape:!0,onClickOutside:function(){return I(!1)},open:T,children:(0,le.jsx)(ae,{addWidget:t,block:i,onClickCallback:function(){return I(!1)},open:T,parentRef:C,rightOffset:9*re.iI,runBlock:v,topOffset:2*re.iI})})]}),(0,le.jsx)("div",{ref:S,children:(0,le.jsx)(be.Z,{ml:re.cd,children:(0,le.jsx)(et.Z,{appearBefore:!0,default:!0,label:(0,le.jsx)(xe.ZP,{children:"More actions"}),size:2.5*re.iI,widthFitContent:!0,children:(0,le.jsx)(de.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return U((function(e){return!e}))},children:(0,le.jsx)(Ie.Z,{borderSize:1.5,size:2.5*re.iI,children:(0,le.jsx)(Ge.mH,{size:re.iI})})})})})}),(0,le.jsx)(fe.Z,{disableEscape:!0,onClickOutside:function(){return U(!1)},open:F,children:(0,le.jsx)(m.Z,{items:Yi(i,v,o,x,W,{blocksMapping:q,fetchFileTree:u,fetchPipeline:a,savePipelineContent:g,updatePipeline:X}),onClickCallback:function(){return U(!1)},open:F,parentRef:S,rightOffset:4.75*re.iI,topOffset:2*re.iI,uuid:"FileHeaderMenu/file_items"})})]})};!function(e){e.APPEND="append",e.FAIL="fail",e.REPLACE="replace"}(Xi||(Xi={}));var $i,er=[Xi.APPEND,Xi.FAIL,Xi.REPLACE];!function(e){e.BIGQUERY="bigquery",e.MYSQL="mysql",e.POSTGRES="postgres",e.REDSHIFT="redshift",e.SNOWFLAKE="snowflake"}($i||($i={}));var nr,tr=t(55378);!function(e){e.DATA_EXPORTER="data_exporter",e.DATA_LOADER="data_loader",e.MAGE_LIBRARY="mage_library",e.TRANSFORMER="transformer",e.USER_LIBRARY="user_library"}(nr||(nr={}));var ir=t(5677);function rr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function or(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?rr(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):rr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function lr(e,n){var t=e;t.includes("__init__")||t.push("__init__");var i,r=t.length;return(0,rn.w6)(r).forEach((function(e,o){if(i)return i;var l=t.slice(0,r-o).join("/");i=n["".concat(l,".py")]})),i}function cr(e,n,t){var i,r,o;return((null===(i=t.outputs)||void 0===i||null===(r=i[0])||void 0===r||null===(o=r.sample_data)||void 0===o?void 0:o.columns)||[]).map((function(t){return{label:"".concat(t," column"),kind:e.languages.CompletionItemKind.Variable,insertText:"'".concat(t,"'"),range:n}}))}function ur(e,n){var t=e.word.split(""),i=new RegExp(t.reduce((function(e,n,i){var r=t[i+1],o=r?"^".concat(r):"";return e+"".concat(n,"[w ").concat(o,"]*")}),""));return n.reduce((function(e,n){return n.label.match(i)?e.concat(n):e}),[])}function ar(e){var n=e.autocompleteItems,t=e.block,i=e.blocks,r=e.pipeline,c=t.type,u=t.upstream_blocks,a=(0,rn.HK)(n,(function(e){return e.id}));return function(t){return function(s,d){var f=[],p=s.getValueInRange({endColumn:d.column,endLineNumber:d.lineNumber,startColumn:1,startLineNumber:1}),m=s.getWordUntilPosition(d),v=m.endColumn,g=m.startColumn,b={endColumn:v,endLineNumber:d.lineNumber,startColumn:g,startLineNumber:d.lineNumber},x=function(e,n,t){var i=(0,ir.Yn)(e),r=(0,ir.M4)(e,n),o=i.find((function(e){var n=e.variableName;return r.match(new RegExp(n))}));if(o){var l=o.assignmentValue,c=(0,ir.S0)(e)[l];if(c){var u,a=lr(c.split(" as ")[0].replace("from ","").replace("import ","").split(" ").reduce((function(e,n){return n.trim()?e.concat(n):e}),[]).join(".").split("."),t),s=(0,ir.rW)(c,l);return null===a||void 0===a||null===(u=a.methods_for_class)||void 0===u?void 0:u[s]}}return[]}(p,b,a);if((null===x||void 0===x?void 0:x.length)>=1){var j=ur(m,x.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Method,label:e,range:b}})));if(j.length>=1)return{suggestions:j}}var y=function(e,n,t){var i=(0,ir.M4)(e,n);if(i=i.match(/([\w_]+)./)){var r=(0,ir.S0)(e)[i[1]];if(r){var o=lr(r.split(" as ")[0].replace("from ","").replace("import ","").split(" ").reduce((function(e,n){return n.trim()?e.concat(n):e}),[]).join(".").split("."),t);if(null!==o&&void 0!==o&&o.functions)return null===o||void 0===o?void 0:o.functions}}return[]}(p,b,a);if((null===y||void 0===y?void 0:y.length)>=1){var k=ur(m,y.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Function,label:e,range:b}})));if(k.length>=1)return{suggestions:k}}if((null===u||void 0===u?void 0:u.length)>=1){var Z=new RegExp("\n@".concat(c));p.match(Z)&&f.push.apply(f,(0,o.Z)(ur(m,function(e,n,t){var i=t.block,r=t.blocks,o=i.upstream_blocks,l=(0,rn.HK)(r,(function(e){return e.uuid}));return o.map((function(t,i){var r=l[t].type,o=0===i?"output_0":"args[".concat(i-1,"]");return{label:"df ".concat(t," ").concat(r," block"),kind:e.languages.CompletionItemKind.Variable,documentation:"Variable for ".concat(r," ").concat(t," data."),insertText:o,range:n}}))}(t,b,e))))}if(m.word.match(/i|f/)){var _=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,t=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,r=(arguments.length>2?arguments[2]:void 0).word,c=new Set,u={};e.forEach((function(e){var n=e.group,t=e.id,i=e.imports;if([nr.MAGE_LIBRARY,nr.USER_LIBRARY].includes(n)){var r=t;r.match(/__init__.py/)&&(r=r.replace(/\/__init__.py/,"")),r=r.split(".py")[0].replaceAll("/","."),u[r]=e}var o=t.replace(".py","").replace("/__init__","").split("/");if(1===o.length)c.add("import ".concat(o[0]));else if(o.length>=2){var l=o.slice(0,o.length-1).join(".");c.add("from ".concat(l," import ").concat(o[o.length-1]))}i.forEach((function(e){return c.add(e)}))}));var a,s="i"===r,d="f"===r,f=s?"import":d?"from":"",p=(0,ir.M4)(n,i);if(s&&p.match(/from/)&&(a=p.match(/from ([A-Za-z0-9_.]+) /)[1]),a&&u[a]){var h=u[a],m=h.classes,v=h.constants,g=h.files,b=h.functions,x=[];return[[v,t.languages.CompletionItemKind.Constant],[m,t.languages.CompletionItemKind.Class],[b,t.languages.CompletionItemKind.Function]].forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],r=n[1];t.forEach((function(e){x.push({filterText:"import ".concat(e),insertText:"import ".concat(e),kind:r,label:e,range:i})}))})),g.forEach((function(e){var n=e.split("/"),r=n[n.length-1].split(".py")[0];x.push({filterText:"import ".concat(r),insertText:"import ".concat(r),kind:t.languages.CompletionItemKind.Variable,label:r,range:i})})),x}return(0,o.Z)(c).map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.File,label:e,range:i}})).concat(Object.entries(u).map((function(e){var n=(0,l.Z)(e,2),r=n[0];return n[1],{filterText:"".concat(f," ").concat(r),insertText:"".concat(f," ").concat(r," "),kind:t.languages.CompletionItemKind.File,label:"".concat(r),range:or({},i)}})))}(n,p,m,t,b,e);f.push.apply(f,(0,o.Z)(_))}if(h.tf.CHART===c||h.tf.SCRATCHPAD===c){var C=[];if(h.tf.CHART===c?u.forEach((function(e,n){C.push({block:i.find((function(n){var t=n.uuid;return e===t})),matchIndex:0,variableName:"df_".concat(n+1)})})):h.tf.SCRATCHPAD===c&&function(e,n){return e.map((function(e){return{block:e,regex:new RegExp("([\\w_]+)[ ]*=[ ]*get_variable\\('".concat(n.uuid,"', '").concat(e.uuid,"', 'output_0'\\)"),"g")}}))}(i,r).forEach((function(e){var n=e.block,t=e.regex,i=p.matchAll(t);(0,o.Z)(i).forEach((function(e){var t=null===e||void 0===e?void 0:e.index,i=null===e||void 0===e?void 0:e[1];i&&C.push({block:n,matchIndex:t,variableName:i})}))})),C.length>=1){var O,w=null===(O=p.split("\n")[d.lineNumber-1])||void 0===O?void 0:O.slice(0,m.startColumn-1);if(w){var S=[];if(C.forEach((function(e){var n=e.block,i=e.matchIndex,r=e.variableName,o=new RegExp("".concat(r,"\\["));w.match(o)&&S.push({items:cr(t,b,n),matchIndex:i})})),S.length>=1)return{suggestions:ur(m,(0,rn.YC)(S,"matchIndex",{ascending:!1})[0].items)}}}1===g&&(h.tf.CHART===c?f.push.apply(f,(0,o.Z)(ur(m,u.map((function(e,n){var i="df_".concat(n+1);return{label:"".concat(i," ").concat(e," block"),kind:t.languages.CompletionItemKind.Snippet,insertText:i,range:b}}))))):h.tf.SCRATCHPAD===c&&f.push.apply(f,(0,o.Z)(ur(m,function(e,n,t){var i=t.block,r=t.blocks,o=t.pipeline;return r.reduce((function(t,r){var l=r.type,c=r.uuid;return i.uuid!==c&&[h.tf.DATA_LOADER,h.tf.TRANSFORMER].includes(l)?t.concat({label:"df ".concat(c," ").concat(l," block"),kind:e.languages.CompletionItemKind.Snippet,documentation:"Get the data from ".concat(l," block ").concat(c,"."),insertText:"from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(o.uuid,"', '").concat(c,"', 'output_0')\n"),range:n}):t}),[])}(t,b,e)))))}var E=new Set;i.concat({content:p}).forEach((function(e){var n=e.content;(0,o.Z)(n.matchAll("([A-Za-z_0-9]+)","g")).forEach((function(e){return E.add(e[1])}))}));var P=(0,o.Z)(E);if(P.length){var T=P.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Variable,label:e,range:b}}));f.push.apply(f,(0,o.Z)(ur(m,T)))}return{suggestions:f}}}}var sr=t(32365),dr=t(80636),fr=t(25958),pr=t(66653),hr=t(87323);function mr(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?mr(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):mr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function gr(e,n){var t,i,r,u,a,s,p=e.addNewBlock,m=e.addNewBlockMenuOpenIdx,v=e.addWidget,g=e.autocompleteItems,b=e.block,x=e.blockIdx,j=e.blockRefs,y=e.blocks,k=e.dataProviders,Z=e.defaultValue,_=void 0===Z?"":Z,C=e.deleteBlock,O=e.executionState,w=e.fetchFileTree,S=e.fetchPipeline,L=e.height,F=e.interruptKernel,U=e.mainContainerRef,H=e.mainContainerWidth,z=e.messages,G=void 0===z?[]:z,W=e.noDivider,Q=e.onCallbackChange,q=e.onChange,Y=e.onClickAddSingleDBTModel,V=e.openSidekickView,K=e.pipeline,X=e.runBlock,J=e.runningBlocks,$=e.savePipelineContent,ee=e.selected,ne=e.setAddNewBlockMenuOpenIdx,te=e.setAnyInputFocused,ie=e.setCreatingNewDBTModel,ce=e.setEditingBlock,ue=e.setErrors,ae=e.setOutputBlocks,se=e.setRecsWindowOpenBlockIdx,fe=e.setSelected,me=e.setSelectedOutputBlock,ve=e.setTextareaFocused,ke=e.textareaFocused,Ce=e.widgets,Oe=(0,d.useContext)(Te.ThemeContext),we=(0,d.useState)(!1),Se=we[0],Ee=we[1],Pe=(0,d.useState)(null),Ae=Pe[0],Re=Pe[1],De=(0,d.useState)(!1),Me=De[0],Ne=De[1],Be=(0,d.useState)(!1),Le=Be[0],Fe=Be[1],Ue=(0,d.useState)(_),He=Ue[0],ze=Ue[1],We=(0,d.useState)(null),Qe=We[0],qe=We[1],Ye=(0,d.useMemo)((function(){return(null===b||void 0===b?void 0:b.configuration)||{}}),[b]),Ve=(0,d.useState)((t={},(0,c.Z)(t,E,Ye.data_provider),(0,c.Z)(t,P,Ye.data_provider_database),(0,c.Z)(t,T,Ye.data_provider_profile),(0,c.Z)(t,I,Ye.data_provider_schema),(0,c.Z)(t,A,Ye.data_provider_table),(0,c.Z)(t,D,Ye.dbt_profile_target),(0,c.Z)(t,R,Ye.dbt_project_name),(0,c.Z)(t,M,Ye.export_write_policy||Xi.APPEND),(0,c.Z)(t,N,Ye.limit),(0,c.Z)(t,B,!!Ye.use_raw_sql),t)),Ke=Ve[0],Je=Ve[1],$e=(0,d.useState)(null),en=$e[0],nn=$e[1],tn=(0,d.useState)(!1),on=tn[0],ln=tn[1],cn=(0,d.useState)(b.uuid),un=cn[0],fn=cn[1],pn=(0,d.useState)(!1),hn=pn[0],mn=pn[1],vn=(0,d.useState)(0),gn=vn[0],bn=vn[1],xn=(0,d.useState)(null),jn=xn[0],yn=xn[1],kn=(0,d.useState)(null),Zn=kn[0],_n=kn[1],Cn=(0,d.useState)(G),On=Cn[0],wn=Cn[1],Sn=(0,d.useState)(Pi[0]),En=Sn[0],Pn=Sn[1],Tn=h.tf.DBT===(null===b||void 0===b?void 0:b.type),In=b.callback_content,Rn=b.has_callback,Dn=(0,d.useState)(In),Mn=Dn[0],Ln=Dn[1];(0,d.useEffect)((function(){In!==Mn&&Ln(In)}),[In]);var Fn=(0,gi.Z)(b);(0,d.useEffect)((function(){if(JSON.stringify(b)!=JSON.stringify(Fn)){var e=Ai([b]).messages,n=null===e||void 0===e?void 0:e[null===b||void 0===b?void 0:b.uuid];(null===n||void 0===n?void 0:n.length)>=1&&wn(n)}}),[b,Fn,wn]);var Un=(0,gi.Z)(G);(0,d.useEffect)((function(){"undefined"!==typeof G&&G.length!==(null===Un||void 0===Un?void 0:Un.length)&&wn(G)}),[G,Un,wn]);var zn=(0,d.useMemo)((function(){var e=new Set;return null===k||void 0===k||k.forEach((function(n){var t=n.profiles;e=new Set([].concat((0,o.Z)(e),(0,o.Z)(t)))})),(0,o.Z)(e)}),[k]),Gn=(0,d.useMemo)((function(){return"".concat(null===K||void 0===K?void 0:K.uuid,"/").concat(null===b||void 0===b?void 0:b.uuid,"/codeCollapsed")}),[null===K||void 0===K?void 0:K.uuid,null===b||void 0===b?void 0:b.uuid]),Wn=(0,d.useMemo)((function(){return"".concat(null===K||void 0===K?void 0:K.uuid,"/").concat(null===b||void 0===b?void 0:b.uuid,"/outputCollapsed")}),[null===K||void 0===K?void 0:K.uuid,null===b||void 0===b?void 0:b.uuid]);(0,d.useEffect)((function(){Fe((0,Ze.U2)(Gn,!1)),mn((0,Ze.U2)(Wn,!1))}),[Gn,Wn]);var Qn=(0,d.useRef)(null),qn=(0,d.useMemo)((function(){return(0,rn.HK)(y,(function(e){return e.uuid}))}),[y]),Yn=(0,d.useMemo)((function(){return!!Ce.find((function(e){return e.upstream_blocks.includes(b.uuid)}))}),[b,Ce]),Vn=(0,d.useCallback)((function(e){var n=e||{},t=n.block,i=n.code,r=n.disableReset,o=n.runDownstream,l=n.runSettings,c=n.runUpstream,u=n.runTests;if(null===u||"undefined"===typeof u){var a=(t||{}).type;u=[h.tf.DATA_LOADER,h.tf.DATA_EXPORTER,h.tf.TRANSFORMER].includes(a)}X({block:t,code:i||He,runDownstream:o||Yn,runSettings:l,runTests:u||!1,runUpstream:c||!1}),r||(bn(1+Number(gn)),yn(null),mn(!1))}),[He,Yn,gn,X,bn,yn]),Kn=!!J.find((function(e){return e.uuid===b.uuid}))||(null===On||void 0===On?void 0:On.length)>=1&&O!==Bn.uF.IDLE;(0,d.useEffect)((function(){Kn&&_n(Number(new Date))}),[Kn,_n]);var Xn=(0,gi.Z)(O);(0,d.useEffect)((function(){O===Bn.uF.IDLE&&O!==Xn&&yn(Number(new Date))}),[O,Xn,yn]);var Jn=(0,d.useCallback)((function(e){var n=e.editorRect,t=(n.height,n.top),i=e.position.lineNumber;if(null!==U&&void 0!==U&&U.current){var r=U.current.getBoundingClientRect().height,o=i*sr.aU;if(t+o>r){var l=U.current.scrollTop+(o-r+t);U.current.scrollTo(0,l)}else if(o+t<sr.aU){var c=U.current.scrollTop+(o+t-sr.aU);U.current.scrollTo(0,c)}}}),[U]),nt=(0,d.useMemo)((function(){return(null===en||void 0===en?void 0:en.length)>=0?en.map((function(e){return{data:e,execution_state:Bn.uF.IDLE,type:Bn.Gi.TEXT_PLAIN}})):On.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[en,On]),tt=!!nt.find((function(e){return e.error})),it=(0,Xe.qn)(b.type,{blockColor:b.color,theme:Oe}).accent,rt=(null===b||void 0===b||null===(i=b.upstream_blocks)||void 0===i?void 0:i.length)||0,ot=(0,hr.cU)([b],y)[0],lt=ot.dynamic,ct=ot.dynamicUpstreamBlock,ut=ot.reduceOutput,at=ot.reduceOutputUpstreamBlock,st=(0,d.useMemo)((function(){var e=[];lt&&e.push({title:"Dynamic",description:"This block will create N blocks for each of its downstream blocks."});var n=ct&&!at;return n&&(e.push({title:"Dynamic child",description:"This block is dynamically created by its upstream parent block that is dynamic."}),ut&&e.push({title:"Reduce output",description:"Reduce output from all dynamically created blocks into a single array output."})),{borderColorShareProps:{blockColor:null===b||void 0===b?void 0:b.color,blockType:null===b||void 0===b?void 0:b.type,dynamicBlock:lt,dynamicChildBlock:n,hasError:tt,selected:ee},tags:e}}),[null===b||void 0===b?void 0:b.color,null===b||void 0===b?void 0:b.type,lt,ct,tt,ut,at,ee]),dt=st.borderColorShareProps,ft=st.tags,pt=nt.length>=1,ht=(0,d.useCallback)((function(){ee||(te(!1),fe(!0))}),[ee,te,fe]),mt=an.ZP.blocks.pipelines.detail(null===K||void 0===K?void 0:K.uuid,Ei.uuid===(null===En||void 0===En?void 0:En.uuid)||Si.uuid===(null===En||void 0===En?void 0:En.uuid)?encodeURIComponent(null===b||void 0===b?void 0:b.uuid):null,{_format:"dbt"},{revalidateOnFocus:!0}),vt=mt.data,gt=mt.mutate,bt=(0,d.useMemo)((function(){var e;return(null===vt||void 0===vt||null===(e=vt.block)||void 0===e?void 0:e.metadata)||{}}),[vt]),xt=(0,f.Db)(an.ZP.blocks.pipelines.useUpdate(null===K||void 0===K?void 0:K.uuid,b.uuid),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){ln(!1),S(),w(),ze(He)},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})},onError:function(e){var n=(0,dn.qQ)(e).messages;nn(n)}}),yt=(0,l.Z)(xt,1)[0],kt="CodeBlock/".concat(b.uuid),Zt=(0,Hn.y)(),_t=Zt.registerOnKeyDown,Ct=Zt.unregisterOnKeyDown;(0,d.useEffect)((function(){return function(){Ct(kt)}}),[Ct,kt]),_t(kt,(function(e,n,t){on&&String(t[0])===String(ye.Uq)&&String(t[1])!==String(ye.zX)?b.uuid===un?e.target.blur():yt({block:vr(vr({},b),{},{name:un})}):ee&&((0,_e.y)([ye.zX,ye.Uq],n)||(0,_e.y)([ye.PQ,ye.Uq],n)?Vn({block:b}):(0,_e.y)([ye.XR,ye.Uq],n)&&(e.preventDefault(),p({language:b.language,type:b.type,upstream_blocks:[b.uuid]}),Vn({block:b})))}),[p,b,on,un,Vn,ee,yt]),(0,d.useEffect)((function(){var e;return Zn&&(e=setInterval((function(){return qe(Number(new Date))}),1e3)),function(){return clearInterval(e)}}),[Zn]);var Ot=(0,d.useCallback)((function(e){return(0,c.Z)({},h.tf.SCRATCHPAD,(0,o.Z)(qi(e,y,"block_menu/scratchpad",p)).map((function(e){return vr(vr({},e),{},{onClick:function(){return $().then((function(){return e.onClick()}))}})})))[e.type]}),[p,y,$]),wt=(0,d.useMemo)((function(){var e;return(null===b||void 0===b||null===(e=b.metadata)||void 0===e?void 0:e.dbt)||{project:null,projects:{}}}),[b]),St=(0,d.useMemo)((function(){return wt.projects||{}}),[wt]),Et=(0,d.useMemo)((function(){return wt.project||Ke.dbt_project_name}),[Ke,wt]),Pt=(0,d.useMemo)((function(){return St[Et]||{target:null,targets:[]}}),[Et,St]),It=(0,d.useMemo)((function(){return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(Nn.Z,{autoHeight:!0,autocompleteProviders:Ae,height:L,language:b.language,onChange:function(e){ze(e),null===q||void 0===q||q(e)},onDidChangeCursorPosition:Jn,placeholder:h.tf.DBT===b.type&&h.t6.YAML===b.language?"e.g. --select ".concat(Et||"project","/models --exclude ").concat(Et||"project","/models/some_dir"):"Start typing here...",selected:ee,setSelected:fe,setTextareaFocused:ve,shortcuts:[function(e,n){return(0,dr.Q)(e,(function(){Vn({block:b,code:n.getValue()})}))}],textareaFocused:ke,value:He,width:"100%"}),Rn&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(vi.Z,{}),(0,le.jsxs)(be.Z,{mt:1,children:[(0,le.jsxs)(Xe.y9,{children:[(0,le.jsx)(xe.ZP,{small:!0,children:"Callback block: define @on_success or @on_failure callbacks for this block."}),(0,le.jsxs)(xe.ZP,{monospace:!0,muted:!0,small:!0,children:["kwargs",(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:" \u2192 "}),"global variables"]})]}),(0,le.jsx)(Nn.Z,{autoHeight:!0,autocompleteProviders:Ae,language:"python",onChange:function(e){Ln(e),null===Q||void 0===Q||Q(e)},onDidChangeCursorPosition:Jn,placeholder:"Start typing here...",selected:ee,setSelected:fe,setTextareaFocused:ve,textareaFocused:ke,value:Mn,width:"100%"})]})]})]})}),[Ae,b,Mn,He,Et,Rn,L,q,Jn,Vn,ee,ze,fe,ve,ke]);(0,d.useEffect)((function(){Re({python:ar({autocompleteItems:g,block:b,blocks:y,pipeline:K})})}),[g,b,y,K]);var At=(0,d.useMemo)((function(){return Tn?(0,le.jsx)(be.Z,{py:1,children:(0,le.jsx)(di.Z,{onClickTab:function(e){Pn(e),Ei.uuid!==e.uuid&&Si.uuid!==e.uuid||gt()},selectedTabUUID:null===En||void 0===En?void 0:En.uuid,small:!0,tabs:Pi})}):null}),[gt,Tn,En]),Rt=(0,d.useMemo)((function(){return(0,le.jsx)(Bi,vr(vr({},dt),{},{block:b,blockMetadata:bt,buttonTabs:At,collapsed:hn,hasOutput:pt,isInProgress:Kn,mainContainerWidth:H,messages:nt,openSidekickView:V,pipeline:K,runCount:gn,runEndTime:jn,runStartTime:Zn,selected:ee,selectedTab:En,setCollapsed:function(e){mn((function(){return(0,Ze.t8)(Wn,e),e}))},setOutputBlocks:ae,setSelectedOutputBlock:me,setSelectedTab:Pn}))}),[b,bt,dt,At,pt,Kn,H,nt,V,hn,Wn,K,gn,jn,Zn,ee,En,ae,mn,me]),Dt=(0,d.useCallback)((function(){return Ne(!1)}),[]),Mt=(0,d.useCallback)((function(e){Je((function(n){var t=vr(vr({},n),e);return(t.data_provider&&t.data_provider_profile||t.dbt_profile_target||t.dbt_project_name||t.limit)&&$({block:{configuration:t,uuid:b.uuid}}),t}))}),[b,$]),Nt=Lt.BIGQUERY===Ke.data_provider||Lt.SNOWFLAKE===Ke.data_provider,Bt=(0,d.useMemo)((function(){return(null===y||void 0===y?void 0:y.length)||0}),[y]);return(0,le.jsxs)("div",{ref:n,style:{position:"relative",zIndex:x===m?Bt+9:null},children:[(0,le.jsx)(Xe.nz,vr(vr({},dt),{},{onClick:function(){return ht()},zIndex:Bt+1-(x||0),children:(0,le.jsxs)(he.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,le.jsxs)(An.Z,{alignItems:"center",flex:1,children:[(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(si,{children:h.dO[b.language]}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsx)(Ie.Z,{color:it,size:1.5*re.iI,square:!0}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsx)(Tt.Z,{items:Ot(b),onClickCallback:Dt,onClickOutside:Dt,open:Me,parentRef:Qn,uuid:"CodeBlock/block_menu",children:(0,le.jsx)(xe.ZP,{color:it,monospace:!0,children:null===(r=Tn?h.tf.DBT:h.V4[b.type])||void 0===r?void 0:r.toUpperCase()})}),h.tf.SCRATCHPAD===b.type&&(0,le.jsxs)(le.Fragment,{children:["\xa0",(0,le.jsx)(de.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return Ne(!0)},transparent:!0,children:(0,le.jsx)(Ge.K5,{muted:!0})})]}),(0,le.jsx)(be.Z,{mr:1})]}),(0,le.jsx)(be.Z,{mr:re.cd}),(0,le.jsx)(Ge.iU,{size:1.5*re.iI}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsxs)(he.Z,{alignItems:"center",children:[Tn&&h.t6.YAML!==b.language&&(0,le.jsx)(xe.ZP,{monospace:!0,muted:!0,children:(0,fr.$)(b,{fullPath:!0})}),(!Tn||h.t6.YAML===b.language)&&(0,le.jsx)(jt,{bold:!1,inputValue:un,monospace:!0,muted:!0,notRequired:!0,onBlur:function(){return setTimeout((function(){te(!1),ln(!1)}),300)},onChange:function(e){fn(e.target.value),e.preventDefault()},onClick:function(){te(!0),ln(!0)},onFocus:function(){te(!0),ln(!0)},stacked:!0,value:!on&&b.uuid}),on&&!Tn&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(be.Z,{ml:1}),(0,le.jsx)($n.Z,{onClick:function(){return $({block:{name:un,uuid:b.uuid}}).then((function(){ln(!1),S(),w()}))},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]}),(0,le.jsx)(be.Z,{mr:2}),!h.iZ.includes(b.type)&&(0,le.jsx)(et.Z,{appearBefore:!0,block:!0,label:"\n ".concat((0,oe._6)("parent block",rt),". ").concat(0===rt?"Click to select 1 or more blocks to depend on.":"Edit parent blocks.","\n "),size:null,widthFitContent:rt>=1,children:(0,le.jsx)(de.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){var e;fe(!0),ce({upstreamBlocks:{block:b,values:null===(e=b.upstream_blocks)||void 0===e?void 0:e.map((function(e){return{uuid:e}}))}})},children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsxs)(xe.ZP,{monospace:rt>=1,small:rt>=1,underline:0===rt,children:[0===rt&&"Edit parent blocks",rt>=1&&(0,oe._6)("parent block",rt)]}),(0,le.jsx)(be.Z,{mr:1}),0===rt&&(0,le.jsx)(Ge.Jj,{size:3*re.iI}),rt>=1&&(0,le.jsx)(Ge.eV,{size:3*re.iI})]})})})]}),(0,le.jsx)(Ji,{addNewBlock:p,addWidget:v,block:b,blocks:y,deleteBlock:C,executionState:O,fetchFileTree:w,fetchPipeline:S,interruptKernel:F,pipeline:K,runBlock:Vn,savePipelineContent:$,setErrors:ue,setOutputCollapsed:mn,visible:ee||Kn}),(0,le.jsx)(be.Z,{px:1,children:(0,le.jsx)(de.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){Fe((function(e){return(0,Ze.t8)(Gn,!e),!e})),Le||mn((function(){return(0,Ze.t8)(Wn,!0),!0}))},transparent:!0,children:Le?(0,le.jsx)(Ge._M,{muted:!0,size:2*re.iI}):(0,le.jsx)(Ge.Kh,{muted:!0,size:2*re.iI})})})]})})),(0,le.jsxs)(Xe.Nk,{onClick:function(){return ht()},children:[(0,le.jsxs)(Xe.jv,vr(vr({},dt),{},{className:ee&&ke?"selected":null,hasOutput:!!At||pt,children:[h.tf.DBT===b.type&&!Le&&(0,le.jsxs)(Xe.y9,{children:[(0,le.jsxs)(he.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,le.jsxs)(An.Z,{alignItems:"center",children:[h.t6.YAML===b.language&&(0,le.jsxs)(tr.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){te(!1)}),300)},onChange:function(e){var n;Mt((n={},(0,c.Z)(n,D,""),(0,c.Z)(n,R,e.target.value),n)),e.preventDefault()},onClick:pr.j,onFocus:function(){te(!0)},placeholder:"Project",small:!0,value:Ke.dbt_project_name||"",children:[(0,le.jsx)("option",{value:""}),Object.keys(St||{}).map((function(e){return(0,le.jsx)("option",{value:e,children:e},e)}))]}),h.t6.YAML!==b.language&&(0,le.jsx)(xe.ZP,{monospace:!0,small:!0,children:Et}),(0,le.jsx)(be.Z,{mr:2}),(0,le.jsx)(xe.ZP,{monospace:!0,muted:!0,small:!0,children:"Target"}),(0,le.jsx)("span",{children:"\xa0"}),(0,le.jsxs)(tr.Z,{compact:!0,disabled:!Et,monospace:!0,onBlur:function(){return setTimeout((function(){te(!1)}),300)},onChange:function(e){Mt((0,c.Z)({},D,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){te(!0)},placeholder:Et?h.t6.SQL===(null===b||void 0===b?void 0:b.language)?null===Pt||void 0===Pt?void 0:Pt.target:null:"Select project first",small:!0,value:Ke.dbt_profile_target||"",children:[(0,le.jsx)("option",{value:""}),null===(u=Pt.targets)||void 0===u?void 0:u.map((function(e){return(0,le.jsx)("option",{value:e,children:e},e)}))]})]}),h.t6.YAML!==b.language&&(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(et.Z,{appearBefore:!0,block:!0,description:(0,le.jsxs)(xe.ZP,{default:!0,inline:!0,children:["Limit the number of results that are returned when running this block in the notebook.",(0,le.jsx)("br",{}),"This limit won\u2019t affect the number of results returned when running the pipeline end-to-end."]}),size:null,widthFitContent:!0,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(Ge.kI,{muted:!0}),(0,le.jsx)("span",{children:"\xa0"}),(0,le.jsx)(xe.ZP,{monospace:!0,muted:!0,small:!0,children:"Sample limit"}),(0,le.jsx)("span",{children:"\xa0"})]})}),(0,le.jsx)(je.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){te(!1)}),300)},onChange:function(e){Mt((0,c.Z)({},N,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){te(!0)},small:!0,type:"number",value:Ke.limit||"",width:10*re.iI}),(0,le.jsx)(be.Z,{mr:5})]})]}),h.t6.YAML===b.language&&(0,le.jsx)(be.Z,{mt:1,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsxs)(An.Z,{flex:1,children:[(0,le.jsxs)(xe.ZP,{monospace:!0,default:!0,small:!0,children:["dbt run ",(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,small:!0,children:"[type your --select and --exclude syntax below]"})]}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsxs)(xe.ZP,{monospace:!0,muted:!0,small:!0,children:["(paths start from ",(null===Ke||void 0===Ke?void 0:Ke.dbt_project_name)||"project"," folder)"]})]}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsx)(xe.ZP,{muted:!0,small:!0,children:(0,le.jsx)($n.Z,{href:"https://docs.getdbt.com/reference/node-selection/syntax#examples",openNewWindow:!0,small:!0,children:"Examples"})}),(0,le.jsx)(be.Z,{mr:5})]})})]}),h.t6.SQL===b.language&&!Le&&h.tf.DBT!==b.type&&(0,le.jsx)(Xe.y9,{children:(0,le.jsxs)(he.Z,{justifyContent:"space-between",children:[(0,le.jsxs)(he.Z,{children:[(0,le.jsxs)(tr.Z,{compact:!0,label:"Connection",onChange:function(e){return Mt((0,c.Z)({},E,e.target.value))},onClick:pr.j,small:!0,value:Ke.data_provider,children:[(0,le.jsx)("option",{value:""}),null===k||void 0===k?void 0:k.map((function(e){var n=e.id,t=e.value;return(0,le.jsx)("option",{value:t,children:n},n)}))]}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsxs)(tr.Z,{compact:!0,label:"Profile",onChange:function(e){return Mt((0,c.Z)({},T,e.target.value))},onClick:pr.j,small:!0,value:Ke.data_provider_profile,children:[(0,le.jsx)("option",{value:""}),null===zn||void 0===zn?void 0:zn.map((function(e){return(0,le.jsx)("option",{value:e,children:e},e)}))]}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsx)(he.Z,{alignItems:"center",children:(0,le.jsx)(et.Z,{block:!0,description:(0,le.jsxs)(xe.ZP,{default:!0,inline:!0,children:["If checked, you\u2019ll have to write your own custom",(0,le.jsx)("br",{}),"CREATE TABLE commands and INSERT commands.",(0,le.jsx)("br",{}),"Separate your commands using a semi-colon: ",(0,le.jsx)(xe.ZP,{default:!0,inline:!0,monospace:!0,children:";"})]}),size:null,widthFitContent:!0,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(pe.Z,{checked:Ke.use_raw_sql,label:(0,le.jsx)(xe.ZP,{muted:!0,small:!0,children:"Use raw SQL"}),onClick:function(e){(0,pr.j)(e),Mt((0,c.Z)({},B,!Ke.use_raw_sql))}}),(0,le.jsx)("span",{children:"\xa0"}),(0,le.jsx)(Ge.kI,{muted:!0})]})})}),!Ke.use_raw_sql&&(0,le.jsxs)(le.Fragment,{children:[Nt&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(be.Z,{mr:1}),(0,le.jsx)(he.Z,{alignItems:"center",children:(0,le.jsx)(je.Z,{compact:!0,label:"Database",monospace:!0,onBlur:function(){return setTimeout((function(){te(!1)}),300)},onChange:function(e){Mt((0,c.Z)({},P,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){te(!0)},small:!0,value:Ke.data_provider_database,width:10*re.iI})})]}),(0,le.jsx)(be.Z,{mr:1}),Ke.data_provider!==$i.MYSQL&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(et.Z,{block:!0,description:(0,le.jsxs)(xe.ZP,{default:!0,inline:!0,children:["Schema that is used when creating a table and inserting values.",(0,le.jsx)("br",{}),"This field is required."]}),size:null,widthFitContent:!0,children:(0,le.jsx)(he.Z,{alignItems:"center",children:(0,le.jsx)(je.Z,{compact:!0,label:"Schema",monospace:!0,onBlur:function(){return setTimeout((function(){te(!1)}),300)},onChange:function(e){Mt((0,c.Z)({},I,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){te(!0)},small:!0,value:Ke.data_provider_schema,width:10*re.iI})})}),(0,le.jsx)(be.Z,{mr:1})]}),(0,le.jsx)(et.Z,{block:!0,description:(0,le.jsxs)(xe.ZP,{default:!0,inline:!0,children:["This value will be used as the table name.",(0,le.jsx)("br",{}),"If blank, the default table name will be:",(0,le.jsx)("br",{}),(0,le.jsxs)(xe.ZP,{inline:!0,monospace:!0,children:[null===K||void 0===K?void 0:K.uuid,"_",null===b||void 0===b?void 0:b.uuid]}),(0,le.jsx)("br",{}),"This field is optional."]}),size:null,widthFitContent:!0,children:(0,le.jsx)(he.Z,{alignItems:"center",children:(0,le.jsx)(je.Z,{compact:!0,label:"Table (optional)",monospace:!0,onBlur:function(){return setTimeout((function(){te(!1)}),300)},onChange:function(e){Mt((0,c.Z)({},A,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){te(!0)},small:!0,value:Ke.data_provider_table,width:20*re.iI})})})]})]}),!Ke.use_raw_sql&&(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(et.Z,{appearBefore:!0,block:!0,description:(0,le.jsxs)(xe.ZP,{default:!0,inline:!0,children:["How do you want to handle existing data with the same",Nt?" database,":""," schema, and table name?",(0,le.jsx)("br",{}),(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:"Append"}),": add rows to the existing table.",(0,le.jsx)("br",{}),(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:"Replace"}),": delete the existing data.",(0,le.jsx)("br",{}),(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:"Fail"}),": raise an error during execution."]}),size:null,widthFitContent:!0,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(Ge.kI,{muted:!0}),(0,le.jsx)("span",{children:"\xa0"}),(0,le.jsx)(xe.ZP,{monospace:!0,muted:!0,small:!0,children:"Write policy:"}),(0,le.jsx)("span",{children:"\xa0"})]})}),(0,le.jsxs)(tr.Z,{compact:!0,label:"strategy",onChange:function(e){return Mt((0,c.Z)({},M,e.target.value))},onClick:pr.j,small:!0,value:Ke.export_write_policy,children:[(0,le.jsx)("option",{value:""}),null===er||void 0===er?void 0:er.map((function(e){return(0,le.jsx)("option",{value:e,children:(0,oe.kC)(e)},e)}))]}),(0,le.jsx)(be.Z,{mr:5})]})]})}),ft.length>=1&&(0,le.jsx)(Xe.y9,{normalPadding:!0,children:(0,le.jsx)(he.Z,{children:ft.map((function(e,n){var t=e.description,i=e.title;return(0,le.jsx)(be.Z,{ml:n>=1?1:0,children:(0,le.jsx)(et.Z,{block:!0,description:t,size:null,widthFitContent:!0,children:(0,le.jsx)(si,{children:i})})},i)}))})}),b.upstream_blocks.length>=1&&!Le&&h.f2.includes(b.type)&&(null===K||void 0===K?void 0:K.type)!==ge.q.STREAMING&&(0,le.jsxs)(Xe.y9,{children:[(0,le.jsxs)(xe.ZP,{small:!0,children:[h.t6.SQL!==b.language&&"Positional arguments for decorated function:",h.t6.SQL===b.language&&"Tables available in query from upstream blocks:"]}),(0,le.jsxs)(be.Z,{mt:1,children:[h.t6.SQL!==b.language&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)(xe.ZP,{monospace:!0,muted:!0,small:!0,children:[h.tf.DATA_EXPORTER===b.type&&"@data_exporter",h.tf.DATA_LOADER===b.type&&"@data_loader",h.tf.TRANSFORMER===b.type&&"@transformer"]}),(0,le.jsxs)(xe.ZP,{monospace:!0,muted:!0,small:!0,children:["def ",(h.tf.DATA_EXPORTER===b.type?"export_data":h.tf.DATA_LOADER===b.type&&"load_data")||h.tf.TRANSFORMER===b.type&&"transform_df","(",b.upstream_blocks.map((function(e,n){return n>=1?"df_".concat(n+1):"df"})).join(", "),"):"]})]}),b.upstream_blocks.map((function(e,n){var t=qn[e],i=(0,Xe.qn)(null===t||void 0===t?void 0:t.type,{blockColor:null===t||void 0===t?void 0:t.color,theme:Oe}).accent;return(0,le.jsxs)("div",{children:[h.t6.SQL!==b.language&&(0,le.jsxs)(xe.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0df",n>=1?"_".concat(n+1):null]}),h.t6.SQL===b.language&&(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"{{ df_".concat(n+1," }}")})," ",(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"\u2192"})," ",(0,le.jsx)($n.Z,{color:i,onClick:function(){var e,n,i=null===j||void 0===j||null===(e=j.current)||void 0===e?void 0:e["".concat(null===t||void 0===t?void 0:t.type,"s/").concat(null===t||void 0===t?void 0:t.uuid,".py")];null===i||void 0===i||null===(n=i.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,le.jsx)(xe.ZP,{color:i,inline:!0,monospace:!0,small:!0,children:e})})]},e)}))]})]}),!(null!==b&&void 0!==b&&b.error)&&(0,le.jsx)(le.Fragment,{children:Le?(0,le.jsx)(be.Z,{px:1,children:(0,le.jsxs)(xe.ZP,{monospace:!0,muted:!0,children:["(",(0,oe._6)("line",null===He||void 0===He?void 0:He.split(/\r\n|\r|\n/).length)," collapsed)"]})}):It}),(null===b||void 0===b?void 0:b.error)&&(0,le.jsxs)(be.Z,{p:re.cd,children:[(0,le.jsx)(xe.ZP,{bold:!0,danger:!0,children:null===b||void 0===b||null===(a=b.error)||void 0===a?void 0:a.error}),(0,le.jsx)(xe.ZP,{muted:!0,children:null===b||void 0===b||null===(s=b.error)||void 0===s?void 0:s.message})]}),Kn&&Qe&&Qe>Zn&&(0,le.jsx)(Xe.HC,{children:(0,le.jsxs)(xe.ZP,{muted:!0,children:["".concat(Math.round((Qe-Zn)/1e3)),"s"]})})]})),Rt]}),!W&&(0,le.jsxs)(Xe.gE,{additionalZIndex:Bt-x,onMouseEnter:function(){return Ee(!0)},onMouseLeave:function(){Ee(!1),ne(null)},children:[Se&&(0,le.jsx)(be.Z,{mt:2,children:(0,le.jsx)(ii,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=Qi(b,e);return[h.tf.DATA_LOADER,h.tf.TRANSFORMER].includes(b.type)&&h.tf.SCRATCHPAD===e.type&&(n="from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(K.uuid,"', '").concat(b.uuid,"', 'output_0')")),n=ei(e,n),h.t6.SQL===b.language&&(n=$t(n),t=vr(vr({},(0,sn.GL)(b.configuration,[E,P,T,I,M])),t)),p(vr(vr({},e),{},{configuration:t,content:n,upstream_blocks:i}))},blockIdx:x,compact:!0,onClickAddSingleDBTModel:Y,pipeline:K,setAddNewBlockMenuOpenIdx:ne,setCreatingNewDBTModel:ie,setRecsWindowOpenBlockIdx:se})}),(0,le.jsx)(Xe.t1,{className:"block-divider-inner"})]})]})}var br=d.forwardRef(gr),xr=t(90880),jr=6.25*re.iI,yr=(re.iI,100*re.iI),kr=Te.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%);",""],gn.n_,yr,(function(e){return"\n box-shadow: ".concat((e.theme||vn.Z).shadow.window,";\n background-color: ").concat((e.theme||vn.Z).background.panel,";\n ")})),Zr=(0,Te.css)(["display:flex;align-items:center;justify-content:space-between;height:","px;padding:","px ","px;",""],jr,re.iI,re.cd*re.iI,(function(e){return"\n background-color: ".concat((e.theme||vn.Z).background.output,";\n ")})),_r=Te.default.div.withConfig({displayName:"indexstyle__WindowHeaderStyle",componentId:"sc-g0cszf-1"})([""," border-top-left-radius:","px;border-top-right-radius:","px;",""],Zr,gn.n_,gn.n_,(function(e){return"\n border-bottom: ".concat(gn.YF,"px ").concat(gn.M8," ").concat((e.theme||vn.Z).borders.medium,";\n ")})),Cr=Te.default.div.withConfig({displayName:"indexstyle__WindowContentStyle",componentId:"sc-g0cszf-2"})(["overflow:auto;padding:","px 0;"," "," "," ",""],re.iI,tt.w5,(0,xr.eR)(),(function(e){return e.minMaxHeight&&"\n max-height: ".concat(7*re.iI,"px;\n ")}),(function(e){return!e.minMaxHeight&&"\n max-height: calc(100vh - ".concat(6.5*jr,"px);\n ")})),Or=Te.default.div.withConfig({displayName:"indexstyle__WindowFooterStyle",componentId:"sc-g0cszf-3"})([""," justify-content:flex-end;border-bottom-left-radius:","px;border-bottom-right-radius:","px;",""],Zr,gn.n_,gn.n_,(function(e){return"\n border-top: ".concat(gn.YF,"px ").concat(gn.M8," ").concat((e.theme||vn.Z).borders.medium,";\n ")})),wr=Te.default.div.withConfig({displayName:"indexstyle__InputRowStyle",componentId:"sc-g0cszf-4"})(["padding:","px ","px;",""],.75*re.iI,2*re.iI,(function(e){return"\n border-bottom: ".concat(gn.YF,"px ").concat(gn.M8," ").concat((e.theme||vn.Z).borders.medium,";\n ")}));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 Er(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,c.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 Pr,Tr,Ir,Ar,Rr=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,d.useState)(!1),a=u[0],s=u[1],f=(0,d.useState)(null),p=f[0],m=f[1],v=(0,d.useMemo)((function(){var e,n,t=null===(e=(0,rn.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).filter((function(e){return"models"===e.name}));t.length>=1&&i.push(Er(Er({},e),{},{children:t}))})),i}),[r]),g=(0,d.useMemo)((function(){return(0,rn.HK)(n,(function(e){return e.configuration.file_path}))}),[n]);return(0,le.jsxs)(kr,{children:[(0,le.jsxs)(_r,{children:[(0,le.jsx)(An.Z,{alignItems:"center",children:(0,le.jsx)(xe.ZP,{disableWordBreak:!0,monospace:!0,children:t?"Create new DBT model":"Select DBT model file"})}),(0,le.jsx)(de.Z,{iconOnly:!0,onClick:o,children:(0,le.jsx)(Ge.x8,{muted:!0})})]}),t&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(wr,{children:(0,le.jsx)(jt,{inputValue:i,label:"Model name (cannot be changed):",labelColor:vn.Z.accent.dbt,minWidth:38*re.iI,notRequired:!0,onBlur:function(){s(!1)},onChange:function(e){c(e.target.value),e.preventDefault()},onClick:function(){s(!0)},onFocus:function(){s(!0)},placeholder:"Enter name",required:!0,stacked:!0,value:!a&&i})}),(0,le.jsxs)(wr,{children:[(0,le.jsx)(xe.ZP,{bold:!0,color:vn.Z.accent.dbt,children:"Select folder location:"}),(0,le.jsx)(xe.ZP,{bold:!0,muted:!p,children:p?"dbt/".concat(p):"Choose folder below"})]})]}),(0,le.jsx)(Cr,{children:(0,le.jsx)(In,{allowSelectingFolders:t,disableContextMenu:!0,files:v,isFileDisabled:function(e,n){return t?!n||(null===n||void 0===n?void 0:n.some((function(e){return"models"===(null===e||void 0===e?void 0:e.name)}))):!!g[e]||!(null!==n&&void 0!==n&&n.length)&&!e.match(new RegExp(".".concat(h.t6.SQL,"$")))},openFile:l,selectFile:m,uncollapsed:!0,useRootFolder:!0})}),t&&(0,le.jsx)(Or,{children:(0,le.jsx)(de.Z,{backgroundColor:i&&p?vn.Z.accent.dbt:vn.Z.monotone.grey500,disabled:!i||!p,onClick:function(){return l(p)},padding:"6px 8px",children:"Create model"})})]})},Dr=t(4804),Mr=t(65730),Nr=t(87372);!function(e){e.FULL_TABLE="FULL_TABLE",e.INCREMENTAL="INCREMENTAL",e.LOG_BASED="LOG_BASED"}(Tr||(Tr={})),function(e){e.IGNORE="IGNORE",e.UPDATE="UPDATE"}(Ir||(Ir={})),function(e){e.DATE_TIME="date-time",e.UUID="uuid"}(Ar||(Ar={}));var Br,Lr="datetime",Fr=(Pr={},(0,c.Z)(Pr,Ar.DATE_TIME,Lr),(0,c.Z)(Pr,Ar.UUID,Ar.UUID),Pr);!function(e){e.ARRAY="array",e.BOOLEAN="boolean",e.INTEGER="integer",e.NULL="null",e.NUMBER="number",e.OBJECT="object",e.STRING="string"}(Br||(Br={}));var Ur,Hr,zr,Gr,Wr,Qr=[Br.ARRAY,Br.BOOLEAN,Lr,Br.INTEGER,Br.NULL,Br.NUMBER,Br.OBJECT,Br.STRING,Ar.UUID];!function(e){e.PROPERTIES="properties"}(Ur||(Ur={})),function(e){e.AUTOMATIC="automatic",e.AVAILABLE="available",e.UNSUPPORTED="unsupported"}(Hr||(Hr={})),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"}(zr||(zr={})),function(e){e.AMPLITUDE="amplitude",e.BIGQUERY="bigquery",e.CHARGEBEE="chargebee",e.GOOGLE_SEARCH_CONSOLE="google_search_console",e.GOOGLE_SHEETS="google_sheets",e.INTERCOM="intercom",e.MYSQL="mysql",e.POSTGRESQL="postgresql",e.REDSHIFT="redshift",e.SALESFORCE="salesforce",e.STRIPE="stripe"}(Gr||(Gr={})),function(e){e.BIGQUERY="bigquery",e.DELTA_LAKE_S3="delta_lake_s3",e.MYSQL="mysql",e.POSTGRESQL="postgresql",e.SNOWFLAKE="snowflake"}(Wr||(Wr={}));var qr=Te.default.div.withConfig({displayName:"Chip__ChipStyle",componentId:"sc-1ok73g-0"})(["display:inline-block;"," "," "," "," ",""],(function(e){return!e.primary&&"\n background-color: ".concat((e.theme.background||vn.Z.background).popup,";\n ")}),(function(e){return e.primary&&"\n background-color: ".concat((e.theme.chart||vn.Z.chart).primary,";\n ")}),(function(e){return!e.small&&"\n border-radius: ".concat((re.iI+oi.Al)/2,"px;\n height: ").concat(1.5*re.iI+oi.Al,"px;\n padding: ").concat(re.iI/1.5,"px ").concat(1.25*re.iI,"px;\n ")}),(function(e){return e.small&&"\n border-radius: ".concat((re.iI/2+oi.Al)/2,"px;\n height: ").concat(oi.Al+re.iI/2+2,"px;\n padding: ").concat(re.iI/4,"px ").concat(re.iI,"px;\n ")}),(function(e){return e.border&&"\n border: 1px solid ".concat((e.theme.content||vn.Z.content).muted,";\n ")})),Yr=function(e){var n=e.border,t=e.children,i=e.label,r=e.onClick,o=e.primary,l=e.small;return(0,le.jsx)(qr,{border:n,primary:o,small:l,children:(0,le.jsx)(de.Z,{basic:!0,noPadding:!0,noBackground:!0,onClick:r,transparent:!0,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[t,i&&(0,le.jsx)(xe.ZP,{small:l,children:i}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsx)(Ge.x8,{default:o,muted:!o,size:l?re.iI:1.25*re.iI})]})})})},Vr=t(85307);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 Xr(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,c.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 Jr="4px",$r=[Wr.BIGQUERY,Wr.DELTA_LAKE_S3];var eo=function(e){var n=e.destination,t=e.isLoadingLoadSampleData,i=e.loadSampleData,r=e.source,o=e.stream,c=e.streams,u=e.updateAllStreams,a=e.updateMetadataForColumns,s=e.updateSchemaProperty,f=e.updateStream,p=(0,d.useRef)(null),h=o.bookmark_properties,m=o.destination_table,v=void 0===m?"":m,g=o.key_properties,b=o.metadata,x=o.partition_keys,j=o.replication_method,y=o.schema.properties,k=o.tap_stream_id,Z=o.unique_constraints,_=o.unique_conflict_method,C=(0,d.useState)(v),O=C[0],w=C[1],S=(0,d.useState)(!1),E=S[0],P=S[1],T=(0,d.useState)(null),I=T[0],A=T[1],R=(0,gi.Z)(k);(0,d.useEffect)((function(){R!==k&&(w(v),A(null))}),[v,j,k,R,_]);var D=(0,d.useMemo)((function(){return(0,rn.HK)(b,(function(e){return e.breadcrumb.join("/")}))}),[b]),M=(0,d.useMemo)((function(){var e;return null===(e=(0,rn.sE)(b,(function(e){return 0===e.breadcrumb.length})))||void 0===e?void 0:e.metadata}),[b]),N=(0,d.useMemo)((function(){return M[zr.KEY_PROPERTIES]||[]}),[M]),B=(0,d.useMemo)((function(){return M[zr.REPLICATION_KEYS]||[]}),[M]),L=$r.includes(n),F=c.length>1,U=(0,d.useMemo)((function(){var e=[],t=[],i=(0,rn.mr)(Object.entries(y)).map((function(i,r){var o=(0,l.Z)(i,2),c=o[0],d=o[1],p=d.anyOf,m=void 0===p?[]:p,v=d.format,b=d.type,j=void 0===b?[]:b,y=new Set(Array.isArray(j)?j:[j]),_=new Set(y);m.forEach((function(e){var n=e.format,t=(e.items,e.type);Array.isArray(t)?t.forEach((function(e){y.add(e),_.add(e)})):(y.add(t),_.add(t),n&&_.add(n))}));var C=Array.from(y);v&&_.add(v);var O=(D["properties/".concat(c)]||{}).metadata,w=(O.inclusion,O.selected);e.push(w),t.push(c);var S=Qr.reduce((function(e,n){return C.indexOf(n)>=0||Lr===String(n)&&Ar.DATE_TIME===v||Ar.UUID===String(n)&&Ar.UUID===v?e:e.concat((0,le.jsx)("option",{value:n,children:n},n))}),[]),E=C.findIndex((function(e){return e===Br.STRING})),P=[(0,le.jsx)(pe.Z,{checked:w,onClick:function(){a(k,[c],{selected:!w})}},"".concat(k,"/").concat(c,"/selected")),(0,le.jsx)(xe.ZP,{children:c},"".concat(k,"/").concat(c,"/name")),(0,le.jsxs)(he.Z,{children:[(0,le.jsx)(An.Z,{flex:1,children:(0,le.jsx)(he.Z,{alignItems:"center",flexWrap:"wrap",fullWidth:!0,children:C.map((function(e,n){return(0,le.jsx)(be.Z,{mb:1,mr:1,children:(0,le.jsx)(Yr,{border:!0,label:v&&Br.STRING===e&&E===n?Fr[v]:e,onClick:function(){var n={format:v,type:C.filter((function(n){return n!==e}))};Ar.DATE_TIME!==v&&Ar.UUID!==v||Br.STRING!==e||(n.format=null),s(k,c,n)},small:!0})},"".concat(k,"/").concat(c,"/").concat(e,"/").concat(n,"/chip"))}))})}),S.length>=1&&(0,le.jsxs)(tr.Z,{compact:!0,onChange:function(e){var n=e.target.value,t={format:v,type:C};Lr===String(n)?(t.format=Ar.DATE_TIME,t.type.push(Br.STRING)):Ar.UUID===String(n)?(t.format=Ar.UUID,t.type.push(Br.STRING)):t.type.push(n),s(k,c,t)},primary:!0,small:!0,value:"",width:10*re.iI,children:[(0,le.jsx)("option",{value:""}),S]})]},"".concat(k,"/").concat(c,"/type")),(0,le.jsx)(pe.Z,{checked:!(null===Z||void 0===Z||!Z.includes(c)),disabled:N.length>=1&&!N.includes(c),onClick:N.length>=1&&!N.includes(c)?null:function(){return f(k,(function(e){var n;return null!==(n=e.unique_constraints)&&void 0!==n&&n.includes(c)?e.unique_constraints=(0,rn.Od)(e.unique_constraints,(function(e){return c===e})):e.unique_constraints=[c].concat(e.unique_constraints||[]),e}))}},"".concat(k,"/").concat(c,"/unique")),(0,le.jsx)(pe.Z,{checked:!(null===h||void 0===h||!h.includes(c)),disabled:B.length>=1&&!B.includes(c),onClick:B.length>=1&&!B.includes(c)?null:function(){return f(k,(function(e){var n;return null!==(n=e.bookmark_properties)&&void 0!==n&&n.includes(c)?e.bookmark_properties=(0,rn.Od)(e.bookmark_properties,(function(e){return c===e})):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),e}))}},"".concat(k,"/").concat(c,"/bookmark")),(0,le.jsx)(pe.Z,{checked:!(null===g||void 0===g||!g.includes(c)),onClick:function(){return f(k,(function(e){var n;return null!==(n=e.key_properties)&&void 0!==n&&n.includes(c)?e.key_properties=(0,rn.Od)(e.key_properties,(function(e){return c===e})):e.key_properties=[c].concat(e.key_properties||[]),e}))}},"".concat(k,"/").concat(c,"/key_property"))];if(L){var T=n!==Wr.DELTA_LAKE_S3,R=T&&(N.includes(c)||!_.has(Ar.DATE_TIME));P.push((0,le.jsx)(pe.Z,{checked:!(null===x||void 0===x||!x.includes(c)),disabled:R,onClick:R?null:function(){return f(k,(function(e){var n,t;null!==(n=e.partition_keys)&&void 0!==n&&n.includes(c)?e.partition_keys=(0,rn.Od)(e.partition_keys,(function(e){return c===e})):T&&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(k,"/").concat(c,"/partition_key")))}if(F){var M=I===r;P.push((0,le.jsx)(de.Z,{compact:!0,disabled:M,onClick:function(){A(r),setTimeout((function(){return A(null)}),2e3),u((function(e){var n,t;if((null===e||void 0===e?void 0:e.tap_stream_id)!==k&&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,d,f;e.schema.properties[c]={format:v||null,type:C};var p=null===(i=(0,rn.sE)((null===e||void 0===e?void 0:e.metadata)||[],(function(e){return 0===e.breadcrumb.length})))||void 0===i?void 0:i.metadata,m=p[zr.REPLICATION_KEYS]||[],b=p[zr.KEY_PROPERTIES]||[];null===Z||void 0===Z||!Z.includes(c)||null!==e&&void 0!==e&&null!==(r=e.unique_constraints)&&void 0!==r&&r.includes(c)||!b.includes(c)?null!==Z&&void 0!==Z&&Z.includes(c)||null===e||void 0===e||null===(o=e.unique_constraints)||void 0===o||!o.includes(c)||(e.unique_constraints=(0,rn.Od)(e.unique_constraints,(function(e){return c===e}))):e.unique_constraints=[c].concat(e.unique_constraints||[]),null===h||void 0===h||!h.includes(c)||null!==e&&void 0!==e&&null!==(l=e.bookmark_properties)&&void 0!==l&&l.includes(c)||!m.includes(c)?null!==h&&void 0!==h&&h.includes(c)||null===e||void 0===e||null===(u=e.bookmark_properties)||void 0===u||!u.includes(c)||(e.bookmark_properties=(0,rn.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),null===g||void 0===g||!g.includes(c)||null!==e&&void 0!==e&&null!==(a=e.key_properties)&&void 0!==a&&a.includes(c)?null!==g&&void 0!==g&&g.includes(c)||null===e||void 0===e||null===(s=e.key_properties)||void 0===s||!s.includes(c)||(e.key_properties=(0,rn.Od)(e.key_properties,(function(e){return c===e}))):e.key_properties=[c].concat(e.key_properties||[]),null===x||void 0===x||!x.includes(c)||null!==e&&void 0!==e&&null!==(d=e.partition_keys)&&void 0!==d&&d.includes(c)?null!==x&&void 0!==x&&x.includes(c)||null===e||void 0===e||null===(f=e.partition_keys)||void 0===f||!f.includes(c)||(e.partition_keys=(0,rn.Od)(e.partition_keys,(function(e){return c===e}))):e.partition_keys=[c].concat(e.partition_keys||[])}return Xr({},e)}))},pill:!0,secondary:!0,children:(0,le.jsx)(xe.ZP,{success:M,children:M?"Applied!":"Apply"})}))}return P})),r=e.every((function(e){return e})),o=[null,2,1,null,null,null],c=[{label:function(){return(0,le.jsx)(pe.Z,{checked:r,onClick:function(){a(k,t,{selected:!r})}})},uuid:"Selected"},{uuid:"Name"},{uuid:"Type"},{uuid:"Unique"},{uuid:"Bookmark"},{uuid:"Key prop"}];return L&&(o.push(null),c.push({uuid:"Partition key"})),F&&(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,le.jsx)(Vr.cl,{children:(0,le.jsx)(mn.Z,{alignTop:!0,columnFlex:o,columns:c,rows:i,stickyHeader:!0})})}),[h,n,F,I,g,D,x,y,L,k,Z,u,a,s,f,N,B]);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)(Nr.Z,{condensed:!0,level:4,spacingBelow:!0,children:[(0,le.jsx)(Nr.Z,{condensed:!0,inline:!0,level:4,monospace:!0,children:k})," schema"]}),(0,le.jsx)(be.Z,{mb:3,children:(0,le.jsx)(ve.Z,{headerTitle:"Output",overflowVisible:!0,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(xe.ZP,{children:"Destination table name"}),(0,le.jsx)(be.Z,{ml:Jr}),(0,le.jsx)(et.Z,{label:(0,le.jsxs)(xe.ZP,{children:["By default, this stream will be saved to your destination under the table named ",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:k}),". To change the table name, enter in a different value."]}),lightBackground:!0,primary:!0}),(0,le.jsx)(be.Z,{ml:1}),(0,le.jsx)(je.Z,{compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;w(n),clearTimeout(p.current),p.current=setTimeout((function(){f(k,(function(e){return Xr(Xr({},e),{},{destination_table:n})}))}),300)},value:O||"",width:45*re.iI})]})})}),(0,le.jsx)(be.Z,{mb:3,children:(0,le.jsx)(ve.Z,{headerTitle:"Usage",overflowVisible:!0,children:(0,le.jsxs)(he.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,le.jsxs)(An.Z,{alignItems:"center",children:[(0,le.jsx)(xe.ZP,{children:"Replication method"}),(0,le.jsx)(be.Z,{ml:Jr}),(0,le.jsx)(et.Z,{label:(0,le.jsxs)(xe.ZP,{children:["Do you want to synchronize the entire stream (",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:Tr.FULL_TABLE}),") on each integration pipeline run or only new records (",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:Tr.INCREMENTAL}),")?",r===Gr.POSTGRESQL&&(0,le.jsxs)(xe.ZP,{children:["Log-based incremental replication (",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:Tr.LOG_BASED}),") is also available for PostgreSQL sources."]})]}),lightBackground:!0,primary:!0}),(0,le.jsx)(be.Z,{ml:1}),(0,le.jsxs)(tr.Z,{compact:!0,onChange:function(e){f(k,(function(n){return Xr(Xr({},n),{},{replication_method:e.target.value})}))},primary:!0,value:j,children:[(0,le.jsx)("option",{value:""}),Object.values(Tr).filter((function(e){return r===Gr.POSTGRESQL||e!==Tr.LOG_BASED})).map((function(e){return(0,le.jsx)("option",{value:e,children:e},e)}))]}),(0,le.jsx)(be.Z,{ml:3}),(0,le.jsx)(xe.ZP,{children:"Unique conflict method"}),(0,le.jsx)(be.Z,{ml:Jr}),(0,le.jsx)(et.Z,{label:(0,le.jsxs)(xe.ZP,{wordBreak:!0,children:["If a new record has the same value as an existing record in the ",(0,oe._6)("column",null===Z||void 0===Z?void 0:Z.length),(null===Z||void 0===Z?void 0:Z.length)>0&&(0,le.jsx)(le.Fragment,{children:"\xa0"}),null===Z||void 0===Z?void 0:Z.sort().map((function(e,n){return(0,le.jsxs)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:[1!==(null===Z||void 0===Z?void 0:Z.length)&&n===(null===Z||void 0===Z?void 0:Z.length)-1?(0,le.jsx)(xe.ZP,{inline:!0,children:" and "},e):n>=1&&(0,le.jsx)(le.Fragment,{children:",\xa0"}),e]},e)})),", how do you want to resolve the conflict? The conflict method ",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:Ir.IGNORE})," will skip the new record if it\u2019s a duplicate of an existing record. The conflict method ",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:Ir.UPDATE})," will not save the new record and instead update the existing record with the new record\u2019s properties."]}),lightBackground:!0,primary:!0}),(0,le.jsx)(be.Z,{ml:1}),(0,le.jsxs)(tr.Z,{compact:!0,inputWidth:11*re.iI,onChange:function(e){f(k,(function(n){return Xr(Xr({},n),{},{unique_conflict_method:e.target.value})}))},primary:!0,value:_,children:[(0,le.jsx)("option",{value:""}),(0,le.jsx)("option",{value:Ir.IGNORE,children:Ir.IGNORE}),(0,le.jsx)("option",{value:Ir.UPDATE,children:Ir.UPDATE})]})]}),F&&(0,le.jsxs)(An.Z,{alignItems:"center",children:[(0,le.jsx)(xe.ZP,{default:!0,children:"All streams"}),(0,le.jsx)(be.Z,{ml:Jr}),(0,le.jsx)(et.Z,{appearBefore:!0,label:(0,le.jsx)(xe.ZP,{children:"This will apply this stream's replication method and unique conflict method settings to all selected streams."}),lightBackground:!0,primary:!0}),(0,le.jsx)(be.Z,{ml:1}),(0,le.jsx)(de.Z,{compact:!0,disabled:E,onClick:function(){P(!0),setTimeout((function(){return P(!1)}),2e3),u((function(e){return Xr(Xr({},e),{},{replication_method:j,unique_conflict_method:_})}))},pill:!0,secondary:!0,children:(0,le.jsx)(xe.ZP,{bold:!E,success:E,children:E?"Applied!":"Apply"})})]})]})})}),(0,le.jsx)(ve.Z,{headerTitle:"Features",noPadding:!0,children:U}),(0,le.jsx)(be.Z,{mt:2,children:(0,le.jsx)(de.Z,{loading:t,onClick:function(){return i(k)},primary:!0,small:!0,children:"Load sample data"})}),(0,le.jsxs)(be.Z,{mt:5,children:[(0,le.jsx)(Nr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Settings"}),Tr.INCREMENTAL===j&&(0,le.jsxs)(be.Z,{mb:5,children:[(0,le.jsxs)(be.Z,{mb:1,children:[(0,le.jsx)(xe.ZP,{bold:!0,large:!0,children:"Bookmark properties"}),(0,le.jsxs)(xe.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,le.jsx)("br",{}),"On the next run, the synchronization will start after the bookmarked record."]})]}),(0,le.jsxs)(he.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==h&&void 0!==h&&h.length)&&(0,le.jsxs)(xe.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,italic:!0,children:"Bookmark"})," to use a specific column as a bookmark property."]}),null===h||void 0===h?void 0:h.sort().map((function(e){return(0,le.jsx)(be.Z,{mb:1,mr:1,children:(0,le.jsx)(Yr,{label:e,onClick:function(){f(k,(function(n){return Xr(Xr({},n),{},{bookmark_properties:(0,rn.Od)(n.bookmark_properties||[],(function(n){return n===e}))})}))},primary:!0})},"bookmark_properties/".concat(e))}))]})]}),(0,le.jsxs)(be.Z,{mb:5,children:[(0,le.jsxs)(be.Z,{mb:1,children:[(0,le.jsx)(xe.ZP,{bold:!0,large:!0,children:"Unique constraints"}),(0,le.jsx)(xe.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,le.jsxs)(he.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==Z&&void 0!==Z&&Z.length)&&(0,le.jsxs)(xe.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,italic:!0,children:"Unique"})," to use a specific column as a unique constraint."]}),null===Z||void 0===Z?void 0:Z.sort().map((function(e){return(0,le.jsx)(be.Z,{mb:1,mr:1,children:(0,le.jsx)(Yr,{label:e,onClick:function(){f(k,(function(n){return Xr(Xr({},n),{},{unique_constraints:(0,rn.Od)(n.unique_constraints||[],(function(n){return n===e}))})}))},primary:!0})},"unique_constraints/".concat(e))}))]})]}),(0,le.jsxs)(be.Z,{mb:5,children:[(0,le.jsxs)(be.Z,{mb:1,children:[(0,le.jsx)(xe.ZP,{bold:!0,large:!0,children:"Key properties"}),(0,le.jsx)(xe.ZP,{default:!0,children:"Key properties are used as the primary key for the destination table."})]}),(0,le.jsxs)(he.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==g&&void 0!==g&&g.length)&&(0,le.jsxs)(xe.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,italic:!0,children:"Key prop"})," to use a specific column as a key property."]}),null===g||void 0===g?void 0:g.sort().map((function(e){return(0,le.jsx)(be.Z,{mb:1,mr:1,children:(0,le.jsx)(Yr,{label:e,onClick:function(){f(k,(function(n){return Xr(Xr({},n),{},{key_properties:(0,rn.Od)(n.key_properties||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]}),L&&(0,le.jsxs)(be.Z,{mb:3,children:[(0,le.jsxs)(be.Z,{mb:1,children:[(0,le.jsx)(xe.ZP,{bold:!0,large:!0,children:"Partition keys"}),(0,le.jsx)(xe.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,le.jsxs)(he.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==x&&void 0!==x&&x.length)&&(0,le.jsxs)(xe.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,italic:!0,children:"Partition key"})," to use a specific column as a partition key."]}),null===x||void 0===x?void 0:x.sort().map((function(e){return(0,le.jsx)(be.Z,{mb:1,mr:1,children:(0,le.jsx)(Yr,{label:e,onClick:function(){f(k,(function(n){return Xr(Xr({},n),{},{partition_keys:(0,rn.Od)(n.partition_keys||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]})]})]})},no=["catalog","setSelectedStream"];function to(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 io(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?to(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):to(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ro=function(e){var n=e.catalog,t=e.setSelectedStream,i=(0,Pe.Z)(e,no),r=(0,d.useState)(null),o=r[0],l=r[1],c=(0,d.useMemo)((function(){return(null===n||void 0===n?void 0:n.streams)||[]}),[n]),u=(0,d.useMemo)((function(){return(0,rn.YC)(c,"stream").map((function(e){return{uuid:e.stream}}))}),[c]),a=(0,d.useMemo)((function(){return(0,rn.HK)(c,(function(e){return e.stream}))}),[c]),s=(0,d.useMemo)((function(){return a[null===o||void 0===o?void 0:o.uuid]}),[o,a]);(0,d.useEffect)((function(){u.length>0&&(o&&(0,rn.sE)(u,(function(e){var n=e.uuid;return o.uuid===n}))||l(u[0]))}),[o,l,u]);var f=(0,d.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,le.jsx)(Vr.cl,{children:(0,le.jsx)(mn.Z,{alignTop:!0,columnBorders:!0,columnFlex:e.map((function(e){return 1})),columns:e,rows:c.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,le.jsx)(xe.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,le.jsx)(xe.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})})}),[c]);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(di.Z,{allowScroll:!0,noPadding:!0,onClickTab:function(e){l(e),t(e.uuid)},selectedTabUUID:null===o||void 0===o?void 0:o.uuid,tabs:u}),s&&(0,le.jsx)(be.Z,{mt:1,children:(0,le.jsx)(Vr.dE,{children:(0,le.jsx)(eo,io(io({},i),{},{stream:s,streams:c}))})}),c.length>=1&&(0,le.jsx)(be.Z,{mt:1,children:(0,le.jsxs)(Vr.dE,{children:[(0,le.jsx)(Nr.Z,{level:4,children:"Streams Summary"}),(0,le.jsx)(be.Z,{mt:1}),f]})})]})},oo=Te.default.div.withConfig({displayName:"indexstyle__PanelStyle",componentId:"sc-1rfr5wd-0"})(["border-radius:","px;width:100%;",""],gn.n_,(function(e){return"\n background-color: ".concat((e.theme.background||vn.Z.background).panel,";\n ")}));var lo,co=function(e){var n=e.children;return(0,le.jsx)(oo,{children:n})};function uo(e){return Object.values(e).filter((function(e){return null!==e})).map((function(e){return e.tap_stream_id}))}function ao(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function so(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ao(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ao(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}!function(e){e.ALL="All",e.SELECTED="Selected",e.NOT_SELECTED="Not selected"}(lo||(lo={}));var fo=45*re.iI;var po=function(e){var n=e.catalog,t=e.isLoading,i=e.onActionCallback,r=e.streams,o=(0,rn.HK)((null===n||void 0===n?void 0:n.streams)||[],(function(e){return e.stream})),l=(0,d.useState)(o),u=l[0],a=l[1],s=(0,d.useState)(null),f=s[0],p=s[1],h=(0,d.useState)(!1),m=h[0],v=h[1],g=(0,d.useState)(lo.ALL),b=g[0],x=g[1],j=(0,d.useRef)(null),y=uo(u),k=(0,d.useMemo)((function(){var e=r;return e=e.filter((function(e){var n=e.tap_stream_id;return b===lo.SELECTED?y.includes(n):b!==lo.NOT_SELECTED||!y.includes(n)})),f?e.filter((function(e){var n=e.tap_stream_id;return null===n||void 0===n?void 0:n.toLowerCase().includes(null===f||void 0===f?void 0:f.toLowerCase())})):e}),[b,f,y,r]),Z=(0,d.useMemo)((function(){return r.every((function(e){var n=e.stream;return!!u[n]}))}),[u,r]);return(0,le.jsxs)(co,{children:[(0,le.jsx)(Vr.cv,{rounded:!0,children:(0,le.jsx)(xe.ZP,{bold:!0,large:!0,children:"Select streams to sync"})}),(0,le.jsx)(Vr.cv,{padding:1.25*re.iI,children:(0,le.jsxs)(he.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,le.jsx)(je.Z,{beforeIcon:(0,le.jsx)(Ge.HN,{}),compact:!0,noBackground:!0,noBorder:!0,onChange:function(e){return p(e.target.value)},placeholder:"Search",value:f}),(0,le.jsx)(be.Z,{pr:1,children:(0,le.jsx)(Tt.Z,{items:[{label:function(){return lo.ALL},onClick:function(){return x(lo.ALL)},uuid:"all_streams"},{label:function(){return lo.SELECTED},onClick:function(){return x(lo.SELECTED)},uuid:"selected"},{label:function(){return lo.NOT_SELECTED},onClick:function(){return x(lo.NOT_SELECTED)},uuid:"unselected"}],onClickCallback:function(){return v(!1)},onClickOutside:function(){return v(!1)},open:m,parentRef:j,uuid:"SelectStreams/filter",children:(0,le.jsx)(de.Z,{beforeIcon:(0,le.jsx)(Ge.wn,{}),noBackground:!0,onClick:function(){return v((function(e){return!e}))},ref:j,children:(0,le.jsx)(xe.ZP,{children:b})})})})]})}),(0,le.jsx)(Vr.cl,{height:"55vh",hideHorizontalScrollbar:!0,width:"".concat(fo,"px"),children:(0,le.jsx)(mn.Z,{borderCollapseSeparate:!0,columnFlex:[1,6],columns:[{label:function(){return(0,le.jsx)(pe.Z,{checked:Z,onClick:function(){var e=(0,rn.HK)(r||[],(function(e){return e.stream}));a(Z?{}:e)}})},uuid:"Selected"},{uuid:"Stream name"}],rows:k.map((function(e){var n=e.stream,t=!!u[n];return[(0,le.jsx)(pe.Z,{checked:t,onClick:function(){a((function(i){return so(so({},i),{},(0,c.Z)({},n,t?null:e))}))}},"selected-".concat(n)),(0,le.jsx)(xe.ZP,{children:n},"stream-".concat(n))]})),stickyHeader:!0})}),(0,le.jsx)(vi.Z,{medium:!0}),(0,le.jsxs)(be.Z,{p:2,children:[(null===y||void 0===y?void 0:y.length)>50&&(0,le.jsx)(be.Z,{pb:2,children:(0,le.jsxs)(xe.ZP,{danger:!0,maxWidth:fo-4*re.iI,rightAligned:!0,whiteSpaceNormal:!0,children:["WARNING: Selecting too many streams (e.g. >50)",(0,le.jsx)("br",{}),"may cause app performance issues."]})}),(0,le.jsx)(he.Z,{justifyContent:"flex-end",children:(0,le.jsx)(de.Z,{loading:t,onClick:function(){return i(u)},primary:!0,children:"Confirm ".concat(uo(u).length," streams")})})]})]})};function ho(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 mo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ho(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ho(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var vo=function(e){var n=e.api,t=e.block,i=e.blockContent,r=e.onChangeCodeBlock,o=e.pipeline,u=(0,d.useState)(null),a=u[0],s=u[1];(0,d.useEffect)((function(){i&&!a&&s((0,Dr.Pz)(null===i||void 0===i?void 0:i.config))}),[a,i]);var p=(0,d.useState)(null),m=p[0],v=p[1],g=(0,d.useState)(),b=g[0],x=g[1],j=(0,f.Db)(an.ZP[n].useCreate(),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(e){var t,i,r=(0,oe.C5)(n);v(null===e||void 0===e||null===(t=e[r])||void 0===t?void 0:t.success),x(null===e||void 0===e||null===(i=e[r])||void 0===i?void 0:i.error_message)},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})}}),y=(0,l.Z)(j,2),k=y[0],Z=y[1].isLoading;return t?(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(Vr.$W,{children:(0,le.jsx)(Nn.Z,{autoHeight:!0,language:h.t6.YAML,onChange:function(e){s(e),r(t.uuid,(0,Dr.Pz)(mo(mo({},i),{},{config:(0,Dr.Qc)(e)})))},tabSize:2,value:a||void 0,width:"100%"})}),(0,le.jsxs)(be.Z,{mt:1,children:[(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(de.Z,{onClick:function(){k((0,c.Z)({},(0,oe.C5)(n),{action_type:"test_connection",config:a,pipeline_uuid:o.uuid})),x(null)},small:!0,success:!0,children:"Test connection"}),(0,le.jsx)(be.Z,{ml:1,children:Z?(0,le.jsx)(zi.Z,{color:"white",small:!0}):(0,le.jsxs)(le.Fragment,{children:[m&&(0,le.jsx)(xe.ZP,{small:!0,success:!0,children:"Connected successfully!"}),!1===m&&(0,le.jsx)(xe.ZP,{small:!0,warning:!0,children:"Failed to connect, see error below."})]})})]}),b&&(0,le.jsx)(be.Z,{mt:1,children:(0,le.jsx)(xe.ZP,{small:!0,warning:!0,children:b})})]})]}):null},go=t(70902);function bo(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 xo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?bo(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):bo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var jo=function(e){var n,t,i,r=e.addNewBlockAtIndex,o=e.blocks,c=e.codeBlocks,u=e.fetchFileTree,a=e.fetchPipeline,s=e.fetchSampleData,p=e.globalVariables,m=e.onChangeCodeBlock,v=e.openSidekickView,g=e.pipeline,b=e.savePipelineContent,x=e.setErrors,j=e.setIntegrationStreams,y=e.setOutputBlocks,k=e.setSelectedBlock,Z=e.setSelectedOutputBlock,_=e.setSelectedStream,C=(0,d.useState)(!0),O=C[0],w=C[1],S=(0,d.useState)(!0),E=S[0],P=S[1],T=(0,d.useState)(!0),I=T[0],A=T[1],R=an.ZP.integration_sources.list().data,D=(0,d.useMemo)((function(){return(null===R||void 0===R?void 0:R.integration_sources)||[]}),[R]),M=(0,d.useMemo)((function(){return(0,rn.HK)(D,(function(e){return e.uuid}))}),[D]),N=an.ZP.integration_destinations.list().data,B=(0,d.useMemo)((function(){return(null===N||void 0===N?void 0:N.integration_destinations)||[]}),[N]),L=(0,d.useMemo)((function(){return(0,rn.HK)(B,(function(e){return e.uuid}))}),[B]),F=(0,d.useMemo)((function(){return(0,rn.sE)(o,(function(e){var n=e.type;return h.tf.DATA_LOADER===n}))}),[o]),U=(0,d.useMemo)((function(){return F?(0,Dr.Qc)(F.content):{}}),[F]),H=(0,d.useMemo)((function(){return(0,le.jsx)(vo,{api:"integration_sources",block:F,blockContent:U,onChangeCodeBlock:m,pipeline:g})}),[F,U]),z=(0,d.useMemo)((function(){return(0,rn.sE)(o,(function(e){var n=e.type;return h.tf.DATA_EXPORTER===n}))}),[o]),G=(0,d.useMemo)((function(){return z?(0,Dr.Qc)(z.content):{}}),[z]),W=(0,d.useMemo)((function(){return(0,le.jsx)(vo,{api:"integration_destinations",block:z,blockContent:G,onChangeCodeBlock:m,pipeline:g})}),[z,G]),Q=(0,d.useMemo)((function(){var e;return(0,sn.Qr)(null===U||void 0===U?void 0:U.catalog)?null===g||void 0===g||null===(e=g.data_integration)||void 0===e?void 0:e.catalog:null===U||void 0===U?void 0:U.catalog}),[U,null===g||void 0===g||null===(n=g.data_integration)||void 0===n?void 0:n.catalog]),q=((null===Q||void 0===Q?void 0:Q.streams)||[]).every((function(e){return e.auto_add_new_fields})),Y=((null===Q||void 0===Q?void 0:Q.streams)||[]).every((function(e){return e.disable_column_type_check})),V=(0,gi.Z)(Q);(0,d.useEffect)((function(){!V&&Q&&(y((function(){return Z(F),[F]})),j((function(e){var n;return e||(null===Q||void 0===Q||null===(n=Q.streams)||void 0===n?void 0:n.map((function(e){return e.tap_stream_id})))})))}),[Q]);var K=(0,d.useState)(),X=K[0],J=K[1],$=(0,f.Db)(an.ZP.integration_sources.useCreate(),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(e){var n=e.integration_source;if(n.success){var t=(null===n||void 0===n?void 0:n.streams)||[];y((function(){return Z(F),[F]})),t.length>0&&_(t[0]),j((function(e){var n=(e||[]).concat(t);return Array.from(new Set(n)).sort()})),v(Re.DATA),s()}else J(null===n||void 0===n?void 0:n.error_message)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),ee=(0,l.Z)($,2),ne=ee[0],te=ee[1].isLoading,ie=(0,f.Db)(an.ZP.integration_sources.useUpdate(null===g||void 0===g?void 0:g.uuid),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(e){var n=e.integration_source,t=n.selected_streams,i=n.streams,r=((null===Q||void 0===Q?void 0:Q.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(Hr.UNSUPPORTED!==i.inclusion){var r;if(e.replication_method||(e.replication_method=Tr.FULL_TABLE),e.unique_conflict_method||(e.unique_conflict_method=Ir.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]=xo(xo({},n),{},{metadata:xo(xo({},i),{},{selected:!0})})}}))}));var c={streams:r.concat(l)};j(Se.map((function(e){return e.tap_stream_id})));var s=null===U||void 0===U?void 0:U.catalog;(0,sn.Qr)(s)||m(F.uuid,(0,Dr.Pz)(xo(xo({},U),{},{catalog:{}})));var d={pipeline:xo(xo({},g),{},{data_integration:xo(xo({},(null===g||void 0===g?void 0:g.data_integration)||{}),{},{catalog:c})})};b(d).then((function(){a(),u()}))},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),oe=(0,l.Z)(ie,2),ce=oe[0],ue=oe[1].isLoading,ae=(0,d.useState)(null),se=ae[0],fe=ae[1],pe=(0,f.Db)(an.ZP.integration_source_streams.useUpdate(null===g||void 0===g?void 0:g.uuid),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(e){fe(e.integration_source_stream)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),me=(0,l.Z)(pe,2),ve=me[0],ge=me[1].isLoading,je=(0,d.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}}(Q,e),i=t.stream,r=t.streams,o=xo(xo({},Q),{},{streams:r.concat(n(i))}),l=null===U||void 0===U?void 0:U.catalog;(0,sn.Qr)(l)||m(F.uuid,(0,Dr.Pz)(xo(xo({},U),{},{catalog:{}})));var c={pipeline:xo(xo({},g),{},{data_integration:xo(xo({},(null===g||void 0===g?void 0:g.data_integration)||{}),{},{catalog:o})})};b(c).then((function(){return a()}))}),[Q,F,U,a,m,g,b]),ye=(0,d.useCallback)((function(e){if(null!==Q&&void 0!==Q&&Q.streams){var n=xo(xo({},Q),{},{streams:Q.streams.map((function(n){return e(n)}))}),t=null===U||void 0===U?void 0:U.catalog;(0,sn.Qr)(t)||m(F.uuid,(0,Dr.Pz)(xo(xo({},U),{},{catalog:{}})));var i={pipeline:xo(xo({},g),{},{data_integration:xo(xo({},(null===g||void 0===g?void 0:g.data_integration)||{}),{},{catalog:n})})};b(i).then((function(){return a()}))}}),[Q,F,U,a,m,g,b]),ke=(0,d.useCallback)((function(e,n,t){je(e,(function(e){return e.schema.properties[n]=t,e}))}),[je]),Ze=(0,d.useCallback)((function(e,n,t){je(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=xo(xo({},o),t)}})),e}))}),[je]),_e=(0,f.Db)(an.ZP.blocks.pipelines.useUpdate(null===g||void 0===g?void 0:g.uuid,null===z||void 0===z?void 0:z.uuid),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){null===a||void 0===a||a()},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})}}),Ce=(0,l.Z)(_e,1)[0],Oe=(0,d.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,le.jsx)(xe.ZP,{monospace:!0,children:t},"variable-uuid-".concat(t)),(0,le.jsx)(xe.ZP,{monospace:!0,children:i},"variable-uuid-".concat(t,"-{value}")),(0,le.jsx)(xe.ZP,{monospace:!0,children:r},"variable-uuid-".concat(t,"-{value}-code")),(0,le.jsx)(Mr.Z,{copiedText:r,monospace:!0,withCopyIcon:!0},"variable-uuid-".concat(t,"-{value}-code-copy"))])}))})),(0,le.jsx)(mn.Z,{alignTop:!0,columnFlex:[null,null,1],columns:[{uuid:"Key"},{uuid:"Value"},{uuid:"Code"}],rows:e})}),[p]),we=(0,d.useCallback)((function(e){return(0,le.jsxs)(be.Z,{mt:2,children:[(0,le.jsxs)(xe.ZP,{default:!0,children:["Use the following variables to interpolate sensitive or dynamic information into the configuration.",(0,le.jsx)("br",{}),"You can also access values from your environment variables by using the following syntax: ",(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,children:"\"{{ env_var('MY_ENV_VARIABLE_NAME') }}\""}),(0,le.jsx)("br",{}),"For more information, check out the ",(0,le.jsx)($n.Z,{href:e,openNewWindow:!0,children:"documentation"}),"."]}),(0,le.jsx)(be.Z,{mt:1,children:Oe})]})}),[Oe]),Se=(0,d.useMemo)((function(){return(null===se||void 0===se?void 0:se.streams)||[]}),[se]),Ee=(0,Cn.dd)((function(){return(0,le.jsx)(po,{catalog:Q,isLoading:ue,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)ce({integration_source:{streams:n}}),Ie();else{var t=null===U||void 0===U?void 0:U.catalog;(0,sn.Qr)(t)||m(F.uuid,(0,Dr.Pz)(xo(xo({},U),{},{catalog:{}}))),b({pipeline:xo(xo({},g),{},{data_integration:xo(xo({},(null===g||void 0===g?void 0:g.data_integration)||{}),{},{catalog:null})})}).then((function(){return a()})),Ie()}},streams:Se})}),{},[Q,F,U,a,ue,m,b,Se],{background:!0,uuid:"select_streams"}),Pe=(0,l.Z)(Ee,2),Te=Pe[0],Ie=Pe[1];return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(be.Z,{mb:1,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(de.Z,{iconOnly:!0,onClick:function(){return P((function(e){return!e}))},children:(0,le.jsxs)(le.Fragment,{children:[E&&(0,le.jsx)(Ge.Kh,{size:1.5*re.iI}),!E&&(0,le.jsx)(Ge._M,{size:1.5*re.iI})]})}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(Nr.Z,{children:"Source"}),!E&&(0,le.jsxs)(Nr.Z,{default:!0,inline:!0,children:["\xa0",null===(t=M[null===U||void 0===U?void 0:U.source])||void 0===t?void 0:t.name]})]})]})}),E&&(0,le.jsxs)(be.Z,{mb:5,children:[(0,le.jsxs)(Vr.dE,{children:[(0,le.jsxs)(be.Z,{mb:5,children:[(0,le.jsx)(Nr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select source"}),(null===D||void 0===D?void 0:D.length)>0?(0,le.jsxs)(tr.Z,{onChange:function(e){var n,t,i=e.target.value;if(i){var o=null===(n=M[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})),F?m(F.uuid,(0,Dr.Pz)(xo(xo({},U),{},{catalog:{},config:o,source:i}))):r({content:(0,Dr.Pz)({source:i,config:o}),language:h.t6.YAML,type:h.tf.DATA_LOADER},0,k),fe(null),b().then((function(){a()}))}},primary:!0,value:null===U||void 0===U?void 0:U.source,children:[(0,le.jsx)("option",{value:""}),D.map((function(e){var n=e.name,t=e.uuid;return(0,le.jsx)("option",{value:t,children:n},t)}))]}):(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(zi.Z,{inverted:!0}),(0,le.jsx)(be.Z,{ml:1}),(0,le.jsx)(Nr.Z,{level:5,primary:!0,children:"Loading sources..."})]})]}),F&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)(be.Z,{mb:5,children:[(0,le.jsx)(Nr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===U||void 0===U?void 0:U.source)&&(0,le.jsxs)(be.Z,{mb:2,children:[(0,le.jsxs)(xe.ZP,{default:!0,children:["For more information on how to configure this source, read the ",(0,le.jsxs)($n.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/sources/".concat(U.source,"/README.md"),openNewWindow:!0,children:[U.source," documentation"]})]}),we("https://docs.mage.ai/guides/data-integration-pipeline#configure-source")]}),H]}),(0,le.jsxs)("div",{children:[(0,le.jsx)(Nr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select stream"}),(0,le.jsx)(de.Z,{loading:ge,onClick:function(){b().then((function(){ve().then((function(){return Te()})),a()}))},primary:!0,small:!0,children:"View and select streams"})]}),X&&(0,le.jsx)(xe.ZP,{warning:!0,children:X})]})]}),ue&&(0,le.jsx)(be.Z,{p:2,children:(0,le.jsx)(zi.Z,{})}),!ue&&(0,le.jsx)(be.Z,{mt:3,children:(0,le.jsx)(ro,{catalog:Q,destination:null===G||void 0===G?void 0:G.destination,isLoadingLoadSampleData:te,loadSampleData:function(e){return ne({integration_source:{action_type:"sample_data",pipeline_uuid:null===g||void 0===g?void 0:g.uuid,streams:[e]}})},setSelectedStream:_,source:null===U||void 0===U?void 0:U.source,updateAllStreams:ye,updateMetadataForColumns:Ze,updateSchemaProperty:ke,updateStream:je})})]}),(0,le.jsx)(be.Z,{mb:1,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(de.Z,{disabled:!F,iconOnly:!0,onClick:function(){return A((function(e){return!e}))},children:(0,le.jsxs)(le.Fragment,{children:[I&&F&&(0,le.jsx)(Ge.Kh,{size:1.5*re.iI}),(!I||!F)&&(0,le.jsx)(Ge._M,{disabled:!F,size:1.5*re.iI})]})}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsx)(he.Z,{alignItems:"center",children:(0,le.jsx)(Nr.Z,{children:"Transformers"})})]})}),I&&F&&(0,le.jsx)(be.Z,{mb:5,children:(0,le.jsxs)(Vr.dE,{children:[c.length>0&&(0,le.jsx)(be.Z,{mb:1,children:c.map((function(e,n){return(0,le.jsx)(be.Z,{mb:1,children:e},n)}))}),(0,le.jsx)(be.Z,{mt:1,children:(0,le.jsx)(ii,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=[];return F&&i.push(F.uuid),r(xo(xo({},e),{},{configuration:t,content:n,upstream_blocks:i}),o.length-1,(function(e){z&&(Ce({block:xo(xo({},z),{},{upstream_blocks:[e.uuid]})}),k(e))}))},compact:!0,hideCustom:!0,hideDataExporter:!0,hideDataLoader:!0,hideDbt:!0,hideRecommendations:!0,hideScratchpad:!0,hideSensor:!0,hideTransformerDataSources:!0,pipeline:g})})]})}),(0,le.jsx)(be.Z,{mb:1,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(de.Z,{disabled:!F,iconOnly:!0,onClick:function(){return w((function(e){return!e}))},children:(0,le.jsxs)(le.Fragment,{children:[O&&F&&(0,le.jsx)(Ge.Kh,{size:1.5*re.iI}),(!O||!F)&&(0,le.jsx)(Ge._M,{disabled:!F,size:1.5*re.iI})]})}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(Nr.Z,{children:"Destination"}),!O&&(0,le.jsxs)(Nr.Z,{default:!0,inline:!0,children:["\xa0",null===(i=L[null===G||void 0===G?void 0:G.destination])||void 0===i?void 0:i.name]})]})]})}),O&&F&&(0,le.jsxs)(Vr.dE,{children:[(0,le.jsxs)(be.Z,{mb:5,children:[(0,le.jsx)(Nr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select destination"}),(null===B||void 0===B?void 0:B.length)>0?(0,le.jsxs)(tr.Z,{onChange:function(e){var n=e.target.value;if(n){if(z)m(z.uuid,(0,Dr.Pz)(xo(xo({},G),{},{destination:n})));else{var t,i,l=null===(t=L[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===F||void 0===F?void 0:F.uuid)!==n}));u&&c.push(u.uuid)}else F&&c.push(F.uuid);r({content:(0,Dr.Pz)({config:l,destination:n}),language:h.t6.YAML,type:h.tf.DATA_EXPORTER,upstream_blocks:c},1,k)}b().then((function(){a()}))}},primary:!0,value:null===G||void 0===G?void 0:G.destination,children:[(0,le.jsx)("option",{value:""}),B.map((function(e){var n=e.name,t=e.uuid;return(0,le.jsx)("option",{value:t,children:n},t)}))]}):(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(zi.Z,{inverted:!0}),(0,le.jsx)(be.Z,{ml:1}),(0,le.jsx)(Nr.Z,{level:5,primary:!0,children:"Loading destinations..."})]})]}),z&&(0,le.jsxs)(be.Z,{mb:5,children:[(0,le.jsx)(Nr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===G||void 0===G?void 0:G.destination)&&(0,le.jsx)(le.Fragment,{children:(0,le.jsxs)(be.Z,{mb:2,children:[(0,le.jsxs)(xe.ZP,{default:!0,children:["For more information on how to configure this destination, read the ",(0,le.jsxs)($n.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/destinations/".concat(G.destination,"/README.md"),openNewWindow:!0,children:[G.destination," documentation"]}),".",(0,le.jsx)("br",{}),(0,le.jsx)("br",{}),"If your configuration contains a key named ",(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,children:"table"}),", it\u2019s optional.",(0,le.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,le.jsx)(xe.ZP,{bold:!0,inline:!0,children:"Table name"})," in a previous section."]}),we("https://docs.mage.ai/guides/data-integration-pipeline#configure-destination")]})}),W,(0,le.jsx)(be.Z,{mt:3,children:(0,le.jsxs)(he.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,le.jsxs)(be.Z,{mr:2,children:[(0,le.jsx)(xe.ZP,{bold:!0,large:!0,children:"Automatically add new fields"}),(0,le.jsx)(xe.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,le.jsx)(go.Z,{checked:!!q,disabled:!(null!==Q&&void 0!==Q&&Q.streams),onCheck:function(){return ye((function(e){return xo(xo({},e),{},{auto_add_new_fields:!q})}))}})]})}),(0,le.jsx)(be.Z,{mt:3,children:(0,le.jsxs)(he.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,le.jsxs)(be.Z,{mr:2,children:[(0,le.jsx)(xe.ZP,{bold:!0,large:!0,children:"Disable column type check"}),(0,le.jsxs)(xe.ZP,{default:!0,children:["By default, the value for each column is validated according to the schema property for that column.",(0,le.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,le.jsx)("br",{}),"Turn this toggle on if you want to disable this strict type checking."]})]}),(0,le.jsx)(go.Z,{checked:!!Y,disabled:!(null!==Q&&void 0!==Q&&Q.streams),onCheck:function(){return ye((function(e){return xo(xo({},e),{},{disable_column_type_check:!Y})}))}})]})})]})]})]})};function yo(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 ko(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?yo(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):yo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Zo=function(e){var n=e.addNewBlockAtIndex,t=e.addWidget,i=e.anyInputFocused,r=e.autocompleteItems,o=e.blockRefs,l=e.blocks,u=void 0===l?[]:l,a=e.dataProviders,s=e.deleteBlock,f=e.fetchFileTree,p=e.fetchPipeline,m=e.fetchSampleData,v=e.files,g=e.globalVariables,b=e.interruptKernel,x=(e.isPipelineUpdating,e.kernel,e.mainContainerRef),j=e.mainContainerWidth,y=e.messages,k=e.onChangeCallbackBlock,Z=e.onChangeCodeBlock,_=e.openSidekickView,C=e.pipeline,O=e.pipelineContentTouched,w=(e.pipelineLastSaved,e.restartKernel),S=e.runBlock,A=e.runningBlocks,R=void 0===A?[]:A,D=e.savePipelineContent,N=e.selectedBlock,B=e.setAnyInputFocused,L=e.setEditingBlock,F=e.setErrors,U=e.setIntegrationStreams,H=(e.setMessages,e.setOutputBlocks),z=e.setPipelineContentTouched,G=e.setRecsWindowOpenBlockIdx,W=(e.setRunningBlocks,e.setSelectedBlock),Q=e.setSelectedOutputBlock,q=e.setSelectedStream,Y=e.setTextareaFocused,V=e.textareaFocused,K=e.widgets,X=(0,d.useState)(!1),J=X[0],$=X[1],ee=(0,d.useState)(!1),ne=ee[0],te=ee[1],ie=(0,d.useState)(!0),ce=ie[0],ue=ie[1],ae=(0,d.useState)(null),se=ae[0],de=ae[1],pe=(0,d.useState)(null),he=pe[0],me=pe[1],ve=(0,d.useState)(!1),xe=ve[0],je=ve[1],ke=(0,d.useState)(""),Ze=ke[0],Ce=ke[1],Oe=(0,d.useMemo)((function(){return R.reduce((function(e,n,t){return ko(ko({},e),{},(0,c.Z)({},n.uuid,ko(ko({},n),{},{priority:t})))}),{})}),[R]),Se=(0,gi.Z)(N),Ee=(0,d.useMemo)((function(){return u.length}),[u]),Pe=(0,d.useMemo)((function(){return ge.q.INTEGRATION===(null===C||void 0===C?void 0:C.type)}),[C]),Te="PipelineDetail/index",Ie=(0,Hn.y)(),Ae=Ie.disableGlobalKeyboardShortcuts,Re=Ie.registerOnKeyDown,De=Ie.unregisterOnKeyDown;(0,d.useEffect)((function(){return function(){De(Te)}}),[De,Te]),Re(Te,(function(e,t,r){if(Ae)(0,pr.j)(e);else if(O&&(0,_e.y)([ye.zX,ye.hS],t)){e.preventDefault();"undefined"!==typeof location&&window.confirm("You have changes that are unsaved. Click cancel and save your changes before reloading page.")&&location.reload()}else if((0,_e.y)([ye.zX,ye.Um],t)||(0,_e.y)([ye.PQ,ye.Um],t))e.preventDefault(),D();else if(V)t[ye.vP]?Y(!1):O||ye.Z1.find((function(e){return t[e]}))||z(!0);else if(!Pe){if(N){var l=u.findIndex((function(e){var n=e.uuid;return N.uuid===n}));if(t[ye.vP])W(null),G(null);else if(r[0]===ye.xD&&r[1]===ye.xD)b();else if(r[0]===ye.l1&&r[1]===ye.l1&&-1!==l)s(N).then((function(e){null!==e&&void 0!==e&&e.error||setTimeout((function(){l===u.length-1?W(u[l-1]):u.length>=0?W(u[l+1]):W(null)}),100)}));else if(t[ye.Bu]&&l>=1){var c=u[l-1];if(c){var a,d;W(c);var f="".concat(c.type,"s/").concat(c.uuid,".py");null===(a=o.current[f])||void 0===a||null===(d=a.current)||void 0===d||d.scrollIntoView()}}else if(t[ye.kD]&&l<=Ee-2){var p=u[l+1];if(p){var m,v;W(p);var g="".concat(p.type,"s/").concat(p.uuid,".py");null===(m=o.current[g])||void 0===m||null===(v=m.current)||void 0===v||v.scrollIntoView()}}else(0,_e.y)([ye.Uq],t)?Y(!0):!i&&(0,_e.y)([ye.zH],t)?n({type:h.tf.SCRATCHPAD},l,W):!i&&(0,_e.y)([ye.Fv],t)&&n({type:h.tf.SCRATCHPAD},l+1,W)}else Se&&t[ye.Uq]&&W(Se);r[0]===ye.OC&&r[1]===ye.OC&&w()}}),[n,i,o.current,u,b,Pe,Ee,O,w,D,N,Se,z,W,Y,V]),(0,d.useEffect)((function(){var e=setInterval((function(){O&&D()}),5e3);return function(){clearInterval(e)}}),[O,D]),(0,d.useEffect)((function(){setTimeout((function(){return te(!0)}),600)}),[C]);var Me=(0,d.useCallback)((function(e){$(!0),me(e)}),[$,me]),Ne=(0,d.useCallback)((function(){$(!1),je(!1),Ce("")}),[]),Be=(0,d.useMemo)((function(){return u.filter((function(e){var n=e.type;return!Pe||h.tf.TRANSFORMER===n})).map((function(e,i){var l=e.type,c=e.uuid,h=(null===N||void 0===N?void 0:N.uuid)===c,m=Oe[c],v=m?0===m.priority?Bn.uF.BUSY:Bn.uF.QUEUED:Bn.uF.IDLE,g="".concat(l,"s/").concat(c,".py");return o.current[g]=(0,d.createRef)(),(0,le.jsx)(br,{addNewBlock:function(e){return Y(!0),n(e,i+1,W)},addNewBlockMenuOpenIdx:se,addWidget:t,autocompleteItems:r,block:e,blockIdx:i,blockRefs:o,blocks:u,dataProviders:a,defaultValue:e.content,deleteBlock:function(e){s(e),B(!1)},executionState:v,fetchFileTree:f,fetchPipeline:p,interruptKernel:b,mainContainerRef:x,mainContainerWidth:j,messages:y[c],noDivider:i===Ee-1||Pe,onCallbackChange:function(e){return k(c,e)},onChange:function(e){return Z(c,e)},onClickAddSingleDBTModel:Me,openSidekickView:_,pipeline:C,ref:o.current[g],runBlock:S,runningBlocks:R,savePipelineContent:D,selected:h,setAddNewBlockMenuOpenIdx:de,setAnyInputFocused:B,setCreatingNewDBTModel:je,setEditingBlock:L,setErrors:F,setOutputBlocks:H,setRecsWindowOpenBlockIdx:G,setSelected:function(n){return W(!0===n?e:null)},setSelectedOutputBlock:Q,setTextareaFocused:Y,textareaFocused:h&&V,widgets:K},c)}))}),[n,se,t,r,o,u,a,s,f,p,b,Pe,x,j,y,Ee,k,Z,Me,_,C,S,R,Oe,D,N,de,B,L,F,H,G,W,Q,Y,V,K]),Le=(0,d.useMemo)((function(){return(0,le.jsx)(jo,{addNewBlockAtIndex:n,blocks:u,codeBlocks:Be,fetchFileTree:f,fetchPipeline:p,fetchSampleData:m,globalVariables:g,onChangeCodeBlock:Z,openSidekickView:_,pipeline:C,savePipelineContent:D,setErrors:F,setIntegrationStreams:U,setOutputBlocks:H,setSelectedBlock:W,setSelectedOutputBlock:Q,setSelectedStream:q})}),[n,u,Be,p,g,Z,Z,C,D,F,W]),Fe=(0,d.useMemo)((function(){return(0,le.jsx)(ii,{addNewBlock:function(e){var t=u[u.length-1],i=null,r={},o=t?Qi(t,e):[];t&&([h.tf.DATA_LOADER,h.tf.TRANSFORMER].includes(t.type)&&h.tf.SCRATCHPAD===e.type&&(i="from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(C.uuid,"', '").concat(t.uuid,"', 'output_0')\n")),h.t6.SQL===t.language&&(r=ko(ko({},(0,sn.GL)(t.configuration,[E,P,T,I,M])),r))),h.t6.SQL===e.language&&(i=$t(i)),i=ei(e,i),n(ko(ko({},e),{},{configuration:r,content:i,upstream_blocks:o}),Ee,W),Y(!0)},hideCustom:Pe,hideDataExporter:Pe,hideDataLoader:Pe,hideDbt:Pe||ge.q.STREAMING===(null===C||void 0===C?void 0:C.type),hideRecommendations:Pe,hideScratchpad:Pe,hideSensor:Pe,onClickAddSingleDBTModel:Me,pipeline:C,setCreatingNewDBTModel:je,setRecsWindowOpenBlockIdx:G})}),[u,Pe,C,Me,G]);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(rt,{children:ce&&(0,le.jsx)(Zt.Z,{classNames:"pipeline-detail",in:ne,onEntered:function(){return setTimeout((function(){return ue(!1)}),it)},timeout:1,children:(0,le.jsx)(ot,{})})}),(0,le.jsxs)(be.Z,{mt:1,px:re.cd,children:[Pe&&Le,!Pe&&(0,le.jsxs)(le.Fragment,{children:[Be,(0,le.jsx)(be.Z,{mt:re.cd,children:Fe})]}),J&&(0,le.jsx)(fe.Z,{onClickOutside:Ne,open:!0,children:(0,le.jsx)(Rr,{blocks:u,creatingNewDBTModel:xe,dbtModelName:Ze,files:v,onClose:Ne,onOpenFile:function(e){var t=xe?"".concat(e,"/").concat((0,oe.RA)(Ze||(0,oe.Y6)()),".").concat(we.SQL):e,i={configuration:{file_path:t},language:h.t6.SQL,name:(0,oe.wE)(t),type:h.tf.DBT};xe&&(i.content="--Docs: https://docs.mage.ai/dbt/sources\n");var r="undefined"===typeof he||null===he,o=u[r?u.length-1:he],l=o?Qi(o,i):[];n(ko(ko({},i),{},{upstream_blocks:l}),r?Ee:he+1,W),Ne(),Y(!0)},setDbtModelName:Ce})})]})]})},_o=t(28358),Co=t(19767),Oo=t(32063),wo=t(70543),So=t(24141);function Eo(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 Po(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Eo(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Eo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var To=function(e){var n=e.after,t=e.afterHeader,i=e.afterHidden,r=e.afterSubheader,o=e.before,c=e.beforeHeader,u=e.children,a=e.errors,s=e.headerOffset,f=e.mainContainerHeader,p=e.mainContainerRef,h=e.page,m=e.pipeline,v=e.projectName,g=e.setAfterHidden,b=e.setAfterWidthForChildren,x=e.setErrors,j=e.setMainContainerWidth,y=(0,So.i)().width,k=(0,d.useState)((0,Ze.U2)(Ze.L8,nt.Zt)),Z=k[0],_=k[1],C=(0,d.useState)((0,Ze.U2)(Ze.J3,nt.ve)),O=C[0],w=C[1],S=(0,d.useState)(!!(0,Ze.U2)(Ze.Uu)),E=S[0],P=S[1],T=(0,d.useState)(!1),I=T[0],A=T[1],R=(0,d.useState)(!1),D=R[0],M=R[1],N=i,B=g;if(!B){var L=(0,d.useState)(!!(0,Ze.U2)(Ze.zg)),F=(0,l.Z)(L,2);N=F[0],B=F[1]}(0,d.useEffect)((function(){null===p||void 0===p||!p.current||I||D||null===j||void 0===j||j(p.current.getBoundingClientRect().width)}),[I,D,N,Z,E,O,null===p||void 0===p?void 0:p.current,j,y]),(0,d.useEffect)((function(){I||(null===b||void 0===b||b(Z),(0,Ze.t8)(Ze.L8,Z))}),[I,Z,b]),(0,d.useEffect)((function(){D||(0,Ze.t8)(Ze.J3,O)}),[D,O]);var U=an.ZP.projects.list({},{revalidateOnFocus:!1}).data,H=null===U||void 0===U?void 0:U.projects,z=(0,d.useMemo)((function(){var e,n=[{label:function(){return"Pipelines"},linkProps:{href:"/pipelines",as:"/pipelines"}}];return m&&(n.push.apply(n,[{bold:wo.b!==h,label:function(){return null===m||void 0===m?void 0:m.name},linkProps:{href:"/pipelines/[pipeline]",as:"/pipelines/".concat(null===m||void 0===m?void 0:m.uuid)}}]),wo.b===h&&n.push.apply(n,[{bold:!0,label:function(){return(0,oe.kC)(h)}}])),(0,le.jsx)(Co.Z,{breadcrumbs:n,project:null===H||void 0===H?void 0:H[0],version:null===H||void 0===H||null===(e=H[0])||void 0===e?void 0:e.version})}),[h,m,v,H]);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(ft.Z,{title:null===m||void 0===m?void 0:m.name}),(0,le.jsx)(Oo.Z,{after:n,afterHeader:t,afterHidden:N,afterMousedownActive:I,afterSubheader:r,afterWidth:Z,before:o,beforeHeader:c,beforeHidden:E,beforeMousedownActive:D,beforeWidth:O,header:z,headerOffset:s,mainContainerHeader:f,mainContainerRef:p,setAfterHidden:B,setAfterMousedownActive:A,setAfterWidth:_,setBeforeHidden:P,setBeforeMousedownActive:M,setBeforeWidth:w,children:u}),a&&(0,le.jsx)(fe.Z,{disableClickOutside:!0,isOpen:!0,onClickOutside:function(){return x(null)},children:(0,le.jsx)(_o.Z,Po(Po({},a),{},{onClose:function(){return x(null)}}))})]})},Io=t(41788),Ao=t(70001),Ro=t(26226),Do=t(29989),Mo=t(53655),No=t(84181),Bo=t(31969);function Lo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Fo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Lo(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Lo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Uo=Te.default.div.withConfig({displayName:"HeatMap__YAxisLabelContainer",componentId:"sc-h2irj-0"})(["-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-o-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);white-space:nowrap;"]);function Ho(e,n){return Math.max.apply(Math,(0,o.Z)(e.map(n)))}function zo(e,n){return Math.min.apply(Math,(0,o.Z)(e.map(n)))}var Go=function(e){return e.bins},Wo=function(e){return e.count},Qo={top:0,left:0,right:0,bottom:0};function qo(e){var n=e.countMidpoint,t=e.data,i=(e.events,e.height),r=e.margin,o=void 0===r?{}:r,l=e.minCount,c=e.width,u=(e.yLabels,(0,d.useContext)(Te.ThemeContext)),a=(u.monotone||Bo.Z.monotone).grey300,s=(u.brand||Bo.Z.brand).wind400,f=(u.content||Bo.Z.content).default,p=(u.monotone||Bo.Z.monotone).white,h=Fo(Fo({},Qo),o),m=[];t[0].forEach((function(e,n){var i=t.map((function(e){return e[n]}));m.push({bin:n,bins:i.reverse().map((function(e,n){return{bin:n,count:e}}))})}));var v=Ho(m,(function(e){return Ho(Go(e),Wo)})),g=zo(m,(function(e){return zo(Go(e),Wo)})),b=Ho(m,(function(e){return Go(e).length})),x="undefined"!==typeof n?n:0,j="undefined"!==typeof l?l:g,y=(0,No.Z)({domain:[0,m.length]}),k=(0,No.Z)({domain:[0,b]}),Z=(0,No.Z)({range:[a,s],domain:[x,v]}),_=(0,No.Z)({range:[.1,1],domain:[x,v]}),C=(0,No.Z)({range:[a,s],domain:[j,x]}),O=(0,No.Z)({range:[1,.1],domain:[j,x]}),w=c-(h.left+h.right),S=i-(h.bottom+h.top),E=w/m.length,P=S/b;return y.range([0,w]),k.range([S,0]),c<10?null:(0,le.jsx)(le.Fragment,{children:(0,le.jsx)("svg",{width:c,height:i,children:(0,le.jsx)(Do.Z,{left:h.left,top:h.top,children:(0,le.jsx)(Mo.Z,{data:m,xScale:y,yScale:k,colorScale:Z,opacityScale:_,binWidth:E,binHeight:E,gap:0,children:function(e){return e.map((function(e){return e.map((function(e){var t=e.opacity,i=e.color;return"undefined"!==typeof n&&e.count<n&&(t=O(e.count),i=C(e.count)),(0,le.jsxs)("svg",{height:P,width:E,x:e.x,y:e.y-P,children:[(0,le.jsx)("rect",{className:"visx-heatmap-rect",fill:i,fillOpacity:t,height:P,width:E}),(0,le.jsx)("text",{alignmentBaseline:"middle",fill:e.count>=.8*v?p:f,fontFamily:ri.ry,fontSize:14,textAnchor:"middle",x:"50%",y:"50%",children:e.count})]},"heatmap-rect-".concat(e.row,"-").concat(e.column))}))}))}})})})})}var Yo=function(e){var n=e.countMidpoint,t=e.data,i=e.height,r=e.margin,o=e.minCount,l=e.xAxisLabel,c=e.xLabels,u=e.yAxisLabel,a=e.yLabels,s=function(e){return e.length>12?"".concat(e.substring(0,12),"..."):e},d=4*re.iI,f=8*re.iI,p=0;return u&&(p+=d+1*re.iI),a&&(p+=f+1*re.iI),(0,le.jsxs)(le.Fragment,{children:[(l||c)&&(0,le.jsx)("div",{style:{marginBottom:null===r||void 0===r?void 0:r.bottom,marginLeft:null===r||void 0===r?void 0:r.left,marginRight:null===r||void 0===r?void 0:r.right,marginTop:null===r||void 0===r?void 0:r.top,paddingLeft:p},children:(0,le.jsxs)(be.Z,{mb:{xs:1},children:[l&&(0,le.jsx)(be.Z,{mb:1,children:(0,le.jsx)(xe.ZP,{center:!0,muted:!0,xsmall:!0,children:l})}),c&&(0,le.jsx)(he.Z,{children:c.map((function(e){var n=e.label,t=e.linkProps;return(0,le.jsx)(An.Z,{flex:"1",justifyContent:"center",children:t?(0,le.jsx)($n.Z,{bold:!0,centerAlign:!0,minWidth:70,onClick:t.onClick,xsmall:!0,children:n}):(0,le.jsx)(xe.ZP,{bold:!0,center:!0,minWidth:70,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})]})}),(0,le.jsxs)("div",{style:{height:i,display:"flex",width:"100%"},children:[u&&(0,le.jsx)("div",{style:{marginRight:1*re.iI,width:d},children:(0,le.jsx)(he.Z,{alignItems:"center",justifyContent:"center",children:(0,le.jsx)(Uo,{children:(0,le.jsx)(xe.ZP,{center:!0,muted:!0,xsmall:!0,children:u})})})}),a&&(0,le.jsx)("div",{style:{marginRight:1*re.iI},children:(0,le.jsx)(he.Z,{alignItems:"center",flexDirection:"column",fullHeight:!0,width:f,children:a.map((function(e){var n=e.label,t=e.linkProps;return(0,le.jsx)(An.Z,{alignItems:"center",flex:"1",children:t?(0,le.jsx)($n.Z,{bold:!0,centerAlign:!0,onClick:t.onClick,xsmall:!0,children:n}):(0,le.jsx)(xe.ZP,{bold:!0,center:!0,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})}),(0,le.jsx)("div",{style:{height:i,width:"100%"},children:(0,le.jsx)(Ro.Z,{children:function(e){var i=e.width,l=e.height;return(0,le.jsx)(qo,{countMidpoint:n,data:t,height:l,margin:r,minCount:o,width:i,yLabels:a})}})})]})]})},Vo=t(11754);var Ko=function(e){var n=e.afterWidth,t=e.features,i=e.insightsOverview,r=e.statistics,o=i.correlations,c=void 0===o?[]:o,u=n-(2*re.cd*re.iI+tt.nn),a=function(e){var n=[];return{heatmapData:null===e||void 0===e?void 0:e.map((function(e,t){var i=e.correlations,r=e.feature.uuid;n.push({label:r});var o=i[0].y.map((function(e){var n=e.value;return(0,oe.QV)(n)}));return o.splice(t,0,1),o})),xyLabels:n}}(c),s=a.heatmapData,d=a.xyLabels,f=function(e,n){return(0,rn.YC)(null===e||void 0===e?void 0:e.map((function(e){return{feature:e,value:1-n["".concat(e.uuid,"/null_value_rate")]}})),"value")}(t,r),p=function(e,n){return(0,rn.YC)(null===e||void 0===e?void 0:e.map((function(e){return{feature:e,value:n["".concat(e.uuid,"/count_distinct")]}})),"value")}(t,r),h=function(e,n){return(0,rn.YC)(null===e||void 0===e?void 0:e.map((function(e){var t=Object.entries(n["".concat(e.uuid,"/value_counts")]||{})[0]||[],i=(0,l.Z)(t,2),r=i[0],o=i[1];return{feature:e,percentage:Number(o)/n.count,value:r}})),"percentage")}(t,r);return(0,le.jsxs)(he.Z,{flexDirection:"column",children:[(null===f||void 0===f?void 0:f.length)>=1&&(0,le.jsx)(Vo.Z,{headerTitle:"Data completion",width:u,children:(0,le.jsx)(Ao.Z,{data:f.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*re.iI,50*re.iI),renderTooltipContent:function(e){var n=e.x;return"".concat((0,oe.T3)(n)," of rows have a value")},xNumTicks:2,ySerialize:function(e){return e.y}})}),(null===p||void 0===p?void 0:p.length)>=1&&(0,le.jsx)(Vo.Z,{headerTitle:"Number of unique values",width:u,children:(0,le.jsx)(Ao.Z,{data:p.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*re.iI,50*re.iI),renderTooltipContent:function(e){var n=e.x;return"".concat(n," unique values")},xNumTicks:2,ySerialize:function(e){return e.y}})}),h.length>=1&&(0,le.jsx)(Vo.Z,{headerTitle:"Distribution of values",width:u,children:(0,le.jsx)(Ao.Z,{data:h.map((function(e){var n=e.feature,t=e.percentage;return{feature:n,value:e.value,x:t,y:n.uuid}})),height:Math.max(3*h.length*re.iI,50*re.iI),renderTooltipContent:function(e){var n=e.value,t=e.x;return"".concat(n," is ").concat((0,oe.T3)(t)," of all rows")},xNumTicks:2,ySerialize:function(e){return e.y}})}),c&&(null===s||void 0===s?void 0:s.length)>=1&&(0,le.jsx)(Vo.Z,{headerTitle:"Correlations",children:(0,le.jsx)(be.Z,{p:1,children:(0,le.jsx)(Yo,{countMidpoint:0,data:s,height:8*re.iI*d.length,minCount:-1,xLabels:d,yLabels:d})})})]})},Xo=t(92083),Jo=t.n(Xo),$o=t(84969),el=t(90948),nl=t(65743),tl=t(39048),il=t(79487),rl=t(61655),ol=t(16853),ll=t(65376),cl=t(52359),ul=t(48072),al=t(24903),sl=t(98677),dl=t(73899);function fl(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 pl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?fl(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):fl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var hl={bottom:re.iI*(3+re.cd),left:re.iI*re.cd,right:re.iI*re.cd,top:re.iI*re.cd};function ml(e,n){return Math.max.apply(Math,(0,o.Z)(e.map(n)))}function vl(e){var n=e.data,t=e.height,i=e.keyForYData,r=e.large,l=e.margin,c=void 0===l?{}:l,u=e.orientationVertical,a=void 0!==u&&u,s=e.showTooltip,f=e.width,p=e.yLabelFormat,h=(0,d.useContext)(Te.ThemeContext),m=(0,d.useCallback)((function(e){return e[i]}),[i]),v=p;v||(v=function(e){return e.length>20?"".concat(e.substring(0,20),"..."):e});var g=r?oi.iD:oi.J5,b=pl(pl({},hl),c),x=n.slice(Math.max(0,n.length-50)),j=(0,d.useMemo)((function(){return Object.keys((null===x||void 0===x?void 0:x[0])||{}).filter((function(e){return e!==i}))}),[x,i]),y=(0,al.Z)({domain:j,range:[dl.a$,dl.Ej,dl.hM,dl.ZA,dl.$R,dl.X_,dl.er,dl.hl,dl.nQ]}),k=(0,d.useMemo)((function(){return x.map(m)}),[x,m]),Z=(0,sl.Z)({domain:k,padding:.1}),_=(0,sl.Z)({domain:j,padding:.1}),C=(0,No.Z)({domain:[0,ml(x,(function(e){return ml(j,(function(n){return Number(e[n])}))}))]}),O={active:(null===h||void 0===h?void 0:h.content.default)||vn.Z.content.default,backgroundPrimary:(null===h||void 0===h?void 0:h.chart.backgroundPrimary)||vn.Z.chart.backgroundPrimary,backgroundSecondary:(null===h||void 0===h?void 0:h.chart.backgroundSecondary)||vn.Z.chart.backgroundSecondary,muted:(null===h||void 0===h?void 0:h.content.muted)||vn.Z.content.muted,primary:(null===h||void 0===h?void 0:h.chart.primary)||vn.Z.chart.primary,tooltipBackground:(null===h||void 0===h?void 0:h.background.navigation)||vn.Z.background.navigation},w=k;a&&(w=x.reduce((function(e,n){return e.concat(j.map((function(e){var t=n[e];return(0,oe.HW)(t)?parseInt(String(t)):t})))}),[]));var S=Math.min(Math.max.apply(Math,(0,o.Z)(w.map((function(e){return String(e).length})))),20);b.left+=7*S;var E=f-(b.left+b.right),P=t-(b.top+b.bottom);a?(Z.rangeRound([0,E]),C.rangeRound([P,0])):(Z.rangeRound([P,0]),C.rangeRound([0,E])),_.rangeRound([0,Z.bandwidth()]);var T=x.map(m).length,I=0;a||(I=Z(w[T-1]));var A=(0,d.useCallback)((function(e){var n=(0,ul.Z)(e)||{x:0,y:0},t=n.x,i=n.y,r=t-b.left,o=i-b.top,l=0;l=a?(r-I/2)/(E-I):1-(o-I/2)/(P-I);var c=Math.floor(l*T),u=x[c];"undefined"===typeof u&&(u=x[c-1]),a?r>I&&r<E+b.left-I&&s({tooltipData:u,tooltipLeft:t,tooltipTop:i}):o>I&&o<P-I&&s({tooltipData:u,tooltipLeft:t,tooltipTop:i})}),[x,T,b.left,b.top,a,s,I,E,P]);return{colorScale:y,colors:O,data:x,fontSize:g,handleTooltip:A,margin:b,tempScale:C,tickValues:w,xKeys:j,xMax:E,y1Scale:_,yLabelFormat:v,yMax:P,yScale:Z,ySerialize:m}}var gl=["height","width","xAxisLabel","yAxisLabel"];function bl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function xl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?bl(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):bl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}re.iI,re.iI,re.iI;var jl=(0,rl.Z)((function(e){var n=e.data,t=e.height,i=e.hideTooltip,r=e.keyForYData,o=void 0===r?"__y":r,c=e.large,u=e.margin,a=void 0===u?{}:u,s=e.renderNoDataText,d=e.renderTooltipContent,f=e.showTooltip,p=e.tooltipData,h=e.tooltipLeft,m=e.tooltipOpen,v=e.tooltipTop,g=e.width,b=e.xAxisLabel,x=e.xNumTicks,j=e.yLabelFormat,y=vl({data:n,height:t,keyForYData:o,large:c,margin:a,showTooltip:f,width:g,yLabelFormat:j}),k=y.colorScale,Z=y.colors,_=y.data,C=y.fontSize,O=y.handleTooltip,w=y.margin,S=y.tempScale,E=y.tickValues,P=y.xKeys,T=y.xMax,I=y.y1Scale,A=y.yLabelFormat,R=y.yMax,D=y.yScale,M=y.ySerialize;return g<10?null:(0,le.jsxs)("div",{children:[(0,le.jsxs)("svg",{height:t,width:g,children:[s&&!(null!==_&&void 0!==_&&_.length)&&(0,le.jsx)("text",{fill:Z.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:ri.ry,fontSize:C,x:"50%",y:"50%",children:s()}),(0,le.jsx)(nl.Z,{fill:"transparent",height:t-(w.top+w.bottom),onMouseLeave:function(){return i()},onMouseMove:O,onTouchMove:O,onTouchStart:O,rx:14,width:g-(w.left+w.right),x:w.left,y:w.top}),(null===_||void 0===_?void 0:_.length)&&(0,le.jsxs)(Do.Z,{left:w.left,top:w.top,children:[(0,le.jsx)(tl.Z,{color:k,data:_,keys:P,width:T,xScale:S,y0:M,y0Scale:D,y1Scale:I,children:function(e){return e.map((function(e){return(0,le.jsx)(Do.Z,{top:e.y0,children:e.bars.map((function(n){return(0,le.jsx)("g",{children:(0,le.jsx)(le.Fragment,{children:(0,le.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,le.jsx)($o.Z,{hideTicks:!0,scale:D,stroke:Z.muted,tickFormat:function(e){return A(e)},tickLabelProps:function(){return{fill:Z.active,fontFamily:ri.ry,fontSize:C,style:{width:"10px"},textAnchor:"end"}},tickStroke:Z.muted,tickValues:E,top:2}),(0,le.jsx)(el.Z,{label:b,labelProps:{fill:Z.muted,fontFamily:ri.ry,fontSize:C,textAnchor:"middle"},numTicks:x,scale:S,stroke:Z.muted,tickLabelProps:function(){return{fill:Z.active,fontFamily:ri.ry,fontSize:C,textAnchor:"middle"}},tickStroke:Z.muted,top:R})]}),p&&(0,le.jsx)("g",{children:(0,le.jsx)(il.Z,{from:{x:w.left,y:v},pointerEvents:"none",stroke:Z.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:T+w.left,y:v}})})]}),m&&p&&(0,le.jsxs)(ol.Z,{left:h,style:xl(xl({},ll.j),{},{backgroundColor:Z.tooltipBackground}),top:v,children:[d&&d(p),!d&&Object.entries(p).map((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];if(o!==t){var r=i;return(0,oe.HW)(r)&&String(r).split(".").length>=2&&(r=r.toFixed(4)),(0,le.jsxs)(xe.ZP,{inverted:!0,small:!0,children:[t,": ",r]},t)}}))]})]})}));var yl=function(e){var n,t=e.height,i=e.width,r=e.xAxisLabel,o=e.yAxisLabel,l=(0,Pe.Z)(e,gl);return n="undefined"===typeof i?"100%":o?0===i?i:i-28:i,(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)("div",{style:{display:"flex",height:t,marginBottom:r?re.iI:null,width:"100%"},children:[o&&(0,le.jsx)(he.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,le.jsx)(cl.Z,{children:(0,le.jsx)(xe.ZP,{center:!0,muted:!0,small:!0,children:o})})}),(0,le.jsx)("div",{style:{height:t,width:n},children:(0,le.jsx)(Ro.Z,{children:function(e){var n=e.width,t=e.height;return(0,le.jsx)(jl,xl(xl({},l),{},{height:t,width:n}))}})})]}),r&&(0,le.jsx)("div",{style:{paddingLeft:o?36:0,paddingTop:4},children:(0,le.jsx)(xe.ZP,{center:!0,muted:!0,small:!0,children:r})})]})},kl=t(95422),Zl=["keyForYData"],_l=["height","width","xAxisLabel","yAxisLabel"];function Cl(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 Ol(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Cl(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Cl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var wl=(0,rl.Z)((function(e){var n=e.keyForYData,t=void 0===n?"__y":n,i=(0,Pe.Z)(e,Zl),r=i.height,o=i.hideTooltip,c=i.renderNoDataText,u=i.renderTooltipContent,a=i.tooltipData,s=i.tooltipLeft,d=i.tooltipOpen,f=i.tooltipTop,p=i.width,h=i.xLabelFormat,m=i.xNumTicks,v=i.yNumTicks,g=vl(Ol(Ol({},i),{},{keyForYData:t,orientationVertical:!0})),b=g.colorScale,x=g.colors,j=g.data,y=g.fontSize,k=g.handleTooltip,Z=g.margin,_=g.tempScale,C=(g.tickValues,g.xKeys),O=(g.xMax,g.y1Scale),w=g.yLabelFormat,S=g.yMax,E=g.yScale,P=g.ySerialize;return p<10?null:(0,le.jsxs)("div",{children:[(0,le.jsxs)("svg",{height:r,width:p,children:[c&&!(null!==j&&void 0!==j&&j.length)&&(0,le.jsx)("text",{fill:x.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:ri.ry,fontSize:y,x:"50%",y:"50%",children:c()}),(null===j||void 0===j?void 0:j.length)&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(nl.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,le.jsxs)(Do.Z,{top:Z.top,children:[(0,le.jsx)(kl.Z,{color:b,data:j,height:S,keys:C,x0:P,x0Scale:E,x1Scale:O,yScale:_,children:function(e){return e.map((function(e){return(0,le.jsx)(Do.Z,{left:e.x0+Z.left,top:Z.top,children:e.bars.map((function(n){return(0,le.jsx)("g",{children:(0,le.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,le.jsx)($o.Z,{left:Z.left,numTicks:v,scale:_,stroke:x.muted,tickFormat:function(e){return w(e)},tickLabelProps:function(){return{fill:x.active,fontFamily:ri.ry,fontSize:y,textAnchor:"end",transform:"translate(-2,2.5)"}},tickStroke:x.muted,top:Z.top}),(0,le.jsx)(el.Z,{hideTicks:!0,left:Z.left,numTicks:m,scale:E,stroke:x.muted,tickFormat:h,tickLabelProps:function(){return{fill:x.active,fontFamily:ri.ry,fontSize:y,textAnchor:"middle"}},tickStroke:x.muted,top:S+Z.top})]})]}),a&&(0,le.jsx)("g",{children:(0,le.jsx)(il.Z,{from:{x:s,y:2*Z.top},pointerEvents:"none",stroke:x.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:s,y:S+2*Z.top}})})]}),d&&a&&(0,le.jsxs)(ol.Z,{left:s,style:Ol(Ol({},ll.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,oe.HW)(o)&&String(o).split(".").length>=2&&(o=o.toFixed(4)),(0,le.jsxs)(xe.ZP,{inverted:!0,small:!0,children:[i,": ",o]},i)}})),(0,le.jsx)("br",{}),(0,le.jsxs)(xe.ZP,{inverted:!0,small:!0,children:[h&&h(P(a)),!h&&P(a)]})]})]})}));var Sl=function(e){var n=e.height,t=e.width,i=e.xAxisLabel,r=e.yAxisLabel,o=(0,Pe.Z)(e,_l);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)("div",{style:{display:"flex",height:n,marginBottom:i?re.iI:null,width:"100%"},children:[r&&(0,le.jsx)(he.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,le.jsx)(cl.Z,{children:(0,le.jsx)(xe.ZP,{center:!0,muted:!0,small:!0,children:r})})}),(0,le.jsx)("div",{style:{height:n,width:r?0===t?t:t-28:t},children:(0,le.jsx)(Ro.Z,{children:function(e){var n=e.height,t=e.width;return(0,le.jsx)(wl,Ol(Ol({},o),{},{height:n,width:t}))}})})]}),i&&(0,le.jsx)("div",{style:{paddingLeft:r?36:0,paddingTop:4},children:(0,le.jsx)(xe.ZP,{center:!0,muted:!0,small:!0,children:i})})]})},El=t(66872),Pl=t(68735),Tl=t(320),Il=40*re.iI,Al=Te.default.div.withConfig({displayName:"indexstyle__ChartBlockStyle",componentId:"sc-1c3ufnj-0"})(["border-radius:","px;margin-left:","px;margin-right:","px;margin-top:","px;",""],gn.n_,.5*re.iI,.5*re.iI,1*re.iI,(function(e){return"\n background-color: ".concat((e.theme.background||vn.Z.background).chartBlock,";\n ")})),Rl=Te.default.div.withConfig({displayName:"indexstyle__ConfigurationOptionsStyle",componentId:"sc-1c3ufnj-1"})(["flex:4;padding-left:","px;padding-right:","px;"],1*re.iI,1*re.iI),Dl=Te.default.div.withConfig({displayName:"indexstyle__CodeStyle",componentId:"sc-1c3ufnj-2"})(["padding-top:","px;",""],re.iI/2,(function(e){return"\n background-color: ".concat((e.theme.background||vn.Z.background).codeTextarea,";\n ")})),Ml=Te.default.div.withConfig({displayName:"indexstyle__CodeHelperStyle",componentId:"sc-1c3ufnj-3"})(["margin-bottom:","px;padding-bottom:","px;padding-left:","px;",""],re.cd*re.iI,re.iI,re.iI,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.borders||vn.Z.borders).medium,";\n ")}));function Nl(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 Bl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Nl(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Nl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ll=function(e){var n,t=e.block,r=e.data,o=e.width,u=t.configuration,a=void 0===u?{}:u,s=a||{},d=s.chart_style,f=s.chart_type,p=s.y_sort_order,h=a.height||Il,m=(null===a||void 0===a||null===(n=a.metrics)||void 0===n?void 0:n.map((function(e){return"".concat((n=e).aggregation,"(").concat(n.column,")");var n})))||[],v=yt.n1,g=a.time_interval;if([G.HOUR,G.MINUTE,G.SECOND].includes(g)&&(v=yt.OC),i.BAR_CHART===f||i.TIME_SERIES_BAR_CHART===f){var b=r.x,x=r.y,j=i.TIME_SERIES_BAR_CHART===f;if(b&&x&&Array.isArray(b)&&Array.isArray(x)){var y,k=null===(y=a.group_by)||void 0===y?void 0:y.join(", "),Z=null===m||void 0===m?void 0:m.join(", ");m.length||m.push(w);var _=m[0],C=b.map((function(e,n){return Bl({__y:e},m.reduce((function(e,t,i){var r,o=null===x||void 0===x||null===(r=x[i])||void 0===r?void 0:r[n];return"undefined"===typeof o?e:Bl(Bl({},e),{},(0,c.Z)({},t,o))}),{}))}));z.ASCENDING===p?C=(0,rn.YC)(C,(function(e){return e[_]}),{ascending:!1}):z.DESCENDING===p&&(C=(0,rn.YC)(C,(function(e){return e[_]}),{ascending:!0}));var O={data:C,height:h,renderNoDataText:function(){return"No data matching query"},width:o,xNumTicks:3};return F.HORIZONTAL===d?(0,le.jsx)(yl,Bl(Bl({},O),{},{xAxisLabel:Z||a.y,yAxisLabel:k||a.x})):(0,le.jsx)(Sl,Bl(Bl({},O),{},{xAxisLabel:k,xLabelFormat:function(e){return j?Jo()(1e3*e).format(yt.n1):e},xNumTicks:C.length,yAxisLabel:Z,yNumTicks:5}))}}else if(i.HISTOGRAM===f){var S,E=r.x,P=r.y,T=null===(S=a.group_by)||void 0===S?void 0:S.join(", ");if(E&&P&&Array.isArray(E))return(0,le.jsx)(El.Z,{data:E.map((function(e,n){var t,i=e.max,r=e.min;return[i,null===P||void 0===P||null===(t=P[n])||void 0===t?void 0:t.value,r]})),height:h,width:o,large:!0,margin:{left:5*re.iI,right:1*re.iI,top:3*re.iI},noPadding:!0,renderTooltipContent:function(e){var n=(0,l.Z)(e,3),t=n[0],i=n[1],r=n[2];return(0,le.jsxs)(xe.ZP,{inverted:!0,monospace:!0,small:!0,children:["Count : ",i,(0,le.jsx)("br",{}),"Bucket: ",r,"-",t]})},showAxisLabels:!0,showYAxisLabels:!0,showZeroes:!0,sortData:function(e){return(0,rn.YC)(e,"[0]")},xAxisLabel:T||a.x,yAxisLabel:T?"count(".concat(T,")"):a.y})}else if(i.LINE_CHART===f||i.TIME_SERIES_LINE_CHART===f){var I=r.x,A=r.y,R=i.TIME_SERIES_LINE_CHART===f;if(I&&A&&Array.isArray(I)&&Array.isArray(A)&&Array.isArray(null===A||void 0===A?void 0:A[0])){var D,M=m;a.legend_labels&&(M=a.legend_labels.split(",").map((function(e){return e.trim()})));var N=I.map((function(e,n){return{x:e,y:(0,rn.w6)(A.length).map((function(e,t){var i=A[t][n];return"undefined"===typeof i||null===i?0:i}))}})),B=null===(D=a.group_by)||void 0===D?void 0:D.join(", "),L=m.join(", ");return(0,le.jsx)(Pl.Z,{data:N,height:h,lineLegendNames:M,margin:{bottom:8*re.iI,left:5*re.iI},noCurve:!0,renderXTooltipContent:function(e){e.index;var n=e.x,t=a.x,i=n;return a.group_by&&(t=a.group_by.map(String).join(", ")),R&&(i=Jo()(1e3*n).format(v)),(0,le.jsxs)(xe.ZP,{inverted:!0,small:!0,children:[t,": ",i]})},renderYTooltipContent:function(e,n){var t=e.y;return(0,le.jsxs)(xe.ZP,{inverted:!0,small:!0,children:[M&&M[n]&&"".concat(M[n],": "),t&&(0,oe.x6)((0,oe.QV)(t[n],4))]})},width:o?o-3*re.iI:o,xAxisLabel:B||String(a.x),xLabelFormat:function(e){return R?Jo()(1e3*e).format(yt.n1):e},yAxisLabel:L||String(a.y),yLabelFormat:function(e){return e}})}}else if(i.PIE_CHART===f){var U,H=r[String(a.x)],W=null===(U=a.group_by)||void 0===U?void 0:U.join(", ");if(H)return(0,le.jsx)(Tl.Z,{data:Object.entries(H),getX:function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];return"".concat(t," (").concat((0,oe.x6)(i),")")},getY:function(e){return(0,l.Z)(e,2)[1]},height:h,width:o,xAxisLabel:W||String(a.x)})}else if(i.TABLE===f){var Q=r.index,q=r.x,Y=r.y;return Array.isArray(q)&&Array.isArray(Y)&&Array.isArray(Y[0])&&(0,le.jsx)(hi.Z,{columns:q,index:Q,height:a.height?null:h,maxHeight:a.height?h:null,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,rows:Y,width:o})}return(0,le.jsx)("div",{})},Fl=t(76096);var Ul=function(e){var n=e.children,t=e.onChange,i=(0,d.useState)(d.Children.map(n,(function(){return null}))),r=i[0],o=i[1],l=(0,d.useState)(0),c=l[0],u=l[1];return(0,le.jsx)(he.Z,{children:d.Children.map(n,(function(e,n){return(0,le.jsx)(be.Z,{ml:n>=1?1:0,style:{display:"flex",flex:1},children:d.cloneElement(e,{onChange:function(e){o((function(i){return i[n]=e.target.value,t(i,{resetValues:function(){return u((function(e){return e+1}))},setValues:o}),i}))},value:r[n]})},"multi-select-child-".concat(n,"-").concat(c))}))})};function Hl(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 zl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Hl(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Hl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Gl(e,n){var t,r,o,u,a=e.autocompleteItems,s=e.block,p=e.blockRefs,m=e.blocks,v=e.deleteWidget,g=e.executionState,b=e.fetchPipeline,x=e.fetchFileTree,j=e.messages,y=void 0===j?[]:j,k=e.onChangeContent,Z=e.pipeline,_=e.runBlock,O=e.runningBlocks,w=e.savePipelineContent,S=e.selected,E=e.setAnyInputFocused,P=e.setSelectedBlock,T=e.setTextareaFocused,I=e.textareaFocused,A=e.updateWidget,R=e.width,D=(0,d.useRef)(null),M=(0,d.useContext)(Te.ThemeContext),N=an.ZP.blocks.pipelines.detail(null===Z||void 0===Z?void 0:Z.uuid,null===s||void 0===s?void 0:s.upstream_blocks[0]).data,B=(null===N||void 0===N||null===(t=N.block)||void 0===t?void 0:t.outputs)||(null===s||void 0===s?void 0:s.outputs)||[],F=(0,d.useState)(null),U=F[0],z=F[1],G=(0,d.useState)(null===(r=s.configuration)||void 0===r?void 0:r.chart_type),W=G[0],Q=G[1],q=(0,d.useState)(s.configuration),Y=q[0],V=q[1],K=(0,d.useState)(s.content),$=K[0],ie=K[1],ce=(0,d.useState)(!W||0===B.length),ue=ce[0],ae=ce[1],se=(0,d.useState)(!1),de=se[0],fe=se[1],pe=(0,d.useState)(null),ve=pe[0],ge=pe[1],ke=(0,d.useState)(null===s||void 0===s?void 0:s.upstream_blocks),Ze=ke[0],_e=ke[1],Ce=(0,d.useState)((null===B||void 0===B?void 0:B.length)||0),Oe=Ce[0],we=Ce[1],Se=(0,d.useState)(s.uuid),Ee=Se[0],Pe=Se[1],Ie=ee[W],Ae=ne[W],Re=(0,d.useMemo)((function(){return null===m||void 0===m?void 0:m.filter((function(e){var n=e.type;return[h.tf.DATA_LOADER,h.tf.TRANSFORMER].includes(n)}))}),[m]),De=(0,d.useMemo)((function(){return(0,rn.HK)(Re,(function(e){return e.uuid}))}),[Re]),Me=!!O.find((function(e){return e.uuid===s.uuid}))||(null===y||void 0===y?void 0:y.length)>=1&&g!==Bn.uF.IDLE,Ne=(0,d.useMemo)((function(){return null===y||void 0===y?void 0:y.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[y]),Be=!!Ne.find((function(e){return e.error})),Le=Ne.length>=1,Fe=(0,d.useMemo)((function(){return{blockType:s.type,hasError:Be,selected:S}}),[s.type,Be,S]);if(null!==Ne&&void 0!==Ne&&Ne.length){var Ue,He,ze=Ne.length-1;u=null===Ne||void 0===Ne||null===(Ue=Ne[ze])||void 0===Ue||null===(He=Ue.data)||void 0===He?void 0:He[0]}u?(u=(u=u.slice(1,u.length-1)).replaceAll('\\"','"').replaceAll("\\'","'"),(0,oe.Pb)(u)&&(o=JSON.parse(u))):(null===B||void 0===B?void 0:B.length)>=1&&(o={},B.forEach((function(e){var n=e||{},t=n.text_data,i=n.type,r=n.variable_uuid;Bn.Gi.TEXT===i&&(0,oe.Pb)(t)&&(o[r]=JSON.parse(t))})));var We=(0,d.useCallback)((function(e){var n=zl(zl(zl({},s),e),{},{configuration:zl(zl({},s.configuration),e.configuration)});w().then((function(){_({block:n,code:$,ignoreAlreadyRunning:!0,runUpstream:!!Ze.find((function(e){var n;return![h.DA.EXECUTED,h.DA.UPDATED].includes(null===(n=De[e])||void 0===n?void 0:n.status)}))})})),we((function(e){return e+1}))}),[s,De,$,we,Ze]),Qe=(0,d.useCallback)((function(e){ie(e),k(e)}),[k,ie]),qe=(0,d.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.autoRun;V((function(n){return zl(zl({},n),e)}));var i=zl(zl({},s),{},{configuration:zl(zl(zl({},Y),e),{},{chart_type:W})});A(i);Object.keys(e);Oe&&t&&We(i)}),[s,W,Y,Oe,We,V,A]);(0,d.useEffect)((function(){z({python:ar({autocompleteItems:a,block:s,blocks:m,pipeline:Z})})}),[a,s,m,Z]);var Ye=(0,d.useMemo)((function(){return(0,le.jsx)(Nn.Z,{autoHeight:!0,autocompleteProviders:U,onChange:Qe,selected:S,setSelected:function(e){return P(!0===e?s:null)},setTextareaFocused:T,showLineNumbers:!1,textareaFocused:I||i.TABLE===W&&!ue,value:$,width:"100%"})}),[U,W,$,ue,S,P,T,I,Qe]),Ve=(0,d.useMemo)((function(){return Be&&Le&&(0,le.jsx)(Bi,zl(zl({},Fe),{},{block:s,contained:!1,hideExtraInfo:!0,isInProgress:Me,messages:Ne,selected:S}))}),[s,Fe,Be,Le,Me,Ne,S]),Ke=(0,gi.Z)(ue),Je=(0,gi.Z)(R);(0,d.useEffect)((function(){var e,n=null===D||void 0===D||null===(e=D.current)||void 0===e?void 0:e.getBoundingClientRect();Ke!==ue||Je!==R?(ge(0),setTimeout((function(){var e,n,t=null===D||void 0===D||null===(e=D.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.width;t&&ge(t)}),100)):n&&ge(n.width)}),[ue,Ke,D.current,ge,R,Je]);var $e=(0,d.useMemo)((function(){var e=[];return Ze.forEach((function(n,t){var i=De[n],r=(0,Xe.qn)(null===i||void 0===i?void 0:i.type,{blockColor:null===i||void 0===i?void 0:i.color,theme:M}).accent;e.push((0,le.jsxs)(be.Z,{ml:2,children:[(0,le.jsxs)(xe.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:["df_",t+1]})," ",(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,le.jsx)($n.Z,{color:r,inline:!0,onClick:function(){var e,n,t=null===p||void 0===p||null===(e=p.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,le.jsx)(xe.ZP,{color:r,monospace:!0,small:!0,children:n})})]},n))})),e}),[De,Ze]),en=(0,d.useMemo)((function(){var e,n=[],t=null===Ie||void 0===Ie||null===(e=Ie.code)||void 0===e?void 0:e.reduce((function(e,n){var t=n.uuid;return L.includes(t)?e.concat(t):e}),[]);null===t||void 0===t||t.length;return null===t||void 0===t||t.forEach((function(e,t){var i=Y[e];if(i){var r,o,l=null===(r=te[W])||void 0===r||null===(o=r[e])||void 0===o?void 0:o.call(r);n.push((0,le.jsxs)(be.Z,{ml:2,children:[(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:i})," ",l&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,le.jsx)(xe.ZP,{default:!0,inline:!0,small:!0,children:l})]})]},i))}})),n}),[Y,Ie]),nn=(0,gi.Z)(W),tn=(0,gi.Z)(Ze);(0,d.useEffect)((function(){if((!nn&&W&&null!==Ze&&void 0!==Ze&&Ze.length||(null===tn||void 0===tn||!tn.length)&&(null===Ze||void 0===Ze?void 0:Ze.length)>=1&&W)&&!$&&(0,sn.Qr)(Y)&&Ae){var e=zl(zl({},s),{},{upstream_blocks:Ze});Ae.configuration&&qe(Ae.configuration(e)),Ae.content&&Qe(Ae.content(e))}}),[s,W,nn,Y,$,qe,Qe,Ze,tn]);var on=(0,d.useMemo)((function(){return Y.width_percentage||1}),[Y]),ln=(0,d.useMemo)((function(){return Object.entries(Ie||{}).reduce((function(e,n){var t=(0,l.Z)(n,2),i=t[0],r=t[1];return zl(zl({},e),{},(0,c.Z)({},i,r.map((function(e){var n,t=e.autoRun,i=e.label,r=e.monospace,o=e.options,l=e.settings,u=void 0===l?{}:l,a=e.type,d=e.uuid,f={fullWidth:!0,key:d,label:(0,oe.kC)(i()),monospace:r,onBlur:function(){return P(s)},onChange:function(e){return qe((0,c.Z)({},d,e.target.value),{autoRun:t})},onFocus:function(){return P(s)},value:(null===Y||void 0===Y?void 0:Y[d])||""},p=(null!==N&&void 0!==N&&N.block?[N.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(X.COLUMNS===a){var h=Y[d]||[];n=(0,le.jsxs)(le.Fragment,{children:[(!u.maxValues||h.length<u.maxValues)&&(0,le.jsxs)(tr.Z,zl(zl({},f),{},{onChange:function(e){var n=Y[d]||[],i=e.target.value;n.includes(i)?n=(0,rn.Od)(n,(function(e){return e===i})):n.push(i),qe((0,c.Z)({},d,n),{autoRun:t})},value:null,children:[(0,le.jsx)("option",{value:""}),(0,rn.YC)(p.filter((function(e){return!h.includes(e)})),(function(e){return e})).map((function(e){return(0,le.jsx)("option",{value:e,children:e},e)}))]})),h.map((function(e){return(0,le.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,le.jsx)(Yr,{label:e,onClick:function(){qe((0,c.Z)({},d,(0,rn.Od)(h,(function(n){return n===e}))),{autoRun:t})}})},e)}))]})}else if(X.METRICS===a){var m=Y[d]||[];n=(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(xe.ZP,{bold:!0,children:"Metrics"}),(0,le.jsx)(xe.ZP,{muted:!0,small:!0,children:"Select a column and an aggregation function."}),(0,le.jsxs)(Ul,{onChange:function(e,n){var i=n.resetValues,r=n.setValues;2===e.filter((function(e){return!!e})).length&&(m.find((function(n){var t=n.aggregation;return n.column===e[1]&&t===e[0]}))||(qe((0,c.Z)({},d,m.concat({aggregation:e[0],column:e[1]})),{autoRun:t}),r([null,null]),i()))},children:[(0,le.jsxs)(tr.Z,zl(zl({},f),{},{label:"aggregation",children:[(0,le.jsx)("option",{value:""}),(0,rn.YC)(J,(function(e){return e})).map((function(e){return(0,le.jsx)("option",{value:e,children:e},e)}))]})),(0,le.jsxs)(tr.Z,zl(zl({},f),{},{label:"column",children:[(0,le.jsx)("option",{value:""}),(0,rn.YC)(p,(function(e){return e})).map((function(e){return(0,le.jsx)("option",{value:e,children:e},e)}))]}))]}),m.map((function(e){var n=e.aggregation,i=e.column;return(0,le.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,le.jsx)(Yr,{label:(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)(xe.ZP,{inline:!0,monospace:!0,children:[n,"("]}),i,(0,le.jsx)(xe.ZP,{inline:!0,monospace:!0,children:")"})]}),onClick:function(){qe((0,c.Z)({},d,(0,rn.Od)(m,(function(e){var t=e.aggregation,r=e.column;return n===t&&i===r}))),{autoRun:t})}})},"".concat(n,"(").concat(i,")"))}))]})}else n=o?(0,le.jsx)(tr.Z,zl(zl({},f),{},{children:o.map((function(e){return(0,le.jsx)("option",{value:e,children:e},e)}))})):(0,le.jsx)(je.Z,zl(zl({},f),{},{type:a}));return(0,le.jsx)(be.Z,{mb:1,children:n},d)}))))}),{noCode:[]})}),[De,Y,Ie,B,P,qe,Ze]),cn=ln.code,un=ln.noCode,fn=(0,f.Db)(an.ZP.widgets.pipelines.useUpdate(null===Z||void 0===Z?void 0:Z.uuid,s.uuid),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){fe(!1),b(),x()},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})},onError:function(e){(0,dn.qQ)(e).messages}}),pn=(0,l.Z)(fn,1)[0],hn="ChartBlock/".concat(s.uuid),mn=(0,Hn.y)(),gn=mn.registerOnKeyDown,bn=mn.unregisterOnKeyDown;return(0,d.useEffect)((function(){return function(){bn(hn)}}),[bn,hn]),gn(hn,(function(e,n,t){de&&String(t[0])===String(ye.Uq)&&String(t[1])!==String(ye.zX)&&pn({widget:zl(zl({},s),{},{name:Ee})})}),[s,de,Ee,pn]),(0,le.jsx)(Fl.Z,{sm:12,md:12*on,children:(0,le.jsxs)(Al,{ref:n,children:[(0,le.jsx)(be.Z,{mt:1,pt:1,px:1,children:(0,le.jsxs)(he.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,le.jsxs)(An.Z,{flex:1,style:{position:"relative"},children:[(0,le.jsx)(jt,{bold:!1,fullWidth:!0,inputValue:Ee,notRequired:!0,onBlur:function(){return setTimeout((function(){return fe(!1)}),300)},onChange:function(e){Pe(e.target.value),e.preventDefault()},onClick:function(){E(!0),fe(!0)},onFocus:function(){E(!0),fe(!0)},small:!0,stacked:!0,value:!de&&s.uuid}),de&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(be.Z,{ml:1}),(0,le.jsx)($n.Z,{noWrapping:!0,onClick:function(){return pn({widget:zl(zl({},s),{},{name:Ee})})},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update chart name"})]})]}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(tr.Z,{compact:!0,onChange:function(e){var n=[e.target.value],t=zl(zl({},s),{},{upstream_blocks:n});A(t),We(t),_e(n)},placeholder:"Source block",small:!0,value:(null===Ze||void 0===Ze?void 0:Ze[0])||"",children:null===Re||void 0===Re?void 0:Re.map((function(e){var n=e.uuid;return(0,le.jsx)("option",{value:n,children:n},n)}))}),(0,le.jsx)(be.Z,{mr:1}),!Me&&(0,le.jsx)(et.Z,{appearBefore:!0,default:!0,label:"Run chart block",size:null,widthFitContent:!0,children:(0,le.jsx)(me.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return We(s)},uuid:"ChartBlock/run/".concat(s.uuid),children:(0,le.jsx)(Ge.Py,{size:2*re.iI})})}),Bn.uF.QUEUED===g&&(0,le.jsx)(zi.Z,{color:(M||vn.Z).content.active,small:!0,type:"cylon"}),Bn.uF.BUSY===g&&(0,le.jsx)(zi.Z,{color:(M||vn.Z).content.active,small:!0}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsx)(et.Z,{appearBefore:!0,default:!0,label:"Edit chart",size:null,widthFitContent:!0,children:(0,le.jsx)(me.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return ae((function(e){return!e}))},selected:ue,uuid:"ChartBlock/edit/".concat(s.uuid),children:(0,le.jsx)(Ge.I8,{size:2*re.iI})})}),(0,le.jsx)(be.Z,{mr:1}),(0,le.jsx)(et.Z,{appearBefore:!0,default:!0,label:"Delete chart",size:null,widthFitContent:!0,children:(0,le.jsx)(me.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return v(s)},uuid:"ChartBlock/delete/".concat(s.uuid),children:(0,le.jsx)(Ge.rF,{size:2*re.iI})})})]})]})}),(0,le.jsx)(be.Z,{mt:1}),(0,le.jsxs)(he.Z,{justifyContent:"space-between",fullWidth:!0,children:[(0,le.jsx)(An.Z,{flex:6,ref:D,children:o&&!(0,sn.Qr)(o)&&(0,le.jsx)(be.Z,{pb:3,children:(0,le.jsx)(Ll,{block:zl(zl({},s),{},{configuration:zl(zl({},s.configuration),Y)}),data:o,width:ve})})}),ue&&(0,le.jsx)(Rl,{children:(0,le.jsxs)(he.Z,{flexDirection:"column",fullWidth:!0,children:[(0,le.jsx)(be.Z,{mb:1,children:(0,le.jsx)(tr.Z,{onChange:function(e){var n=e.target.value,t=zl(zl({},s),{},{configuration:zl(zl({},Y),{},{chart_type:n})});A(t),We(t),Q(n)},placeholder:"Select chart type",value:W,children:H.map((function(e){return(0,le.jsx)("option",{value:e,children:(0,oe.kC)(e)},e)}))})}),(0,le.jsx)(be.Z,{mb:1,children:(0,le.jsx)(tr.Z,{onChange:function(e){return qe((0,c.Z)({},C,e.target.value))},placeholder:"Chart width",value:(null===Y||void 0===Y?void 0:Y.width_percentage)||1,children:[["1/2 width",.5],["full width",1]].map((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];return(0,le.jsx)("option",{value:i,children:t},t)}))})}),un]})})]}),ue&&!(null===cn||void 0===cn||!cn.length)&&h.t6.SQL!==s.language&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)(be.Z,{my:1,px:1,children:[(0,le.jsx)(xe.ZP,{bold:!0,children:"Custom chart code"}),(0,le.jsxs)(xe.ZP,{muted:!0,children:["Write custom logic mapping data to input values for your chart.",(0,le.jsx)("br",{}),"This code is only executed if you don\u2019t have any columns or metrics selected."]})]}),(0,le.jsxs)(Dl,{children:[Ze.length>=1&&(0,le.jsxs)(Ml,{children:[(0,le.jsxs)(xe.ZP,{muted:!0,small:!0,children:["Variables you can use in your code: ",$e]}),(0,le.jsxs)(xe.ZP,{muted:!0,small:!0,children:["Variables that you must define: ",en]})]}),Ye]})]}),Ve&&(0,le.jsx)(be.Z,{px:1,children:Ve})]})})}var Wl=d.forwardRef(Gl),Ql=t(97361),ql=["blockRefs","blocks","chartRefs","deleteWidget","messages","onChangeChartBlock","runBlock","runningBlocks","savePipelineContent","selectedBlock","setAnyInputFocused","setSelectedBlock","setTextareaFocused","textareaFocused","updateWidget","widgets","width"];function Yl(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 Vl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Yl(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Yl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Kl=function(e){var n=e.blockRefs,t=e.blocks,i=e.chartRefs,r=e.deleteWidget,o=e.messages,l=e.onChangeChartBlock,u=e.runBlock,a=e.runningBlocks,s=e.savePipelineContent,f=e.selectedBlock,p=e.setAnyInputFocused,h=e.setSelectedBlock,m=e.setTextareaFocused,v=e.textareaFocused,g=e.updateWidget,b=e.widgets,x=e.width,j=(0,Pe.Z)(e,ql),y=(0,d.useMemo)((function(){return a.reduce((function(e,n,t){return Vl(Vl({},e),{},(0,c.Z)({},n.uuid,Vl(Vl({},n),{},{priority:t})))}),{})}),[a]);return(0,le.jsxs)(he.Z,{flexDirection:"column",fullWidth:!0,children:[(0,le.jsx)(Ql.Z,{fullHeight:!0,style:{marginLeft:.5*re.iI,marginRight:.5*re.iI},children:null===b||void 0===b?void 0:b.map((function(e){var c=e.uuid,b=y[c],k=b?0===b.priority?Bn.uF.BUSY:Bn.uF.QUEUED:Bn.uF.IDLE;return i.current[c]=(0,d.createRef)(),(0,d.createElement)(Wl,Vl(Vl({},j),{},{block:e,blockRefs:n,blocks:t,chartRefs:i,deleteWidget:r,executionState:k,key:c,messages:o[c],onChangeContent:function(e){return l(c,e)},ref:i.current[c],runBlock:u,runningBlocks:a,savePipelineContent:s,selected:(null===f||void 0===f?void 0:f.uuid)===c,setAnyInputFocused:p,setSelectedBlock:h,setTextareaFocused:m,textareaFocused:v,updateWidget:g,width:x}))}))}),(0,le.jsx)("div",{style:{height:"80vh"}})]})},Xl=Te.default.svg.withConfig({displayName:"EmptyCharts__SVGStyle",componentId:"sc-ttsjrp-0"})([""]),Jl=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,le.jsxs)(Xl,{height:t*(305/358),viewBox:r,width:t,children:[(0,le.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,le.jsx)("path",{fill:"#000",d:"M118 46h1v216h-1zM178 46h1v216h-1zM238 46h1v216h-1z"}),(0,le.jsx)("path",{fill:"#000",d:"M59 208.25v-1h239v1zM59 154.5v-1h239v1zM59 100.75v-1h239v1z"}),(0,le.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,le.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,le.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,le.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,le.jsx)("circle",{cx:"55.2178",cy:"34.6274",r:"5.2954",fill:"#8ADE00"}),(0,le.jsx)("circle",{cx:"113.818",cy:"106.582",r:"5.2954",fill:"#8ADE00"}),(0,le.jsx)("circle",{cx:"84.2832",cy:"80.6953",r:"5.2954",fill:"#8ADE00"}),(0,le.jsx)("circle",{cx:"117.115",cy:"43.6274",r:"5.2954",fill:"#8ADE00"}),(0,le.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,le.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,le.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,le.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,le.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,le.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,le.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,le.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"})]})},$l=t(88560),ec=(Te.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-43nc8t-0"})(["border-radius:","px;",""],gn.TR,(function(e){return"\n border: 1px solid ".concat((e.theme.interactive||Bo.Z.interactive).defaultBorder,";\n ")})),Te.default.div.withConfig({displayName:"indexstyle__ColumnProfileStyle",componentId:"sc-43nc8t-1"})(["",""],(function(e){return"\n background: ".concat((e.theme.background||Bo.Z.background).table,";\n border-bottom: 1px solid ").concat((e.theme.interactive||Bo.Z.interactive).defaultBorder,";\n border-right: 1px solid ").concat((e.theme.interactive||Bo.Z.interactive).defaultBorder,";\n ")}))),nc=(Te.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-43nc8t-2"})(["background:",";padding:","px ","px;"," border-top-left-radius:","px;border-top-right-radius:","px;"],dl.Uq,1.75*re.iI,re.tr,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||Bo.Z.interactive).defaultBorder,";\n ")}),gn.TR,gn.TR),Te.default.div.withConfig({displayName:"indexstyle__FeatureProfileStyle",componentId:"sc-43nc8t-3"})(["",""],(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||Bo.Z.interactive).defaultBorder,";\n ")}))),tc=(Te.default.div.withConfig({displayName:"indexstyle__BodyStyle",componentId:"sc-43nc8t-4"})(["border-bottom-left-radius:","px;border-bottom-right-radius:","px;overflow-y:scroll;"],gn.TR,gn.TR),Te.default.div.withConfig({displayName:"indexstyle__CellStyle",componentId:"sc-43nc8t-5"})([""," padding:","px;"],(function(e){return e.backgroundColor&&"\n background-color: ".concat(e.backgroundColor,";\n ")}),re.iI)),ic=Te.default.div.withConfig({displayName:"indexstyle__ScrollOverflowStyle",componentId:"sc-43nc8t-6"})([""," overflow-x:auto;"],tt.w5);function rc(e,n){return{average:e["".concat(n,"/average")],avg_string_length:e["".concat(n,"/avg_string_length")],avg_word_count:e["".concat(n,"/avg_word_count")],completeness:e["".concat(n,"/completeness")],count:e["".concat(n,"/count")],count_distinct:e["".concat(n,"/count_distinct")],invalid_indices:e["".concat(n,"/invalid_indices")],invalid_value_count:e["".concat(n,"/invalid_value_count")],invalid_value_rate:e["".concat(n,"/invalid_value_rate")],invalid_values:e["".concat(n,"/invalid_values")],max:e["".concat(n,"/max")],max_character_count:e["".concat(n,"/max_character_count")],max_null_seq:e["".concat(n,"/max_null_seq")],max_word_count:e["".concat(n,"/max_word_count")],median:e["".concat(n,"/median")],min:e["".concat(n,"/min")],min_character_count:e["".concat(n,"/min_character_count")],min_word_count:e["".concat(n,"/min_word_count")],mode:e["".concat(n,"/mode")],null_value_count:e["".concat(n,"/null_value_count")],null_value_rate:e["".concat(n,"/null_value_rate")],outlier_count:e["".concat(n,"/outlier_count")],outlier_ratio:e["".concat(n,"/outlier_ratio")],outliers:e["".concat(n,"/outliers")],quality:e["".concat(n,"/quality")],skew:e["".concat(n,"/skew")],std:e["".concat(n,"/std")],sum:e["".concat(n,"/sum")],unique_value_rate:e["".concat(n,"/unique_value_rate")],validity:e["".concat(n,"/validity")],value_counts:e["".concat(n,"/value_counts")]}}var oc=["Type","Missing","Unique","Min","Max","Mean","Median","Mode","Invalid","Outliers","Skewness","Std dev"],lc={Missing:0,Invalid:0,Outliers:0,Unique:.9};function cc(e){var n=e.columns,t=e.feature,i=e.shouldLink,r=e.statistics,o=(0,d.useContext)(Te.ThemeContext),l=t.columnType,c=t.uuid,u=rc(r,c),a=u.average,s=u.avg_string_length,f=u.avg_word_count,p=u.count,h=u.count_distinct,m=u.invalid_value_count,v=u.invalid_value_rate,g=u.max,b=u.max_character_count,x=u.max_word_count,j=u.min,y=u.min_character_count,k=u.min_word_count,Z=u.median,_=u.mode,C=u.null_value_count,O=u.null_value_rate,w=u.outlier_count,S=u.skew,E=u.std,P=u.unique_value_rate,T=[l,C,h,j,g,a,Z,_,m,w,S,E],I={Min:k,Max:x,Mean:f},A={Min:"".concat((0,oe._6)("character",y)),Max:"".concat((0,oe._6)("character",b)),Mean:"".concat((0,oe._6)("character",(0,oe.QV)(s)))},R={Invalid:(0,oe.T3)(v),Missing:(0,oe.T3)(O),Unique:(0,oe.T3)(P)},D=yn.T5[l],M=[o.background.row,o.background.row2],N=M[0],B=M[1],L=i?$n.Z:xe.ZP;return(0,le.jsxs)(An.Z,{flexDirection:"column",children:[(0,le.jsx)(nc,{children:(0,le.jsx)(be.Z,{px:1,py:2,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[D&&(0,le.jsxs)(An.Z,{title:$l.Rp[l],children:[(0,le.jsx)(D,{size:2*re.iI}),"\xa0"]}),(0,le.jsx)(L,{inline:!0,onClick:i?function(){return(0,ut.u)({column:n.indexOf(c)},{pushHistory:!0})}:void 0,preventDefault:!0,secondary:!0,children:(0,le.jsx)(xe.ZP,{bold:!0,default:!i,maxWidth:25*re.iI,monospace:!0,secondary:i,textOverflow:!0,title:c,children:c})})]})})}),T.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"-",n=arguments.length>1?arguments[1]:void 0,t=oc[n],i=l===$l.RL.TEXT&&t in I,r=i?I[t]:e,o=isNaN(r)?r:(0,oe.QV)(r),c=t in lc&&o/p>lc[t];return(0,le.jsx)(tc,{backgroundColor:n%2===0?N:B,children:(0,le.jsxs)(xe.ZP,{bold:c,danger:c,default:!0,textOverflow:!0,title:i?A[t]:"",children:[i?"".concat((0,oe._6)("word",o)):o,t in R&&" (".concat(R[t],")")]})},n)}))]})}var uc=function(e){var n=e.features,t=void 0===n?[]:n,i=e.shouldLink,r=e.statistics,o=(0,d.useContext)(Te.ThemeContext),l=(0,d.useMemo)((function(){return t.map((function(e){return e.uuid}))}),[t]);return(0,le.jsx)(Vo.Z,{headerTitle:"Feature profiles",children:(0,le.jsxs)(he.Z,{children:[(0,le.jsx)(ec,{children:(0,le.jsxs)(An.Z,{flex:1,flexDirection:"column",style:{background:o.background.table},children:[(0,le.jsx)(be.Z,{mr:1.25*re.iI,mt:"".concat(53,"px")}),oc.map((function(e,n){return(0,le.jsx)(tc,{children:(0,le.jsx)(xe.ZP,{default:!i,secondary:i,children:e})},"".concat(e,"-").concat(n))}))]})}),(0,le.jsx)(ic,{children:(0,le.jsx)(he.Z,{children:t.map((function(e,n){return(0,le.jsx)(nc,{children:(0,le.jsx)(cc,{columns:l,feature:e,shouldLink:i,statistics:r})},"".concat(e,"-").concat(n))}))})})]})})},ac=t(21764),sc=t(22673),dc=t(1286),fc=(re.iI,dc.O$,re.iI,oi.dN,Te.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-cr39lf-0"})(["height:calc(100vh - ","px - ","px);width:fit-content;",""],nt.Wi,tt.nn,(function(e){return e.fullWidth&&"\n width: 100%;\n "})),Te.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-cr39lf-1"})(["padding:","px;",""],2*re.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "})),Te.default.table.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-cr39lf-2"})(["",""],(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}))),pc=Te.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*re.iI,"px;\n ")})),hc=t(19963);var mc=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,s=(u.type,u.value),p=(0,d.useRef)(null),h=(0,d.useState)(!1),m=h[0],v=h[1],g=(0,d.useState)(a),b=g[0],x=g[1],j=(0,d.useState)(s),y=j[0],k=j[1],Z=(0,d.useState)(!1),_=Z[0],C=Z[1],O=(0,f.Db)(an.ZP.variables.pipelines.useUpdate(c,a),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){C(!1),i()}})}}),w=(0,l.Z)(O,1)[0],S=(0,d.useCallback)((function(e){if("Enter"===e.key){var n=y;try{n=JSON.parse(y)}catch(t){}w({variable:{name:b,value:n}})}else"Escape"===e.key&&C(!1)}),[b,y]);(0,d.useEffect)((function(){var e;_&&(null===p||void 0===p||null===(e=p.current)||void 0===e||e.focus())}),[_,p]);var E=n||"kwargs['".concat(a,"']");return(0,le.jsx)("div",{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},children:(0,le.jsxs)(Ql.Z,{children:[(0,le.jsx)(Fl.Z,{md:1,hiddenSmDown:!0,children:(0,le.jsx)(pc,{noPadding:!0,children:(0,le.jsx)(me.ZP,{backgroundColor:hc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(E),ac.Am.success("Successfully copied to clipboard.",{position:ac.Am.POSITION.BOTTOM_RIGHT,toastId:a})},small:!0,uuid:"Sidekick/GlobalVariables/".concat(a),withIcon:!0,children:(0,le.jsx)(Ge.CK,{size:2.5*re.iI})})})}),(0,le.jsx)(Fl.Z,{md:4,children:_?(0,le.jsx)(pc,{children:(0,le.jsx)(je.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){x(e.target.value),e.preventDefault()},onKeyDown:S,paddingHorizontal:0,placeholder:"variable",small:!0,value:b})}):(0,le.jsx)(pc,{children:(0,le.jsx)(xe.ZP,{color:dl.Or,monospace:!0,small:!0,textOverflow:!0,children:a})})}),(0,le.jsx)(Fl.Z,{md:7,children:_?(0,le.jsx)(pc,{children:(0,le.jsx)(je.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){k(e.target.value),e.preventDefault()},onKeyDown:S,paddingHorizontal:0,placeholder:"enter value",ref:p,small:!0,value:y})}):(0,le.jsxs)(pc,{children:[o?(0,le.jsx)(xe.ZP,{monospace:!0,small:!0,children:"********"}):(0,le.jsx)(xe.ZP,{monospace:!0,small:!0,children:s}),(0,le.jsxs)(An.Z,{children:[!r&&m&&(0,le.jsx)(me.ZP,{backgroundColor:hc.qJ,borderless:!0,inline:!0,muted:!0,onClick:function(){C(!0)},small:!0,uuid:"Sidekick/GlobalVariables/edit_".concat(a),withIcon:!0,children:(0,le.jsx)(Ge.I8,{size:2.5*re.iI})}),t&&m&&(0,le.jsx)(me.ZP,{backgroundColor:hc.qJ,borderless:!0,inline:!0,muted:!0,onClick:t,small:!0,uuid:"Sidekick/GlobalVariables/delete_".concat(a),withIcon:!0,children:(0,le.jsx)(Ge.rF,{size:2.5*re.iI})})]})]})})]})})},vc=t(93348),gc=t(58122);var bc=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,d.useState)(!1),a=u[0],s=u[1],p=(0,d.useState)(),m=p[0],v=p[1],g=(0,d.useState)(),b=g[0],x=g[1],j=null===t||void 0===t?void 0:t.uuid,y=(0,f.Db)(an.ZP.variables.pipelines.useCreate(j),{onSuccess:function(e){return(0,dn.wD)(e,{onErrorCallback:function(e){var n=e.error.exception;r((function(e){return e.concat(n)}))}})}}),k=(0,l.Z)(y,1)[0],Z=(0,f.Db)((function(e){return an.ZP.variables.pipelines.useDelete(j,e)()}),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),_=(0,l.Z)(Z,1)[0],C=(0,d.useCallback)((function(e){if("Enter"===e.key){var t=b;try{t=JSON.parse(b)}catch(i){}k({variable:{name:m,value:t}}).then((function(){n(),v(null),x(null)})),s(!1)}else"Escape"===e.key&&s(!1)}),[k,n,m,b]),O=(0,d.useMemo)((function(){return c-4*re.iI}),[c]),w=(0,d.useMemo)((function(){return(0,gc.wx)(o,(function(e){return"global"===e.uuid}))}),[o]),S=(0,d.useMemo)((function(){return(0,gc.wx)(o,(function(e){return e.uuid===(null===i||void 0===i?void 0:i.uuid)}))}),[i,o]),E=(0,d.useMemo)((function(){return(0,le.jsxs)(fc,{width:O,children:[a&&(0,le.jsxs)(Ql.Z,{children:[(0,le.jsx)(Fl.Z,{md:1,children:(0,le.jsx)(pc,{noPadding:!0,children:(0,le.jsx)(me.ZP,{backgroundColor:hc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(m),ac.Am.success("Successfully copied to clipboard.",{position:ac.Am.POSITION.BOTTOM_RIGHT,toastId:m})},uuid:"Sidekick/GlobalVariables/".concat(m),withIcon:!0,children:(0,le.jsx)(Ge.CK,{size:2.5*re.iI})})})}),(0,le.jsx)(Fl.Z,{md:4,children:(0,le.jsx)(pc,{children:(0,le.jsx)(je.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){v(e.target.value),e.preventDefault()},onKeyDown:C,paddingHorizontal:0,placeholder:"variable",small:!0,value:m})})}),(0,le.jsx)(Fl.Z,{md:7,children:(0,le.jsx)(pc,{children:(0,le.jsx)(je.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){x(e.target.value),e.preventDefault()},onKeyDown:C,paddingHorizontal:0,placeholder:"enter value",small:!0,value:b})})})]}),null===w||void 0===w?void 0:w.map((function(e){return(0,le.jsx)(mc,{deleteVariable:function(){return _(e.uuid)},fetchVariables:n,pipelineUUID:j,variable:e})}))]})}),[_,w,m,b,j,v,x,s,a,O]),P=(0,d.useMemo)((function(){return(0,le.jsx)(fc,{width:O,children:null===S||void 0===S?void 0:S.map((function(e){return(0,le.jsx)(mc,{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});var n}))})}),[S,i,O]);return(0,le.jsxs)(be.Z,{p:re.cd,children:[(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(Nr.Z,{level:4,monospace:!0,children:"Global Variables"}),(0,le.jsx)(be.Z,{ml:2}),(0,le.jsx)(me.ZP,{Icon:Ge.mm,blackBorder:!0,inline:!0,onClick:function(){return s((function(e){return!e}))},uuid:"Sidekick/GlobalVariables/addNewVariable",children:"New"})]})}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsxs)(xe.ZP,{muted:!0,children:["Press ",(0,le.jsx)(xe.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,le.jsx)(xe.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,le.jsx)(be.Z,{mb:re.cd,children:E}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsx)(xe.ZP,{children:"Global variables will be passed into all non-scratchpad blocks as keyword arguments. To load a global variable, use the following syntax:"})}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsx)(sc.Z,{language:"python",small:!0,source:"\n var = kwargs['variable_name']\n"})}),(0,le.jsxs)(be.Z,{mb:re.cd,children:[(0,le.jsx)(Nr.Z,{level:4,monospace:!0,children:"Trigger Runtime Variables"}),(0,le.jsx)(be.Z,{mb:re.cd}),(0,le.jsx)(xe.ZP,{children:"Depending on what kind of trigger you use for this pipeline, some default runtime variables will be provided."})]}),Object.values(vc.Xm).map((function(e){var n;return(0,le.jsxs)(be.Z,{mb:re.cd,children:[(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsx)(xe.ZP,{large:!0,monospace:!0,children:(0,oe.vg)(null===(n=vc.Z4[e])||void 0===n?void 0:n.call(vc.Z4))})}),(0,gc.JZ)([],e).map((function(e){return(0,le.jsx)(mc,{hideEdit:!0,variable:e,pipelineUUID:j})}))]})})),S&&S.length>0&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(be.Z,{my:2,children:(0,le.jsx)(Nr.Z,{level:4,monospace:!0,children:"Block Output Variables"})}),(0,le.jsx)(be.Z,{mb:2,children:P}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsxs)(xe.ZP,{children:["Output variables can be used in any ",(0,le.jsx)(xe.ZP,{bold:!0,inline:!0,monospace:!0,children:h.tf.SCRATCHPAD})," block."]})}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsx)(xe.ZP,{children:"To load the variable, use the following syntax:"})}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsx)(sc.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"})})]})]})},xc=Te.default.div.withConfig({displayName:"indexstyle__OutputContainerStyle",componentId:"sc-wkjnrg-0"})([""," overflow-y:scroll;"," ",""],tt.w5,(function(e){return e.height&&"\n height: ".concat(e.height,"px;\n ")}),(function(e){return!e.height&&"\n height: ".concat(300,"px;\n ")}));function jc(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 yc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?jc(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):jc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var kc=function(e){var n=e.cancelPipeline,t=e.executePipeline,i=e.isPipelineExecuting,r=e.pipelineMessages,o=(0,d.useMemo)((function(){return(null===r||void 0===r?void 0:r.length)||0}),[r]);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)(he.Z,{children:[(0,le.jsx)(de.Z,{beforeIcon:(0,le.jsx)(Ge.JM,{inverted:!0,size:2*re.iI}),loading:i,onClick:t,success:!0,children:(0,le.jsx)(xe.ZP,{bold:!0,inverted:!0,primary:!1,children:"Execute pipeline"})}),(0,le.jsx)(be.Z,{ml:1}),i&&(0,le.jsx)(de.Z,{beforeIcon:(0,le.jsx)(Ge.x8,{inverted:!0,size:2*re.iI}),onClick:n,success:!0,children:(0,le.jsx)(xe.ZP,{bold:!0,inverted:!0,primary:!1,children:"Cancel Pipeline"})})]}),(0,le.jsx)(xc,{noScrollbarTrackBackground:!0,children:(0,le.jsx)(bi,{executedAndIdle:!0,hasError:!1,selected:!0,children:r.map((function(e,n){var t=e.data,i=e.type,r=[],l=(r=(r=Array.isArray(t)?t:[t]).filter((function(e){return e}))).length;return r.map((function(e,t){var r,c={first:0===n&&0===t,last:n===o-1&&t===l-1};return Bn.jU.includes(i)?r=(0,le.jsx)(xi,yc(yc({},c),{},{children:(0,le.jsx)(xe.ZP,{monospace:!0,preWrap:!0,children:(0,le.jsx)(pi(),{children:e})})})):i===Bn.Gi.IMAGE_PNG&&(r=(0,le.jsx)("div",{style:{backgroundColor:"white"},children:(0,le.jsx)("img",{alt:"Image ".concat(n," from code output"),src:"data:image/png;base64, ".concat(e)})})),(0,le.jsx)("div",{children:r},"code-output-".concat(n,"-").concat(t))}))}))})})]})};var Zc=function(e){var n=e.fetchSecrets,t=e.pipelineUUID,i=e.secrets,r=e.setErrorMessages,o=e.width,c=(0,d.useState)(!1),u=c[0],a=c[1],s=(0,d.useState)(),p=s[0],h=s[1],m=(0,d.useState)(),v=m[0],g=m[1],b=(0,d.useMemo)((function(){return o-4*re.iI}),[o]),x=(0,f.Db)(an.ZP.secrets.useCreate(),{onSuccess:function(e){return(0,dn.wD)(e,{onErrorCallback:function(e){var n=e.error.exception;r((function(e){return e.concat(n)}))}})}}),j=(0,l.Z)(x,1)[0],y=(0,f.Db)((function(e){return an.ZP.secrets.useDelete(e)()}),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),k=(0,l.Z)(y,1)[0],Z=(0,d.useCallback)((function(e){"Enter"===e.key?(j({secret:{name:p,value:v}}).then((function(){n(),h(null),g(null)})),a(!1)):"Escape"===e.key&&a(!1)}),[j,n,p,v]);return(0,le.jsxs)(be.Z,{p:re.cd,children:[(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsxs)(he.Z,{alignItems:"center",children:[(0,le.jsx)(Nr.Z,{level:4,monospace:!0,children:"Secrets"}),(0,le.jsx)(be.Z,{ml:2}),(0,le.jsx)(me.ZP,{Icon:Ge.mm,blackBorder:!0,inline:!0,onClick:function(){return a((function(e){return!e}))},uuid:"Sidekick/Secrets/addNewSecret",children:"New"})]})}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsxs)(xe.ZP,{children:[(0,le.jsx)(xe.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,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsxs)(xe.ZP,{muted:!0,children:["Press ",(0,le.jsx)(xe.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,le.jsx)(xe.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsxs)(fc,{width:b,children:[u&&(0,le.jsxs)(Ql.Z,{children:[(0,le.jsx)(Fl.Z,{md:1,children:(0,le.jsx)(pc,{noPadding:!0,children:(0,le.jsx)(me.ZP,{backgroundColor:hc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText("{{ mage_secret_var(".concat(p,") }}")),ac.Am.success("Successfully copied to clipboard.",{position:ac.Am.POSITION.BOTTOM_RIGHT,toastId:p})},uuid:"Sidekick/Secrets/".concat(p),withIcon:!0,children:(0,le.jsx)(Ge.CK,{size:2.5*re.iI})})})}),(0,le.jsx)(Fl.Z,{md:4,children:(0,le.jsx)(pc,{children:(0,le.jsx)(je.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){h(e.target.value),e.preventDefault()},onKeyDown:Z,paddingHorizontal:0,placeholder:"secret name",small:!0,value:p})})}),(0,le.jsx)(Fl.Z,{md:7,children:(0,le.jsx)(pc,{children:(0,le.jsx)(je.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){g(e.target.value),e.preventDefault()},onKeyDown:Z,paddingHorizontal:0,placeholder:"secret value",small:!0,value:v})})})]}),null===i||void 0===i?void 0:i.map((function(e){return(0,le.jsx)(mc,{deleteVariable:function(){return k(e.name)},fetchVariables:n,hideEdit:!0,obfuscate:!0,pipelineUUID:t,variable:{uuid:e.name,value:e.value}})}))]})}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsx)(xe.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,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsx)(sc.Z,{language:"yaml",small:!0,source:"\n {{ mage_secret_var('<secret_name>') }}\n "})}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsx)(xe.ZP,{children:"To reference a secret in code, you can import the `get_secret_value` helper method:"})}),(0,le.jsx)(be.Z,{mb:re.cd,children:(0,le.jsx)(sc.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 "})})]})},_c=t(66607),Cc=t(64155);var Oc=function(e){var n=e.activeView,t=e.afterWidth,i=e.autocompleteItems,r=e.blockRefs,o=e.blocks,l=e.cancelPipeline,c=e.chartRefs,u=e.deleteWidget,a=e.editingBlock,s=e.executePipeline,f=e.fetchFileTree,p=e.fetchPipeline,h=e.fetchSecrets,m=e.fetchVariables,v=e.globalVariables,g=e.insights,b=e.interruptKernel,x=e.isPipelineExecuting,j=e.messages,y=e.metadata,k=e.onChangeChartBlock,Z=e.pipeline,_=e.pipelineMessages,C=e.runBlock,O=e.runningBlocks,w=e.sampleData,S=e.savePipelineContent,E=e.secrets,P=e.selectedBlock,T=e.setAnyInputFocused,I=e.setEditingBlock,A=e.setErrors,R=e.setSelectedBlock,D=e.setTextareaFocused,M=e.statistics,N=e.textareaFocused,B=e.updateWidget,L=e.widgets,F=(0,So.i)().height,U=nt.uX,H=(0,d.useState)([]),z=H[0],G=H[1],W=((null===a||void 0===a?void 0:a.upstreamBlocks)||{}).block,Q=((null===w||void 0===w?void 0:w.columns)||[]).slice(0,100),q=(null===w||void 0===w?void 0:w.rows)||[],Y=(null===y||void 0===y?void 0:y.column_types)||{},V=null===Q||void 0===Q?void 0:Q.map((function(e){return{columnType:Y[e],uuid:e}})),K=(null===g||void 0===g?void 0:g[1])||{},X=(0,d.useMemo)((function(){return(0,rn.HK)((null===g||void 0===g?void 0:g[0])||[],(function(e){return e.feature.uuid}))}),[g]),J=(0,gc.v0)({statistics:M}),$=(0,gc.CL)({columnTypes:Y,statistics:M}),ee=!!w,ne=(0,d.useMemo)((function(){return ge.q.INTEGRATION===(null===Z||void 0===Z?void 0:Z.type)}),[Z]),te=(0,d.useCallback)((0,dc.Fk)({columnTypes:Y,columns:Q,insightsByFeatureUUID:X,insightsOverview:K,noColumnLinks:!0,statistics:M}),[Y,Q,X,K,M]),ie=(0,d.useMemo)((function(){return(0,le.jsx)(bc,{blocks:o,fetchVariables:m,pipeline:Z,selectedBlock:P,setErrorMessages:G,variables:v,width:t})}),[t,null===r||void 0===r?void 0:r.current,o,m,v,Z,P,R]),oe=(0,d.useMemo)((function(){return(0,le.jsx)(Zc,{fetchSecrets:h,pipelineUUID:null===Z||void 0===Z?void 0:Z.uuid,secrets:E,setErrorMessages:G,width:t})}),[t,h,Z,E]);return(0,d.useMemo)((function(){return(0,le.jsx)(hi.Z,{columnHeaderHeight:Cc.Eh,columns:Q,height:F-U-nt.OM,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,renderColumnHeader:te,rows:q,width:t})}),[Q,q]),(0,le.jsxs)(le.Fragment,{children:[(null===z||void 0===z?void 0:z.length)>=1&&(0,le.jsxs)(be.Z,{mb:3,mt:2,mx:2,children:[(0,le.jsxs)(he.Z,{justifyContent:"space-between",children:[(0,le.jsx)(xe.ZP,{bold:!0,danger:!0,children:"Errors"}),(0,le.jsx)(de.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return G([])},transparent:!0,children:(0,le.jsx)(Ge.x8,{muted:!0})})]}),null===z||void 0===z?void 0:z.map((function(e){return(0,le.jsx)(be.Z,{pb:1,children:(0,le.jsx)(xe.ZP,{monospace:!0,xsmall:!0,children:e})},e)}))]}),(0,le.jsxs)(Cc.t0,{fullWidth:qe.includes(n),heightOffset:Re.TERMINAL===n?0:tt.nn,children:[n===Re.TREE&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(mi.Z,{blockRefs:r,editingBlock:a,enablePorts:!ne,fetchPipeline:p,height:F-U-300,pipeline:Z,runningBlocks:O,selectedBlock:P,setEditingBlock:I,setErrors:A,setSelectedBlock:R}),!W&&ge.q.INTEGRATION!==(null===Z||void 0===Z?void 0:Z.type)&&(0,le.jsx)(be.Z,{p:2,children:(0,le.jsx)(kc,{cancelPipeline:l,executePipeline:s,isPipelineExecuting:x,pipelineMessages:_})})]}),n===Re.DATA&&Q.length>0&&(0,le.jsx)(hi.Z,{columnHeaderHeight:(0,sn.Qr)(Y)&&(0,sn.Qr)(X)&&(0,sn.Qr)(K)?0:Cc.Eh,columns:Q,height:F-U-nt.OM,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,renderColumnHeader:te,rows:q,width:t}),n===Re.REPORTS&&(0,le.jsx)(Cc.ht,{noPadding:!P||!ee,children:(0,le.jsxs)(he.Z,{flexDirection:"column",fullWidth:!0,children:[J&&(0,le.jsx)(_c.Z,{stats:J,title:"Quality metrics"}),$&&(0,le.jsx)(be.Z,{mt:re.cd,children:(0,le.jsx)(_c.Z,{stats:$,title:"Statistics"})}),V.length>0&&(0,le.jsx)(be.Z,{mt:re.cd,children:(0,le.jsx)(uc,{features:V,statistics:M})})]})}),n===Re.GRAPHS&&(0,le.jsx)(Cc.ht,{noPadding:!P||!ee,children:(0,le.jsx)(Ko,{afterWidth:t,features:V,insightsOverview:K,statistics:M})}),Re.SECRETS===n&&oe,Re.VARIABLES===n&&ie,ne||P&&ee||!P&&ee&&n===Re.DATA?null:Ye.includes(n)&&(0,le.jsx)(he.Z,{alignItems:"center",justifyContent:"center",verticalHeight:90,verticalHeightOffset:U,width:t,children:(0,le.jsx)(xe.ZP,{center:!0,default:!0,disableWordBreak:!0,large:!0,monospace:!0,children:P?!ee&&"No data or insights available":"Select a block for insights"})}),Re.CHARTS===n&&(L.length>0?(0,le.jsx)(Kl,{autocompleteItems:i,blockRefs:r,blocks:o,chartRefs:c,deleteWidget:u,fetchFileTree:f,fetchPipeline:p,messages:j,onChangeChartBlock:k,pipeline:Z,runBlock:C,runningBlocks:O,savePipelineContent:S,selectedBlock:P,setAnyInputFocused:T,setSelectedBlock:R,setTextareaFocused:D,textareaFocused:N,updateWidget:B,widgets:L,width:t}):(0,le.jsxs)(he.Z,{alignItems:"center",justifyContent:"center",verticalHeight:90,verticalHeightOffset:U,width:t,children:[(0,le.jsx)(be.Z,{pl:1}),(0,le.jsx)(Jl,{size:358}),(0,le.jsx)(be.Z,{pr:1})]})),Re.TERMINAL===n&&(0,le.jsx)(Ln.Z,{interruptKernel:b,onFocus:function(){return R(null)},width:t})]})]})},wc=t(59e3);function Sc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ec(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Sc(Object(t),!0).forEach((function(n){(0,c.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Sc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Pc(e){var n,t,i,r=e.page,u=e.pipeline,a=(0,p.useRouter)(),m=(0,So.i)().height,v=(0,d.useState)(!!(0,Ze.U2)(Ze.zg)),g=v[0],b=v[1],x=(0,d.useState)(null),j=x[0],y=x[1],k=(0,d.useState)(null),Z=k[0],_=k[1],C=(0,d.useState)(null),O=C[0],w=C[1],S=(0,d.useState)(null),E=S[0],P=S[1],T=(0,d.useState)([]),I=T[0],A=T[1],R=(0,d.useState)(!1),D=R[0],M=R[1],N=(0,d.useState)({}),B=N[0],L=N[1],F=(0,d.useState)(!1),U=F[0],H=F[1],z=(0,d.useState)(!1),G=z[0],W=z[1],Q=(0,d.useRef)(null),q=(0,d.useState)({}),Y=q[0],V=q[1],K=(0,d.useState)([]),X=K[0],J=K[1],$=an.ZP.kernels.list({},{refreshInterval:5e3,revalidateOnFocus:!0}),ee=$.data,ne=$.mutate,te=null===ee||void 0===ee?void 0:ee.kernels,ie=(null===te||void 0===te?void 0:te.find((function(e){return e.name===ge.a[null===we||void 0===we?void 0:we.type]})))||(null===te||void 0===te?void 0:te[0]),ce=u.uuid,ue=(0,gi.Z)(ce),pe=an.ZP.pipelines.detail(ce,{includes_outputs:(0,sn.Qr)(Y)}),ve=pe.data,xe=pe.mutate,je=an.ZP.files.list(),ye=je.data,_e=je.mutate,Ce=(0,d.useMemo)((function(){return(null===ye||void 0===ye?void 0:ye.files)||[]}),[ye]),Oe=(0,d.useMemo)((function(){var e;return null===Ce||void 0===Ce||null===(e=Ce[0])||void 0===e?void 0:e.name}),[Ce]),we=null===ve||void 0===ve?void 0:ve.pipeline,Pe=(0,d.useMemo)((function(){return ge.q.INTEGRATION===(null===we||void 0===we?void 0:we.type)}),[we]);(0,d.useEffect)((function(){null!==ve&&void 0!==ve&&ve.error&&_({errors:(0,dn.QZ)(ve),response:ve})}),[ve]);var Te=(0,d.useState)(null),Ie=Te[0],Ae=Te[1],De=(0,d.useState)(!1),Me=De[0],Ne=De[1],Be=(0,wc.iV)(),Le=Be.sideview,Fe=Be.block_uuid,Ue=Be.file_path,He=(0,d.useMemo)((function(){var e=Be["file_paths[]"]||[];return Array.isArray(e)||(e=[e]),e}),[Be]),We=(0,d.useCallback)((function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(0,wc.iV)().sideview!==e&&(0,ut.u)((0,c.Z)({},Qe,e),{pushHistory:n})}),[]);(0,d.useEffect)((function(){Le||We(Re.TREE,!1)}),[Le,We]);var qe=(0,d.useCallback)((function(e,n){We(e,n),b(!1)}),[We]),Ye=(0,d.useRef)(null),Xe=(0,d.useRef)({}),Je=(0,d.useRef)({}),$e=(0,d.useRef)({}),en=(0,d.useRef)({}),nn=(0,d.useRef)({}),tn=(0,d.useCallback)((function(e){$e.current=Ec(Ec({},$e.current),e)}),[$e]),on=(0,d.useCallback)((function(e){en.current=Ec(Ec({},en.current),e)}),[en]),ln=(0,d.useCallback)((function(e,n){tn((0,c.Z)({},e,n)),Ne(!0)}),[tn,Ne]),cn=(0,d.useCallback)((function(e,n){on((0,c.Z)({},e,n)),Ne(!0)}),[on,Ne]),un=(0,d.useCallback)((function(e){nn.current=Ec(Ec({},nn.current),e)}),[nn]),fn=(0,d.useCallback)((function(e,n){un((0,c.Z)({},e,n)),Ne(!0)}),[un,Ne]),pn=(0,d.useState)(null),hn=pn[0],mn=pn[1],vn=an.ZP.data_providers.list({},{revalidateOnFocus:!0}).data,gn=null===vn||void 0===vn?void 0:vn.data_providers,bn=an.ZP.variables.pipelines.list(ce),xn=bn.data,jn=bn.mutate,yn=null===xn||void 0===xn?void 0:xn.variables,kn=an.ZP.secrets.list(),Zn=kn.data,_n=kn.mutate,On=null===Zn||void 0===Zn?void 0:Zn.secrets,wn=(0,d.useState)([]),Sn=wn[0],En=wn[1],Pn=(0,d.useState)([]),Tn=Pn[0],Rn=Pn[1],Dn=(0,d.useRef)({}),Mn=(0,d.useCallback)((function(e){var n;Ne(!0);var t=Dn.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),Dn.current[e.uuid]=Ec(Ec(Ec({},t),e),{},{configuration:Ec(Ec({},t.configuration),e.configuration),upstream_blocks:i})}),[Ne,Dn]),Nn=(0,d.useState)(!1),Ln=Nn[0],Hn=Nn[1],zn=(0,d.useState)({upstreamBlocks:null}),Gn=zn[0],Wn=zn[1],qn=(0,d.useState)([]),Yn=qn[0],Vn=qn[1],Kn=(0,d.useState)(null),Xn=Kn[0],$n=Kn[1],et=(0,d.useState)(null),nt=et[0],tt=et[1],it=function(e,n){var t=(0,rn.HK)(n,(function(e){return e.uuid}));return e.map((function(e){return t[e]})).filter((function(e){return!!e}))}(Di(ce),Sn),rt=(0,d.useState)(it),ot=rt[0],lt=rt[1],ct=(0,d.useState)(),at=ct[0],st=ct[1],pt=(0,d.useState)(),ht=pt[0],mt=pt[1],vt=(0,d.useState)(null),gt=vt[0],bt=vt[1],xt=(0,gi.Z)(ot),jt=(0,d.useCallback)((function(){Wn({upstreamBlocks:{block:null,values:[]}}),V({}),Ne(!1),Ae(null),Vn([]),$n(null)}),[]);(0,d.useEffect)((function(){ce!==ue&&($e.current={},en.current={})}),[ce,ue]);var yt=an.ZP.blocks.pipelines.outputs.detail(!g&&ce,(null===gt||void 0===gt?void 0:gt.type)!==h.tf.SCRATCHPAD&&(null===gt||void 0===gt?void 0:gt.type)!==h.tf.CHART&&(null===gt||void 0===gt?void 0:gt.uuid)&&encodeURIComponent(null===gt||void 0===gt?void 0:gt.uuid)),Zt=yt.data,_t=yt.mutate,Ct=(0,d.useMemo)((function(){var e,n,t;return Pe?null===(e=(0,rn.sE)(null===Zt||void 0===Zt?void 0:Zt.outputs,(function(e){return e.variable_uuid==="output_sample_data_".concat(ht)})))||void 0===e?void 0:e.sample_data:null===Zt||void 0===Zt||null===(n=Zt.outputs)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.sample_data}),[Zt,Pe,ht]),Ot=an.ZP.blocks.pipelines.analyses.detail(!g&&ce,(null===gt||void 0===gt?void 0:gt.type)!==h.tf.SCRATCHPAD&&(null===gt||void 0===gt?void 0:gt.type)!==h.tf.CHART&&(null===gt||void 0===gt?void 0:gt.uuid)&&encodeURIComponent(null===gt||void 0===gt?void 0:gt.uuid)),wt=Ot.data,St=Ot.mutate,Et=(null===wt||void 0===wt||null===(n=wt.analyses)||void 0===n?void 0:n[0])||{},Pt=Et.insights,Tt=void 0===Pt?{}:Pt,It=Et.metadata,At=void 0===It?{}:It,Rt=Et.statistics,Dt=void 0===Rt?{}:Rt,Mt=an.ZP.blocks.pipelines.analyses.detail(ce,(null===Xn||void 0===Xn?void 0:Xn.type)!==h.tf.CHART&&null!==nt&&(null===Xn||void 0===Xn?void 0:Xn.uuid)),Nt=Mt.data;Mt.mutate,null===Nt||void 0===Nt||null===(t=Nt.analyses)||void 0===t||null===(i=t[0])||void 0===i||i.suggestions;(0,d.useEffect)((function(){0===Yn.length&&(St(),_t(),jn())}),[St,_t,jn,Yn]),(0,d.useEffect)((function(){if(0===ot.length)bt(null);else if((null===xt||void 0===xt?void 0:xt.length)!==(null===ot||void 0===ot?void 0:ot.length)&&(null===ot||void 0===ot?void 0:ot.length)<(null===xt||void 0===xt?void 0:xt.length)){var e=xt.findIndex((function(e){return e.uuid===(null===gt||void 0===gt?void 0:gt.uuid)})),n=xt.length-1===e?e-1:e+1;bt(xt[Math.max(0,n)])}}),[ot,xt,null===gt||void 0===gt?void 0:gt.uuid]),(0,d.useEffect)((function(){var e;null!==(e=Gn.upstreamBlocks)&&void 0!==e&&e.block&&(b(!1),We(Re.TREE))}),[Gn.upstreamBlocks,We]);var Bt=an.ZP.autocomplete_items.list({},{refreshInterval:!1,revalidateOnFocus:!0}),Lt=Bt.data,Ft=Bt.mutate,Ut=null===Lt||void 0===Lt?void 0:Lt.autocomplete_items;(0,d.useEffect)((function(){P(Ue)}),[Ue]),(0,d.useEffect)((function(){(0,rn.fS)(He,I)||A(He)}),[He,I]);var Ht=(0,f.Db)(an.ZP.pipelines.useCreate(),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(e){var n=e.pipeline.uuid;a.push("/pipelines/[pipeline]/edit","/pipelines/".concat(n,"/edit")),_e()},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})}}),zt=(0,l.Z)(Ht,1)[0],Gt=(0,f.Db)(an.ZP.pipelines.useUpdate(ce,{update_content:!0}),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){return Ne(!1)},onErrorCallback:function(e,n){return _({errors:n,response:e})}})}}),Wt=(0,l.Z)(Gt,2),Qt=Wt[0],qt=Wt[1].isLoading,Yt=(0,d.useCallback)((function(e,n){var t=e||{},i=t.block,r=t.pipeline,o=void 0===r?{}:r,c=(n||{}).contentOnly;return Ae(new Date),Qt({pipeline:Ec(Ec(Ec({},we),o),{},{blocks:Sn.map((function(e){var n,t=en.current[e.uuid];"undefined"===typeof t&&(t=e.content);var r,o=$e.current[e.uuid];"undefined"===typeof o&&(o=e.callback_content);var u=null===(n=Y[e.uuid])||void 0===n?void 0:n.filter((function(e){return!!e})),a=null===u||void 0===u?void 0:u.find((function(e){return e.error}));if(u){var s=[];u.forEach((function(n){var t=n.data,i=n.type;(h.tf.SCRATCHPAD===e.type||a||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(_i)?e:e.concat(n)}),[])),s.push(n))})),r=s.map((function(n,t){return{text_data:JSON.stringify(n),variable_uuid:"".concat(e.uuid,"_").concat(t)}}))}var d=Ec(Ec({},e),{},{callback_content:o,content:t,outputs:r});return(null===i||void 0===i?void 0:i.uuid)===e.uuid&&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];d[t]||(d[t]={}),d[t][i]=r})):d[t]=i})),c?{callback_content:d.callback_content,content:d.content,outputs:d.outputs,uuid:d.uuid}:d})),widgets:Tn.map((function(e){var n,t,i=nn.current[e.uuid],r=Dn.current[e.uuid]||{};"undefined"===typeof i&&(i=e.content);var o=null===(n=Y[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;(h.tf.SCRATCHPAD===e.type||l||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(_i)?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 Ec(Ec(Ec({},e),r),{},{configuration:Ec(Ec({},e.configuration),r.configuration),content:i,outputs:t})}))})})}),[Sn,Y,we,Ae,Qt,Tn]),Vt=(0,d.useCallback)((function(e){Yt();var n=encodeURIComponent(e),t=(0,wc.iV)()["file_paths[]"]||[];Array.isArray(t)||(t=[t]),t.includes(n)||t.push(n),(0,ut.u)({"file_paths[]":t,file_path:n})}),[Yt]),Kt=(0,d.useCallback)((function(e,n){return Yt({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;ce!==r?window.location.href="/pipelines/".concat(r,"/edit"):(_e(),n!==(null===we||void 0===we?void 0:we.type)&&xe(),function(e,n,t){e.forEach((function(e){(0,Ze.t8)("".concat(t,"/").concat(e.uuid,"/codeCollapsed"),(0,Ze.Od)("".concat(n,"/").concat(e.uuid,"/codeCollapsed"))),(0,Ze.t8)("".concat(t,"/").concat(e.uuid,"/outputCollapsed"),(0,Ze.Od)("".concat(n,"/").concat(e.uuid,"/outputCollapsed")))}))}(Sn,ce,r))}else null!==e&&void 0!==e&&null!==(i=e.data)&&void 0!==i&&i.error&&_((function(e){return Ec(Ec({},e),{},{links:[{label:"Check pipeline configuration",onClick:function(){Vt("pipelines/".concat(ce,"/").concat(Se.METADATA_YAML)),_(null)}}]})}))}))}),[Sn,_e,xe,Vt,null===we||void 0===we?void 0:we.type,ce,Yt]),Xt=(0,f.Db)((function(e){var n=e.uuid;return an.ZP.blocks.pipelines.useDelete(ce,encodeURIComponent(n))()}),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(e){var n=e.block,t=n.type,i=n.uuid;En((function(e){return(0,rn.oM)(e,e.findIndex((function(e){var n=e.uuid;return i===n})))})),xe(),$n(null),t===h.tf.SCRATCHPAD&&_e()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;_({errors:n,response:e}),V((function(e){return Ec(Ec({},e),{},(0,c.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:Bn.Gi.TEXT_PLAIN}}))))}))}})}}),Jt=(0,l.Z)(Xt,1)[0],$t=(0,f.Db)((function(e){var n=e.uuid;return an.ZP.widgets.pipelines.useDelete(ce,n)()}),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(e){var n=e.widget.uuid;Rn((function(e){return(0,rn.oM)(e,e.findIndex((function(e){var t=e.uuid;return n===t})))})),xe(),_e()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;_({errors:n,response:e}),V((function(e){return Ec(Ec({},e),{},(0,c.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:Bn.Gi.TEXT_PLAIN}}))))}))}})}}),ei=(0,l.Z)($t,1)[0],ni=(0,f.Db)((function(e){var n=e.language,t=e.type,i=e.uuid,r="".concat(t,"/").concat(i);return n&&ze[n]&&(r="".concat(r,".").concat(ze[n].toLowerCase())),an.ZP.blocks.useDelete(encodeURIComponent(r))()}),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){Ft(),xe(),_e()},onErrorCallback:function(e,n){return _({displayMessage:"Error deleting block file. Check that there are no downstream blocks, then try again.",errors:n,response:e})}})}}),ti=(0,l.Z)(ni,1)[0],ii=(0,f.Db)(an.ZP.kernels.useUpdate(null===ie||void 0===ie?void 0:ie.id),{onSuccess:function(e){return(0,dn.wD)(e,{callback:function(){return ne()},onErrorCallback:function(e,n){return _({errors:n,response:e})}})}}),ri=(0,l.Z)(ii,1)[0],oi=(0,d.useCallback)((function(){return ri({kernel:{action_type:"restart"}})}),[ri]),li=(0,d.useCallback)((function(){return ri({kernel:{action_type:"interrupt"}})}),[ri]),ci=((0,d.useCallback)((function(){window.confirm("Do you want to restart the kernel? All variables will be cleared.")&&oi()}),[oi]),(0,f.Db)(an.ZP.blocks.pipelines.useCreate(ce))),ui=(0,l.Z)(ci,1)[0],ai=(0,d.useCallback)((function(e,n,t){var i,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,oe.Y6)();e.converted_from&&(i=en.current[e.converted_from]);var o=e.language,l=e.type;if(Pe){var c=(0,rn.HK)((null===we||void 0===we?void 0:we.blocks)||[],(function(e){return e.type})),u=c[h.tf.DATA_EXPORTER],a=c[h.tf.DATA_LOADER],s=c[h.tf.TRANSFORMER];if(h.tf.DATA_LOADER===l){if(h.t6.YAML!==o)return void _({displayMessage:"The source you\u2019re trying to add must contain the language ".concat(h.t6.YAML," and not ").concat(o,".")});if(a)return void _({displayMessage:"Pipeline ".concat(null===we||void 0===we?void 0:we.uuid," already has a source: ").concat(null===a||void 0===a?void 0:a.uuid,".")})}else if(h.tf.TRANSFORMER===l){if(s)return void _({displayMessage:"Pipeline ".concat(null===we||void 0===we?void 0:we.uuid," already has a transformer: ").concat(null===s||void 0===s?void 0:s.uuid,".")})}else if(h.tf.DATA_EXPORTER===l){if(h.t6.YAML!==o)return void _({displayMessage:"The destination you\u2019re trying to add must contain the language ".concat(h.t6.YAML," and not ").concat(o,".")});if(u)return void _({displayMessage:"Pipeline ".concat(null===we||void 0===we?void 0:we.uuid," already has a destination: ").concat(null===u||void 0===u?void 0:u.uuid,".")})}}return ui({block:Ec({content:i,name:r,priority:n},e)}).then((function(e){(0,dn.wD)(e,{callback:function(){var n=e.data.block;null===t||void 0===t||t(n),tt(null),_e(),xe().then((function(e){var n=e.pipeline.blocks;return En((function(e){var t=(0,rn.HK)(e,(function(e){return e.uuid})),i=[];return n.forEach((function(e){var n=t[e.uuid];n?i.push(n):i.push(e)})),i}))}))},onErrorCallback:function(e,n){return _({errors:n,response:e})}})}))}),[ui,_e,xe,Pe,En,_,we]),si=(0,d.useState)(!1),di=si[0],fi=si[1];(0,d.useEffect)((function(){fi(!!(0,Ze.U2)(ke.k))}),[]);var pi=(0,Cn.dd)((function(e){var n=e.block,t=e.idx,i=e.name,r=void 0===i?(0,oe.Y6)():i,o=e.onCreateCallback;return(0,le.jsx)(Ee,{block:n,defaultName:r,onClose:vi,onSave:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ai(n,t,o,null===e||void 0===e?void 0:e.name).then((function(){return vi()}))},pipeline:we})}),{},[ai,we],{background:!0,uuid:"configure_block_name_and_create"}),hi=(0,l.Z)(pi,2),mi=hi[0],vi=hi[1],bi=an.ZP.widgets.pipelines.list(!g&&ce),xi=(bi.data,bi.mutate,(0,f.Db)(an.ZP.widgets.pipelines.useCreate(ce))),ji=(0,l.Z)(xi,1)[0],yi=(0,d.useCallback)((function(e,n,t){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,oe.Y6)();return ji({widget:Ec({name:i,priority:n,type:h.tf.CHART},e)}).then((function(e){return(0,dn.wD)(e,{callback:function(){var n=e.data.widget;null===t||void 0===t||t(n),_e(),xe(),We(Re.CHARTS),w(n)},onErrorCallback:function(e,n){return _({errors:n,response:e})}})}))}),[Le,_e,xe,ji,We]);(0,d.useEffect)((function(){if(O){var e,n=null===(e=Je.current[O.uuid])||void 0===e?void 0:e.current;n&&(n.scrollIntoView(),w(null))}}),[O,w]),(0,d.useEffect)((function(){ue!==ce&&(En([]),Rn([]),lt([]),J([]))}),[ce,ue]),(0,d.useEffect)((function(){"undefined"!==typeof(null===we||void 0===we?void 0:we.blocks)&&En(we.blocks)}),[null===we||void 0===we?void 0:we.blocks]),(0,d.useEffect)((function(){"undefined"!==typeof(null===we||void 0===we?void 0:we.widgets)&&Rn(we.widgets)}),[null===we||void 0===we?void 0:we.widgets]),(0,d.useEffect)((function(){(null===it||void 0===it?void 0:it.length)>0&&0===(null===ot||void 0===ot?void 0:ot.length)&&(lt(it),bt(it[0]))}),[ot,it]);var ki=(0,gi.Z)(Sn);(0,d.useEffect)((function(){if("undefined"!==typeof(null===we||void 0===we?void 0:we.blocks)&&(!Sn.length||(null===ki||void 0===ki?void 0:ki.map((function(e){return e.uuid})).sort())!==(null===Sn||void 0===Sn?void 0:Sn.map((function(e){return e.uuid})).sort()))){var e=Ai(we.blocks),n=e.content,t=e.messages;en.current=n,V((function(e){return Ec(Ec({},t),e)}))}}),[Sn,ki,null===we||void 0===we?void 0:we.blocks,En,V]),(0,d.useEffect)((function(){if(!Tn.length&&"undefined"!==typeof(null===we||void 0===we?void 0:we.widgets)){var e=Ai(we.widgets),n=e.content,t=e.messages;nn.current=n,V((function(e){return Ec(Ec({},t),e)}))}}),[null===we||void 0===we?void 0:we.widgets,En,V,Tn]);var Zi=(0,d.useCallback)((function(e,n,t){var i=Sn.find((function(t){var i=t.type,r=t.uuid;return i===n&&r===e}));if(i){if($n(i),null!==Xe&&void 0!==Xe&&Xe.current){var r,o=Xe.current["".concat(i.type,"s/").concat(i.uuid,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}(0,ut.u)({file_path:null,"file_paths[]":[]})}else if(n===h.tf.CHART){var l=Tn.find((function(n){return n.uuid===e}));if(l&&($n(l),null!==Je&&void 0!==Je&&Je.current)){var c,u=Je.current[l.uuid];null===u||void 0===u||null===(c=u.current)||void 0===c||c.scrollIntoView()}}else t&&Vt(t)}),[Sn,Vt,Tn]);(0,d.useEffect)((function(){if(Fe&&!Xn){var e=Sn.find((function(e){var n=e.uuid;return Fe===n}));e&&Zi(e.uuid,e.type,null)}else(null===ki||void 0===ki?void 0:ki.length)!==(null===Sn||void 0===Sn?void 0:Sn.length)&&Xn&&Zi(Xn.uuid,Xn.type,null)}),[Fe,null===ki||void 0===ki?void 0:ki.length,Sn,Zi,Xn]);var Ci=new se.Z,Oi=(0,d.useMemo)((function(){return{api_key:Fn.l,token:Ci.decodedToken.token}}),[Ci]),wi=(0,s.ZP)((0,Un.Ib)(),{onOpen:function(){return console.log("socketUrlPublish opened")},shouldReconnect:function(e){return console.log("Attempting to reconnect..."),!0}}),Si=wi.lastMessage,Ei=(wi.readyState,wi.sendMessage);(0,d.useEffect)((function(){if(Si){var e=JSON.parse(Si.data),n=e.execution_state,t=e.msg_type,i=e.uuid,r=Sn.find((function(e){var n=e.uuid;return i===n}));"stream_pipeline"!==t?V((function(n){var t=n[i]||[];return Ec(Ec({},n),{},(0,c.Z)({},i,t.concat(e)))})):(J((function(n){return[].concat((0,o.Z)(n),[e])})),Bn.uF.IDLE===n&&(Vn([]),xe(),i||Hn(!1))),Bn.uF.BUSY===n?Vn((function(e){return e.find((function(e){var n=e.uuid;return i===n}))||!r?e:e.concat(r)})):Bn.uF.IDLE===n&&Vn((function(e){return e.filter((function(e){var n=e.uuid;return i!==n}))})),Ne(!0)}}),[Sn,xe,Si]);var Pi=(0,d.useCallback)((function(){Yt().then((function(){Hn(!0),J([]),Ei(JSON.stringify(Ec(Ec({},Oi),{},{execute_pipeline:!0,pipeline_uuid:ce})))}))}),[ce,Yt,Ei,Oi]),Ti=(0,d.useCallback)((function(){Ei(JSON.stringify(Ec(Ec({},Oi),{},{cancel_pipeline:!0,pipeline_uuid:ce})))}),[ce,Ei,Oi]),Ii=(0,d.useCallback)((function(e){var n=e.block,t=e.code,i=e.ignoreAlreadyRunning,r=e.runDownstream,o=void 0!==r&&r,l=e.runSettings,c=void 0===l?{}:l,u=e.runUpstream,a=void 0!==u&&u,s=e.runTests,d=void 0!==s&&s,f=n.uuid;Yn.find((function(e){var n=e.uuid;return f===n}))&&!i||(Ei(JSON.stringify(Ec(Ec({},Oi),{},{code:t,pipeline_uuid:null===we||void 0===we?void 0:we.uuid,run_downstream:o,run_settings:c,run_tests:d,run_upstream:a,type:n.type,uuid:f}))),V((function(e){return delete e[f],e})),H(!1),Vn((function(e){return e.find((function(e){var n=e.uuid;return f===n}))?e:e.concat(n)}))),xe()}),[xe,we,Yn,Ei,V,Vn,H,Oi]),Mi=(0,d.useCallback)((function(e){var n=e.block;return Yt({block:{outputs:[],uuid:n.uuid}},{contentOnly:!0}).then((function(){return Ii(e)}))}),[Ii,Yt]),Ni=(null===ot||void 0===ot?void 0:ot.length)>0?Ve:Ve.filter((function(e){return e.key!==Re.DATA})),Bi=(0,d.useMemo)((function(){return(0,le.jsx)(Oc,{activeView:Le,afterWidth:j,autocompleteItems:Ut,blockRefs:Xe,blocks:Sn,cancelPipeline:Ti,chartRefs:Je,deleteWidget:ei,editingBlock:Gn,executePipeline:Pi,fetchFileTree:_e,fetchPipeline:xe,fetchSecrets:_n,fetchVariables:jn,globalVariables:yn,insights:Tt,interruptKernel:li,isPipelineExecuting:Ln,messages:Y,metadata:At,onChangeChartBlock:fn,pipeline:we,pipelineMessages:X,runBlock:Mi,runningBlocks:Yn,sampleData:Ct,savePipelineContent:Yt,secrets:On,selectedBlock:Xn,setAnyInputFocused:W,setEditingBlock:Wn,setErrors:_,setSelectedBlock:$n,setTextareaFocused:H,statistics:Dt,textareaFocused:U,updateWidget:Mn,widgets:Tn})}),[Le,j,Ut,Xe,Sn,Ti,ei,Gn,Pi,_e,xe,_n,jn,yn,Tt,li,Ln,Y,At,fn,we,X,Mi,Yn,Ct,Yt,On,Xn,W,Wn,_,H,Dt,U,Mn,Tn]),Li=(0,d.useMemo)((function(){return(0,le.jsx)(Zo,{addNewBlockAtIndex:di?ai:function(e,n,t,i){return new Promise((function(r,o){h.tf.DBT===(null===e||void 0===e?void 0:e.type)&&h.t6.SQL===(null===e||void 0===e?void 0:e.language)?ai(e,n,t,i):mi({block:e,idx:n,name:i,onCreateCallback:t})}))},addWidget:function(e,n){var t=n.onCreateCallback;return yi(e,Tn.length,t)},anyInputFocused:G,autocompleteItems:Ut,blockRefs:Xe,blocks:Sn,dataProviders:gn,deleteBlock:Jt,fetchFileTree:_e,fetchPipeline:xe,fetchSampleData:_t,files:Ce,globalVariables:yn,interruptKernel:li,isPipelineUpdating:qt,kernel:ie,mainContainerRef:Q,mainContainerWidth:hn,messages:Y,onChangeCallbackBlock:ln,onChangeCodeBlock:cn,openSidekickView:qe,pipeline:we,pipelineContentTouched:Me,pipelineLastSaved:Ie,restartKernel:oi,runBlock:Mi,runningBlocks:Yn,savePipelineContent:Yt,selectedBlock:Xn,setAnyInputFocused:W,setEditingBlock:Wn,setErrors:_,setIntegrationStreams:st,setMessages:V,setOutputBlocks:lt,setPipelineContentTouched:Ne,setRecsWindowOpenBlockIdx:tt,setRunningBlocks:Vn,setSelectedBlock:$n,setSelectedOutputBlock:bt,setSelectedStream:mt,setTextareaFocused:H,textareaFocused:U,widgets:Tn})}),[ai,yi,G,Ut,di,Xe,Sn,gn,Jt,_e,xe,_t,Ce,yn,li,qt,ie,Q,hn,Y,ln,cn,qe,we,Me,Ie,oi,Mi,Yn,Yt,Xn,W,Wn,_,V,Ne,Vn,$n,H,mi,U,Tn]),Fi=(0,d.useMemo)((function(){if(r===wo.b)return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(kt,{filePaths:I,filesTouched:B,isBusy:Yn.length>=1,isPipelineUpdating:qt,kernel:ie,pipeline:we,pipelineContentTouched:Me,pipelineLastSaved:Ie,restartKernel:oi,savePipelineContent:Yt,selectedFilePath:E,setErrors:_,updatePipelineMetadata:Kt}),(null===I||void 0===I?void 0:I.length)>0&&(0,le.jsx)(dt,{filePaths:I,filesTouched:B,savePipelineContent:Yt,selectedFilePath:E})]})}),[B,qt,ie,r,we,Me,Ie,oi,Yn,Yt,E,I,_,Kt]),Ui=(0,d.useMemo)((function(){var e=null===Sn||void 0===Sn?void 0:Sn.filter((function(e){var n=e.type;return h.tf.SCRATCHPAD!==n}));return(0,le.jsxs)(he.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,le.jsx)(An.Z,{children:Ni.map((function(e){var n=e.key,t=e.label,i=n===Le,r=Ke[n];return(0,le.jsx)(be.Z,{pl:1,children:(0,le.jsx)(me.ZP,{beforeElement:r&&(0,le.jsx)(r,{}),blackBorder:!0,compact:!0,onClick:function(){return We(n)},selected:i,uuid:n,children:t})},n)}))}),(0,le.jsxs)(be.Z,{px:1,ref:Ye,style:{position:"relative"},children:[(0,le.jsx)(me.ZP,{beforeElement:(0,le.jsx)(Ge.mm,{}),blackBorder:!0,compact:!0,disabled:0===(null===e||void 0===e?void 0:e.length),onClick:function(){return M(!0)},primaryGradient:!0,uuid:"Pipeline/afterHeader/add_chart",children:"Add chart"}),(0,le.jsx)(fe.Z,{disableEscape:!0,onClickOutside:function(){return M(!1)},open:D,children:(0,le.jsx)(ae,{addWidget:function(e,n){var t=n.onCreateCallback;return yi(e,Tn.length,t)},block:e[e.length-1],onClickCallback:function(){return M(!1)},open:D,parentRef:Ye,rightOffset:2*re.iI,runBlock:Mi})})]})]})}),[Le,yi,Sn,Ni,Ye,Mi,We,M,D,Tn]),Hi=(0,d.useMemo)((function(){var e;return null===at||void 0===at||null===(e=at.filter((function(e){return(0,rn.sE)(null===Zt||void 0===Zt?void 0:Zt.outputs,(function(n){return n.variable_uuid==="output_sample_data_".concat(e)}))})))||void 0===e?void 0:e.map((function(e){return(0,le.jsx)(be.Z,{pl:1,children:(0,le.jsx)(me.ZP,{blackBorder:!0,compact:!0,muted:!0,onClick:function(){return mt(e)},selected:ht===e,uuid:e,children:e})},e)}))}),[Zt,at,ht]),zi=(0,d.useRef)(null),Gi=(0,d.useMemo)((function(){return(0,le.jsx)(In,{addNewBlock:function(e,n){ai(e,Sn.length,n,e.name),(null===He||void 0===He?void 0:He.length)>=1&&a.push("/pipelines/".concat(ce,"/edit"))},blocks:Sn,deleteBlockFile:ti,deleteWidget:ei,fetchFileTree:_e,fetchPipeline:xe,files:Ce,onSelectBlockFile:Zi,openFile:Vt,openPipeline:function(e){jt(),a.push("/pipelines/[pipeline]/edit","/pipelines/".concat(e,"/edit"))},openSidekickView:qe,pipeline:we,ref:zi,setErrors:_,setSelectedBlock:$n,widgets:Tn})}),[ai,Sn,ti,ei,_e,xe,null===He||void 0===He?void 0:He.length,Ce,Zi,Vt,qe,we,ce,jt,a,_,$n,Tn]),Wi=(0,d.useMemo)((function(){if(r===wo.b)return(0,le.jsx)(Jn,{cancelPipeline:Ti,createPipeline:zt,executePipeline:Pi,interruptKernel:li,isPipelineExecuting:Ln,restartKernel:oi,savePipelineContent:Yt,setMessages:V})}),[Ti,zt,Pi,li,Ln,r,oi,Yt,V]);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(ft.Z,{title:null===we||void 0===we?void 0:we.name}),(0,le.jsxs)(To,{after:Bi,afterHeader:Ui,afterHidden:g,afterSubheader:(null===ot||void 0===ot?void 0:ot.length)>0&&Le===Re.DATA&&(0,le.jsxs)(he.Z,{alignItems:"center",fullHeight:!0,fullWidth:!0,children:[!Pe&&ot.map((function(e){var n=e.uuid,t=(null===gt||void 0===gt?void 0:gt.uuid)===n;return(0,le.jsx)(be.Z,{pl:1,children:(0,le.jsx)(me.ZP,{afterElement:t?(0,le.jsx)(de.Z,{basic:!0,highlightOnHover:!0,onClick:function(){!function(e,n){var t=Di(e).filter((function(e){return e!==n}));(0,Ze.t8)(Ri(e),t)}(ce,e.uuid),lt((function(e){return e.filter((function(e){return e.uuid!==n}))}))},padding:"2px",transparent:!0,children:(0,le.jsx)(Ge.x8,{muted:!0,size:1.25*re.iI})}):null,blackBorder:!0,compact:!0,muted:!0,onClick:function(){return bt(e)},selected:t,uuid:n,children:n})},n)})),Pe&&Hi]}),before:Gi,beforeHeader:Wi,errors:Z,headerOffset:(null===I||void 0===I?void 0:I.length)>0?36:0,mainContainerHeader:Fi,mainContainerRef:Q,page:r,pipeline:we,projectName:Oe,setAfterHidden:b,setAfterWidthForChildren:y,setErrors:_,setMainContainerWidth:mn,children:[(0,le.jsx)("div",{style:{height:E?0:null,visibility:E?"hidden":null,opacity:E?0:null},children:Li}),null===He||void 0===He?void 0:He.map((function(e){return(0,le.jsx)("div",{style:{display:E===e?null:"none"},children:(0,le.jsx)(Qn,{active:E===e,addNewBlock:function(e,n){ai(e,Sn.length,n,e.name),a.push("/pipelines/".concat(ce,"/edit"))},fetchPipeline:xe,fetchVariables:jn,filePath:e,openSidekickView:qe,pipeline:we,projectName:Oe,selectedFilePath:E,setFilesTouched:L,setSelectedBlock:$n})},e)})),(0,le.jsx)(be.Z,{pb:Ue?0:Math.max(Math.floor(m*(2/3)/re.iI),0)})]})]})}Pc.getInitialProps=function(){var e=(0,r.Z)(a().mark((function e(n){var t,i,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.query.pipeline,i=wo.b,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 Tc=(0,Io.Z)(Pc)},11366:function(e,n,t){"use strict";t.d(n,{k:function(){return i}});var i="automatically_name_blocks"},42305:function(e,n,t){"use strict";t.d(n,{A5:function(){return d},AY:function(){return f},BP:function(){return s},JX:function(){return a},OC:function(){return o},Pc:function(){return p},d$:function(){return u},lJ:function(){return h},n1:function(){return c}});var i=t(92083),r=t.n(i),o="YYYY-MM-DD HH:mm:SS",l="YYYY-MM-DD HH:mm",c="YYYY-MM-DD";function u(e,n){var t=n.utcFormat,i=n.dayAgo,o=r()(e);return t&&(o=o.utc()),i&&(o=o.subtract(1,"days")),o.format(l)}function a(e){return r().unix(e).format(l)}function s(e,n,t){return r()(e).utc().hours(+n).minutes(+t).format()}function d(e){return r()(e).unix()}function f(e,n,t){return"".concat(e.toISOString().split("T")[0]," ").concat(n,":").concat(t)}function p(e){var n=r().unix(+e).utc();return{date:n.toDate(),hour:String(n.hour()),minute:String(n.minute())}}function h(e){return e.padStart(2,"0")}},51504:function(e,n,t){"use strict";t.d(n,{y:function(){return o}});var i=t(75582),r=t(16115);function o(e,n){var t=e.map((function(e){return String(e)})),o=e.includes(r.PQ),l=e.includes(r.zX),c=e.includes(r.XR),u=r.xU.map((function(e){return String(e)})),a=r.vk.map((function(e){return String(e)})),s=r.Tr.map((function(e){return String(e)})),d=Object.entries(n).find((function(e){var n=(0,i.Z)(e,2),r=n[0];return n[1]&&!t.includes(String(r))&&(!l||!a.includes(String(r)))&&(!o||!u.includes(String(r)))&&(!c||!s.includes(String(r)))}));return e.every((function(e){return n[e]}))&&!d}},33766:function(e,n,t){"use strict";t.d(n,{u:function(){return s}});var i=t(75582),r=t(82394),o=t(34376),l=t.n(o),c=t(59e3);function u(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?u(Object(t),!0).forEach((function(n){(0,r.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e){var n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.replaceParams,o=t.pushHistory,u=r?{}:(0,c.iV)();n=window.location.pathname;var s=o?l().push:l().replace,d=a(a({},u),e);Object.entries(e).forEach((function(e){var n=(0,i.Z)(e,2),t=n[0],r=n[1];"undefined"!==typeof r&&null!==r||delete d[t]}));var f=(0,c.uM)(d);f.length>=1&&(f="?".concat(f));var p="".concat(n.split("?")[0]).concat(f);return s(l().router.pathname,p,{shallow:!0})}},76419:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/pipelines/[pipeline]/edit",function(){return t(51438)}])}},function(e){e.O(0,[3662,3850,2083,5896,4804,1774,5872,2524,9565,2714,2125,7011,6085,8789,704,9767,6579,9898,1830,4463,6532,1286,2426,6641,9774,2888,179],(function(){return n=76419,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
|