mage-ai 0.8.26__py3-none-any.whl → 0.8.27__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/data_preparation/executors/streaming_pipeline_executor.py +2 -1
- mage_ai/data_preparation/logging/logger_manager.py +7 -1
- mage_ai/data_preparation/models/block/__init__.py +60 -29
- mage_ai/data_preparation/models/block/sql/__init__.py +25 -8
- mage_ai/data_preparation/models/block/sql/utils/shared.py +49 -3
- mage_ai/data_preparation/models/variable.py +6 -1
- mage_ai/data_preparation/repo_manager.py +5 -2
- mage_ai/data_preparation/shared/secrets.py +6 -3
- mage_ai/data_preparation/templates/sensors/bigquery.py +32 -0
- mage_ai/data_preparation/templates/sensors/mysql.py +33 -0
- mage_ai/data_preparation/templates/sensors/postgres.py +33 -0
- mage_ai/data_preparation/templates/sensors/redshift.py +33 -0
- mage_ai/data_preparation/templates/sensors/s3.py +11 -7
- mage_ai/data_preparation/templates/sensors/snowflake.py +33 -0
- mage_ai/io/postgres.py +13 -1
- 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/WbTBCvyjQQ9UFFLZOU1E5/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/2344-f8ae030d6a6863ae.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/2626-e7fa4f83f8214c97.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{4178-663d9f70bffc7a47.js → 4178-a6d1bd2be4706f51.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/4261-88b0103fad331620.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/5141-57c3868a80196da8.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/6166-705b4fdecaf11e63.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/6532-b1bd0b3f422abec8.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/8180-8de652170ea5ed93.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/839-15c54471a9a9bf2e.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{9386-9d6a4e5836229264.js → 9386-d4cc11bab74eec8d.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{_app-624f87faa4b5ee9a.js → _app-5f3dbed367342a3d.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-3046bc53d24917c7.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipeline-runs-f6059e27e601627c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/{[...slug]-123556bdfe2e194b.js → [...slug]-050ef37b6672100a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills-5f95bb4c3a2d7d46.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-270c0198eeef1542.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/logs-c9f1df40e0aa6981.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/{block-runs-e0eb0098dcbf27ac.js → block-runs-d74850779dbe87b3.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-848544a58563dbec.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{monitors-204daac985c03b62.js → monitors-675171cfd7d7b346.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs/{[run]-44533e244974a422.js → [run]-b2955f0ff960894e.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{runs-2d41695001370abc.js → runs-219960b3cc4742e3.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/syncs-1767a2f57f887ef7.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-0f373aaa7deb98c9.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{triggers-181343d8eb894426.js → triggers-bea0439ca2a862ba.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-7446a70bdd8381a5.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/users-d72dfc596e943cc4.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/terminal-4c9ad80f8f9d1074.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/triggers-783b9526167f1249.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 +9 -9
- 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/server.py +1 -6
- mage_ai/shared/security.py +9 -2
- mage_ai/shared/utils.py +7 -0
- mage_ai/tests/shared/test_security.py +6 -6
- {mage_ai-0.8.26.dist-info → mage_ai-0.8.27.dist-info}/METADATA +1 -1
- {mage_ai-0.8.26.dist-info → mage_ai-0.8.27.dist-info}/RECORD +86 -81
- mage_ai/server/frontend_dist/_next/static/chunks/1830-3882c19d710feadd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2344-a82a406b72fe782b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2626-30c0fab7c3926578.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3688-562e0f129b09d1cd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3699-dcc0946dd0709216.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/4463-777e71000be29fc4.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6532-baf1818fbc89e6c1.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6567-2488118bb39a9d99.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-c580ee38f5442bef.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipeline-runs-dd72d2f3375064cf.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills-26974ca695994804.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-df603787c041cd8a.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/logs-72011b08ef047531.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-3b17a6d28cdde471.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/syncs-c31fec2be1160dbe.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-3a60003fce7dfb93.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-ebb4a57934e4fa52.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/users-ff24167e21f2f0cf.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/terminal-be9eab29e8ed712b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/triggers-e9c1789f6d5a0429.js +0 -1
- mage_ai/server/frontend_dist/_next/static/kiWhqtXdRSgsbVPwfDLY4/_buildManifest.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{kiWhqtXdRSgsbVPwfDLY4 → WbTBCvyjQQ9UFFLZOU1E5}/_middlewareManifest.js +0 -0
- /mage_ai/server/frontend_dist/_next/static/{kiWhqtXdRSgsbVPwfDLY4 → WbTBCvyjQQ9UFFLZOU1E5}/_ssgManifest.js +0 -0
- {mage_ai-0.8.26.dist-info → mage_ai-0.8.27.dist-info}/LICENSE +0 -0
- {mage_ai-0.8.26.dist-info → mage_ai-0.8.27.dist-info}/WHEEL +0 -0
- {mage_ai-0.8.26.dist-info → mage_ai-0.8.27.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.8.26.dist-info → mage_ai-0.8.27.dist-info}/top_level.txt +0 -0
mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-270c0198eeef1542.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2551],{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),O=t(20567),C=t(24224),E=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 w(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,I=20*_.iI,T=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/(I-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,T=e.maxHeight,R=e.numberOfIndexes,D=e.previewIndexes,M=e.renderColumnHeader,N=e.width,L=(0,o.useContext)(d.ThemeContext),B=(0,o.useRef)(null),F=(0,o.useRef)(null);(0,o.useEffect)((function(){var e=function(e){var n;null===B||void 0===B||null===(n=B.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)}}),[B,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,C.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),W=(0,o.useMemo)((function(){return x()}),[]),G=(0,o.useMemo)((function(){var e=N-(Math.max.apply(Math,(0,r.Z)(H))+1.5*_.iI+W),n=t.length-1,i=I;return i*n<e&&(i=e/n),{width:i}}),[t,H,W,N]),V=(0,p.useTable)({columns:t,data:i,defaultColumn:G},p.useBlockLayout,h.useSticky),Q=V.getTableBodyProps,q=V.getTableProps,Y=V.headerGroups,K=V.prepareRow,X=V.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,E.jsx)("div",w(w({},i.getRowProps({style:w(w({},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=w({},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",w(w({},s),{},{className:"td ".concat(a?"td-index-column":""),key:"".concat(t,"-").concat(g),style:p}),h,!a&&(0,E.jsxs)(m.Z,{justifyContent:"space-between",children:[(0,E.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,E.jsx)(u(),{as:(0,O.o_)(Z.mW,x),href:"/datasets/[...slug]",passHref:!0,children:(0,E.jsx)(l.Z,{danger:!0,children:"View all"})})]}))}))}))}),[k,S,H,R,K,X,$]),te=(0,o.useMemo)((function(){var e;return T?(e=(0,C.Sm)(X.map(A)),e+=n||P-y.dN):(e=a,e-=n||P),e}),[n,A,a,T,X]),ie=(0,o.useMemo)((function(){return(0,E.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:T,pointerEvents:c?"none":null},children:ne})}),[te,F,ne,X]);return(0,E.jsx)("div",w(w({},q()),{},{className:"table sticky",style:{width:N},children:(0,E.jsxs)("div",w(w({},Q()),{},{className:"body",children:[(0,E.jsx)("div",{className:"header",ref:B,children:Y.map((function(e,n){return(0,o.createElement)("div",w(w({},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=w({},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:G.width}):(t=e.render("Header"),l.color=(L||g.Z).content.default,l.padding=1*_.iI,l.minWidth=G.width),(0,o.createElement)("div",w(w({},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,C.w6)(b).map((function(e,n){return{Header:(0,C.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 w(w({},e),{},(0,i.Z)({},t[r],n))}),{})}))}),[t,v]),(0,E.jsx)(T,{columnHeaderHeight:n,disableScrolling:r,height:l,maxHeight:(a||0)+37,noBorderBottom:s,noBorderLeft:d,noBorderRight:f,noBorderTop:p,children:(0,E.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})})}},43032:function(e,n,t){"use strict";t.d(n,{Cl:function(){return c},Nk:function(){return u},ZG:function(){return l}});var i=t(9518),r=t(23831),o=t(49125),l=1.5*o.iI,c=1*l+o.iI/2,u=i.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-uvd91-0"})([".row:hover{","}"],(function(e){return"\n background-color: ".concat((e.theme.interactive||r.Z.interactive).hoverBackground,";\n ")}))},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,O=v.type,C=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:O});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({},C),{},{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})}},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: calc(100% - ".concat(e.widthOffset||0,"px);\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 "}))},68735:function(e,n,t){"use strict";var i=t(26304),r=t(21831),o=t(82394),l=t(82684),c=t(26226),u=t(9518),a=t(90948),s=t(84969),d=t(65743),f=t(85587),p=t(79487),h=t(52136),m=t(67778),v=t(29989),g=t(17066),b=t(84482),x=t(76771),j=t(98889),y=t(65376),k=t(61655),Z=t(97745),_=t(48072),O=t(10103),C=t(84181),E=t(24903),S=t(67971),w=t(86673),P=t(19711),I=t(52359),T=t(23831),A=t(80906),R=t(73899),D=t(2005),M=t(31012),N=t(49125),L=t(24224),B=t(344),F=t(45739),U=t(28598),H=["areaBetweenLines","data","events","height","lineLegendNames","margin","width","xAxisLabel","xLabelFormat","yAxisLabel","yLabelFormat"];function z(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function W(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?z(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):z(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var G=W(W({},y.j),{},{backgroundColor:T.Z.background.muted,border:"none"}),V=(0,k.Z)((function(e){var n=e.areaBetweenLines,t=e.data,i=e.events,o=void 0!==i&&i,c=e.getX,k=e.getY,S=e.gridProps,w=void 0===S?{}:S,I=e.height,H=e.hideGridX,z=e.hideTooltip,V=e.increasedXTicks,Q=e.lineLegendNames,q=e.margin,Y=e.noCurve,K=e.numYTicks,X=e.renderXTooltipContent,J=e.renderYTooltipContent,$=e.showTooltip,ee=e.thickStroke,ne=e.tooltipData,te=e.tooltipLeft,ie=void 0===te?0:te,re=e.tooltipTop,oe=void 0===re?[]:re,le=e.width,ce=e.xLabelFormat,ue=e.xLabelRotate,ae=void 0===ue||ue,se=e.yLabelFormat,de=(0,l.useContext)(u.ThemeContext),fe=c||function(e){return null===e||void 0===e?void 0:e.x},pe=k||function(e){var n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null===e||void 0===e||null===(n=e.y)||void 0===n?void 0:n[t]},he=T.Z.monotone.gray,me=T.Z.brand.wind200,ve=T.Z.content.muted,ge=T.Z.monotone.gray,be=t.map((function(e){return Number(fe(e))}));if(le<10)return null;var xe=le-q.left-q.right,je=I-q.top-q.bottom,ye=xe/2,ke=Math.max.apply(Math,(0,r.Z)(t.map((function(e){var n=e.y;return(null===n||void 0===n?void 0:n.length)||0})))),Ze=(0,l.useMemo)((function(){return(0,C.Z)({domain:[Math.min.apply(Math,(0,r.Z)(be)),Math.max.apply(Math,(0,r.Z)(be))],range:[0,xe]})}),[xe,be]),_e=Math.min.apply(Math,(0,r.Z)(t.map((function(e){var n=e.y;return Math.min.apply(Math,(0,r.Z)(n||[]))})))),Oe=Math.max.apply(Math,(0,r.Z)(t.map((function(e){var n=e.y;return Math.max.apply(Math,(0,r.Z)(n||[]))})))),Ce=(0,l.useMemo)((function(){return(0,C.Z)({domain:[_e,Oe],nice:!0,range:[je,0]})}),[je,Oe,_e]),Ee=le>520?V?20:10:V?10:5,Se=(0,F.K)(de),we=ve,Pe=Se.map((function(e){return{stroke:e}})),Ie=(0,E.Z)({domain:Q||[],range:Pe.map((function(e){return e.stroke}))}),Te=(0,l.useCallback)((function(e){var n=((0,_.Z)(e)||{x:0}).x,i=Ze.invert(n-q.left),r=(0,L.ry)(be,(function(e){return i>=e})),o=t[r-1],l=t[r],c=o;l&&(i-fe(o)>fe(l)-i?c=l:(c=o,r-=1));var u=(0,O.range)(0,ke).map((function(e){return Ce(pe(c,e))}));pe(c)&&$({tooltipData:W(W({},c),{},{index:r}),tooltipLeft:n,tooltipTop:u})}),[t,fe,pe,q,$,Ze,Ce]),Ae={};return Y||(Ae.curve=Z.ZP),(0,U.jsxs)(U.Fragment,{children:[Q&&(0,U.jsx)("div",{style:{marginLeft:null===q||void 0===q?void 0:q.left},children:(0,U.jsx)(g.Z,{labelFormat:function(e){return e},scale:Ie,children:function(e){return(0,U.jsx)("div",{style:{display:"flex",flexDirection:A.qs.ROW},children:e.map((function(e,n){return(0,U.jsxs)(b.Z,{margin:"0 5px",onClick:function(){o&&alert("clicked: ".concat(JSON.stringify(e)))},children:[(0,U.jsx)("svg",{height:15,width:15,children:(0,U.jsx)("rect",{fill:e.value,height:15,width:15})}),(0,U.jsx)(x.Z,{align:"left",margin:"0 0 0 4px",children:(0,U.jsx)(P.ZP,{small:!0,children:e.text})})]},"legend-quantile-".concat(n))}))})}})}),(0,U.jsxs)("svg",{height:I,width:le,children:[!n&&(0,U.jsx)(d.Z,{fill:"transparent",height:I,onMouseLeave:function(){return z()},onMouseMove:Te,onTouchMove:Te,onTouchStart:Te,rx:14,width:le-(q.left+q.right),x:q.left,y:0}),(0,U.jsxs)(v.Z,{left:q.left,top:q.top,children:[!H&&(0,U.jsx)(h.Z,W({height:je,pointerEvents:"none",scale:Ze,stroke:he,strokeDasharray:"3,3",strokeOpacity:.4,width:xe},w)),(0,U.jsx)(m.Z,W({height:je,pointerEvents:"none",scale:Ce,stroke:he,strokeDasharray:"3,3",strokeOpacity:.4,width:xe},w)),(0,U.jsx)("line",{stroke:he,x1:xe,x2:xe,y1:0,y2:je}),(0,U.jsx)(a.Z,{numTicks:Ee,scale:Ze,stroke:we,tickFormat:function(e){return ce?ce(e):e},tickLabelProps:function(e){return{fill:ve,fontFamily:D.ry,fontSize:M.J5,textAnchor:"middle",transform:ae&&"rotate(-45, ".concat(Ze(e),", 0) translate(-32, 4)")}},tickStroke:we,top:je}),(0,U.jsx)(s.Z,{hideTicks:!0,numTicks:K,scale:Ce,stroke:we,tickFormat:function(e){return se?se(e):(0,B.P5)(e)},tickLabelProps:function(e){return{dx:String(e).length>4?3:0,fill:ve,fontFamily:D.ry,fontSize:M.J5,textAnchor:"end",transform:"translate(0,2.5)"}},tickStroke:we}),n&&n.map((function(e){var n=e[0],i=e[1];return(0,l.createElement)(j.Z,W(W({},Ae),{},{aboveAreaProps:{fill:T.Z.brand.earth400,fillOpacity:.3},belowAreaProps:{fill:me,fillOpacity:.2},clipAboveTo:0,clipBelowTo:je,data:t,id:"".concat(Math.random()),key:"".concat(n,"-").concat(i),x:function(e){return Ze(fe(e))},y0:function(e){return Ce("undefined"===typeof i?_e:pe(e,i))},y1:function(e){return Ce(pe(e,n))}}))})),(0,O.range)(0,ke).map((function(e){return(0,l.createElement)(f.Z,W(W({},Ae),{},{data:t.filter((function(e){return void 0!=e.y})),key:e,pointerEvents:"none",strokeWidth:ee?2:1,x:function(e){return Ze(fe(e))},y:function(n){return Ce(n.y&&(e>=n.y.length?_e:pe(n,e)))}},Pe[e]))}))]}),ne&&(0,U.jsxs)("g",{children:[(0,U.jsx)(p.Z,{from:{x:ie,y:q.top},pointerEvents:"none",stroke:R.Ej,strokeDasharray:"5,2",strokeWidth:1,to:{x:ie,y:je+q.top}}),oe.map((function(e,n){return(0,U.jsx)("circle",{cx:ie,cy:e+1+q.top,fill:Pe[n].stroke,fillOpacity:.1,pointerEvents:"none",r:4,stroke:ge,strokeOpacity:.1,strokeWidth:1},n)})),oe.map((function(e,n){return(0,U.jsx)("circle",{cx:ie,cy:e+q.top,fill:Pe[n].stroke,pointerEvents:"none",r:4,stroke:Pe[n].stroke,strokeWidth:2},n)}))]})]}),ne&&(0,U.jsxs)("div",{children:[oe.map((function(e,n){var t=pe(ne,n);return n>=1&&Math.abs(oe[n-1]-e)<5*N.iI&&(e+=3*N.iI),(0,U.jsxs)(y.Z,{left:ie>ye?ie-(0,B.Vs)(J,ne,n)*N.iI:ie+N.iI,style:G,top:e-2*N.iI,children:[J&&J(ne,n),!J&&(0,U.jsxs)(P.ZP,{center:!0,small:!0,children:[t.toFixed?t.toFixed(3):t," ",null===Q||void 0===Q?void 0:Q[n]]})]},n)})),(0,U.jsxs)(y.Z,{left:ie>ye?ie-4*(0,B.Vs)(X,ne):ie,style:W(W({},G),{},{transform:"translateX(-65%)"}),top:je+q.top,children:[X&&X(ne),!X&&(0,U.jsx)(P.ZP,{center:!0,small:!0,children:fe(ne).toFixed(3)})]})]})]})}));n.Z=function(e){var n=e.areaBetweenLines,t=e.data,r=(e.events,e.height),o=e.lineLegendNames,l=e.margin,u=void 0===l?{}:l,a=e.width,s=e.xAxisLabel,d=e.xLabelFormat,f=e.yAxisLabel,p=e.yLabelFormat,h=(0,i.Z)(e,H),m=W(W({},{bottom:3*N.iI,left:5*N.iI,right:3*N.iI,top:3*N.iI}),u);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{style:{display:"flex",height:r,marginBottom:N.iI,width:"100%"},children:[f&&(0,U.jsx)(S.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,U.jsx)(I.Z,{children:(0,U.jsx)(P.ZP,{center:!0,muted:!0,small:!0,children:f})})}),(0,U.jsx)(w.Z,{mr:1}),(0,U.jsx)("div",{style:{height:r,width:"undefined"===typeof a?"100%":a},children:(0,U.jsx)(c.Z,{children:function(e){var i=e.width,r=e.height;return(0,U.jsx)(V,W(W({},h),{},{areaBetweenLines:n,data:t,height:r,lineLegendNames:o,margin:m,width:i,xLabelFormat:d,yLabelFormat:p}))}})})]}),s&&(0,U.jsx)("div",{style:{paddingLeft:f?36:0,paddingTop:4},children:(0,U.jsx)(P.ZP,{center:!0,muted:!0,small:!0,children:s})})]})}},76096:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(33591)),l=t(28598),c=["children","fullHeight","gutter","style"];function u(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?u(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.fullHeight,i=e.gutter,u=e.style,s=void 0===u?{}:u,d=(0,r.Z)(e,c),f=a({},s);return i&&(f.paddingLeft=i,f.paddingRight=f.paddingLeft),t&&(f.height="100%"),(0,l.jsx)(o.Col,a(a({},d),{},{style:f,children:n}))}},97361:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=t(82684),l=t(33591),c=t(28598),u=["children","fullHeight","gutter","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})}))}))}},80906:function(e,n,t){"use strict";var i,r,o,l;t.d(n,{Q0:function(){return i},qs:function(){return r}}),function(e){e.ADD="add",e.AVERAGE="average",e.CLEAN_COLUMN_NAME="clean_column_name",e.COUNT="count",e.COUNT_DISTINCT="count_distinct",e.CUSTOM="custom",e.DIFF="diff",e.DROP_DUPLICATE="drop_duplicate",e.EXPAND_COLUMN="expand_column",e.EXPLODE="explode",e.FILTER="filter",e.FIRST="first",e.FIX_SYNTAX_ERRORS="fix_syntax_errors",e.GROUP="group",e.IMPUTE="impute",e.JOIN="join",e.LAST="last",e.LIMIT="limit",e.MAX="max",e.MEDIAN="median",e.MIN="min",e.MODE="mode",e.NORMALIZE="normalize",e.REFORMAT="reformat",e.REMOVE="remove",e.REMOVE_OUTLIERS="remove_outliers",e.SCALE="scale",e.SELECT="select",e.SHIFT_DOWN="shift_down",e.SHIFT_UP="shift_up",e.SORT="sort",e.STANDARDIZE="standardize",e.SUM="sum",e.UNION="union",e.UPDATE_TYPE="update_type",e.UPDATE_VALUE="update_value"}(i||(i={})),function(e){e.COLUMN="column",e.ROW="row"}(r||(r={})),function(e){e.NOT_APPLIED="not_applied",e.COMPLETED="completed"}(o||(o={})),function(e){e.FEATURE="feature"}(l||(l={}))},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)},18283:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(9518)),l=t(23831),c=t(73942),u=t(2005),a=t(49125),s=t(31012),d=t(28598),f=["children"];function p(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 h(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?p(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var m=o.default.p.withConfig({displayName:"Badge__BadgeStyle",componentId:"sc-tfqsp0-0"})(["border-radius:","px;display:inline;font-family:",";margin:0;",";"," ",";",";"," "," "," "," ",""],c.BG,u.ry,s.iD,(function(e){return e.small&&"\n ".concat(s.HC,";\n ")}),(function(e){return!e.regular&&"\n padding: 2px 4px;\n "}),(function(e){return e.regular&&"\n padding: ".concat(1*a.iI,"px ").concat(1.25*a.iI,"px;\n ")}),(function(e){return e.noVerticalPadding&&"\n padding-bottom: 0;\n padding-top: 0;\n "}),(function(e){return!e.disabled&&"\n background-color: ".concat((e.theme||l.Z).background.row,";\n color: ").concat((e.theme||l.Z).content.muted,";\n ")}),(function(e){return e.cyan&&"\n background-color: ".concat((e.theme||l.Z).accent.cyan,";\n color: ").concat((e.theme||l.Z).monotone.black,";\n ")}),(function(e){return e.disabled&&"\n background-color: ".concat((e.theme||l.Z).feature.disabled,";\n color: ").concat((e.theme||l.Z).content.disabled,";\n ")}),(function(e){return e.quantifier&&"\n border-radius: 34px;\n line-height: 10px;\n padding: 4px 6px;\n "}));n.Z=function(e){var n=e.children,t=(0,r.Z)(e,f);return(0,d.jsx)(m,h(h({},t),{},{children:n}))}},30264:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(47999)),l=t(62084),c=t(28598),u=["children","items","open","onClickCallback","onClickOutside","parentRef","uuid"];function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.items,i=e.open,a=e.onClickCallback,d=e.onClickOutside,f=e.parentRef,p=e.uuid,h=(0,r.Z)(e,u),m=(0,c.jsxs)("div",{style:{position:"relative",zIndex:d?3:2},children:[(0,c.jsx)("div",{ref:f,children:n}),(0,c.jsx)(l.Z,s(s({},h),{},{items:t,onClickCallback:a,open:i,parentRef:f,uuid:p}))]});return d?(0,c.jsx)(o.Z,{onClickOutside:d,open:!0,children:m}):m}},29237:function(e,n,t){"use strict";var i=t(9518),r=t(67971),o=t(86673),l=t(19711),c=t(23831),u=t(73942),a=t(37391),s=t(49125),d=t(28598),f=(0,i.css)(["padding:","px;padding-bottom:","px;padding-top:","px;"],2*s.iI,1.5*s.iI,1.5*s.iI),p=i.default.div.withConfig({displayName:"Panel__PanelStyle",componentId:"sc-1ct8cgl-0"})(["border-radius:","px;overflow:hidden;"," "," "," "," "," "," "," "," "," ",""],u.n_,(function(e){return e.fullWidth&&"\n width: 100%;\n "}),(function(e){return"\n border: 1px solid ".concat((e.theme.interactive||c.Z.interactive).defaultBorder,";\n ")}),(function(e){return!e.dark&&"\n background-color: ".concat((e.theme.background||c.Z.background).panel,";\n ")}),(function(e){return e.dark&&"\n background-color: ".concat((e.theme.background||c.Z.background).content,";\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.maxWidth&&"\n max-width: ".concat(e.maxWidth,"px;\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 "})),h=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 ")}),f,(function(e){return e.headerPaddingVertical&&"\n padding-bottom: ".concat(e.headerPaddingVertical,"px;\n padding-top: ").concat(e.headerPaddingVertical,"px;\n ")})),m=i.default.div.withConfig({displayName:"Panel__ContentStyle",componentId:"sc-1ct8cgl-2"})(["overflow-y:auto;padding:","px;height:100%;"," "," "," "," ",""],1.75*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 "})),v=i.default.div.withConfig({displayName:"Panel__FooterStyle",componentId:"sc-1ct8cgl-3"})(["border-style:",";border-top-width:","px;padding:","px;"],u.M8,u.YF,1.75*s.iI);n.Z=function(e){var n=e.borderless,t=e.children,i=e.containerRef,c=e.contentContainerRef,u=e.dark,a=e.footer,s=e.fullHeight,f=void 0===s||s,g=e.fullWidth,b=void 0===g||g,x=e.header,j=e.headerHeight,y=e.headerIcon,k=e.headerPaddingVertical,Z=e.headerTitle,_=e.maxHeight,O=e.maxWidth,C=e.minWidth,E=e.noPadding,S=e.overflowVisible,w=e.subtitle;return(0,d.jsxs)(p,{borderless:n,dark:u,fullHeight:f,fullWidth:b,maxHeight:_,maxWidth:O,minWidth:C,overflowVisible:S,ref:i,children:[(x||Z)&&(0,d.jsxs)(h,{headerPaddingVertical:k,height:j,children:[x&&x,Z&&(0,d.jsx)(r.Z,{alignItems:"center",justifyContent:"space-between",children:(0,d.jsxs)(r.Z,{alignItems:"center",children:[y&&y,(0,d.jsx)(o.Z,{ml:y?1:0,children:(0,d.jsx)(l.ZP,{bold:!0,default:!0,children:Z})})]})})]}),(0,d.jsxs)(m,{maxHeight:_,noPadding:E,overflowVisible:S,ref:c,children:[w&&(0,d.jsx)(o.Z,{mb:2,children:(0,d.jsx)(l.ZP,{default:!0,children:w})}),t]}),a&&(0,d.jsx)(v,{children:a})]})}},946:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Kc}});var i=t(77837),r=t(21831),o=t(75582),l=t(82394),c=t(38860),u=t.n(c),a=t(56085),s=t(82684),d=t(83455),f=t(34376),p=(0,t(44152).r)({apiReloads:{}}).useGlobalState;var h=function(e){var n=e.children,t=e.uuid,i=e.uuids,l=void 0===i?[]:i,c=p("apiReloads"),u=(0,o.Z)(c,1)[0],a=(0,r.Z)(l);t&&a.push(t);var d=a.map((function(e){return String(u[e])||"-"})).join("_");return s.cloneElement(n,{key:d})},m=t(35490),v=t(86422),g=t(60328),b=t(38341),x=t(67971),j=t(11135),y=t(29237),k=t(98781),Z=t(86673),_=t(19711),O=t(82944),C=t(16115),E=t(11366),S=t(91427),w=t(51504),P=t(28598);var I,T,A,R,D=function(e){var n=e.block,t=e.defaultName,i=e.onClose,r=e.onSave,o=e.pipeline,l=(0,s.useRef)(null),c=(0,s.useState)(t),u=c[0],a=c[1],d=(0,s.useState)(!!(0,S.U2)(E.k)),f=d[0],p=d[1];(0,s.useEffect)((function(){var e;null===l||void 0===l||null===(e=l.current)||void 0===e||e.focus()}),[]);var h=(0,s.useMemo)((function(){return k.qL.INTEGRATION===(null===o||void 0===o?void 0:o.type)}),[o]),m=(0,s.useMemo)((function(){var e=null===n||void 0===n?void 0:n.type;if(h){if(v.tf.DATA_LOADER===e)return"Source";if(v.tf.DATA_EXPORTER===e)return"Destination"}return v.V4[e]}),[n,h]);return(0,P.jsxs)(y.Z,{children:[(0,P.jsxs)(_.ZP,{bold:!0,children:[m," block name"]}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsx)(O.Z,{monospace:!0,onChange:function(e){return a(e.target.value)},ref:l,value:u})}),(0,P.jsx)(Z.Z,{mt:2,children:(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(b.Z,{checked:f,label:(0,P.jsxs)(_.ZP,{muted:!0,small:!0,children:["Automatically use randomly generated name",(0,P.jsx)("br",{}),"for blocks created in the future"]}),onClick:function(){p(!f),(0,S.t8)(E.k,!f)}})})}),(0,P.jsx)(Z.Z,{mt:3,children:(0,P.jsxs)(x.Z,{children:[(0,P.jsx)(j.ZP,{bold:!0,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,w.y)([C.Uq],n)},onClick:function(){return r({name:u||t})},primary:!0,tabIndex:0,uuid:"ConfigureBlock/SaveAndAddBlock",children:"Save and add block"}),(0,P.jsx)(Z.Z,{ml:1,children:(0,P.jsx)(g.Z,{onClick:i,tabIndex:0,children:"Cancel"})})]})})]})},M=t(26304),N=t(9518),L=t(62084),B=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"}(A||(A={})),function(e){e.INIT_PY="__init__.py",e.METADATA_YAML="metadata.yaml",e.REQS_TXT="requirements.txt"}(R||(R={}));var F,U,H=[A.PY,A.SQL],z=[A.JSON,A.PY,A.R,A.SQL,A.TXT,A.YAML,A.YML],W=new RegExp(z.map((function(e){return".".concat(e,"$")})).join("|")),G=z.concat(A.PY),V=new RegExp(G.map((function(e){return".".concat(e,"$")})).join("|")),Q="charts",q="pipelines",Y=(I={},(0,l.Z)(I,A.JSON,A.JSON),(0,l.Z)(I,A.PY,v.t6.PYTHON),(0,l.Z)(I,A.R,v.t6.R),(0,l.Z)(I,A.SQL,v.t6.SQL),(0,l.Z)(I,A.TXT,"text"),(0,l.Z)(I,A.YAML,v.t6.YAML),(0,l.Z)(I,A.YML,v.t6.YAML),I),K=(T={},(0,l.Z)(T,v.t6.PYTHON,A.PY),(0,l.Z)(T,v.t6.R,A.R),(0,l.Z)(T,v.t6.SQL,A.SQL),(0,l.Z)(T,v.t6.YAML,A.YAML),(0,l.Z)(T,"text",A.TXT),T),X=t(10503),J=t(43032),$=t(49125),ee=t(24224),ne="sideview";!function(e){e.CHARTS="charts",e.DATA="data",e.EXTENSIONS="power_ups",e.FILE_VERSIONS="file_versions",e.GRAPHS="graphs",e.REPORTS="reports",e.SECRETS="secrets",e.TERMINAL="terminal",e.TREE="tree",e.VARIABLES="variables"}(U||(U={}));var te=[U.CHARTS,U.DATA,U.EXTENSIONS,U.REPORTS,U.TREE],ie=[U.DATA,U.REPORTS,U.GRAPHS],re=[{key:U.TREE,label:"Tree"},{key:U.CHARTS,label:"Charts"},{key:U.VARIABLES,label:"Variables"},{key:U.SECRETS,label:"Secrets"},{key:U.EXTENSIONS,label:"Power ups"},{key:U.DATA,label:"Data"},{key:U.TERMINAL,label:"Terminal"}],oe=(0,ee.HK)(re,(function(e){return e.key})),le=(F={},(0,l.Z)(F,U.CHARTS,X.er),(0,l.Z)(F,U.DATA,X.t1),(0,l.Z)(F,U.EXTENSIONS,X.Bf),(0,l.Z)(F,U.GRAPHS,X.er),(0,l.Z)(F,U.REPORTS,X.Do),(0,l.Z)(F,U.SECRETS,X.EK),(0,l.Z)(F,U.TERMINAL,X.oI),(0,l.Z)(F,U.TREE,X.BJ),(0,l.Z)(F,U.VARIABLES,X.KJ),F),ce=t(44162),ue=t(90211);function ae(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),ae(e.parent,r.join("/"))}return i}function se(e){return null===e||void 0===e?void 0:e.split("/").slice(1).join("/")}function de(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=ae(e,n,t);return se(i)}function fe(e){var n,t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=ae(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]===v.tf.CUSTOM?r[0]:(0,ue.C5)(r[0]||""));else if(r[1]===v.tf.CUSTOM)n=r[1];else{var o=r[1];n=v.tf.DBT===o?o:(0,ue.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(A.PY),"\\.".concat(A.R),"\\.".concat(A.SQL),"\\.".concat(A.YAML),"\\.".concat(A.YML)].join("|"),u=new RegExp("".concat(c,"$"));if(v.$W.concat(v.tf.DBT).includes(n)&&l.match(u)){var a=l.split("."),s=a[1];return{language:Y[s],type:n,uuid:a[0]}}}function pe(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=ae(e,n).split("/");if(t[1]){var i=(0,ue.C5)(t[n?0:1]);t[1]===v.tf.DBT&&(i=v.tf.DBT);var r=t[t.length-1],o=new RegExp(".".concat(A.YAML,"$")),l=new RegExp(".".concat(A.R,"$")),c=new RegExp(".".concat(A.SQL,"$"));if(r.match(o)&&v.VZ.includes(i))return{type:i,uuid:r.replace(o,"")};if(r.match(l)&&v.J8.includes(i))return{type:i,uuid:r.replace(l,"")};if(r.match(c)&&v.HX.includes(i)){var u=r.replace(/[.]/g,"_"),a=i===v.tf.DBT?t.slice(2,-1).join("_").concat("_".concat(u)):r.replace(c,"");return{type:i,uuid:a}}}}function he(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 me(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?he(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):he(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ve="default_repo";var ge=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,d=n.openFile,f=n.openPipeline,p=n.openSidekickView,h=n.pipelineBlockUuids,m=n.selectFile,g=n.setContextItem,b=n.setCoordinates,x=n.setDraggingFile,j=n.setSelectedFile,y=n.theme,k=n.timeout,Z=n.uncollapsed,O=n.useRootFolder,C=o.children,E=o.disabled,w=o.name,I=o.parent;w||(o.name=ve);var T,A=O?ae(o):de(o),R=(null===I||void 0===I?void 0:I.name)===q,D=(0,s.useMemo)((function(){return C?(0,ee.YC)(C,(function(e){return e.children?0:1})):C}),[C]),M=l?l(A,D):E||"__init__.py"===w||!(null===w||void 0===w||!w.match(/^\./))||!w.match(V)&&!C,N="".concat(c,"/").concat(w),L=(h.includes(function(e){var n=e.name.split("."),t=n[n.length-1];return H.includes(t)&&n.pop(),n.join("")}(o)),(0,s.useState)("undefined"===typeof Z?(0,S.U2)(N,!1):!Z)),F=L[0],z=L[1],G=X.iU;1===c&&w===q?G=X.B_:w===Q?G=X.er:D&&(G=X.gt),D&&v.$W.includes((0,ue.C5)(w))&&(0,ue.C5)(w)!==v.tf.CHART&&(T=(0,ce.qn)((0,ue.C5)(w),{theme:y}).accent);var Y=(0,s.useMemo)((function(){return null===D||void 0===D?void 0:D.map((function(n){return(0,P.jsx)(e,{allowSelectingFolders:t,containerRef:i,disableContextMenu:r,file:me(me({},n),{},{parent:o}),isFileDisabled:l,level:a?c:c+1,onSelectBlockFile:u,openFile:d,openPipeline:f,openSidekickView:p,pipelineBlockUuids:h,selectFile:m,setContextItem:g,setCoordinates:b,setDraggingFile:x,setSelectedFile:j,theme:y,timeout:k,uncollapsed:Z,useRootFolder:O},"".concat(N,"/").concat((null===n||void 0===n?void 0:n.name)||ve))}))}),[t,i,D,r,o,l,c,u,a,d,f,p,h,m,g,y,k,Z,O,N]);return(0,P.jsxs)(P.Fragment,{children:[!a&&(0,P.jsxs)("div",{className:"row",onClick:function(e){if(e.preventDefault(),!M){if((null===I||void 0===I?void 0:I.name)===Q){null===p||void 0===p||p(U.CHARTS);var n=fe(o);n&&(null===u||void 0===u||u(n.uuid,n.type,de(o)))}var i=pe(o);if(D)t?m(A):z((function(e){return(0,S.t8)(N,!e),!e}));else if(i)null===u||void 0===u||u(i.uuid,i.type,de(o));else if(w.match(W))d(A);else{var r=fe(o);r&&(null===u||void 0===u||u(r.uuid,r.type,de(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?fe(o):null;null===i||void 0===i||null===(n=i.current)||void 0===n||!n.contains(e.target)||!t||(null===D||void 0===D?void 0:D.length)>=1||r||M||R||(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*J.Cl+o.name.length*$.Fo+2*$.iI,paddingBottom:$.iI/4,paddingLeft:$.iI/4+J.Cl*c,paddingRight:$.iI/4,paddingTop:$.iI/4},children:[D&&!F&&(0,P.jsx)(X._M,{muted:!0,size:J.ZG}),D&&F&&(0,P.jsx)(X._Q,{muted:!0,size:J.ZG}),!D&&(0,P.jsx)("div",{style:{width:J.ZG}}),(0,P.jsxs)("div",{style:{marginLeft:$.iI/2,marginRight:$.iI/2},children:[!T&&(0,P.jsx)(G,{disabled:M,size:J.ZG}),T&&(0,P.jsx)(B.Z,{color:T,size:J.ZG,square:!0})]}),(0,P.jsx)(_.ZP,{color:T,default:!T&&!M,disabled:M,monospace:!0,small:!0,children:w})]}),(0,P.jsx)("div",{style:{display:F?"none":"block"},children:Y})]})},be=t(82531),xe=t(7715),je=t(96510);var ye=function(e){var n=e.fetchFileTree,t=e.file,i=e.onCancel,r=e.selectedFolder,l=e.setErrors,c=(0,s.useRef)(null),u=(0,xe.Qr)(t)?null:t,a=(0,s.useState)(u?de(u,null,!0):""),f=a[0],p=a[1],h=(0,s.useState)(u?null===u||void 0===u?void 0:u.name:""),m=h[0],v=h[1];(0,s.useEffect)((function(){var e;null===c||void 0===c||null===(e=c.current)||void 0===e||e.focus()}),[]),(0,s.useEffect)((function(){r&&p(de(r))}),[r]);var b=(0,d.Db)(be.ZP.files.useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===n||void 0===n||n(),i()},onErrorCallback:function(e,n){return l({errors:n,response:e})}})}}),k=(0,o.Z)(b,1)[0],_=(0,d.Db)(be.ZP.files.useUpdate(u&&encodeURIComponent(de(u))),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===n||void 0===n||n(),i()},onErrorCallback:function(e,n){return l({errors:n,response:e})}})}}),E=(0,o.Z)(_,1)[0];return(0,P.jsxs)(y.Z,{footer:(0,P.jsxs)(x.Z,{children:[(0,P.jsxs)(j.ZP,{bold:!0,disabled:!m,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,w.y)([C.Uq],n)},onClick:function(){return u?E({file:{dir_path:f,name:m},file_json_only:!0}):k({file:{dir_path:f,name:m,overwrite:!1},file_json_only:!0})},primary:!0,tabIndex:0,uuid:"NewFile/create_file",children:[u?"Rename":"Create"," file"]}),(0,P.jsx)(Z.Z,{ml:1,children:(0,P.jsx)(g.Z,{onClick:function(){return i()},tabIndex:0,children:"Cancel"})})]}),headerTitle:u?"Rename file":"New file",children:[(0,P.jsx)(O.Z,{disabled:!!u,label:"Directory",monospace:!0,onChange:function(e){return p(e.target.value)},setContentOnMount:!0,value:f}),(0,P.jsx)(Z.Z,{mt:2,children:(0,P.jsx)(O.Z,{label:"Filename",monospace:!0,onChange:function(e){return v(e.target.value)},ref:c,required:!0,value:m})})]})},ke=t(55106),Ze=t(66176),_e=t(58180),Oe=t(23831),Ce=t(73942),Ee=($.iI,N.default.div.withConfig({displayName:"indexstyle__DropZoneStyle",componentId:"sc-1g3zz7z-0"})(["border-radius:","px;padding:","px;max-width:","px;min-width:","px;",""],Ce.n_,8*$.iI,100*$.iI,55*$.iI,(function(e){return"\n border: 1px dashed ".concat((e.theme.borders||Oe.Z.borders).contrast,";\n ")}))),Se=N.default.div.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-1g3zz7z-1"})(["max-width:","px;min-width:","px;"],100*$.iI,55*$.iI);var we=function(e){var n=e.fetchFileTree,t=e.onCancel,i=e.selectedFolder,r=(0,s.useState)(!1),l=r[0],c=r[1],u=(0,s.useState)({}),a=u[0],d=u[1],f=(0,s.useState)({}),p=f[0],h=f[1],m=!(0,xe.Qr)(a),v=(0,s.useMemo)((function(){var e=[];return(0,ee.YC)(Object.entries(a),(function(e){var n=(0,o.Z)(e,2),t=n[0];n[1];return t})).forEach((function(n){var t=(0,o.Z)(n,2),i=t[0],r=t[1],l=p[i],c=null===l||void 0===l?void 0:l.message;e.push([(0,P.jsxs)("div",{children:[(0,P.jsx)(_.ZP,{overflowWrap:!0,preWrap:!0,children:i}),c&&(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsx)(_.ZP,{danger:!0,small:!0,children:c})})]},"name-".concat(i)),(0,P.jsx)(Ze.Z,{danger:!!c,progress:100*r},"progress-".concat(i))])})),(0,P.jsx)(_e.Z,{columnFlex:[1,4],columns:[{uuid:"Filename"},{uuid:"Upload progress"}],rows:e,uuid:"block-runs"})}),[a,p]);return(0,P.jsxs)(y.Z,{footer:(0,P.jsxs)(x.Z,{fullWidth:!0,children:[(0,P.jsx)(g.Z,{onClick:function(){return t()},children:"Close"}),m&&(0,P.jsx)(Z.Z,{ml:1,children:(0,P.jsx)(g.Z,{onClick:function(){d({}),h({})},children:"Clear files and retry"})})]}),headerTitle:"Upload files",children:[m&&(0,P.jsx)(Se,{children:v}),!m&&(0,P.jsx)(ke.Z,{directoryPath:i?de(i):"",onDragActiveChange:c,setFileUploadProgress:d,setUploadedFiles:function(e){h(e),null===n||void 0===n||n()},children:(0,P.jsx)(Ee,{children:(0,P.jsxs)(_.ZP,{center:!0,children:[l&&"Drop to upload",!l&&"Click or drop files and folders to upload"]})})})]})},Pe=t(86585),Ie=function(e){var n=e[0];return n===v.tf.DBT||n===v.tf.CUSTOM?n:e[0].slice(0,-1)};function Te(){return new RegExp(Object.keys(Y).map((function(e){return".(".concat(e,")$")})).join("|"))}function Ae(e,n,t){var i,o,l=null===e||void 0===e||null===(i=e.path.match(Te())[0])||void 0===i?void 0:i.split(".")[1],c=t.type===k.qL.INTEGRATION,u=(0,ee.sE)(null===t||void 0===t?void 0:t.blocks,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n})),a=e.path.replace(n,"").split("/"),s=e.path.split("/")[0]===v.tf.DBT,d=(o=a)[0]===v.tf.DBT?o.slice(1).join("/"):function(e){return e.at(-1)}(o).split(".")[0];if(a.length>=3&&!s){var f=a.slice(1,a.length-1).join("/");d="".concat(f,"/").concat(d)}var p=Ie(e.path.split("/")),h={configuration:{file_path:s?d:null},language:Y[l],name:(0,ue.wE)(d),type:p};if(p===v.tf.CUSTOM&&(h.color=v.Lq.TEAL),c){var m=(0,ee.sE)(t.blocks,(function(e){var n=e.type;return v.tf.DATA_LOADER===n})),g=(0,ee.sE)(t.blocks,(function(e){var n=e.type;return v.tf.TRANSFORMER===n})),b=[];g?b.push(g.uuid):null!==u&&void 0!==u&&u.upstream_blocks?b.push.apply(b,(0,r.Z)(u.upstream_blocks)):m&&b.push(m.uuid),h.upstream_blocks=b}return h}var Re=t(83608),De=["addNewBlock","blocks","deleteBlockFile","deleteWidget","fetchFileTree","fetchPipeline","files","pipeline","setErrors","setSelectedBlock","widgets"];function Me(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 Ne(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Me(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Me(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Le,Be=20*$.iI;function Fe(e,n){var t=e.addNewBlock,i=e.blocks,r=void 0===i?[]:i,l=e.deleteBlockFile,c=e.deleteWidget,u=e.fetchFileTree,a=e.fetchPipeline,f=e.files,p=e.pipeline,h=e.setErrors,m=e.setSelectedBlock,g=e.widgets,b=void 0===g?[]:g,x=(0,M.Z)(e,De),j=(0,s.useRef)(null),y=(0,s.useContext)(N.ThemeContext),Z=(0,s.useState)(null),O=Z[0],C=Z[1],E=(0,s.useState)(null),S=E[0],w=E[1],I=(0,s.useState)(null),T=I[0],A=I[1],R=be.ZP.status.list().data,D=(0,s.useMemo)((function(){var e;return null===R||void 0===R||null===(e=R.status)||void 0===e?void 0:e.repo_path}),[R]),B=(0,d.Db)((function(e){return be.ZP.files.useDelete(e)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===u||void 0===u||u()},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),F=(0,o.Z)(B,1)[0],U=(0,ee.sE)(null===p||void 0===p?void 0:p.blocks,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n})),H=(0,d.Db)(be.ZP.blocks.pipelines.useUpdate(null===p||void 0===p?void 0:p.uuid,null===U||void 0===U?void 0:U.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===a||void 0===a||a()},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),z=(0,o.Z)(H,1)[0],W=(0,s.useCallback)((function(){return A(null)}),[A]);(0,s.useEffect)((function(){var e,i,r,o=function(e){if(clearTimeout(j.current),w(null),S&&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)===k.qL.INTEGRATION,a=Ae(Ne(Ne({},S),{},{path:de(S)}),D,p);null===t||void 0===t||t(a,(function(e){u&&U&&z({block:Ne(Ne({},U),{},{upstream_blocks:[e.uuid]})}),null===m||void 0===m||m(e)}))}}},l=function(e){S&&C({x:e.pageX,y:e.pageY})};return null===(e=document)||void 0===e||e.addEventListener("click",W),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",W),null===(n=document)||void 0===n||n.removeEventListener("mousemove",l),null===(t=document)||void 0===t||t.removeEventListener("mouseup",o)}}),[t,U,S,W,p,n,D,m,j,z]);var G=(0,s.useMemo)((function(){return r.concat(b).map((function(e){return e.uuid}))}),[r,b]),V=(0,s.useMemo)((function(){return null===f||void 0===f?void 0:f.map((function(e){return(0,s.createElement)(ge,Ne(Ne({},x),{},{containerRef:n,file:e,key:e.name,level:0,pipelineBlockUuids:G,setCoordinates:C,setDraggingFile:w,setSelectedFile:A,theme:y,timeout:j}))}))}),[f,G,x,n,y,j]),Q=(0,s.useMemo)((function(){return T&&fe(T)}),[T]),q=(0,s.useMemo)((function(){return S&&fe(S)}),[S]),Y=(0,s.useMemo)((function(){return T&&"undefined"!==typeof(null===T||void 0===T?void 0:T.children)&&T}),[T]),K=(0,Re.dd)((function(){return(0,P.jsx)(we,{fetchFileTree:u,onCancel:te,selectedFolder:Y})}),{},[u,Y],{background:!0,uuid:"upload_files"}),X=(0,o.Z)(K,2),ne=X[0],te=X[1],ie=(0,Re.dd)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return(0,P.jsx)(ye,{fetchFileTree:u,file:e,onCancel:le,selectedFolder:Y,setErrors:h})}),{},[u,Y,h],{background:!0,disableClickOutside:!0,uuid:"new_file"}),re=(0,o.Z)(ie,2),oe=re[0],le=re[1],ce=(0,s.useMemo)((function(){var e;if(!Q&&!T&&!Y)return(0,P.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,o=O||{},u=o.x,a=void 0===u?0:u,s=o.y,d=void 0===s?0:s,f=a;a+Be>=i+r&&(f=i+r-(Be+$.iI)),f<0&&(f=0);var p=[];return Y?p.push.apply(p,[{label:function(){return"Upload files"},onClick:function(){ne()},uuid:"upload_files"},{label:function(){return"New file"},onClick:function(){oe({})},uuid:"new_file"}]):Q?p.push({label:function(){return"Delete block file"},onClick:function(){Q.type===v.tf.CHART?window.confirm("Are you sure you want to delete widget ".concat(Q.uuid,"?"))&&c(Q):window.confirm("Are you sure you want to delete block ".concat(Q.uuid,"?"))&&l(Q)},uuid:"delete_block_file"}):T&&p.push.apply(p,[{label:function(){return"Rename file"},onClick:function(){oe(T)},uuid:"rename_file"},{label:function(){return"Delete file"},onClick:function(){var e=de(T);window.confirm("Are you sure you want to delete file ".concat(e,"?"))&&F(encodeURIComponent(e))},uuid:"delete_file"}]),(0,P.jsx)("div",{style:{left:f,position:"fixed",top:d+$.iI/2,zIndex:Pe.bf+100},children:(0,P.jsx)(L.Z,{items:p,open:!0,parentRef:void 0,uuid:"FileBrowser/ContextMenu",width:Be})})}),[O,l,F,c,n,ne,oe,Q,T,Y]);return(0,P.jsxs)(J.Nk,{ref:n,children:[V,(Q||T||Y)&&ce,q&&(0,P.jsx)("div",{style:{left:(null===O||void 0===O?void 0:O.x)-$.iI,position:"fixed",top:(null===O||void 0===O?void 0:O.y)-$.iI,zIndex:Pe.bf+100},children:(0,P.jsx)(_.ZP,{cursor:"grabbing",monospace:!0,children:null===q||void 0===q?void 0:q.uuid})})]})}!function(e){e.BLOCK_FILE="block_file",e.DISABLED="disabled",e.FILE="file",e.FOLDER="folder",e.PIPELINE="pipeline"}(Le||(Le={}));var Ue=s.forwardRef(Fe),He=t(93461),ze=N.default.div.withConfig({displayName:"ButtonGroup__ButtonGroupStyle",componentId:"sc-15vbmc8-0"})([""]),We=N.default.div.withConfig({displayName:"ButtonGroup__VerticalDivider",componentId:"sc-15vbmc8-1"})(["width:1px;"]),Ge=function(e){var n=e.children,t=e.divider,i=s.Children.toArray(n).length;return(0,P.jsx)(ze,{children:(0,P.jsx)(x.Z,{children:s.Children.map(n,(function(e,n){return e&&(0,P.jsxs)(He.Z,{children:[n>=1&&t&&(0,P.jsx)(We,{}),s.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))}))})})},Ve=t(57722),Qe=t(82635),qe=t(33699),Ye=t(94353),Ke=t(28799),Xe=t(41150);function Je(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?Je(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Je(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var en,nn=function(e){var n,t=e.active,i=e.addNewBlock,r=e.fetchPipeline,c=e.fetchVariables,u=e.filePath,f=e.openSidekickView,h=e.pipeline,b=e.selectedFilePath,y=e.setErrors,_=e.setFilesTouched,O=e.setSelectedBlock,E=p("apiReloads"),S=(0,o.Z)(E,2)[1],I=(0,s.useState)(null),T=I[0],D=I[1],M=(0,s.useState)(!1),N=M[0],L=M[1],B=(0,s.useRef)(null),F=be.ZP.status.list().data,H=null===F||void 0===F||null===(n=F.status)||void 0===n?void 0:n.repo_path,z=be.ZP.file_contents.detail(u).data;(0,s.useEffect)((function(){null!==z&&void 0!==z&&z.file_content&&D(z.file_content)}),[z]);var W=(0,s.useState)(null===T||void 0===T?void 0:T.content),G=W[0],V=W[1],Q=(0,s.useState)(!1),q=Q[0],K=Q[1];(0,s.useEffect)((function(){var e;b&&(null===B||void 0===B||null===(e=B.current)||void 0===e||e.scrollIntoView())}),[b]);var X=(0,d.Db)(be.ZP.file_contents.useUpdate((null===T||void 0===T?void 0:T.path)&&encodeURIComponent(null===T||void 0===T?void 0:T.path)),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){S((function(e){return $e($e({},e),{},(0,l.Z)({},"FileVersions/".concat(null===T||void 0===T?void 0:T.path),Number(new Date)))}))},onErrorCallback:function(e,n){return null===y||void 0===y?void 0:y({errors:n,response:e})}})}}),J=(0,o.Z)(X,1)[0],$=(0,s.useCallback)((function(e,n){J({file_content:$e($e({},n),{},{content:e})}).then((function(){decodeURIComponent(u).split("/").pop()===R.METADATA_YAML&&c()})),_((function(e){return $e($e({},e),{},(0,l.Z)({},null===n||void 0===n?void 0:n.path,!1))})),K(!1)}),[c,u,_,J]),ne=(0,s.useMemo)((function(){return Te()}),[]),te=(0,s.useMemo)((function(){var e;return null===T||void 0===T||null===(e=T.path.match(ne)[0])||void 0===e?void 0:e.split(".")[1]}),[ne,T]),ie=(0,s.useMemo)((function(){if(null!==T&&void 0!==T&&T.path)return(0,P.jsx)(Ve.Z,{autoHeight:!0,language:Y[te],onSave:function(e){$(e,T)},onChange:function(e){V(e),_((function(e){return $e($e({},e),{},(0,l.Z)({},null===T||void 0===T?void 0:T.path,!0))})),K(!0)},selected:!0,textareaFocused:!0,value:(0,ue.Pb)(null===T||void 0===T?void 0:T.content)?JSON.stringify(JSON.parse(null===T||void 0===T?void 0:T.content),null,2):null===T||void 0===T?void 0:T.content,width:"100%"})}),[T,te,$,_]),re=(0,ee.sE)(null===h||void 0===h?void 0:h.blocks,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n})),oe=(0,d.Db)(be.ZP.blocks.pipelines.useUpdate(null===h||void 0===h?void 0:h.uuid,null===re||void 0===re?void 0:re.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===r||void 0===r||r()}})}}),le=(0,o.Z)(oe,1)[0],ce=(te===A.PY||te===A.SQL||(te===A.YAML||te===A.R)&&pe(T,null===T||void 0===T?void 0:T.path))&&Ie(T.path.split("/"))!==v.tf.SCRATCHPAD&&fe(T)&&(0,P.jsx)(g.Z,{onClick:function(){var e=h.type===k.qL.INTEGRATION,n=Ae(T,H,h);i(n,(function(n){e&&re&&le({block:$e($e({},re),{},{upstream_blocks:[n.uuid]})}),O(n)}))},primary:!0,children:"Add to current pipeline"}),ae=(0,a.ZP)((0,Ke.Ib)(),{shouldReconnect:function(){return!0}}),se=ae.lastJsonMessage,de=ae.sendMessage;(0,s.useEffect)((function(){if(se){var e=se,n=null===e||void 0===e?void 0:e.execution_state;(null===e||void 0===e?void 0:e.uuid)===qe.y&&(Qe.uF.BUSY===n?L(!0):Qe.uF.IDLE===n&&L(!1))}}),[se,L]);var he=(0,P.jsx)(Z.Z,{m:2,children:(0,P.jsx)(j.ZP,{disabled:!H,inline:!0,loading:N,onClick:function(){f(U.TERMINAL),de(JSON.stringify({api_key:Ye.l,code:"!pip install -r ".concat(H,"/requirements.txt"),token:(new m.Z).decodedToken.token,uuid:qe.y}))},title:H?"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"})}),me="FileEditor/".concat(null===T||void 0===T?void 0:T.path),ve=(0,Xe.y)(),ge=ve.registerOnKeyDown,xe=ve.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){xe(me)}}),[xe,me]),ge(me,(function(e,n,i){if(t)if((0,w.y)([C.zX,C.Um],n)||(0,w.y)([C.PQ,C.Um],n))e.preventDefault(),$(G,T);else if(q&&(0,w.y)([C.zX,C.hS],n)){e.preventDefault();var r="".concat(T.path," has changes that are unsaved. ")+"Click cancel and save your changes before reloading page.";"undefined"!==typeof location&&window.confirm(r)&&location.reload()}}),[t,G,T,$,q]),(0,P.jsxs)("div",{ref:B,children:[(0,P.jsx)(Z.Z,{p:2,children:(0,P.jsxs)(x.Z,{justifyContent:"space-between",children:[(0,P.jsxs)(Ge,{children:[ce,(0,P.jsx)(g.Z,{disabled:!G,onClick:function(e){e.preventDefault(),$(G,T)},title:G?null:"No changes have been made to this file.",children:"Save file content"})]}),(0,P.jsx)(Ge,{children:(0,P.jsx)(g.Z,{compact:!0,onClick:function(){f(U.FILE_VERSIONS)},small:!0,title:"View previous changes to this file.",children:"Show versions"})})]})}),ie,u===R.REQS_TXT&&he]})},tn=t(47999),rn=t(64318);!function(e){e.ANDROID="Android",e.CHROME_OS="ChromeOS",e.IOS="iOS",e.LINUX="Linux",e.MAC="macOS",e.WINDOWS="Windows"}(en||(en={}));var on=en;function ln(){return function(){var e,n,t,i,r,o,l,c=on.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=on.MAC:["Win32","Win64","Windows","WinCE"].includes(a)?c=on.WINDOWS:["iPhone","iPad","iPod"].includes(a)&&(c=on.IOS):u&&(u.includes("Macintosh")?c=on.MAC:u.includes("Windows")?c=on.WINDOWS:u.includes("Linux")&&u.includes("X11")?c=on.LINUX:/(iPhone|iPad)/.test(u)?c=on.IOS:u.includes("Android")&&u.includes("Mobi")?c=on.ANDROID:u.includes("CrOS")&&(c=on.CHROME_OS)),c}()===on.MAC}function cn(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 un(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?cn(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):cn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var an=function(e){var n=e.cancelPipeline,t=e.createPipeline,i=e.executePipeline,r=e.interruptKernel,o=e.isPipelineExecuting,c=e.restartKernel,u=e.savePipelineContent,a=e.setMessages,d=(0,s.useState)(null),f=d[0],p=d[1],h=(0,s.useRef)(null),m=(0,s.useRef)(null),v=[{label:function(){return"New standard pipeline"},onClick:function(){return t({pipeline:{name:(0,ue.Y6)()}})},uuid:"new_standard_pipeline"},{label:function(){return"New streaming pipeline"},onClick:function(){return t({pipeline:{name:(0,ue.Y6)(),type:k.qL.STREAMING}})},uuid:"new_streaming_pipeline"},{label:function(){return"Save pipeline"},keyTextGroups:[[ln()?C.RJ:C.hE,C.SS]],onClick:function(){return u()},uuid:"save_pipeline"}],g=(0,s.useMemo)((function(){var e=[{label:function(){return"Interrupt kernel"},keyTextGroups:[[C.kA],[C.kA]],onClick:function(){return r()},uuid:"Interrupt kernel"},{label:function(){return"Restart kernel"},keyTextGroups:[[C.t_[C.OC]],[C.t_[C.OC]]],onClick:function(){return c()},uuid:"Restart kernel"},{label:function(){return"Clear all outputs"},onClick:function(){return a((function(e){return Object.keys(e).reduce((function(e,n){return un(un({},e),{},(0,l.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]),b="FileHeaderMenu/index",j=(0,Xe.y)(),y=j.registerOnKeyDown,Z=j.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){Z(b)}}),[Z,b]),y(b,(function(e,n,t){null!==f&&(n[C.QK]?p((function(e){return 0===e?1:e-1})):n[C.DY]&&p((function(e){return 1===e?0:e+1})))}),[f,p]),(0,P.jsx)(tn.Z,{onClickOutside:function(){return p(null)},open:!0,style:{position:"relative"},children:(0,P.jsxs)(x.Z,{children:[(0,P.jsxs)("div",{style:{position:"relative"},children:[(0,P.jsx)(rn.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,P.jsx)(_.ZP,{children:"File"})}),(0,P.jsx)(L.Z,{items:v,onClickCallback:function(){return p(null)},open:0===f,parentRef:h,uuid:"FileHeaderMenu/file_items"})]}),(0,P.jsxs)("div",{style:{position:"relative"},children:[(0,P.jsx)(rn.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:m,children:(0,P.jsx)(_.ZP,{children:"Run"})}),(0,P.jsx)(L.Z,{items:g,onClickCallback:function(){return p(null)},open:1===f,parentRef:m,uuid:"FileHeaderMenu/run_items"})]})]})})},sn=t(10919),dn=t(46261),fn=t(82386),pn=t(37391),hn=300,mn=N.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;}"],hn,hn),vn=N.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||Oe.Z.background).codeArea,";\n ")})),gn=N.default.div.withConfig({displayName:"indexstyle__PipelineHeaderStyle",componentId:"sc-1sv9513-2"})(["height:","px;position:sticky;top:","px;width:100%;z-index:5;"," "," "," ",""],fn.Wi,fn.Wi,(function(e){return"\n background-color: ".concat((e.theme.background||Oe.Z.background).panel,";\n border-bottom: 1px solid ").concat((e.theme.borders||Oe.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(fn.Wi,"px;\n overflow-x: auto;\n z-index: 3;\n ")}),(0,pn.y$)()),bn=N.default.div.withConfig({displayName:"indexstyle__FileTabStyle",componentId:"sc-1sv9513-3"})(["border-left:1px solid transparent;height:100%;padding:","px ","px;"," "," "," ",""],$.iI,$.cd*$.iI,(function(e){return"\n &:hover {\n cursor: default;\n\n p {\n color: ".concat((e.theme.content||Oe.Z.content).active," !important;\n cursor: default;\n }\n }\n ")}),(function(e){return e.selected&&"\n background-color: ".concat((e.theme.interactive||Oe.Z.interactive).hoverBackground,";\n ")}),(function(e){return!e.selected&&"\n border-color: ".concat((e.theme.borders||Oe.Z.borders).light," !important;\n ")}),(function(e){return e.last&&"\n border-right: 1px solid transparent;\n "})),xn=t(33766);var jn,yn,kn=function(e){var n=e.filePaths,t=e.filesTouched,i=e.savePipelineContent,r=e.selectedFilePath,o=(0,s.useContext)(N.ThemeContext),l=(0,s.useMemo)((function(){return n.map((function(e){return decodeURIComponent(e)}))}),[n]);return(0,P.jsx)(gn,{relativePosition:!0,secondary:!0,children:(0,P.jsx)(x.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,P.jsx)(x.Z,{flexDirection:"column",fullHeight:!0,onClick:function(n){n.preventDefault(),c||(i(),(0,xn.u7)({file_path:encodeURIComponent(e)}))},children:(0,P.jsx)(bn,{last:n===l.length-1,selected:c,children:(0,P.jsxs)(x.Z,{alignItems:"center",fullHeight:!0,children:[!t[e]&&(0,P.jsx)(X.iU,{muted:!c,size:1.5*$.iI}),t[e]&&(0,P.jsx)(dn.Z,{label:"Unsaved changes",size:null,widthFitContent:!0,children:(0,P.jsx)("div",{style:{padding:1},children:(0,P.jsx)(B.Z,{borderColor:(o||Oe.Z).borders.danger,size:1.25*$.iI})})}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(_.ZP,{muted:!c,children:e}),(0,P.jsx)(Z.Z,{mr:2}),c&&(0,P.jsx)(dn.Z,{appearAbove:!0,label:"Close",size:null,widthFitContent:!0,children:(0,P.jsx)(sn.Z,{autoHeight:!0,block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){var n=(0,ee.Od)(l,(function(n){return n===e})).map((function(e){return encodeURIComponent(e)}));(0,xn.u7)({file_path:n[n.length-1]||null,"file_paths[]":n},{pushHistory:!0})},preventDefault:!0,children:(0,P.jsx)(X.x8,{size:1.25*$.iI})})}),!c&&(0,P.jsx)("div",{style:{width:1.25*$.iI}})]})})},e)}))})})},Zn=t(57384);!function(e){e.CREATE_NEW_CLUSTER="create_new_cluster",e.SET_ACTIVE_CLUSTER="set_active_cluster"}(jn||(jn={})),function(e){e.BOOTSTRAPPING="BOOTSTRAPPING",e.STARTING="STARTING",e.WAITING="WAITING"}(yn||(yn={}));var _n=t(90686),On=["bold","defaultColor","description","disableWordBreak","inputValue","inputWidth","invertedTheme","label","labelColor","menuOpen","monospace","muted","onClick","notRequired","selectedTextProps","small","stacked","tooltipProps","value"];function Cn(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 En(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Cn(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Cn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Sn=N.default.div.withConfig({displayName:"LabelWithValueClicker__LabelStyle",componentId:"sc-1hzpn4h-0"})(["margin-bottom:","px;"],.25*$.iI),wn=N.default.div.withConfig({displayName:"LabelWithValueClicker__DescriptionStyle",componentId:"sc-1hzpn4h-1"})([""]);var Pn,In=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,d=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,j=e.small,y=e.stacked,k=e.tooltipProps,C=e.value,E=(0,M.Z)(e,On),S=(0,s.useRef)(null),w=(0,s.useState)(!1),I=w[0],T=w[1],A=(0,s.useState)(!1),R=A[0],D=A[1],N=a&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(_.ZP,{bold:t,color:d,inverted:u,lineHeight:20,monospace:h,muted:m,small:j,children:a}),k&&(0,P.jsx)(Z.Z,{ml:1,children:(0,P.jsx)(dn.Z,En({muted:!0},k))})]}),L=(0,P.jsxs)(P.Fragment,{children:[C&&(0,P.jsx)(sn.Z,{block:!0,danger:null===b||void 0===b?void 0:b.danger,fullWidth:!0,muted:m,onClick:function(){v(),S.current&&S.current.focus(),T(!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,P.jsx)(_.ZP,En(En({inverted:u,muted:m},b),{},{disableWordBreak:o,monospace:h,small:j,width:c,children:C}))}),(0,P.jsx)(O.Z,En(En({},E),{},{basic:!0,defaultColor:i,invertedTheme:u,monospace:h,onBlur:function(e){T(!1),E.onBlur&&E.onBlur(e),R||D(!0)},onFocus:function(e){T(!0),E.onFocus&&E.onFocus(e)},ref:S,small:j,value:l,visible:!C}))]}),B=r&&(0,P.jsx)(wn,{children:(0,P.jsx)(_.ZP,{dangerouslySetInnerHTML:{__html:r},monospace:h,muted:!0,small:j})});return(0,P.jsxs)(P.Fragment,{children:[y&&(0,P.jsxs)(P.Fragment,{children:[N&&(0,P.jsxs)(Sn,{children:[(0,P.jsx)(x.Z,{alignItems:"center",fullHeight:!1,fullWidth:!0,children:N}),B]}),L]}),!y&&(0,P.jsxs)(x.Z,{alignItems:"center",fullWidth:!0,children:[N&&(0,P.jsxs)(P.Fragment,{children:[N,(0,P.jsx)(Z.Z,{ml:1})]}),(0,P.jsx)(He.Z,{flex:"1",children:L})]}),R&&!I&&!C&&!p&&!g&&(0,P.jsx)(_.ZP,{danger:!0,small:j,children:"This field is required."})]})};!function(e){e.EMR="emr"}(Pn||(Pn={}));var Tn=t(42305);var An=function(e){e.filePaths,e.filesTouched;var n,t=e.isBusy,i=e.isPipelineUpdating,l=e.kernel,c=e.pipeline,u=e.pipelineContentTouched,a=e.pipelineLastSaved,f=(e.restartKernel,e.savePipelineContent,e.selectedFilePath),p=e.setErrors,h=e.updatePipelineMetadata,m=(0,s.useContext)(N.ThemeContext),v=l||{},g=v.alive,b=(v.name,(0,s.useState)(!1)),y=b[0],O=b[1],E=(0,s.useState)(""),S=E[0],w=E[1],I=(0,s.useState)(Pn.EMR),T=I[0],A=(I[1],(0,s.useState)(!1)),R=A[0],D=A[1],M=(0,s.useState)(!1),F=M[0],U=M[1],H=(0,s.useRef)(null),z=be.ZP.clusters.detail(T),W=z.data,G=z.mutate,V=(0,s.useMemo)((function(){var e;return(null===W||void 0===W||null===(e=W.cluster)||void 0===e?void 0:e.clusters)||[]}),W),Q=(0,ee.sE)(V,(function(e){return e.is_active})),q=(0,d.Db)(be.ZP.clusters.useUpdate(T),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){G()},onErrorCallback:function(e,n){return p({errors:n,response:e})}})}}),Y=(0,o.Z)(q,2),K=Y[0];Y[1].isLoading,(0,s.useEffect)((function(){null!==c&&void 0!==c&&c.uuid&&w(c.uuid)}),[null===c||void 0===c?void 0:c.uuid]),n=u?"Unsaved changes":i?"Saving changes...":a?"Last saved ".concat((0,Tn.JX)(Number(a)/1e3)):"All changes saved";var J="KernelStatus",ne=(0,Xe.y)(),te=ne.registerOnKeyDown,ie=ne.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){ie(J)}}),[ie,J]),te(J,(function(e,n,t){y&&String(t[0])===String(C.Uq)&&String(t[1])!==String(C.zX)&&((null===c||void 0===c?void 0:c.uuid)===S?e.target.blur():(h(S),O(!1)))}),[y,S,O,h]);var re=(0,s.useMemo)((function(){return(0,P.jsx)(In,{bold:!1,inputValue:S,notRequired:!0,onBlur:function(){return setTimeout((function(){return O(!1)}),300)},onChange:function(e){w(e.target.value),e.preventDefault()},onClick:function(){return O(!0)},onFocus:function(){return O(!0)},stacked:!0,value:y?null:(null===c||void 0===c?void 0:c.uuid)||""})}),[y,S,c]),oe=(0,s.useMemo)((function(){return(0,P.jsx)("div",{ref:H,style:{position:"relative"},children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(null===c||void 0===c?void 0:c.type)===k.qL.PYSPARK&&(0,P.jsxs)(Z.Z,{mr:1,children:[(0,P.jsxs)(sn.Z,{muted:!!Q,onClick:function(){return D(!0)},preventDefault:!0,sameColorAsText:!Q,underline:!Q,children:[Q&&Q.id,!Q&&"Select cluster"]}),(0,P.jsx)(tn.Z,{disableEscape:!0,onClickOutside:function(){return D(!1)},open:R,children:(0,P.jsx)(L.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select cluster"},uuid:"select_cluster"}].concat((0,r.Z)(V.map((function(e){var n=e.id,t=e.is_active,i=e.status;return{label:function(){return(0,P.jsxs)(x.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,P.jsx)(He.Z,{flex:1,children:(0,P.jsx)(_.ZP,{muted:!t&&yn.WAITING!==i,children:n})}),t&&(0,P.jsx)(X.Jr,{size:2*$.iI,success:!0}),!t&&(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,children:i})]})},onClick:t||yn.WAITING!==i?null:function(){return K({cluster:{id:n,is_active:!0}})},uuid:n}})))),onClickCallback:function(){return D(!1)},open:R,parentRef:H,uuid:"KernelStatus/select_cluster",width:40*$.iI})})]}),(0,P.jsx)(j.ZP,{beforeElement:(0,P.jsx)(B.Z,{color:t?(m||Oe.Z).borders.info:g?(m||Oe.Z).borders.success:(m||Oe.Z).borders.danger,size:$.iI}),blackBorder:!0,compact:!0,inline:!0,onClick:function(){return U(!0)},uuid:"Pipeline/KernelStatus/kernel",children:(null===c||void 0===c?void 0:c.type)||k.qL.PYTHON}),(0,P.jsx)(tn.Z,{disableEscape:!0,onClickOutside:function(){return U(!1)},open:F,children:(0,P.jsx)(L.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select kernel"},uuid:"select_kernel"}].concat((0,r.Z)(Object.keys(k.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 U(!1)},open:F,parentRef:H,uuid:"KernelStatus/select_kernel",width:25*$.iI})})]})})}),[g,V,t,c,Q,D,U,R,F,m,K]),le=(0,s.useMemo)((function(){return(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsxs)(_.ZP,{children:["Pipeline:\xa0",f&&(null===c||void 0===c?void 0:c.uuid)]}),!f&&re,(0,P.jsx)(Z.Z,{mr:3})]})}),[g,t,c,re,f,m]);return(0,P.jsx)(gn,{relativePosition:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",fullHeight:!0,justifyContent:"space-between",children:[(0,P.jsx)(x.Z,{alignItems:"center",fullHeight:!0,justifyContent:"flex-start",children:(0,P.jsxs)(Z.Z,{px:$.cd,children:[f&&(0,P.jsx)(sn.Z,{noHoverUnderline:!0,noOutline:!0,onClick:f?function(){return(0,xn.u7)({file_path:null})}:null,preventDefault:!0,children:le}),!f&&(0,P.jsxs)(x.Z,{alignItems:"center",children:[le,y&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(sn.Z,{onClick:function(){h(S),O(!1)},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]})]})}),(0,P.jsx)(Z.Z,{px:$.cd,children:(0,P.jsxs)(He.Z,{alignItems:"center",children:[oe,(0,P.jsx)(Z.Z,{ml:2}),(0,P.jsx)(dn.Z,{appearBefore:!0,block:!0,description:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(_.ZP,{default:!0,inline:!0,children:"Press"}),"\xa0",(0,P.jsx)(_n.Z,{inline:!0,keyText:ln()?C.RJ:C.hE}),"\xa0",(0,P.jsx)(_.ZP,{default:!0,inline:!0,children:"+"}),"\xa0",(0,P.jsx)(_n.Z,{inline:!0,keyText:C.SS}),"\xa0",(0,P.jsx)(_.ZP,{default:!0,inline:!0,children:"to save changes."}),(0,P.jsx)("br",{})]}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(_.ZP,{default:!0,children:["Or, go to ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:"File"})," \u203a ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:"Save pipeline"}),"."]})})]}),size:null,widthFitContent:!0,children:(0,P.jsx)(_.ZP,{muted:!0,children:n})})]})})]})})},Rn=t(16910);var Dn,Mn,Nn,Ln,Bn,Fn,Un=function(e){var n=e.size;return(0,P.jsx)("svg",{fill:"none",height:n,preserveAspectRatio:"xMidYMid",viewBox:"0 0 256 256",width:n,xmlns:"http://www.w3.org/2000/svg",children:(0,P.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"})})},Hn=t(30264),zn=t(80906),Wn=$.cd*$.iI,Gn=N.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;"," "," "," "," "," "," ",""],Ce.BG,(function(e){return e.border&&"\n border: 1px dotted ".concat((e.theme.content||Oe.Z.content).active,";\n ")}),(function(e){return e.blue&&"\n background-color: ".concat((0,ce.qn)(v.tf.DATA_LOADER,e).accent,";\n ")}),(function(e){return e.purple&&"\n background-color: ".concat((0,ce.qn)(v.tf.TRANSFORMER,e).accent,";\n ")}),(function(e){return e.teal&&"\n background-color: ".concat((0,ce.qn)(v.tf.EXTENSION,e).accent,";\n ")}),(function(e){return e.yellow&&"\n background-color: ".concat((0,ce.qn)(v.tf.DATA_EXPORTER,e).accent,";\n ")}),(function(e){return!e.compact&&"\n height: ".concat(Wn+$.iI/2,"px;\n width: ").concat(Wn+$.iI/2,"px;\n ")}),(function(e){return e.compact&&"\n height: ".concat(Wn/2+$.iI,"px;\n width: ").concat(Wn/2+$.iI,"px;\n ")})),Vn=N.default.div.withConfig({displayName:"indexstyle__ButtonWrapper",componentId:"sc-oyfjzc-1"})(["position:relative;margin-bottom:","px;margin-right:","px;",""],$.iI,$.iI,(function(e){return e.increasedZIndex&&"\n z-index: 3;\n "})),Qn=(zn.Q0.AVERAGE,zn.Q0.CLEAN_COLUMN_NAME,zn.Q0.COUNT,zn.Q0.COUNT_DISTINCT,zn.Q0.CUSTOM,zn.Q0.DIFF,zn.Q0.FIRST,zn.Q0.FIX_SYNTAX_ERRORS,zn.Q0.IMPUTE,zn.Q0.LAST,zn.Q0.MAX,zn.Q0.MEDIAN,zn.Q0.MIN,zn.Q0.NORMALIZE,zn.Q0.REFORMAT,zn.Q0.REMOVE,zn.Q0.REMOVE_OUTLIERS,zn.Q0.SELECT,zn.Q0.SHIFT_DOWN,zn.Q0.SHIFT_UP,zn.Q0.STANDARDIZE,zn.Q0.SUM,[zn.Q0.DROP_DUPLICATE,zn.Q0.FILTER,zn.Q0.SORT,zn.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"}(Fn||(Fn={}));var qn,Yn,Kn,Xn=(Mn={},(0,l.Z)(Mn,zn.qs.COLUMN,(Dn={},(0,l.Z)(Dn,Fn.AGGREGATE,[zn.Q0.AVERAGE,zn.Q0.COUNT,zn.Q0.COUNT_DISTINCT,zn.Q0.FIRST,zn.Q0.LAST,zn.Q0.MAX,zn.Q0.MEDIAN,zn.Q0.MIN,zn.Q0.SUM]),(0,l.Z)(Dn,Fn.FORMATTING,[zn.Q0.CLEAN_COLUMN_NAME,zn.Q0.FIX_SYNTAX_ERRORS,zn.Q0.REFORMAT]),(0,l.Z)(Dn,Fn.COLUMN_REMOVAL,[zn.Q0.REMOVE,zn.Q0.SELECT]),(0,l.Z)(Dn,Fn.SHIFT_ROWS,[zn.Q0.SHIFT_DOWN,zn.Q0.SHIFT_UP]),(0,l.Z)(Dn,Fn.MISC,[zn.Q0.DIFF,zn.Q0.IMPUTE,zn.Q0.REMOVE_OUTLIERS]),(0,l.Z)(Dn,Fn.FEATURE_SCALING,[zn.Q0.NORMALIZE,zn.Q0.STANDARDIZE]),Dn)),(0,l.Z)(Mn,zn.qs.ROW,(0,l.Z)({},Fn.MISC,[].concat(Qn))),Mn),Jn=Object.keys(Xn[zn.qs.COLUMN]),$n=[Fn.MISC],et=(Bn={},(0,l.Z)(Bn,zn.qs.COLUMN,(Nn={},(0,l.Z)(Nn,zn.Q0.ADD,"Add column"),(0,l.Z)(Nn,zn.Q0.AVERAGE,"Aggregate by average value"),(0,l.Z)(Nn,zn.Q0.CLEAN_COLUMN_NAME,"Clean column name"),(0,l.Z)(Nn,zn.Q0.COUNT_DISTINCT,"Aggregate by distinct count"),(0,l.Z)(Nn,zn.Q0.COUNT,"Aggregate by total count"),(0,l.Z)(Nn,zn.Q0.DIFF,"Difference"),(0,l.Z)(Nn,zn.Q0.FIRST,"Aggregate by first value"),(0,l.Z)(Nn,zn.Q0.FIX_SYNTAX_ERRORS,"Fix syntax errors"),(0,l.Z)(Nn,zn.Q0.IMPUTE,"Fill in missing values"),(0,l.Z)(Nn,zn.Q0.NORMALIZE,"Normalize Data"),(0,l.Z)(Nn,zn.Q0.STANDARDIZE,"Standardize Data"),(0,l.Z)(Nn,zn.Q0.LAST,"Aggregate by last value"),(0,l.Z)(Nn,zn.Q0.MAX,"Aggregate by maximum value"),(0,l.Z)(Nn,zn.Q0.MEDIAN,"Aggregate by median value"),(0,l.Z)(Nn,zn.Q0.MIN,"Aggregate by mininum value"),(0,l.Z)(Nn,zn.Q0.REFORMAT,"Reformat"),(0,l.Z)(Nn,zn.Q0.REMOVE_OUTLIERS,"Remove outliers"),(0,l.Z)(Nn,zn.Q0.REMOVE,"Remove column(s)"),(0,l.Z)(Nn,zn.Q0.SELECT,"Keep columns"),(0,l.Z)(Nn,zn.Q0.SHIFT_DOWN,"Shift rows down in a column"),(0,l.Z)(Nn,zn.Q0.SHIFT_UP,"Shift rows up in a column"),(0,l.Z)(Nn,zn.Q0.SUM,"Aggregate by sum of values"),Nn)),(0,l.Z)(Bn,zn.qs.ROW,(Ln={},(0,l.Z)(Ln,zn.Q0.DROP_DUPLICATE,"Drop duplicates"),(0,l.Z)(Ln,zn.Q0.FILTER,"Filter"),(0,l.Z)(Ln,zn.Q0.SORT,"Sort"),(0,l.Z)(Ln,zn.Q0.REMOVE,"Remove rows"),Ln)),Bn);!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"}(Kn||(Kn={}));var nt=(qn={},(0,l.Z)(qn,Kn.API,"API"),(0,l.Z)(qn,Kn.AZURE_BLOB_STORAGE,"Azure Blob Storage"),(0,l.Z)(qn,Kn.AZURE_EVENT_HUB,"Azure Event Hub"),(0,l.Z)(qn,Kn.BIGQUERY,"Google BigQuery"),(0,l.Z)(qn,Kn.FILE,"Local file"),(0,l.Z)(qn,Kn.GENERIC,"Generic (no template)"),(0,l.Z)(qn,Kn.GOOGLE_CLOUD_STORAGE,"Google Cloud Storage"),(0,l.Z)(qn,Kn.KAFKA,"Kafka"),(0,l.Z)(qn,Kn.KINESIS,"Kinesis"),(0,l.Z)(qn,Kn.MYSQL,"MySQL"),(0,l.Z)(qn,Kn.OPENSEARCH,"OpenSearch"),(0,l.Z)(qn,Kn.POSTGRES,"PostgreSQL"),(0,l.Z)(qn,Kn.RABBITMQ,"RabbitMQ"),(0,l.Z)(qn,Kn.REDSHIFT,"Amazon Redshift"),(0,l.Z)(qn,Kn.S3,"Amazon S3"),(0,l.Z)(qn,Kn.SNOWFLAKE,"Snowflake"),qn),tt=(Yn={},(0,l.Z)(Yn,v.tf.DATA_LOADER,[Kn.GENERIC,Kn.FILE,Kn.API,Kn.AZURE_BLOB_STORAGE,Kn.BIGQUERY,Kn.GOOGLE_CLOUD_STORAGE,Kn.MYSQL,Kn.POSTGRES,Kn.RABBITMQ,Kn.REDSHIFT,Kn.S3,Kn.SNOWFLAKE]),(0,l.Z)(Yn,v.tf.DATA_EXPORTER,[Kn.GENERIC,Kn.FILE,Kn.AZURE_BLOB_STORAGE,Kn.BIGQUERY,Kn.GOOGLE_CLOUD_STORAGE,Kn.MYSQL,Kn.POSTGRES,Kn.REDSHIFT,Kn.S3,Kn.SNOWFLAKE]),(0,l.Z)(Yn,v.tf.TRANSFORMER,[Kn.BIGQUERY,Kn.POSTGRES,Kn.REDSHIFT,Kn.SNOWFLAKE]),(0,l.Z)(Yn,v.tf.SENSOR,[Kn.GENERIC,Kn.BIGQUERY,Kn.MYSQL,Kn.POSTGRES,Kn.REDSHIFT,Kn.S3,Kn.SNOWFLAKE]),Yn),it=Kn,rt=function(e,n,t){var i=t===k.qL.STREAMING&&(e===v.tf.DATA_LOADER||e===v.tf.DATA_EXPORTER);return(function(e){var n;return e===k.qL.STREAMING?(n={},(0,l.Z)(n,v.tf.DATA_LOADER,[it.AZURE_EVENT_HUB,it.KAFKA,it.KINESIS,it.RABBITMQ]),(0,l.Z)(n,v.tf.DATA_EXPORTER,[it.KAFKA,it.KINESIS,it.OPENSEARCH]),(0,l.Z)(n,v.tf.TRANSFORMER,[it.GENERIC]),n):tt}(t)[e]||[]).map((function(t){return{indent:e===v.tf.TRANSFORMER,label:function(){return nt[t]},onClick:function(){n({config:{data_source:t===it.GENERIC?null:t},language:i?v.t6.YAML:v.t6.PYTHON,type:e})},uuid:"".concat(e,"/").concat(t)}}))},ot=function(e,n){return[{label:function(){return"SQL"},onClick:function(){return e({language:v.t6.SQL,type:n})},uuid:"".concat(n,"/sql")},{label:function(){return"R"},onClick:function(){return e({language:v.t6.R,type:n})},uuid:"".concat(n,"/r")}]},lt=function(e,n,t){var i=Object.fromEntries(v.Ut.map((function(n){return[n,rt(n,e,t)]})));return t===k.qL.PYSPARK||t===k.qL.PYTHON&&n===v.tf.TRANSFORMER||t===k.qL.STREAMING||n===v.tf.SENSOR?i[n]:[{items:i[n],label:function(){return"Python"},uuid:"".concat(n,"/python")}].concat((0,r.Z)(ot(e,n)))};function ct(e,n,t){return e.map((function(e){return{indent:!0,label:function(){return et[n][e]},onClick:function(){t({config:{action_type:e,axis:n},language:v.t6.PYTHON,type:v.tf.TRANSFORMER})},uuid:"".concat(n,"_").concat(e)}})).sort((function(e,n){return e.label().localeCompare(n.label())}))}function ut(e,n,t){var i=[];return e.forEach((function(e){if(e!==Fn.MISC)i.push({indent:!0,items:ct(Xn[n][e],n,t),label:function(){return e},uuid:"".concat(n,"_grouping_").concat((0,ue.RA)(e))});else{var o=ct(Xn[n][e],n,t);i.push.apply(i,(0,r.Z)(o))}})),i}var at=function(e,n,t){return Object.values(v.Lq).map((function(i){return{label:function(){return(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(X.mm,{fill:(0,ce.qn)(v.tf.CUSTOM,{blockColor:i}).accent,size:16}),"\xa0",(0,P.jsx)(_.ZP,{children:(0,ue.kC)(i)})]})},onClick:function(){e({color:i,language:t,type:n})},uuid:"".concat(t,"_").concat(i)}}))},st=function(e){return"-- Docs: https://docs.mage.ai/guides/sql-blocks\n"+(e||"")};function dt(e,n){var t=n;return v.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 ft(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function pt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ft(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ft(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ht=function(e){var n=e.addNewBlock,t=e.blockIdx,i=e.compact,o=e.hideCustom,l=e.hideDataExporter,c=(e.hideDataLoader,e.hideDbt),u=(e.hideRecommendations,e.hideScratchpad),a=e.hideSensor,d=e.hideTransformer,f=e.hideTransformerDataSources,p=e.onClickAddSingleDBTModel,h=e.pipeline,m=e.setAddNewBlockMenuOpenIdx,g=e.setCreatingNewDBTModel,b=(e.setRecsWindowOpenBlockIdx,(0,s.useState)(null)),y=b[0],Z=b[1],_=(0,s.useRef)(null),O=(0,s.useRef)(null),C=(0,s.useRef)(null),E=(0,s.useRef)(null),S=(0,s.useRef)(null),w=(0,s.useRef)(null),I={compact:i,inline:!0},T=null===h||void 0===h?void 0:h.type,A=T===k.qL.STREAMING,R=i?Wn/2:Wn,D=25*$.iI,M=ut(Jn,zn.qs.COLUMN,n),N=[{label:function(){return"Generic (no template)"},onClick:function(){n({language:v.t6.PYTHON,type:v.tf.TRANSFORMER})},uuid:"generic_transformer_action"},{bold:!0,items:ut($n,zn.qs.ROW,n),label:function(){return"Row actions"},uuid:"row_actions_grouping"},{isGroupingTitle:!0,label:function(){return"Column actions"},uuid:"column_actions_grouping"}].concat((0,r.Z)(M));f||N.splice(1,0,{bold:!0,items:lt(n,v.tf.TRANSFORMER,T),label:function(){return"Data sources"},uuid:"data_sources_grouping"});var L=(0,s.useCallback)((function(){return Z(null)}),[]),B=(0,s.useCallback)((function(e){return null===m||void 0===m?void 0:m((function(n){return null===n||y!==e?t:null}))}),[t,y,m]),F=k.qL.PYSPARK===T;return(0,P.jsx)(x.Z,{flexWrap:"wrap",inline:!0,children:(0,P.jsx)(tn.Z,{onClickOutside:L,open:!0,children:(0,P.jsxs)(x.Z,{flexWrap:"wrap",children:[!l&&(0,P.jsx)(Vn,{increasedZIndex:0===y,children:(0,P.jsx)(Hn.Z,{disableKeyboardShortcuts:!0,items:lt(n,v.tf.DATA_LOADER,T),onClickCallback:L,open:0===y,parentRef:_,uuid:"data_loader_button",children:(0,P.jsx)(j.ZP,pt(pt({},I),{},{beforeElement:(0,P.jsx)(Gn,{blue:!0,compact:i,children:(0,P.jsx)(X.mm,{size:R})}),onClick:function(e){e.preventDefault(),Z((function(e){return 0===e?null:0})),B(0)},uuid:"AddNewBlocks/Data_loader",children:"Data loader"}))})}),!d&&(0,P.jsx)(Vn,{increasedZIndex:1===y,children:(0,P.jsx)(Hn.Z,{disableKeyboardShortcuts:!0,items:F||k.qL.INTEGRATION===T?N:A?[{items:lt(n,v.tf.TRANSFORMER,T),label:function(){return"Python"},uuid:"transformers/python"}]:[{items:N,label:function(){return"Python"},uuid:"transformers/python_all"}].concat((0,r.Z)(ot(n,v.tf.TRANSFORMER))),onClickCallback:L,open:1===y,parentRef:O,uuid:"transformer_button",children:(0,P.jsx)(j.ZP,pt(pt({},I),{},{beforeElement:(0,P.jsx)(Gn,{compact:i,purple:!0,children:(0,P.jsx)(X.mm,{size:R})}),onClick:function(e){e.preventDefault(),Z((function(e){return 1===e?null:1})),B(1)},uuid:"AddNewBlocks/Transformer",children:"Transformer"}))})}),!l&&(0,P.jsx)(Vn,{increasedZIndex:2===y,children:(0,P.jsx)(Hn.Z,{disableKeyboardShortcuts:!0,items:lt(n,v.tf.DATA_EXPORTER,T),onClickCallback:L,open:2===y,parentRef:C,uuid:"data_exporter_button",children:(0,P.jsx)(j.ZP,pt(pt({},I),{},{beforeElement:(0,P.jsx)(Gn,{compact:i,yellow:!0,children:(0,P.jsx)(X.mm,{inverted:!0,size:R})}),onClick:function(e){e.preventDefault(),Z((function(e){return 2===e?null:2})),B(2)},uuid:"AddNewBlocks/Data_exporter",children:"Data exporter"}))})}),!c&&(0,P.jsx)(Vn,{increasedZIndex:3===y,children:(0,P.jsx)(Hn.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:v.t6.YAML,type:v.tf.DBT})},uuid:"dbt/all_models"}],onClickCallback:L,open:3===y,parentRef:E,uuid:"dbt_button",children:(0,P.jsx)(j.ZP,pt(pt({},I),{},{beforeElement:(0,P.jsx)(Un,{size:Wn*(i?.75:1.25)}),onClick:function(e){e.preventDefault(),Z((function(e){return 3===e?null:3})),B(3)},uuid:"AddNewBlocks/DBT",children:"DBT model"}))})}),!o&&(0,P.jsx)(Vn,{increasedZIndex:4===y,children:(0,P.jsx)(Hn.Z,{disableKeyboardShortcuts:!0,items:[{items:at(n,v.tf.CUSTOM,v.t6.PYTHON),label:function(){return"Python"},uuid:"custom_block_python"},{items:at(n,v.tf.CUSTOM,v.t6.SQL),label:function(){return"SQL"},uuid:"custom_block_sql"}],onClickCallback:L,open:4===y,parentRef:S,uuid:"custom_block_button",children:(0,P.jsx)(dn.Z,{block:!0,label:"Add a custom code block with a designated color.",maxWidth:D,size:null,children:(0,P.jsx)(j.ZP,pt(pt({},I),{},{beforeElement:(0,P.jsx)(Gn,{compact:i,children:(0,P.jsx)(X.I8,{size:R})}),onClick:function(e){e.preventDefault(),Z((function(e){return 4===e?null:4})),B(4)},uuid:"AddNewBlocks/Scratchpad",children:"Custom"}))})})}),!u&&(0,P.jsx)(Vn,{children:(0,P.jsx)(dn.Z,{block:!0,label:"Write experimental code that doesn\u2019t get executed when you run your pipeline.",maxWidth:D,size:null,children:(0,P.jsx)(j.ZP,pt(pt({},I),{},{beforeElement:(0,P.jsx)(Gn,{border:!0,compact:i,children:(0,P.jsx)(X.mm,{size:R})}),onClick:function(e){e.preventDefault(),n({type:v.tf.SCRATCHPAD})},uuid:"AddNewBlocks/Scratchpad",children:"Scratchpad"}))})}),!A&&!a&&(0,P.jsx)(Vn,{increasedZIndex:6===y,children:(0,P.jsx)(Hn.Z,{disableKeyboardShortcuts:!0,items:lt(n,v.tf.SENSOR,T),onClickCallback:L,open:6===y,parentRef:w,uuid:"sensor_button",children:(0,P.jsx)(j.ZP,pt(pt({},I),{},{beforeElement:(0,P.jsx)(Gn,{compact:i,children:(0,P.jsx)(X.LM,{pink:!0,size:Wn*(i?.75:1.25)})}),onClick:function(e){e.preventDefault(),Z((function(e){return 6===e?null:6})),B(6)},uuid:"AddNewBlocks/Sensor",children:"Sensor"}))})})]})})})},mt=t(18283),vt=t(32316),gt=t(89565),bt=t.n(gt),xt=t(62976),jt=t(86532),yt=t(34744),kt=t(66166),Zt=N.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;"," "," ",""],ce.Kf,(function(e){return e.addBottomPadding&&"\n padding-bottom: ".concat(2*$.tr,"px;\n ")}),(function(e){return"\n background-color: ".concat((e.theme.background||Oe.Z.background).table,";\n ")}),(function(e){return!e.executedAndIdle&&"\n border-bottom-left-radius: ".concat(Ce.n_,"px;\n border-bottom-right-radius: ").concat(Ce.n_,"px;\n border-bottom-style: solid;\n border-bottom-width: 2px;\n ")})),_t=N.default.div.withConfig({displayName:"indexstyle__OutputRowStyle",componentId:"sc-n38rkq-1"})([""," "," ",""],(function(e){return e.first&&"\n padding-top: ".concat($.iI*$.cd,"px;\n ")}),(function(e){return e.last&&"\n padding-bottom: ".concat($.iI*$.cd,"px;\n ")}),(function(e){return e.contained&&"\n padding-left: ".concat(ce.oh,"px;\n padding-right: ").concat($.iI*$.cd,"px;\n ")})),Ot=N.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{","}"],ce.Kf,(function(e){return"\n color: ".concat((e.theme.interactive||Oe.Z.interactive).linkPrimary,";\n ")})),Ct=N.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;",""],ce.Kf,(function(e){return"\n background-color: ".concat((e.theme.borders||Oe.Z.borders).light,";\n border-bottom-left-radius: ").concat(Ce.n_,"px;\n border-bottom-right-radius: ").concat(Ce.n_,"px;\n ")})),Et=N.default.div.withConfig({displayName:"indexstyle__ExtraInfoContentStyle",componentId:"sc-n38rkq-4"})(["padding-bottom:","px;padding-left:","px;padding-right:","px;padding-top:","px;"],$.iI,ce.oh,$.iI*$.cd,$.iI),St=N.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||Oe.Z.borders).medium,";\n ")})),wt=/\[__internal_output__\]/,Pt=/\[__internal_test__\]/,It={uuid:"Preview"},Tt={uuid:"Logs"},At={uuid:"SQL"},Rt={uuid:"Lineage"},Dt=[It,Tt,At,Rt];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 Nt(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,l.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}function Lt(e){var n={},t={};return null===e||void 0===e||e.forEach((function(e){var i=e.content,r=e.outputs,o=e.type,l=e.uuid;(null===r||void 0===r?void 0:r.length)>=1&&(n[l]=r.map((function(e){var n=e||{},t=n.sample_data,i=n.shape,r=n.text_data,o=n.type;return t?{data:Nt({shape:i},t),type:o}:r&&(0,ue.Pb)(r)?JSON.parse(r):r}))),t[o]||(t[o]={}),t[o][l]=i})),{content:t,messages:n}}function Bt(e,n,t){e.forEach((function(e){(0,S.t8)("".concat(t,"/").concat(e.uuid,"/codeCollapsed"),(0,S.Od)("".concat(n,"/").concat(e.uuid,"/codeCollapsed"))),(0,S.t8)("".concat(t,"/").concat(e.uuid,"/outputCollapsed"),(0,S.Od)("".concat(n,"/").concat(e.uuid,"/outputCollapsed")))}))}function Ft(e){return"".concat(e,"/").concat(S.kP)}function Ut(e){return(0,S.U2)(Ft(e),[])}function Ht(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function zt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ht(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ht(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Wt,Gt=function(e){var n=e.block,t=e.blockMetadata,i=e.buttonTabs,o=e.collapsed,l=e.contained,c=void 0===l||l,u=e.dynamicBlock,a=e.dynamicChildBlock,d=e.hasError,f=e.hasOutput,p=e.hideExtraInfo,h=e.isInProgress,m=e.mainContainerWidth,b=e.messages,j=e.openSidekickView,y=e.pipeline,O=e.runCount,C=e.runEndTime,E=e.runStartTime,w=e.selected,I=e.selectedTab,T=e.setCollapsed,R=e.setOutputBlocks,D=e.setSelectedOutputBlock,M=e.setSelectedTab,N=n.status,L=n.type,F=(0,s.useMemo)((function(){return(null===b||void 0===b?void 0:b.length)||0}),[b]),H=v.DA.EXECUTED===N||!h&&0===O&&F>=1||!h&&O>=1&&C>=E,z=(0,s.useState)(),W=z[0],G=z[1],V=(0,s.useState)(),Q=V[0],q=V[1];(0,s.useEffect)((function(){h||q(100)}),[h]);var Y=function(e){return Array.isArray(e)?e.join("\n"):e},K=(0,s.useMemo)((function(){return b.reduce((function(e,n){var t=e.at(-1);if(Qe.jU.includes(null===t||void 0===t?void 0:t.type)&&(null===t||void 0===t?void 0:t.type)===n.type&&!Y(null===n||void 0===n?void 0:n.data).match(wt)){if(Array.isArray(t.data))t.data.concat(n.data);else if("string"===typeof t.data){var i=Y(n.data)||"";t.data=[t.data,i].join("\n")}}else Qe.jU.includes(null===n||void 0===n?void 0:n.type)&&!Y(null===n||void 0===n?void 0:n.data).match(wt)?e.push(zt(zt({},n),{},{data:Y(n.data)})):e.push(zt({},n));return e}),[])}),[b]),J=(0,s.useMemo)((function(){return(0,P.jsx)(Ze.Z,{progress:Q})}),[Q]),ee=v.tf.DBT===(null===n||void 0===n?void 0:n.type),ne=(0,kt.Z)(d);(0,s.useEffect)((function(){ee&&!ne&&d&&M(Tt)}),[d,ne,ee,M]);var te=(0,s.useMemo)((function(){var e=function(e,n){var t=e.columns,i=e.index,r=e.rows,o=e.shape,l=n.borderTop,c=n.selected;return o&&G(o),r.length>=1&&(0,P.jsx)(xt.Z,{columns:t,disableScrolling:!c,index:i,maxHeight:60*$.iI,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!l,rows:r,width:m-(2+$.cd*$.iI*2+2+pn.nn)})},n=[],t=[],i=[];return null===K||void 0===K||K.forEach((function(o,l){var u=o.data,a=o.type;if(u&&0!==(null===u||void 0===u?void 0:u.length)){var s=[];s=(s=Array.isArray(u)?u:[u]).filter((function(e){return e}));var d=[];s.forEach((function(e){if(e&&"string"===typeof e){var n=e.split("\n");d.push.apply(d,(0,r.Z)(n))}else"object"===typeof d&&d.push(e)}));var f=d.length,p=[];d.forEach((function(n,r){var o,u={contained:c,first:0===l&&0===r,last:l===K.length-1&&r===f-1},s=l>=1;if("string"===typeof n&&n.match(Pt)){var d=n.split("\n"),h=[];d.forEach((function(e){if(e.match(Pt)){var t=e.split("[__internal_test__]"),r=t[t.length-1];(0,ue.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(wt)){var m=n.split("[__internal_output__]"),v=m[m.length-1],g=v.split("FloatProgress");if(m.length>=2&&(v=g[0]),(0,ue.Pb)(v)){var b=JSON.parse(v),x=b.data,j=b.type;if(Qe.Gi.TABLE===j){!0;var y=e(x,{borderTop:s,selected:w});t.push(y),ee||(o=y)}}}else if(a===Qe.Gi.TABLE){!0;var k=e((0,ue.Pb)(n)?JSON.parse(n):n,{borderTop:s,selected:w});t.push(k),ee||(o=k)}else if(Qe.jU.includes(a)){var Z,O=null===(Z=n)||void 0===Z?void 0:Z.split("\\n");o=(0,P.jsx)(_t,zt(zt({},u),{},{children:O.map((function(e){return(0,P.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,P.jsx)(bt(),{children:e})},e)}))}))}else if(a===Qe.Gi.TEXT_HTML)o=(0,P.jsx)(_t,zt(zt({},u),{},{children:(0,P.jsx)(Ot,{children:(0,P.jsx)(_.ZP,{dangerouslySetInnerHTML:{__html:n},monospace:!0})})}));else if(a===Qe.Gi.IMAGE_PNG)o=(0,P.jsx)("div",{style:{backgroundColor:"white"},children:(0,P.jsx)("img",{alt:"Image ".concat(l," from code output"),src:"data:image/png;base64, ".concat(n)})});else if(a===Qe.Gi.PROGRESS){var C=parseInt(n);q(C>90?90:C)}o&&p.push((0,P.jsx)("div",{children:o},"code-output-".concat(l,"-").concat(r)))}})),p.length>=1&&n.push(p)}})),h&&(null===y||void 0===y?void 0:y.type)===k.qL.PYSPARK&&n.unshift([(0,P.jsx)(_t,{contained:!0,children:(0,P.jsx)(Z.Z,{mt:1,children:J})},"progress_bar")]),{content:n,tableContent:t,testContent:i}}),[K,c,ee,h,m,y,J,w]),ie=te.content,re=te.tableContent,oe=te.testContent,le=(null===W||void 0===W?void 0:W[1])||0,ce=le>30?" (30 out of ".concat(le," columns displayed)"):"",ae=(0,s.useMemo)((function(){var e;if(ee&&I){var n=I.uuid;if(It.uuid===n)(null===re||void 0===re?void 0:re.length)>=1?e=re:h||(e=(0,P.jsx)(Z.Z,{px:2,py:1,children:(0,P.jsx)(_.ZP,{muted:!0,children:d?"Error, check logs.":"No preview to display yet, try running the block."})}));else if(Tt.uuid===n)(null===ie||void 0===ie?void 0:ie.length)>=1?e=ie:h||(e=(0,P.jsx)(Z.Z,{px:2,py:1,children:(0,P.jsx)(_.ZP,{muted:!0,children:d?"Error, check logs.":"No logs to display yet, try running the block."})}));else if(At.uuid===n){var r,o=null===t||void 0===t||null===(r=t.dbt)||void 0===r?void 0:r.sql;e=o?(0,P.jsx)(Ve.Z,{autoHeight:!0,language:A.SQL,padding:!0,readOnly:!0,value:o,width:"100%"}):null}else if(Rt.uuid===n){var l,c=null===t||void 0===t||null===(l=t.dbt)||void 0===l?void 0:l.lineage;e=c?(0,P.jsx)(jt.Z,{disabled:!0,enablePorts:!1,height:55*$.iI,pannable:w,pipeline:zt(zt({},y),{},{blocks:c}),zoomable:w}):null}}else e=ie;return(0,P.jsxs)(P.Fragment,{children:[i,e]})}),[t,i,ie,d,ee,h,y,w,I,re]);return i||f?(0,P.jsxs)(P.Fragment,{children:[c&&(0,P.jsxs)(Zt,{addBottomPadding:h&&(null===y||void 0===y?void 0:y.type)===k.qL.PYSPARK,blockType:L,dynamicBlock:u,dynamicChildBlock:a,executedAndIdle:H,hasError:d,selected:w,children:[!o&&(null===oe||void 0===oe?void 0:oe.length)>=1&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{py:2,children:(0,P.jsx)(_t,{contained:!0,children:oe.map((function(e,n){var t=e.error,i=e.message,r=e.stacktrace;return(0,P.jsxs)(Z.Z,{mt:n>=1?3:0,children:[(0,P.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,P.jsx)(bt(),{children:"".concat(i).concat(t?" "+t:"")})}),null===r||void 0===r?void 0:r.map((function(e){return(0,P.jsx)(_.ZP,{default:!0,monospace:!0,preWrap:!0,small:!0,children:(0,P.jsx)(bt(),{children:e})},e)}))]},i)}))})}),(0,P.jsx)(Z.Z,{mb:d?2:0,children:(0,P.jsx)(yt.Z,{medium:!0})})]}),!o&&ae]}),!c&&ae,H&&!p&&(0,P.jsxs)(Ct,{blockType:L,dynamicBlock:u,dynamicChildBlock:a,hasError:d,selected:w,children:[(0,P.jsx)(St,{}),(0,P.jsxs)(x.Z,{justifyContent:"space-between",children:[T&&(0,P.jsx)(He.Z,{alignItems:"center",px:1,children:(0,P.jsx)(g.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return T(!o)},transparent:!0,children:o?(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(X._M,{muted:!0,size:2*$.iI}),"\xa0",(0,P.jsx)(_.ZP,{default:!0,children:"Expand output"})]}):(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(X.Kh,{muted:!0,size:2*$.iI}),W&&(0,P.jsx)(Z.Z,{ml:2,children:(0,P.jsx)(_.ZP,{children:"".concat(W[0]," rows x ").concat(W[1]," columns").concat(ce)})})]})})}),(0,P.jsx)(Et,{children:(0,P.jsxs)(x.Z,{alignItems:"center",fullWidth:!0,justifyContent:"flex-end",children:[(0,P.jsx)(dn.Z,{appearAbove:!0,appearBefore:!0,block:!0,label:O>=1&&E?"Last run at ".concat(new Date(E.valueOf()).toLocaleString()):d?"Block executed with errors":"Block executed successfully",size:null,widthFitContent:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[O>=1&&Number(C)>Number(E)&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(_.ZP,{small:!0,children:[(Number(C)-Number(E))/1e3,"s"]}),(0,P.jsx)(Z.Z,{mr:1})]}),!d&&(0,P.jsx)(X.Jr,{size:2*$.iI,success:!0}),d&&(0,P.jsx)(B.Z,{danger:!0,size:2*$.iI,children:(0,P.jsx)(_.ZP,{bold:!0,monospace:!0,small:!0,children:"!"})})]})}),!d&&!v.Qj.includes(L)&&(0,P.jsx)(Z.Z,{pl:1,children:(0,P.jsx)(g.Z,{afterIcon:(0,P.jsx)(X.M0,{muted:!0,size:1.75*$.iI}),basic:!0,noPadding:!0,onClick:function(){!function(e,n){var t=Ut(e);t.includes(n)||(0,S.t8)(Ft(e),[].concat((0,r.Z)(t),[n]))}(null===y||void 0===y?void 0:y.uuid,n.uuid),null===j||void 0===j||j(U.DATA),null===R||void 0===R||R((function(e){return e.find((function(e){return e.uuid===n.uuid}))?e:(null===D||void 0===D||D(n),e.concat(n))}))},transparent:!0,children:(0,P.jsx)(_.ZP,{default:!0,children:"Expand table"})})})]})})]})]})]}):null},Vt="buckets",Qt="chart_style",qt="group_by",Yt="height",Kt="index",Xt="legend_labels",Jt="limit",$t="metrics",ei="time_interval",ni="width_percentage",ti="x",ii="y",ri="y_sort_order",oi="data_provider",li="data_provider_database",ci="data_provider_profile",ui="data_provider_schema",ai="data_provider_table",si="dbt_project_name",di="dbt_profile_target",fi="export_write_policy",pi="limit",hi="use_raw_sql",mi=[ti,ii];!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"}(Wt||(Wt={}));var vi,gi,bi=[Wt.BAR_CHART,Wt.HISTOGRAM,Wt.LINE_CHART,Wt.PIE_CHART,Wt.TABLE,Wt.TIME_SERIES_BAR_CHART,Wt.TIME_SERIES_LINE_CHART];!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(vi||(vi={})),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"}(gi||(gi={}));var xi,ji,yi,ki,Zi,_i,Oi,Ci,Ei,Si=[gi.AVERAGE,gi.COUNT,gi.COUNT_DISTINCT,gi.MAX,gi.MEDIAN,gi.MIN,gi.MODE,gi.SUM];!function(e){e.ASCENDING="ascending",e.DESCENDING="descending"}(xi||(xi={})),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"}(ji||(ji={})),function(e){e.COLUMNS="columns",e.METRICS="metrics",e.NUMBER="number"}(Ei||(Ei={}));var wi={noCode:[{label:function(){return"time column"},settings:{maxValues:1},type:Ei.COLUMNS,uuid:qt},{label:function(){return"time interval"},options:[ji.ORIGINAL,ji.SECOND,ji.MINUTE,ji.HOUR,ji.DAY,ji.WEEK,ji.MONTH,ji.YEAR],uuid:ei},{label:function(){return"metrics"},type:Ei.METRICS,uuid:$t}]},Pi=(yi={},(0,l.Z)(yi,Wt.BAR_CHART,{noCode:[{label:function(){return"group by columns"},type:Ei.COLUMNS,uuid:qt},{label:function(){return"metrics"},type:Ei.METRICS,uuid:$t},{autoRun:!0,label:function(){return"chart style"},options:[vi.HORIZONTAL,vi.VERTICAL],uuid:Qt},{autoRun:!0,label:function(){return"sort direction"},options:[null,xi.ASCENDING,xi.DESCENDING],uuid:ri}],code:[{label:function(){return"variable name of x-axis values"},monospace:!0,uuid:ti},{label:function(){return"variable name of y-axis values"},monospace:!0,uuid:ii}]}),(0,l.Z)(yi,Wt.HISTOGRAM,{noCode:[{label:function(){return"number column for chart"},settings:{maxValues:1},type:Ei.COLUMNS,uuid:qt},{autoRun:!0,label:function(){return"Number of buckets"},type:Ei.NUMBER,uuid:Vt}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:ti}]}),(0,l.Z)(yi,Wt.LINE_CHART,{noCode:[{label:function(){return"group by columns"},settings:{maxValues:1},type:Ei.COLUMNS,uuid:qt},{label:function(){return"metrics"},type:Ei.METRICS,uuid:$t}],code:[{label:function(){return"variable name of x-axis values"},monospace:!0,uuid:ti},{label:function(){return"variable name of y-axis values"},monospace:!0,uuid:ii},{label:function(){return"labels of lines in chart (comma separated)"},uuid:Xt}]}),(0,l.Z)(yi,Wt.PIE_CHART,{noCode:[{label:function(){return"column for chart"},settings:{maxValues:1},type:Ei.COLUMNS,uuid:qt},{autoRun:!0,label:function(){return"Number of slices"},type:Ei.NUMBER,uuid:Vt}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:ti}]}),(0,l.Z)(yi,Wt.TABLE,{noCode:[{label:function(){return"columns"},type:Ei.COLUMNS,uuid:qt},{label:function(){return"max number of rows"},type:Ei.NUMBER,uuid:Jt}],code:[{label:function(){return"variable name of columns"},monospace:!0,uuid:ti},{label:function(){return"variable name of rows"},monospace:!0,uuid:ii}]}),(0,l.Z)(yi,Wt.TIME_SERIES_BAR_CHART,wi),(0,l.Z)(yi,Wt.TIME_SERIES_LINE_CHART,wi),yi),Ii=(ki={},(0,l.Z)(ki,Wt.BAR_CHART,{configuration:function(e){var n;return n={},(0,l.Z)(n,ti,"x"),(0,l.Z)(n,ii,"y"),(0,l.Z)(n,Qt,vi.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,l.Z)(ki,Wt.HISTOGRAM,{configuration:function(e){var n;return n={},(0,l.Z)(n,Vt,10),(0,l.Z)(n,ti,"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,l.Z)(ki,Wt.LINE_CHART,{configuration:function(e){var n;return n={},(0,l.Z)(n,ti,"x"),(0,l.Z)(n,ii,"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,l.Z)(ki,Wt.PIE_CHART,{configuration:function(e){var n;return n={},(0,l.Z)(n,Vt,7),(0,l.Z)(n,ti,"x"),n},content:function(e){return"x = df_1[df_1.columns[0]]"}}),(0,l.Z)(ki,Wt.TABLE,{configuration:function(e){var n;return n={},(0,l.Z)(n,Jt,10),(0,l.Z)(n,ti,"x"),(0,l.Z)(n,ii,"y"),n},content:function(e){return"x = df_1.columns\ny = df_1.to_numpy()"}}),(0,l.Z)(ki,Wt.TIME_SERIES_BAR_CHART,{configuration:function(e){return(0,l.Z)({},ei,ji.ORIGINAL)}}),(0,l.Z)(ki,Wt.TIME_SERIES_LINE_CHART,{configuration:function(e){return(0,l.Z)({},ei,ji.ORIGINAL)}}),ki),Ti=(Ci={},(0,l.Z)(Ci,Wt.BAR_CHART,(Zi={},(0,l.Z)(Zi,ti,(function(){return"must be a list of booleans, dates, integers, floats, or strings."})),(0,l.Z)(Zi,ii,(function(){return"must be a list of lists containing integers or floats."})),Zi)),(0,l.Z)(Ci,Wt.HISTOGRAM,(0,l.Z)({},ti,(function(){return"must be a list of integers or floats."}))),(0,l.Z)(Ci,Wt.LINE_CHART,(_i={},(0,l.Z)(_i,ti,(function(){return"must be a list of integers or floats."})),(0,l.Z)(_i,ii,(function(){return"must be a list of lists containing integers or floats. Each list is a single line in the chart."})),_i)),(0,l.Z)(Ci,Wt.PIE_CHART,(0,l.Z)({},ti,(function(){return"must be a list of booleans, dates, integers, floats, or strings."}))),(0,l.Z)(Ci,Wt.TABLE,(Oi={},(0,l.Z)(Oi,ti,(function(){return"must be a list of strings."})),(0,l.Z)(Oi,ii,(function(){return"must be a list of lists containing booleans, dates, integers, floats, or strings."})),Oi)),Ci),Ai=[{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,l.Z)(n,ti,"columns_with_mising_values"),(0,l.Z)(n,ii,"percentage_of_missing_values"),(0,l.Z)(n,Qt,vi.HORIZONTAL),(0,l.Z)(n,ri,xi.DESCENDING),(0,l.Z)(n,"chart_type",Wt.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,l.Z)(n,ti,"columns"),(0,l.Z)(n,ii,"number_of_unique_values"),(0,l.Z)(n,Qt,vi.HORIZONTAL),(0,l.Z)(n,ri,xi.DESCENDING),(0,l.Z)(n,"chart_type",Wt.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,l.Z)(n,Yt,3e3),(0,l.Z)(n,Kt,"column_index"),(0,l.Z)(n,ti,"columns"),(0,l.Z)(n,ii,"rows"),(0,l.Z)(n,"chart_type",Wt.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,l.Z)(n,Yt,3e3),(0,l.Z)(n,Kt,"stats"),(0,l.Z)(n,ti,"headers"),(0,l.Z)(n,ii,"rows"),(0,l.Z)(n,"chart_type",Wt.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,l.Z)(n,Yt,3e3),(0,l.Z)(n,Kt,"stats"),(0,l.Z)(n,ti,"columns"),(0,l.Z)(n,ii,"rows"),(0,l.Z)(n,"chart_type",Wt.TABLE),n),content:"from mage_ai.data_cleaner.column_types.column_type_detector import infer_column_types\nimport statistics\n\n\ncolumns_and_types = infer_column_types(df_1).items()\ncolumns = [t[0] for t in columns_and_types]\nstats = ['Type', 'Missing values', 'Unique values', 'Min', 'Max', 'Mean', 'Median', 'Mode']\nrows = [[] for _ in stats]\n\nfor col, col_type in columns_and_types:\n series = df_1[col]\n min_value = None\n max_value = None\n mean = None\n median = None\n\n not_null = series[series.notnull()]\n\n if col_type.value in ['number', 'number_with_decimals']:\n count = len(not_null.index)\n if count >= 1:\n mean = round(not_null.sum() / count, 2)\n median = sorted(not_null)[int(count / 2)]\n min_value = round(series.min(), 2)\n max_value = round(series.max(), 2)\n else:\n min_value = not_null.astype(str).min()\n max_value = not_null.astype(str).max()\n\n _, mode = sorted(\n [(v, k) for k, v in not_null.value_counts().items()],\n reverse=True,\n )[0]\n\n for idx, value in enumerate([\n col_type.value,\n len(series[series.isna()].index),\n len(series.unique()),\n min_value,\n max_value,\n mean,\n median,\n mode,\n ]):\n rows[idx].append(value)\n"}}}];function Ri(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Di(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ri(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ri(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Mi=function(e){var n=e.addWidget,t=e.block,i=e.left,o=e.rightOffset,l=e.onClickCallback,c=e.open,u=e.parentRef,a=e.runBlock,d=e.topOffset,f=(0,s.useMemo)((function(){return bi.map((function(e){var i,r,o={configuration:{chart_type:e},language:t.language,type:v.tf.CHART,upstream_blocks:t?[t.uuid]:null},l=Ii[e],c=(null===l||void 0===l||null===(i=l.configuration)||void 0===i?void 0:i.call(l,o))||{},u=v.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,ue.vg)(e)},onClick:function(){return n(Di(Di({},o),{},{name:"".concat(s," ").concat((0,ue.Mp)()),configuration:Di(Di({},o.configuration),c),content:u}),{onCreateCallback:function(e){t&&v.t6.SQL!==t.language&&([v.DA.EXECUTED,v.DA.UPDATED].includes(t.status)?a({block:e,code:u,disableReset:!0}):a({block:t,runDownstream:!0}))}})},uuid:e}}))}),[bi,t,a]),p=(0,s.useMemo)((function(){return Ai.map((function(e){var i=e.label,r=Di(Di({},(0,e.widgetTemplate)({block:t})),{},{language:t.language,type:v.tf.CHART,upstream_blocks:t?[t.uuid]:null});return{label:i,onClick:function(){return n(r,{onCreateCallback:function(e){t&&v.t6.SQL!==t.language&&([v.DA.EXECUTED,v.DA.UPDATED].includes(t.status)?a({block:e,code:e.content,disableReset:!0}):a({block:t,runDownstream:!0}))}})},uuid:i()}}))}),[Ai,n,t,a]),h=[{isGroupingTitle:!0,label:function(){return"Custom charts"},uuid:"custom_charts"}].concat((0,r.Z)(f));return v.t6.SQL!==t.language&&h.push.apply(h,[{isGroupingTitle:!0,label:function(){return"Templates"},uuid:"chart_templates"}].concat((0,r.Z)(p))),(0,P.jsx)(L.Z,{items:h,left:i,onClickCallback:l,open:c,parentRef:u,rightOffset:o,topOffset:d,uuid:"CommandButtons/add_charts",width:25*$.iI})},Ni=t(40656),Li=N.default.svg.withConfig({displayName:"Convert__SVGStyle",componentId:"sc-fmw0vr-0"})([""]),Bi=function(e){var n=e.fill,t=e.opacity,i=e.size,r=void 0===i?Ni.C:i,o=e.style,l=e.viewBox,c=void 0===l?"0 0 12 12":l;return(0,P.jsxs)(Li,{fill:n,height:r,opacity:t,style:o,viewBox:c,width:r,children:[(0,P.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,P.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,P.jsx)("defs",{children:(0,P.jsxs)("linearGradient",{id:"paint0_linear_1332_60037",x1:"-.618557",y1:"-.000001",x2:"10.5709",y2:".83113",gradientUnits:"userSpaceOnUse",children:[(0,P.jsx)("stop",{stopColor:"#FFCC19"}),(0,P.jsx)("stop",{offset:".585938",stopColor:"#2ECDF7"}),(0,P.jsx)("stop",{offset:"1",stopColor:"#9E7BFF"})]})})]})},Fi=t(79749),Ui=t(54283);function Hi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function zi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Hi(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Hi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Wi=function(e,n){var t=(null===n||void 0===n?void 0:n.upstream_blocks)||[];return v.tf.CHART===e.type||v.tf.SCRATCHPAD===e.type||v.tf.CHART===(null===n||void 0===n?void 0:n.type)||v.tf.SCRATCHPAD===(null===n||void 0===n?void 0:n.type)||v.tf.DATA_LOADER===(null===n||void 0===n?void 0:n.type)&&v.tf.SENSOR!==e.type||t.push(e.uuid),t},Gi=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],v.tf.SCRATCHPAD===(null===(c=r)||void 0===c?void 0:c.type)&&(r=null),l-=1}return r&&o.push(r.uuid),v.Ut.map((function(n){return{label:function(){return"Convert to ".concat((0,ue.wX)(v.V4[n]))},onClick:function(){return i({converted_from_type:n,converted_from_uuid:e.uuid,type:n,upstream_blocks:o})},uuid:"".concat(t,"/convert_to/").concat(n)}}))},Vi=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,h=v.tf.DBT===(null===e||void 0===e?void 0:e.type),m=[];if(v.tf.EXTENSION===e.type);else{m.push({label:function(){return h?"Execute and run upstream blocks":"Execute with upstream blocks"},onClick:function(){return n({block:e,runUpstream:!0})},uuid:"execute_upstream"}),h||m.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=[];if(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])}))})),h&&m.unshift.apply(m,[{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"}]),h||!y||!f&&0!==Z.length||m.push({label:function(){return f?"Disable block as dynamic":"Set block as dynamic"},onClick:function(){return y({block:zi(zi({},e),{},{configuration:zi(zi({},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})))&&m.push({label:function(){return p?"Don\u2019t reduce output":"Reduce output"},onClick:function(){return y({block:zi(zi({},e),{},{configuration:zi(zi({},c),{},{reduce_output:!p})})})},uuid:"reduce_output"});m.push({label:function(){return a?"Remove callback":"Add callback"},onClick:function(){return y({block:zi(zi({},e),{},{has_callback:!a})}).then((function(){x(),j()}))},uuid:"has_callback"})}return m.push({label:function(){return"Delete block"},onClick:function(){t(e),i(!1)},uuid:"delete_block"}),r?[m.pop()]:m};function Qi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function qi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Qi(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Qi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Yi,Ki=function(e){var n=e.addNewBlock,t=e.addWidget,i=e.block,r=e.blocks,l=e.deleteBlock,c=e.executionState,u=e.fetchFileTree,a=e.fetchPipeline,f=e.interruptKernel,p=e.pipeline,h=e.runBlock,m=e.savePipelineContent,b=e.setErrors,j=e.setOutputCollapsed,y=(e.visible,i.all_upstream_blocks_executed),O=void 0===y||y,E=i.color,S=i.type,w=i.uuid,I=(0,s.useRef)(null),T=(0,s.useRef)(null),A=(0,s.useRef)(null),R=(0,s.useRef)(null),D=null===p||void 0===p?void 0:p.type,M=(0,s.useState)(!1),F=M[0],U=M[1],H=(0,s.useState)(!1),z=H[0],W=H[1],G=(0,s.useState)(!1),V=G[0],Q=G[1],q=(0,s.useState)(!1),Y=q[0],K=q[1],J=(0,s.useContext)(N.ThemeContext),ne=Qe.uF.IDLE!==c,te=(0,ce.qn)(S,{blockColor:E,theme:J}).accent,ie=D===k.qL.STREAMING,re=(0,s.useMemo)((function(){return Gi(i,r,"CommandButtons",n).map((function(e){return qi(qi({},e),{},{onClick:function(){return m().then((function(){return e.onClick()}))}})}))}),[n,i,r,m]),oe=(0,s.useMemo)((function(){return(0,ee.HK)(r,(function(e){return e.uuid}))}),[r]),le=(0,s.useMemo)((function(){return v.tf.DBT===(null===i||void 0===i?void 0:i.type)}),[i]),ue=(0,d.Db)(be.ZP.pipelines.useUpdate(null===p||void 0===p?void 0:p.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){a()},onErrorCallback:function(e,n){return b({errors:n,response:e})}})}}),ae=(0,o.Z)(ue,2),se=ae[0];return ae[1].isLoading,(0,P.jsxs)(x.Z,{alignItems:"center",children:[Qe.uF.QUEUED===c&&(0,P.jsx)(Ui.Z,{color:(J||Oe.Z).content.active,type:"cylon"}),Qe.uF.BUSY===c&&(0,P.jsx)(Ui.Z,{color:(J||Oe.Z).content.active}),h&&!ne&&!ie&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(dn.Z,{appearBefore:!0,default:!0,label:(0,P.jsxs)(_.ZP,{children:[le?"Compile and preview data":"Run block","\xa0 \xa0",(0,P.jsx)(Fi.Z,{inline:!0,keyTextGroups:[[ln()?C.RJ:C.hE,C.Lz]],monospace:!0,uuidForKey:w})]}),size:3*$.iI,widthFitContent:!0,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){O?h({block:i}):Q(!0)},children:(0,P.jsx)(B.Z,{color:te,size:3*$.iI,children:(0,P.jsx)(X.Py,{black:!0,size:1.5*$.iI})})})}),(0,P.jsx)(tn.Z,{disableEscape:!0,onClickOutside:function(){return Q(!1)},open:V,children:(0,P.jsx)(L.Z,{items:[{label:function(){return"Execute block"},onClick:function(){return h({block:i})},uuid:"execute_block"},{label:function(){return"Execute with upstream blocks"},onClick:function(){return h({block:i,runUpstream:!0})},uuid:"execute_upstream"}],onClickCallback:function(){return Q(!1)},open:V,parentRef:A,rightOffset:13.25*$.iI,topOffset:4.5*$.iI,uuid:"execute_actions",width:25*$.iI})})]}),ne&&(0,P.jsx)(Z.Z,{ml:$.cd,children:(0,P.jsx)(dn.Z,{appearBefore:!0,default:!0,label:(0,P.jsxs)(_.ZP,{children:["Interrupt kernel \xa0 \xa0",(0,P.jsx)(Fi.Z,{inline:!0,keyTextGroups:[[C.kA],[C.kA]],monospace:!0,uuidForKey:w})]}),size:2.5*$.iI,widthFitContent:!0,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return f()},children:(0,P.jsx)(B.Z,{borderSize:1.5,size:2.5*$.iI,children:(0,P.jsx)(X.x8,{size:1*$.iI})})})})}),v.tf.SCRATCHPAD===i.type&&!ie&&(0,P.jsx)(Z.Z,{ml:$.cd,children:(0,P.jsx)(Hn.Z,{items:re,onClickCallback:function(){return W(!1)},onClickOutside:function(){return W(!1)},open:z,parentRef:T,rightOffset:0,topOffset:4,uuid:"CommandButtons/convert_block",children:(0,P.jsx)(dn.Z,{appearBefore:!0,default:!0,label:(0,P.jsx)(_.ZP,{children:"Convert block"}),size:2.5*$.iI,widthFitContent:!0,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return W(!z)},ref:T,children:(0,P.jsx)(Bi,{size:2.5*$.iI})})})})}),[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(i.type)&&!ie&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{ml:$.cd,ref:I,children:(0,P.jsx)(dn.Z,{appearBefore:!0,default:!0,label:"Add chart",size:2.25*$.iI,widthFitContent:!0,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return U((function(e){return!e}))},children:(0,P.jsx)(X.er,{size:2.25*$.iI})})})}),t&&(0,P.jsx)(tn.Z,{disableEscape:!0,onClickOutside:function(){return U(!1)},open:F,children:(0,P.jsx)(Mi,{addWidget:t,block:i,onClickCallback:function(){return U(!1)},open:F,parentRef:I,rightOffset:9*$.iI,runBlock:h,topOffset:2*$.iI})})]}),(0,P.jsx)("div",{ref:R,children:(0,P.jsx)(Z.Z,{ml:$.cd,children:(0,P.jsx)(dn.Z,{appearBefore:!0,default:!0,label:(0,P.jsx)(_.ZP,{children:"More actions"}),size:2.5*$.iI,widthFitContent:!0,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return K((function(e){return!e}))},children:(0,P.jsx)(B.Z,{borderSize:1.5,size:2.5*$.iI,children:(0,P.jsx)(X.mH,{size:$.iI})})})})})}),(0,P.jsx)(tn.Z,{disableEscape:!0,onClickOutside:function(){return K(!1)},open:Y,children:(0,P.jsx)(L.Z,{items:Vi(i,h,l,j,ie,{blocksMapping:oe,fetchFileTree:u,fetchPipeline:a,savePipelineContent:m,updatePipeline:se}),onClickCallback:function(){return K(!1)},open:Y,parentRef:R,rightOffset:4.75*$.iI,topOffset:2*$.iI,uuid:"FileHeaderMenu/file_items"})})]})};!function(e){e.APPEND="append",e.FAIL="fail",e.REPLACE="replace"}(Yi||(Yi={}));var Xi,Ji=[Yi.APPEND,Yi.FAIL,Yi.REPLACE];!function(e){e.BIGQUERY="bigquery",e.MYSQL="mysql",e.POSTGRES="postgres",e.REDSHIFT="redshift",e.SNOWFLAKE="snowflake"}(Xi||(Xi={}));var $i,er=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"}($i||($i={}));var nr=t(5677);function tr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ir(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?tr(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):tr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function rr(e,n){var t=e;t.includes("__init__")||t.push("__init__");var i,r=t.length;return(0,ee.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 or(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 lr(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 cr(e){var n=e.autocompleteItems,t=e.block,i=e.blocks,l=e.pipeline,c=t.type,u=t.upstream_blocks,a=(0,ee.HK)(n,(function(e){return e.id}));return function(t){return function(s,d){var f=[],p=s.getValueInRange({endColumn:d.column,endLineNumber:d.lineNumber,startColumn:1,startLineNumber:1}),h=s.getWordUntilPosition(d),m=h.endColumn,g=h.startColumn,b={endColumn:m,endLineNumber:d.lineNumber,startColumn:g,startLineNumber:d.lineNumber},x=function(e,n,t){var i=(0,nr.Yn)(e),r=(0,nr.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,nr.S0)(e)[l];if(c){var u,a=rr(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,nr.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=lr(h,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,nr.M4)(e,n);if(i=i.match(/([\w_]+)./)){var r=(0,nr.S0)(e)[i[1]];if(r){var o=rr(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=lr(h,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,r.Z)(lr(h,function(e,n,t){var i=t.block,r=t.blocks,o=i.upstream_blocks,l=(0,ee.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(h.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,l=(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([$i.MAGE_LIBRARY,$i.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"===l,d="f"===l,f=s?"import":d?"from":"",p=(0,nr.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,o.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,r.Z)(c).map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.File,label:e,range:i}})).concat(Object.entries(u).map((function(e){var n=(0,o.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:ir({},i)}})))}(n,p,h,t,b,e);f.push.apply(f,(0,r.Z)(_))}if(v.tf.CHART===c||v.tf.SCRATCHPAD===c){var O=[];if(v.tf.CHART===c?u.forEach((function(e,n){O.push({block:i.find((function(n){var t=n.uuid;return e===t})),matchIndex:0,variableName:"df_".concat(n+1)})})):v.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,l).forEach((function(e){var n=e.block,t=e.regex,i=p.matchAll(t);(0,r.Z)(i).forEach((function(e){var t=null===e||void 0===e?void 0:e.index,i=null===e||void 0===e?void 0:e[1];i&&O.push({block:n,matchIndex:t,variableName:i})}))})),O.length>=1){var C,E=null===(C=p.split("\n")[d.lineNumber-1])||void 0===C?void 0:C.slice(0,h.startColumn-1);if(E){var S=[];if(O.forEach((function(e){var n=e.block,i=e.matchIndex,r=e.variableName,o=new RegExp("".concat(r,"\\["));E.match(o)&&S.push({items:or(t,b,n),matchIndex:i})})),S.length>=1)return{suggestions:lr(h,(0,ee.YC)(S,"matchIndex",{ascending:!1})[0].items)}}}1===g&&(v.tf.CHART===c?f.push.apply(f,(0,r.Z)(lr(h,u.map((function(e,n){var i="df_".concat(n+1);return{label:"".concat(i," ").concat(e," block"),kind:t.languages.CompletionItemKind.Snippet,insertText:i,range:b}}))))):v.tf.SCRATCHPAD===c&&f.push.apply(f,(0,r.Z)(lr(h,function(e,n,t){var i=t.block,r=t.blocks,o=t.pipeline;return r.reduce((function(t,r){var l=r.type,c=r.uuid;return i.uuid!==c&&[v.tf.DATA_LOADER,v.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 w=new Set;i.concat({content:p}).forEach((function(e){var n=e.content;(0,r.Z)(n.matchAll("([A-Za-z_0-9]+)","g")).forEach((function(e){return w.add(e[1])}))}));var P=(0,r.Z)(w);if(P.length){var I=P.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Variable,label:e,range:b}}));f.push.apply(f,(0,r.Z)(lr(h,I)))}return{suggestions:f}}}}var ur=t(32365),ar=t(80636),sr=t(25958),dr=t(66653),fr=t(87323);function pr(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 hr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?pr(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function mr(e,n){var t,i,c,u,a,f,p=e.addNewBlock,h=e.addNewBlockMenuOpenIdx,m=e.addWidget,j=e.autocompleteItems,y=e.block,E=e.blockIdx,I=e.blockRefs,T=e.blocks,A=e.dataProviders,R=e.defaultValue,D=void 0===R?"":R,M=e.deleteBlock,L=e.executionState,F=e.extraContent,U=e.fetchFileTree,H=e.fetchPipeline,z=e.height,W=e.hideRunButton,G=e.interruptKernel,V=e.mainContainerRef,Q=e.mainContainerWidth,q=e.messages,Y=void 0===q?[]:q,K=e.noDivider,J=e.onCallbackChange,ne=e.onChange,te=e.onClickAddSingleDBTModel,ie=e.openSidekickView,re=e.pipeline,oe=e.runBlock,le=e.runningBlocks,ae=e.savePipelineContent,se=e.selected,de=e.setAddNewBlockMenuOpenIdx,fe=e.setAnyInputFocused,pe=e.setCreatingNewDBTModel,he=e.setEditingBlock,me=e.setErrors,ve=e.setOutputBlocks,ge=e.setRecsWindowOpenBlockIdx,ye=e.setSelected,ke=e.setSelectedOutputBlock,Ze=e.setTextareaFocused,_e=e.textareaFocused,Oe=e.widgets,Ce=(0,s.useContext)(N.ThemeContext),Ee=(0,s.useState)(!1),Se=Ee[0],we=Ee[1],Pe=(0,s.useState)(null),Ie=Pe[0],Te=Pe[1],Ae=(0,s.useState)(!1),Re=Ae[0],De=Ae[1],Me=(0,s.useState)(!1),Ne=Me[0],Le=Me[1],Be=(0,s.useState)(D),Fe=Be[0],Ue=Be[1],ze=(0,s.useState)(null),We=ze[0],Ge=ze[1],qe=(0,s.useMemo)((function(){return(null===y||void 0===y?void 0:y.configuration)||{}}),[y]),Ye=(0,s.useState)((t={},(0,l.Z)(t,oi,qe.data_provider),(0,l.Z)(t,li,qe.data_provider_database),(0,l.Z)(t,ci,qe.data_provider_profile),(0,l.Z)(t,ui,qe.data_provider_schema),(0,l.Z)(t,ai,qe.data_provider_table),(0,l.Z)(t,di,qe.dbt_profile_target),(0,l.Z)(t,si,qe.dbt_project_name),(0,l.Z)(t,fi,qe.export_write_policy||Yi.APPEND),(0,l.Z)(t,pi,qe.limit),(0,l.Z)(t,hi,!!qe.use_raw_sql),t)),Ke=Ye[0],Je=Ye[1],$e=(0,s.useState)(null),en=$e[0],nn=$e[1],tn=(0,s.useState)(!1),rn=tn[0],on=tn[1],ln=(0,s.useState)(y.uuid),cn=ln[0],un=ln[1],an=(0,s.useState)(!1),fn=an[0],pn=an[1],hn=(0,s.useState)(0),mn=hn[0],vn=hn[1],gn=(0,s.useState)(null),bn=gn[0],xn=gn[1],jn=(0,s.useState)(null),yn=jn[0],kn=jn[1],Zn=(0,s.useState)(Y),_n=Zn[0],On=Zn[1],Cn=(0,s.useState)(Dt[0]),En=Cn[0],Sn=Cn[1],wn=k.qL.STREAMING===(null===re||void 0===re?void 0:re.type),Pn=v.tf.DBT===(null===y||void 0===y?void 0:y.type),Tn=v.t6.SQL===(null===y||void 0===y?void 0:y.language),An=v.t6.R===(null===y||void 0===y?void 0:y.language),Rn=y.callback_content,Dn=y.has_callback,Mn=(0,s.useState)(Rn),Nn=Mn[0],Ln=Mn[1];(0,s.useEffect)((function(){Rn!==Nn&&Ln(Rn)}),[Nn,Rn]);var Bn=(0,kt.Z)(y);(0,s.useEffect)((function(){if(JSON.stringify(y)!=JSON.stringify(Bn)){var e,n=Lt([y]).messages,t=null===n||void 0===n||null===(e=n[null===y||void 0===y?void 0:y.type])||void 0===e?void 0:e[null===y||void 0===y?void 0:y.uuid];(null===t||void 0===t?void 0:t.length)>=1&&On(t)}}),[y,Bn,On]);var Fn=(0,kt.Z)(Y);(0,s.useEffect)((function(){"undefined"!==typeof Y&&Y.length!==(null===Fn||void 0===Fn?void 0:Fn.length)&&On(Y)}),[Y,Fn,On]);var Un=(0,s.useMemo)((function(){var e=new Set;return null===A||void 0===A||A.forEach((function(n){var t=n.profiles;e=new Set([].concat((0,r.Z)(e),(0,r.Z)(t)))})),(0,r.Z)(e)}),[A]),zn=(0,s.useMemo)((function(){return"".concat(null===re||void 0===re?void 0:re.uuid,"/").concat(null===y||void 0===y?void 0:y.uuid,"/codeCollapsed")}),[null===re||void 0===re?void 0:re.uuid,null===y||void 0===y?void 0:y.uuid]),Wn=(0,s.useMemo)((function(){return"".concat(null===re||void 0===re?void 0:re.uuid,"/").concat(null===y||void 0===y?void 0:y.uuid,"/outputCollapsed")}),[null===re||void 0===re?void 0:re.uuid,null===y||void 0===y?void 0:y.uuid]);(0,s.useEffect)((function(){Le((0,S.U2)(zn,!1)),pn((0,S.U2)(Wn,!1))}),[zn,Wn]);var Gn=(0,s.useRef)(null),Vn=(0,s.useMemo)((function(){return(0,ee.HK)(T,(function(e){return e.uuid}))}),[T]),Qn=(0,s.useMemo)((function(){return!(null===Oe||void 0===Oe||!Oe.find((function(e){return e.upstream_blocks.includes(y.uuid)})))}),[y,Oe]),qn=(0,s.useCallback)((function(e){var n=e||{},t=n.block,i=n.code,r=n.disableReset,o=n.runDownstream,l=n.runSettings,c=n.runUpstream,u=n.runTests;if(null===u||"undefined"===typeof u){var a=(t||{}).type;u=[v.tf.DATA_LOADER,v.tf.DATA_EXPORTER,v.tf.TRANSFORMER].includes(a)}oe({block:t,code:i||Fe,runDownstream:o||Qn,runSettings:l,runTests:u||!1,runUpstream:c||!1}),r||(vn(1+Number(mn)),xn(null),pn(!1))}),[Fe,Qn,mn,oe,vn,xn]),Yn=!(null===le||void 0===le||!le.find((function(e){return e.uuid===y.uuid})))||(null===_n||void 0===_n?void 0:_n.length)>=1&&L!==Qe.uF.IDLE;(0,s.useEffect)((function(){Yn&&kn(Number(new Date))}),[Yn,kn]);var Xn=(0,kt.Z)(L);(0,s.useEffect)((function(){L===Qe.uF.IDLE&&L!==Xn&&xn(Number(new Date))}),[L,Xn,xn]);var Jn=(0,s.useCallback)((function(e){var n=e.editorRect,t=(n.height,n.top),i=e.position.lineNumber;if(null!==V&&void 0!==V&&V.current){var r=V.current.getBoundingClientRect().height,o=i*ur.aU;if(t+o>r){var l=V.current.scrollTop+(o-r+t);V.current.scrollTo(0,l)}else if(o+t<ur.aU){var c=V.current.scrollTop+(o+t-ur.aU);V.current.scrollTo(0,c)}}}),[V]),$n=(0,s.useMemo)((function(){return(null===en||void 0===en?void 0:en.length)>=0?en.map((function(e){return{data:e,execution_state:Qe.uF.IDLE,type:Qe.Gi.TEXT_PLAIN}})):_n.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[en,_n]),et=!!$n.find((function(e){return e.error})),nt=(0,ce.qn)(y.type,{blockColor:y.color,theme:Ce}).accent,tt=(null===y||void 0===y||null===(i=y.upstream_blocks)||void 0===i?void 0:i.length)||0,it=(0,fr.cU)([y],T)[0],rt=it.dynamic,ot=it.dynamicUpstreamBlock,lt=it.reduceOutput,ct=it.reduceOutputUpstreamBlock,ut=(0,s.useMemo)((function(){var e=[];rt&&e.push({title:"Dynamic",description:"This block will create N blocks for each of its downstream blocks."});var n=ot&&!ct;return n&&(e.push({title:"Dynamic child",description:"This block is dynamically created by its upstream parent block that is dynamic."}),lt&&e.push({title:"Reduce output",description:"Reduce output from all dynamically created blocks into a single array output."})),{borderColorShareProps:{blockColor:null===y||void 0===y?void 0:y.color,blockType:null===y||void 0===y?void 0:y.type,dynamicBlock:rt,dynamicChildBlock:n,hasError:et,selected:se},tags:e}}),[null===y||void 0===y?void 0:y.color,null===y||void 0===y?void 0:y.type,rt,ot,et,lt,ct,se]),at=ut.borderColorShareProps,ft=ut.tags,pt=$n.length>=1,gt=(0,s.useCallback)((function(){se||(null===fe||void 0===fe||fe(!1),null===ye||void 0===ye||ye(!0))}),[se,fe,ye]),bt=be.ZP.blocks.pipelines.detail(null===re||void 0===re?void 0:re.uuid,Rt.uuid===(null===En||void 0===En?void 0:En.uuid)||At.uuid===(null===En||void 0===En?void 0:En.uuid)?encodeURIComponent(null===y||void 0===y?void 0:y.uuid):null,{_format:"dbt"},{revalidateOnFocus:!0}),xt=bt.data,jt=bt.mutate,Zt=(0,s.useMemo)((function(){var e;return(null===xt||void 0===xt||null===(e=xt.block)||void 0===e?void 0:e.metadata)||{}}),[xt]),_t=(0,d.Db)(be.ZP.blocks.pipelines.useUpdate(null===re||void 0===re?void 0:re.uuid,y.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){on(!1),H(),U(),Ue(Fe)},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})},onError:function(e){var n=(0,je.qQ)(e).messages;nn(n)}}),Ot=(0,o.Z)(_t,1)[0],Ct="CodeBlock/".concat(y.uuid),Et=(0,Xe.y)(),St=Et.registerOnKeyDown,wt=Et.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){wt(Ct)}}),[wt,Ct]),St(Ct,(function(e,n,t){rn&&String(t[0])===String(C.Uq)&&String(t[1])!==String(C.zX)?y.uuid===cn?e.target.blur():Ot({block:hr(hr({},y),{},{name:cn})}):se&&!W&&((0,w.y)([C.zX,C.Uq],n)||(0,w.y)([C.PQ,C.Uq],n)?qn({block:y}):(0,w.y)([C.XR,C.Uq],n)&&p&&(e.preventDefault(),p({language:y.language,type:y.type,upstream_blocks:[y.uuid]}),qn({block:y})))}),[p,y,W,rn,cn,qn,se,Ot]),(0,s.useEffect)((function(){var e;return yn&&(e=setInterval((function(){return Ge(Number(new Date))}),1e3)),function(){return clearInterval(e)}}),[yn]);var Pt=(0,s.useCallback)((function(e){return(0,l.Z)({},v.tf.SCRATCHPAD,(0,r.Z)(Gi(e,T,"block_menu/scratchpad",p)).map((function(e){return hr(hr({},e),{},{onClick:function(){return ae().then((function(){return e.onClick()}))}})})))[e.type]}),[p,T,ae]),It=(0,s.useMemo)((function(){var e;return(null===y||void 0===y||null===(e=y.metadata)||void 0===e?void 0:e.dbt)||{project:null,projects:{}}}),[y]),Tt=(0,s.useMemo)((function(){return It.projects||{}}),[It]),Mt=(0,s.useMemo)((function(){return It.project||Ke.dbt_project_name}),[Ke,It]),Nt=(0,s.useMemo)((function(){return Tt[Mt]||{target:null,targets:[]}}),[Mt,Tt]),Bt=(0,s.useMemo)((function(){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ve.Z,{autoHeight:!0,autocompleteProviders:Ie,height:z,language:y.language,onChange:function(e){Ue(e),null===ne||void 0===ne||ne(e)},onDidChangeCursorPosition:Jn,placeholder:v.tf.DBT===y.type&&v.t6.YAML===y.language?"e.g. --select ".concat(Mt||"project","/models --exclude ").concat(Mt||"project","/models/some_dir"):"Start typing here...",selected:se,setSelected:ye,setTextareaFocused:Ze,shortcuts:[function(e,n){return(0,ar.Q)(e,(function(){W||qn({block:y,code:n.getValue()})}))}],textareaFocused:_e,value:Fe,width:"100%"}),Dn&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(yt.Z,{}),(0,P.jsxs)(Z.Z,{mt:1,children:[(0,P.jsxs)(ce.y9,{children:[(0,P.jsx)(_.ZP,{small:!0,children:"Callback block: define @on_success or @on_failure callbacks for this block."}),(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["kwargs",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:" \u2192 "}),"global variables"]})]}),(0,P.jsx)(Ve.Z,{autoHeight:!0,autocompleteProviders:Ie,language:"python",onChange:function(e){Ln(e),null===J||void 0===J||J(e)},onDidChangeCursorPosition:Jn,placeholder:"Start typing here...",selected:se,setSelected:ye,setTextareaFocused:Ze,textareaFocused:_e,value:Nn,width:"100%"})]})]})]})}),[Ie,y,Nn,Fe,Mt,Dn,z,W,J,ne,Jn,qn,se,Ue,ye,Ze,_e]);(0,s.useEffect)((function(){Te({python:cr({autocompleteItems:j,block:y,blocks:T,pipeline:re})})}),[j,y,T,re]);var Ft=(0,s.useMemo)((function(){return Pn?(0,P.jsx)(Z.Z,{py:1,children:(0,P.jsx)(vt.Z,{onClickTab:function(e){Sn(e),Rt.uuid!==e.uuid&&At.uuid!==e.uuid||jt()},selectedTabUUID:null===En||void 0===En?void 0:En.uuid,small:!0,tabs:Dt})}):null}),[jt,Pn,En]),Ut=(0,s.useMemo)((function(){return(0,P.jsx)(Gt,hr(hr({},at),{},{block:y,blockMetadata:Zt,buttonTabs:Ft,collapsed:fn,hasOutput:pt,isInProgress:Yn,mainContainerWidth:Q,messages:$n,openSidekickView:ie,pipeline:re,runCount:mn,runEndTime:bn,runStartTime:yn,selected:se,selectedTab:En,setCollapsed:function(e){pn((function(){return(0,S.t8)(Wn,e),e}))},setOutputBlocks:ve,setSelectedOutputBlock:ke,setSelectedTab:Sn}))}),[y,Zt,at,Ft,pt,Yn,Q,$n,ie,fn,Wn,re,mn,bn,yn,se,En,ve,pn,ke]),Ht=(0,s.useCallback)((function(){return De(!1)}),[]),zt=(0,s.useCallback)((function(e){Je((function(n){var t=hr(hr({},n),e);return(t.data_provider&&t.data_provider_profile||t.dbt_profile_target||t.dbt_project_name||t.limit)&&ae({block:{configuration:t,uuid:y.uuid}}),t}))}),[y,ae]),Wt=Kn.BIGQUERY===Ke.data_provider||Kn.SNOWFLAKE===Ke.data_provider,Vt=(0,s.useMemo)((function(){return(null===T||void 0===T?void 0:T.length)||0}),[T]);return(0,P.jsxs)("div",{ref:n,style:{position:"relative",zIndex:E===h?Vt+9:null},children:[(0,P.jsxs)("div",{style:{position:"relative"},children:[(0,P.jsx)(ce.nz,hr(hr({},at),{},{onClick:function(){return gt()},zIndex:Vt+1-(E||0),children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{alignItems:"center",flex:1,children:[(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(mt.Z,{children:v.dO[y.language]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(B.Z,{color:nt,size:1.5*$.iI,square:!0}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(Hn.Z,{items:Pt(y),onClickCallback:Ht,onClickOutside:Ht,open:Re,parentRef:Gn,uuid:"CodeBlock/block_menu",children:(0,P.jsx)(_.ZP,{color:nt,monospace:!0,children:null===(c=Pn?v.tf.DBT:v.V4[y.type])||void 0===c?void 0:c.toUpperCase()})}),v.tf.SCRATCHPAD===y.type&&(0,P.jsxs)(P.Fragment,{children:["\xa0",(0,P.jsx)(g.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return De(!0)},transparent:!0,children:(0,P.jsx)(X.K5,{muted:!0})})]}),(0,P.jsx)(Z.Z,{mr:1})]}),(0,P.jsx)(Z.Z,{mr:$.cd}),(0,P.jsx)(X.iU,{size:1.5*$.iI}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(x.Z,{alignItems:"center",children:[Pn&&v.t6.YAML!==y.language&&(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,children:(0,sr.$)(y,{fullPath:!0})}),(!Pn||v.t6.YAML===y.language)&&(0,P.jsx)(In,{bold:!1,inputValue:cn,monospace:!0,muted:!0,notRequired:!0,onBlur:function(){return setTimeout((function(){fe(!1),on(!1)}),300)},onChange:function(e){un(e.target.value),e.preventDefault()},onClick:function(){fe(!0),on(!0)},onFocus:function(){fe(!0),on(!0)},stacked:!0,value:!rn&&y.uuid}),rn&&!Pn&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(sn.Z,{onClick:function(){return ae({block:{name:cn,uuid:y.uuid}}).then((function(){on(!1),H(),U()}))},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]}),(0,P.jsx)(Z.Z,{mr:2}),!v.iZ.includes(y.type)&&(0,P.jsx)(dn.Z,{appearBefore:!0,block:!0,label:"\n ".concat((0,ue._6)("parent block",tt),". ").concat(0===tt?"Click to select 1 or more blocks to depend on.":"Edit parent blocks.","\n "),size:null,widthFitContent:tt>=1,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){var e;ye(!0),he({upstreamBlocks:{block:y,values:null===(e=y.upstream_blocks)||void 0===e?void 0:e.map((function(e){return{uuid:e}}))}})},children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsxs)(_.ZP,{monospace:tt>=1,small:tt>=1,underline:0===tt,children:[0===tt&&"Edit parent blocks",tt>=1&&(0,ue._6)("parent block",tt)]}),(0,P.jsx)(Z.Z,{mr:1}),0===tt&&(0,P.jsx)(X.Jj,{size:3*$.iI}),tt>=1&&(0,P.jsx)(X.eV,{size:3*$.iI})]})})})]}),(0,P.jsx)(Ki,{addNewBlock:p,addWidget:m,block:y,blocks:T,deleteBlock:M,executionState:L,fetchFileTree:U,fetchPipeline:H,interruptKernel:G,pipeline:re,runBlock:W?null:qn,savePipelineContent:ae,setErrors:me,setOutputCollapsed:pn,visible:se||Yn}),(0,P.jsx)(Z.Z,{px:1,children:(0,P.jsx)(g.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){Le((function(e){return(0,S.t8)(zn,!e),!e})),Ne||pn((function(){return(0,S.t8)(Wn,!0),!0}))},transparent:!0,children:Ne?(0,P.jsx)(X._M,{muted:!0,size:2*$.iI}):(0,P.jsx)(X.Kh,{muted:!0,size:2*$.iI})})})]})})),(0,P.jsxs)(ce.Nk,{onClick:function(){return gt()},children:[(0,P.jsxs)(ce.jv,hr(hr({},at),{},{className:se&&_e?"selected":null,hasOutput:!!Ft||pt,children:[v.tf.DBT===y.type&&!Ne&&(0,P.jsxs)(ce.y9,{children:[(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{alignItems:"center",children:[v.t6.YAML===y.language&&(0,P.jsxs)(er.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){fe(!1)}),300)},onChange:function(e){var n;zt((n={},(0,l.Z)(n,di,""),(0,l.Z)(n,si,e.target.value),n)),e.preventDefault()},onClick:dr.j,onFocus:function(){fe(!0)},placeholder:"Project",small:!0,value:Ke.dbt_project_name||"",children:[(0,P.jsx)("option",{value:""}),Object.keys(Tt||{}).map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]}),v.t6.YAML!==y.language&&(0,P.jsx)(_.ZP,{monospace:!0,small:!0,children:Mt}),(0,P.jsx)(Z.Z,{mr:2}),(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Target"}),(0,P.jsx)("span",{children:"\xa0"}),(0,P.jsxs)(er.Z,{compact:!0,disabled:!Mt,monospace:!0,onBlur:function(){return setTimeout((function(){fe(!1)}),300)},onChange:function(e){zt((0,l.Z)({},di,e.target.value)),e.preventDefault()},onClick:dr.j,onFocus:function(){fe(!0)},placeholder:Mt?Tn?null===Nt||void 0===Nt?void 0:Nt.target:null:"Select project first",small:!0,value:Ke.dbt_profile_target||"",children:[(0,P.jsx)("option",{value:""}),null===(u=Nt.targets)||void 0===u?void 0:u.map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]})]}),v.t6.YAML!==y.language&&(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(dn.Z,{appearBefore:!0,block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["Limit the number of results that are returned when running this block in the notebook.",(0,P.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,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(X.kI,{muted:!0}),(0,P.jsx)("span",{children:"\xa0"}),(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Sample limit"}),(0,P.jsx)("span",{children:"\xa0"})]})}),(0,P.jsx)(O.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){fe(!1)}),300)},onChange:function(e){zt((0,l.Z)({},pi,e.target.value)),e.preventDefault()},onClick:dr.j,onFocus:function(){fe(!0)},small:!0,type:"number",value:Ke.limit||"",width:10*$.iI}),(0,P.jsx)(Z.Z,{mr:5})]})]}),v.t6.YAML===y.language&&(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsxs)(He.Z,{flex:1,children:[(0,P.jsxs)(_.ZP,{monospace:!0,default:!0,small:!0,children:["dbt run ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,small:!0,children:"[type your --select and --exclude syntax below]"})]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(_.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,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(_.ZP,{muted:!0,small:!0,children:(0,P.jsx)(sn.Z,{href:"https://docs.getdbt.com/reference/node-selection/syntax#examples",openNewWindow:!0,small:!0,children:"Examples"})}),(0,P.jsx)(Z.Z,{mr:5})]})})]}),Tn&&!Ne&&v.tf.DBT!==y.type&&(0,P.jsx)(ce.y9,{children:(0,P.jsxs)(x.Z,{justifyContent:"space-between",children:[(0,P.jsxs)(x.Z,{children:[(0,P.jsxs)(er.Z,{compact:!0,label:"Connection",onChange:function(e){return zt((0,l.Z)({},oi,e.target.value))},onClick:dr.j,small:!0,value:Ke.data_provider,children:[(0,P.jsx)("option",{value:""}),null===A||void 0===A?void 0:A.map((function(e){var n=e.id,t=e.value;return(0,P.jsx)("option",{value:t,children:n},n)}))]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(er.Z,{compact:!0,label:"Profile",onChange:function(e){return zt((0,l.Z)({},ci,e.target.value))},onClick:dr.j,small:!0,value:Ke.data_provider_profile,children:[(0,P.jsx)("option",{value:""}),null===Un||void 0===Un?void 0:Un.map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(dn.Z,{block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["If checked, you\u2019ll have to write your own custom",(0,P.jsx)("br",{}),"CREATE TABLE commands and INSERT commands.",(0,P.jsx)("br",{}),"Separate your commands using a semi-colon: ",(0,P.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:";"})]}),size:null,widthFitContent:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(b.Z,{checked:Ke.use_raw_sql,label:(0,P.jsx)(_.ZP,{muted:!0,small:!0,children:"Use raw SQL"}),onClick:function(e){(0,dr.j)(e),zt((0,l.Z)({},hi,!Ke.use_raw_sql))}}),(0,P.jsx)("span",{children:"\xa0"}),(0,P.jsx)(X.kI,{muted:!0})]})})}),!Ke.use_raw_sql&&(0,P.jsxs)(P.Fragment,{children:[Wt&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(O.Z,{compact:!0,label:"Database",monospace:!0,onBlur:function(){return setTimeout((function(){fe(!1)}),300)},onChange:function(e){zt((0,l.Z)({},li,e.target.value)),e.preventDefault()},onClick:dr.j,onFocus:function(){fe(!0)},small:!0,value:Ke.data_provider_database,width:10*$.iI})})]}),(0,P.jsx)(Z.Z,{mr:1}),Ke.data_provider!==Xi.MYSQL&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(dn.Z,{block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["Schema that is used when creating a table and inserting values.",(0,P.jsx)("br",{}),"This field is required."]}),size:null,widthFitContent:!0,children:(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(O.Z,{compact:!0,label:"Schema",monospace:!0,onBlur:function(){return setTimeout((function(){fe(!1)}),300)},onChange:function(e){zt((0,l.Z)({},ui,e.target.value)),e.preventDefault()},onClick:dr.j,onFocus:function(){fe(!0)},small:!0,value:Ke.data_provider_schema,width:10*$.iI})})}),(0,P.jsx)(Z.Z,{mr:1})]}),(0,P.jsx)(dn.Z,{block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["This value will be used as the table name.",(0,P.jsx)("br",{}),"If blank, the default table name will be:",(0,P.jsx)("br",{}),(0,P.jsxs)(_.ZP,{inline:!0,monospace:!0,children:[null===re||void 0===re?void 0:re.uuid,"_",null===y||void 0===y?void 0:y.uuid]}),(0,P.jsx)("br",{}),"This field is optional."]}),size:null,widthFitContent:!0,children:(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(O.Z,{compact:!0,label:"Table (optional)",monospace:!0,onBlur:function(){return setTimeout((function(){fe(!1)}),300)},onChange:function(e){zt((0,l.Z)({},ai,e.target.value)),e.preventDefault()},onClick:dr.j,onFocus:function(){fe(!0)},small:!0,value:Ke.data_provider_table,width:20*$.iI})})})]})]}),!Ke.use_raw_sql&&(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(dn.Z,{appearBefore:!0,block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["How do you want to handle existing data with the same",Wt?" database,":""," schema, and table name?",(0,P.jsx)("br",{}),(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Append"}),": add rows to the existing table.",(0,P.jsx)("br",{}),(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Replace"}),": delete the existing data.",(0,P.jsx)("br",{}),(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Fail"}),": raise an error during execution."]}),size:null,widthFitContent:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(X.kI,{muted:!0}),(0,P.jsx)("span",{children:"\xa0"}),(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Write policy:"}),(0,P.jsx)("span",{children:"\xa0"})]})}),(0,P.jsxs)(er.Z,{compact:!0,label:"strategy",onChange:function(e){return zt((0,l.Z)({},fi,e.target.value))},onClick:dr.j,small:!0,value:Ke.export_write_policy,children:[(0,P.jsx)("option",{value:""}),null===Ji||void 0===Ji?void 0:Ji.map((function(e){return(0,P.jsx)("option",{value:e,children:(0,ue.kC)(e)},e)}))]}),(0,P.jsx)(Z.Z,{mr:5})]})]})}),ft.length>=1&&(0,P.jsx)(ce.y9,{normalPadding:!0,children:(0,P.jsx)(x.Z,{children:ft.map((function(e,n){var t=e.description,i=e.title;return(0,P.jsx)(Z.Z,{ml:n>=1?1:0,children:(0,P.jsx)(dn.Z,{block:!0,description:t,size:null,widthFitContent:!0,children:(0,P.jsx)(mt.Z,{children:i})})},i)}))})}),y.upstream_blocks.length>=1&&!Ne&&v.f2.includes(y.type)&&!wn&&(0,P.jsxs)(ce.y9,{children:[(0,P.jsx)(Z.Z,{mr:5,children:(0,P.jsxs)(_.ZP,{small:!0,children:[!Tn&&"Positional arguments for ".concat(An?"":"decorated ","function:"),Tn&&'The interpolated tables below are available in queries from upstream blocks. For example, you can use the query "SELECT * FROM {{ df_1 }}" to insert all the rows from an upstream block into the designated database table.']})}),(0,P.jsxs)(Z.Z,{mt:1,children:[!Tn&&!An&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:[v.tf.DATA_EXPORTER===y.type&&"@data_exporter",v.tf.DATA_LOADER===y.type&&"@data_loader",v.tf.TRANSFORMER===y.type&&"@transformer",v.tf.CUSTOM===y.type&&"@custom"]}),(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["def ",(v.tf.DATA_EXPORTER===y.type?"export_data":v.tf.DATA_LOADER===y.type&&"load_data")||v.tf.TRANSFORMER===y.type&&"transform"||v.tf.CUSTOM===y.type&&"transform_custom","(",y.upstream_blocks.map((function(e,n){return n>=1?"data_".concat(n+1):"data"})).join(", "),"):"]})]}),An&&(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:[v.tf.DATA_EXPORTER===y.type?"export_data":v.tf.TRANSFORMER===y.type&&"transform","\xa0\u2190 function(",y.upstream_blocks.map((function(e,n){return"df_".concat(n+1)})).join(", "),"):"]})}),y.upstream_blocks.map((function(e,n){var t=Vn[e],i=(0,ce.qn)(null===t||void 0===t?void 0:t.type,{blockColor:null===t||void 0===t?void 0:t.color,theme:Ce}).accent,r="{{ df_".concat(n+1," }}");return(0,P.jsxs)("div",{children:[!Tn&&!An&&(0,P.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0data",n>=1?"_".concat(n+1):null]}),Tn&&(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:r}),An&&(0,P.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0","df".concat(n+1)]})," ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"\u2192"})," ",(0,P.jsx)(sn.Z,{color:i,onClick:function(){var e,n,i=null===I||void 0===I||null===(e=I.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,P.jsx)(_.ZP,{color:i,inline:!0,monospace:!0,small:!0,children:e})})]},e)}))]})]}),!(null!==y&&void 0!==y&&y.error)&&(0,P.jsx)(P.Fragment,{children:Ne?(0,P.jsx)(Z.Z,{px:1,children:(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,children:["(",(0,ue._6)("line",null===Fe||void 0===Fe?void 0:Fe.split(/\r\n|\r|\n/).length)," collapsed)"]})}):Bt}),F&&s.cloneElement(F,{runBlockAndTrack:qn}),(null===y||void 0===y?void 0:y.error)&&(0,P.jsxs)(Z.Z,{p:$.cd,children:[(0,P.jsx)(_.ZP,{bold:!0,danger:!0,children:null===y||void 0===y||null===(a=y.error)||void 0===a?void 0:a.error}),(0,P.jsx)(_.ZP,{muted:!0,children:null===y||void 0===y||null===(f=y.error)||void 0===f?void 0:f.message})]}),Yn&&We&&We>yn&&(0,P.jsx)(ce.HC,{children:(0,P.jsxs)(_.ZP,{muted:!0,children:["".concat(Math.round((We-yn)/1e3)),"s"]})})]})),Ut]})]}),!K&&(0,P.jsxs)(ce.gE,{additionalZIndex:Vt-E,onMouseEnter:function(){return we(!0)},onMouseLeave:function(){we(!1),null===de||void 0===de||de(null)},children:[Se&&p&&(0,P.jsx)(Z.Z,{mt:2,children:(0,P.jsx)(ht,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=Wi(y,e);return[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(y.type)&&v.tf.SCRATCHPAD===e.type&&(n="from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(re.uuid,"', '").concat(y.uuid,"', 'output_0')")),n=dt(e,n),v.t6.SQL===y.language&&(n=st(n),t=hr(hr({},(0,xe.GL)(y.configuration,[oi,li,ci,ui,fi])),t)),p(hr(hr({},e),{},{configuration:t,content:n,upstream_blocks:i}))},blockIdx:E,compact:!0,hideCustom:wn,hideDbt:wn,onClickAddSingleDBTModel:te,pipeline:re,setAddNewBlockMenuOpenIdx:de,setCreatingNewDBTModel:pe,setRecsWindowOpenBlockIdx:ge})}),(0,P.jsx)(ce.t1,{className:"block-divider-inner"})]})]})}var vr=s.forwardRef(mr),gr=t(90880),br=6.25*$.iI,xr=($.iI,100*$.iI),jr=N.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%);",""],Ce.n_,xr,(function(e){return"\n box-shadow: ".concat((e.theme||Oe.Z).shadow.window,";\n background-color: ").concat((e.theme||Oe.Z).background.panel,";\n ")})),yr=(0,N.css)(["display:flex;align-items:center;justify-content:space-between;height:","px;padding:","px ","px;",""],br,$.iI,$.cd*$.iI,(function(e){return"\n background-color: ".concat((e.theme||Oe.Z).background.output,";\n ")})),kr=N.default.div.withConfig({displayName:"indexstyle__WindowHeaderStyle",componentId:"sc-g0cszf-1"})([""," border-top-left-radius:","px;border-top-right-radius:","px;",""],yr,Ce.n_,Ce.n_,(function(e){return"\n border-bottom: ".concat(Ce.YF,"px ").concat(Ce.M8," ").concat((e.theme||Oe.Z).borders.medium,";\n ")})),Zr=N.default.div.withConfig({displayName:"indexstyle__WindowContentStyle",componentId:"sc-g0cszf-2"})(["overflow:auto;padding:","px 0;"," "," "," ",""],$.iI,pn.w5,(0,gr.eR)(),(function(e){return e.minMaxHeight&&"\n max-height: ".concat(7*$.iI,"px;\n ")}),(function(e){return!e.minMaxHeight&&"\n max-height: calc(100vh - ".concat(6.5*br,"px);\n ")})),_r=N.default.div.withConfig({displayName:"indexstyle__WindowFooterStyle",componentId:"sc-g0cszf-3"})([""," justify-content:flex-end;border-bottom-left-radius:","px;border-bottom-right-radius:","px;",""],yr,Ce.n_,Ce.n_,(function(e){return"\n border-top: ".concat(Ce.YF,"px ").concat(Ce.M8," ").concat((e.theme||Oe.Z).borders.medium,";\n ")})),Or=N.default.div.withConfig({displayName:"indexstyle__InputRowStyle",componentId:"sc-g0cszf-4"})(["padding:","px ","px;",""],.75*$.iI,2*$.iI,(function(e){return"\n border-bottom: ".concat(Ce.YF,"px ").concat(Ce.M8," ").concat((e.theme||Oe.Z).borders.medium,";\n ")}));function Cr(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?Cr(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Cr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Sr,wr,Pr,Ir,Tr=function(e){var n=e.blocks,t=e.creatingNewDBTModel,i=e.dbtModelName,r=e.files,o=e.onClose,l=e.onOpenFile,c=e.setDbtModelName,u=(0,s.useState)(!1),a=u[0],d=u[1],f=(0,s.useState)(null),p=f[0],h=f[1],m=(0,s.useMemo)((function(){var e,n,t=null===(e=(0,ee.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]),b=(0,s.useMemo)((function(){return(0,ee.HK)(n,(function(e){return e.configuration.file_path}))}),[n]);return(0,P.jsxs)(jr,{children:[(0,P.jsxs)(kr,{children:[(0,P.jsx)(He.Z,{alignItems:"center",children:(0,P.jsx)(_.ZP,{disableWordBreak:!0,monospace:!0,children:t?"Create new DBT model":"Select DBT model file"})}),(0,P.jsx)(g.Z,{iconOnly:!0,onClick:o,children:(0,P.jsx)(X.x8,{muted:!0})})]}),t&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Or,{children:(0,P.jsx)(In,{inputValue:i,label:"Model name (cannot be changed):",labelColor:Oe.Z.accent.dbt,minWidth:38*$.iI,notRequired:!0,onBlur:function(){d(!1)},onChange:function(e){c(e.target.value),e.preventDefault()},onClick:function(){d(!0)},onFocus:function(){d(!0)},placeholder:"Enter name",required:!0,stacked:!0,value:!a&&i})}),(0,P.jsxs)(Or,{children:[(0,P.jsx)(_.ZP,{bold:!0,color:Oe.Z.accent.dbt,children:"Select folder location:"}),(0,P.jsx)(_.ZP,{bold:!0,muted:!p,children:p?"dbt/".concat(p):"Choose folder below"})]})]}),(0,P.jsx)(Zr,{children:(0,P.jsx)(Ue,{allowSelectingFolders:t,disableContextMenu:!0,files:m,isFileDisabled:function(e,n){return t?!n||(null===n||void 0===n?void 0:n.some((function(e){return"models"===(null===e||void 0===e?void 0:e.name)}))):!!b[e]||!(null!==n&&void 0!==n&&n.length)&&!e.match(new RegExp(".".concat(v.t6.SQL,"$")))},openFile:l,selectFile:h,uncollapsed:!0,useRootFolder:!0})}),t&&(0,P.jsx)(_r,{children:(0,P.jsx)(g.Z,{backgroundColor:i&&p?Oe.Z.accent.dbt:Oe.Z.monotone.grey500,disabled:!i||!p,onClick:function(){return l(p)},padding:"6px 8px",children:"Create model"})})]})},Ar=t(4804),Rr=t(65730),Dr=t(87372);!function(e){e.FULL_TABLE="FULL_TABLE",e.INCREMENTAL="INCREMENTAL",e.LOG_BASED="LOG_BASED"}(wr||(wr={})),function(e){e.IGNORE="IGNORE",e.UPDATE="UPDATE"}(Pr||(Pr={})),function(e){e.DATE_TIME="date-time",e.UUID="uuid"}(Ir||(Ir={}));var Mr,Nr="datetime",Lr=(Sr={},(0,l.Z)(Sr,Ir.DATE_TIME,Nr),(0,l.Z)(Sr,Ir.UUID,Ir.UUID),Sr);!function(e){e.ARRAY="array",e.BOOLEAN="boolean",e.INTEGER="integer",e.NULL="null",e.NUMBER="number",e.OBJECT="object",e.STRING="string"}(Mr||(Mr={}));var Br,Fr,Ur,Hr,zr,Wr=[Mr.ARRAY,Mr.BOOLEAN,Nr,Mr.INTEGER,Mr.NULL,Mr.NUMBER,Mr.OBJECT,Mr.STRING,Ir.UUID];!function(e){e.PROPERTIES="properties"}(Br||(Br={})),function(e){e.AUTOMATIC="automatic",e.AVAILABLE="available",e.UNSUPPORTED="unsupported"}(Fr||(Fr={})),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"}(Ur||(Ur={})),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.PIPEDRIVE="pipedrive",e.POSTGRESQL="postgresql",e.REDSHIFT="redshift",e.SALESFORCE="salesforce",e.STRIPE="stripe"}(Hr||(Hr={})),function(e){e.BIGQUERY="bigquery",e.DELTA_LAKE_S3="delta_lake_s3",e.MYSQL="mysql",e.POSTGRESQL="postgresql",e.SNOWFLAKE="snowflake"}(zr||(zr={}));var Gr=t(31012),Vr=N.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||Oe.Z.background).popup,";\n ")}),(function(e){return e.primary&&"\n background-color: ".concat((e.theme.chart||Oe.Z.chart).primary,";\n ")}),(function(e){return!e.small&&"\n border-radius: ".concat(($.iI+Gr.Al)/2,"px;\n height: ").concat(1.5*$.iI+Gr.Al,"px;\n padding: ").concat($.iI/1.5,"px ").concat(1.25*$.iI,"px;\n ")}),(function(e){return e.small&&"\n border-radius: ".concat(($.iI/2+Gr.Al)/2,"px;\n height: ").concat(Gr.Al+$.iI/2+2,"px;\n padding: ").concat($.iI/4,"px ").concat($.iI,"px;\n ")}),(function(e){return e.border&&"\n border: 1px solid ".concat((e.theme.content||Oe.Z.content).muted,";\n ")})),Qr=function(e){var n=e.border,t=e.children,i=e.label,r=e.onClick,o=e.primary,l=e.small;return(0,P.jsx)(Vr,{border:n,primary:o,small:l,children:(0,P.jsx)(g.Z,{basic:!0,noPadding:!0,noBackground:!0,onClick:r,transparent:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[t,i&&(0,P.jsx)(_.ZP,{small:l,children:i}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(X.x8,{default:o,muted:!o,size:l?$.iI:1.25*$.iI})]})})})},qr=t(70902),Yr=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,l.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=[zr.BIGQUERY,zr.DELTA_LAKE_S3];var eo=function(e){var n=e.bookmarkValues,t=e.destination,i=e.isLoadingLoadSampleData,r=e.isLoadingUpdateDestinationBlockState,c=e.loadSampleData,u=e.source,a=e.stream,d=e.streams,f=e.updateAllStreams,p=e.updateDestinationBlockState,h=e.updateMetadataForColumns,m=e.updateSchemaProperty,v=e.updateStream,j=(0,s.useRef)(null),k=a.bookmark_properties,C=a.destination_table,E=void 0===C?"":C,S=a.key_properties,w=a.metadata,I=a.partition_keys,T=a.replication_method,A=a.schema.properties,R=a.tap_stream_id,D=a.unique_constraints,M=a.unique_conflict_method,N=(0,s.useState)(E),L=N[0],B=N[1],F=(0,s.useState)(!1),U=F[0],H=F[1],z=(0,s.useState)(null),W=z[0],G=z[1],V=(0,s.useState)(!1),Q=V[0],q=V[1],Y=(0,s.useState)((0,l.Z)({},R,n||{})),K=Y[0],X=Y[1],J=(0,kt.Z)(R);(0,s.useEffect)((function(){J!==R&&(B(E),G(null))}),[E,T,R,J,M]),(0,s.useEffect)((function(){var e=null===K||void 0===K?void 0:K[R];(null===k||void 0===k?void 0:k.length)>0&&((0,xe.Qr)(e)||!(0,xe.Xy)(n,e))&&X((function(e){return Xr(Xr({},e),{},(0,l.Z)({},R,n))}))}),[null===k||void 0===k?void 0:k.length,n,R]);var ne=(0,s.useMemo)((function(){return(0,ee.HK)(w,(function(e){return e.breadcrumb.join("/")}))}),[w]),te=(0,s.useMemo)((function(){var e;return null===(e=(0,ee.sE)(w,(function(e){return 0===e.breadcrumb.length})))||void 0===e?void 0:e.metadata}),[w]),ie=(0,s.useMemo)((function(){return te[Ur.KEY_PROPERTIES]||[]}),[te]),re=(0,s.useMemo)((function(){return te[Ur.REPLICATION_KEYS]||[]}),[te]),oe=$r.includes(t),le=d.length>1,ce=(0,s.useCallback)((function(e){var n=Xr({},null===K||void 0===K?void 0:K[R]);n.hasOwnProperty(e)&&delete n[e],X((function(e){return Xr(Xr({},e),{},(0,l.Z)({},R,Xr({},n)))})),p({block:{bookmark_values:n,destination_table:L,tap_stream_id:R}})}),[K,L,R,p]),ae=(0,s.useMemo)((function(){var e=[],n=[],i=(0,ee.mr)(Object.entries(A)).map((function(i,r){var l=(0,o.Z)(i,2),c=l[0],u=l[1],a=u.anyOf,s=void 0===a?[]:a,d=u.format,p=u.type,j=void 0===p?[]:p,y=new Set(Array.isArray(j)?j:[j]),O=new Set(y);s.forEach((function(e){var n=e.format,t=(e.items,e.type);Array.isArray(t)?t.forEach((function(e){y.add(e),O.add(e)})):(y.add(t),O.add(t),n&&O.add(n))}));var C=Array.from(y);d&&O.add(d);var E=(ne["properties/".concat(c)]||{}).metadata,w=(E.inclusion,E.selected);e.push(w),n.push(c);var T=Wr.reduce((function(e,n){return C.indexOf(n)>=0||Nr===String(n)&&Ir.DATE_TIME===d||Ir.UUID===String(n)&&Ir.UUID===d?e:e.concat((0,P.jsx)("option",{value:n,children:n},n))}),[]),A=C.findIndex((function(e){return e===Mr.STRING})),M=[(0,P.jsx)(b.Z,{checked:w,onClick:function(){h(R,[c],{selected:!w})}},"".concat(R,"/").concat(c,"/selected")),(0,P.jsx)(_.ZP,{children:c},"".concat(R,"/").concat(c,"/name")),(0,P.jsxs)(x.Z,{children:[(0,P.jsx)(He.Z,{flex:1,children:(0,P.jsx)(x.Z,{alignItems:"center",flexWrap:"wrap",fullWidth:!0,children:C.map((function(e,n){return(0,P.jsx)(Z.Z,{mb:1,mr:1,children:(0,P.jsx)(Qr,{border:!0,label:d&&Mr.STRING===e&&A===n?Lr[d]:e,onClick:function(){var n={format:d,type:C.filter((function(n){return n!==e}))};Ir.DATE_TIME!==d&&Ir.UUID!==d||Mr.STRING!==e||(n.format=null),m(R,c,n)},small:!0})},"".concat(R,"/").concat(c,"/").concat(e,"/").concat(n,"/chip"))}))})}),T.length>=1&&(0,P.jsxs)(er.Z,{compact:!0,onChange:function(e){var n=e.target.value,t={format:d,type:C};Nr===String(n)?(t.format=Ir.DATE_TIME,t.type.push(Mr.STRING)):Ir.UUID===String(n)?(t.format=Ir.UUID,t.type.push(Mr.STRING)):t.type.push(n),m(R,c,t)},primary:!0,small:!0,value:"",width:10*$.iI,children:[(0,P.jsx)("option",{value:""}),T]})]},"".concat(R,"/").concat(c,"/type")),(0,P.jsx)(b.Z,{checked:!(null===D||void 0===D||!D.includes(c)),disabled:ie.length>=1&&!ie.includes(c),onClick:ie.length>=1&&!ie.includes(c)?null:function(){return v(R,(function(e){var n;return null!==(n=e.unique_constraints)&&void 0!==n&&n.includes(c)?e.unique_constraints=(0,ee.Od)(e.unique_constraints,(function(e){return c===e})):e.unique_constraints=[c].concat(e.unique_constraints||[]),e}))}},"".concat(R,"/").concat(c,"/unique")),(0,P.jsx)(b.Z,{checked:!(null===k||void 0===k||!k.includes(c)),disabled:re.length>=1&&!re.includes(c),onClick:re.length>=1&&!re.includes(c)?null:function(){return v(R,(function(e){var n;return null!==(n=e.bookmark_properties)&&void 0!==n&&n.includes(c)?(ce(c),e.bookmark_properties=(0,ee.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),e}))}},"".concat(R,"/").concat(c,"/bookmark")),(0,P.jsx)(b.Z,{checked:!(null===S||void 0===S||!S.includes(c)),onClick:function(){return v(R,(function(e){var n;return null!==(n=e.key_properties)&&void 0!==n&&n.includes(c)?e.key_properties=(0,ee.Od)(e.key_properties,(function(e){return c===e})):e.key_properties=[c].concat(e.key_properties||[]),e}))}},"".concat(R,"/").concat(c,"/key_property"))];if(oe){var N=t!==zr.DELTA_LAKE_S3,L=N&&(ie.includes(c)||!O.has(Ir.DATE_TIME));M.push((0,P.jsx)(b.Z,{checked:!(null===I||void 0===I||!I.includes(c)),disabled:L,onClick:L?null:function(){return v(R,(function(e){var n,t;null!==(n=e.partition_keys)&&void 0!==n&&n.includes(c)?e.partition_keys=(0,ee.Od)(e.partition_keys,(function(e){return c===e})):N&&1===(null===(t=e.partition_keys)||void 0===t?void 0:t.length)?e.partition_keys=[c]:e.partition_keys=[c].concat(e.partition_keys||[]);return e}))}},"".concat(R,"/").concat(c,"/partition_key")))}if(le){var B=W===r;M.push((0,P.jsx)(g.Z,{compact:!0,disabled:B,onClick:function(){G(r),setTimeout((function(){return G(null)}),2e3),f((function(e){var n,t;if((null===e||void 0===e?void 0:e.tap_stream_id)!==R&&null!==e&&void 0!==e&&null!==(n=e.schema)&&void 0!==n&&null!==(t=n.properties)&&void 0!==t&&t[c]){var i,r,o,l,u,a,s,f,p;e.schema.properties[c]={format:d||null,type:C};var h=null===(i=(0,ee.sE)((null===e||void 0===e?void 0:e.metadata)||[],(function(e){return 0===e.breadcrumb.length})))||void 0===i?void 0:i.metadata,m=h[Ur.REPLICATION_KEYS]||[],v=h[Ur.KEY_PROPERTIES]||[];null===D||void 0===D||!D.includes(c)||null!==e&&void 0!==e&&null!==(r=e.unique_constraints)&&void 0!==r&&r.includes(c)||!v.includes(c)?null!==D&&void 0!==D&&D.includes(c)||null===e||void 0===e||null===(o=e.unique_constraints)||void 0===o||!o.includes(c)||(e.unique_constraints=(0,ee.Od)(e.unique_constraints,(function(e){return c===e}))):e.unique_constraints=[c].concat(e.unique_constraints||[]),null===k||void 0===k||!k.includes(c)||null!==e&&void 0!==e&&null!==(l=e.bookmark_properties)&&void 0!==l&&l.includes(c)||!m.includes(c)?null!==k&&void 0!==k&&k.includes(c)||null===e||void 0===e||null===(u=e.bookmark_properties)||void 0===u||!u.includes(c)||(e.bookmark_properties=(0,ee.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),null===S||void 0===S||!S.includes(c)||null!==e&&void 0!==e&&null!==(a=e.key_properties)&&void 0!==a&&a.includes(c)?null!==S&&void 0!==S&&S.includes(c)||null===e||void 0===e||null===(s=e.key_properties)||void 0===s||!s.includes(c)||(e.key_properties=(0,ee.Od)(e.key_properties,(function(e){return c===e}))):e.key_properties=[c].concat(e.key_properties||[]),null===I||void 0===I||!I.includes(c)||null!==e&&void 0!==e&&null!==(f=e.partition_keys)&&void 0!==f&&f.includes(c)?null!==I&&void 0!==I&&I.includes(c)||null===e||void 0===e||null===(p=e.partition_keys)||void 0===p||!p.includes(c)||(e.partition_keys=(0,ee.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,P.jsx)(_.ZP,{success:B,children:B?"Applied!":"Apply"})}))}return M})),r=e.every((function(e){return e})),l=[null,2,1,null,null,null],c=[{label:function(){return(0,P.jsx)(b.Z,{checked:r,onClick:function(){h(R,n,{selected:!r})}})},uuid:"Selected"},{uuid:"Name"},{uuid:"Type"},{uuid:"Unique"},{uuid:"Bookmark"},{uuid:"Key prop"}];return oe&&(l.push(null),c.push({uuid:"Partition key"})),le&&(l.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,P.jsx)(Yr.cl,{children:(0,P.jsx)(_e.Z,{alignTop:!0,columnFlex:l,columns:c,rows:i,stickyHeader:!0})})}),[k,t,le,W,S,ne,I,A,oe,R,D,f,h,m,v,ie,re]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Dr.Z,{condensed:!0,level:4,spacingBelow:!0,children:[(0,P.jsx)(Dr.Z,{condensed:!0,inline:!0,level:4,monospace:!0,children:R})," schema"]}),(0,P.jsx)(Z.Z,{mb:3,children:(0,P.jsx)(y.Z,{headerTitle:"Output",overflowVisible:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(_.ZP,{children:"Destination table name"}),(0,P.jsx)(Z.Z,{ml:Jr}),(0,P.jsx)(dn.Z,{label:(0,P.jsxs)(_.ZP,{children:["By default, this stream will be saved to your destination under the table named ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:R}),". To change the table name, enter in a different value."]}),lightBackground:!0,primary:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(O.Z,{compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;B(n),clearTimeout(j.current),j.current=setTimeout((function(){v(R,(function(e){return Xr(Xr({},e),{},{destination_table:n})}))}),300)},value:L||"",width:45*$.iI})]})})}),(0,P.jsx)(Z.Z,{mb:3,children:(0,P.jsx)(y.Z,{headerTitle:"Usage",overflowVisible:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsx)(_.ZP,{children:"Replication method"}),(0,P.jsx)(Z.Z,{ml:Jr}),(0,P.jsx)(dn.Z,{label:(0,P.jsxs)(_.ZP,{children:["Do you want to synchronize the entire stream (",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:wr.FULL_TABLE}),") on each integration pipeline run or only new records (",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:wr.INCREMENTAL}),")?",u===Hr.POSTGRESQL&&(0,P.jsxs)(_.ZP,{children:["Log-based incremental replication (",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:wr.LOG_BASED}),") is also available for PostgreSQL sources."]})]}),lightBackground:!0,primary:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsxs)(er.Z,{compact:!0,onChange:function(e){v(R,(function(n){return Xr(Xr({},n),{},{replication_method:e.target.value})}))},primary:!0,value:T,children:[(0,P.jsx)("option",{value:""}),Object.values(wr).filter((function(e){return u===Hr.POSTGRESQL||e!==wr.LOG_BASED})).map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]}),(0,P.jsx)(Z.Z,{ml:3}),(0,P.jsx)(_.ZP,{children:"Unique conflict method"}),(0,P.jsx)(Z.Z,{ml:Jr}),(0,P.jsx)(dn.Z,{label:(0,P.jsxs)(_.ZP,{wordBreak:!0,children:["If a new record has the same value as an existing record in the ",(0,ue._6)("column",null===D||void 0===D?void 0:D.length),(null===D||void 0===D?void 0:D.length)>0&&(0,P.jsx)(P.Fragment,{children:"\xa0"}),null===D||void 0===D?void 0:D.sort().map((function(e,n){return(0,P.jsxs)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:[1!==(null===D||void 0===D?void 0:D.length)&&n===(null===D||void 0===D?void 0:D.length)-1?(0,P.jsx)(_.ZP,{inline:!0,children:" and "},e):n>=1&&(0,P.jsx)(P.Fragment,{children:",\xa0"}),e]},e)})),", how do you want to resolve the conflict? The conflict method ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Pr.IGNORE})," will skip the new record if it\u2019s a duplicate of an existing record. The conflict method ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Pr.UPDATE})," will not save the new record and instead update the existing record with the new record\u2019s properties."]}),lightBackground:!0,primary:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsxs)(er.Z,{compact:!0,inputWidth:11*$.iI,onChange:function(e){v(R,(function(n){return Xr(Xr({},n),{},{unique_conflict_method:e.target.value})}))},primary:!0,value:M,children:[(0,P.jsx)("option",{value:""}),(0,P.jsx)("option",{value:Pr.IGNORE,children:Pr.IGNORE}),(0,P.jsx)("option",{value:Pr.UPDATE,children:Pr.UPDATE})]})]}),le&&(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsx)(_.ZP,{default:!0,children:"All streams"}),(0,P.jsx)(Z.Z,{ml:Jr}),(0,P.jsx)(dn.Z,{appearBefore:!0,label:(0,P.jsx)(_.ZP,{children:"This will apply this stream's replication method and unique conflict method settings to all selected streams."}),lightBackground:!0,primary:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(g.Z,{compact:!0,disabled:U,onClick:function(){H(!0),setTimeout((function(){return H(!1)}),2e3),f((function(e){return Xr(Xr({},e),{},{replication_method:T,unique_conflict_method:M})}))},pill:!0,secondary:!0,children:(0,P.jsx)(_.ZP,{bold:!U,success:U,children:U?"Applied!":"Apply"})})]})]})})}),(0,P.jsx)(y.Z,{headerTitle:"Features",noPadding:!0,children:ae}),(0,P.jsx)(Z.Z,{mt:2,children:(0,P.jsx)(g.Z,{loading:i,onClick:function(){return c(R)},primary:!0,small:!0,children:"Load sample data"})}),(0,P.jsxs)(Z.Z,{mt:5,children:[(0,P.jsx)(Dr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Settings"}),wr.INCREMENTAL===T&&(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsxs)(Z.Z,{mb:1,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Bookmark properties"}),(0,P.jsxs)(_.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,P.jsx)("br",{}),"On the next run, the synchronization will start after the bookmarked record."]})]}),(0,P.jsxs)(x.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==k&&void 0!==k&&k.length)&&(0,P.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Bookmark"})," to use a specific column as a bookmark property."]}),null===k||void 0===k?void 0:k.sort().map((function(e){return(0,P.jsx)(Z.Z,{mb:1,mr:1,children:(0,P.jsx)(Qr,{label:e,onClick:function(){ce(e),v(R,(function(n){return Xr(Xr({},n),{},{bookmark_properties:(0,ee.Od)(n.bookmark_properties||[],(function(n){return n===e}))})}))},primary:!0})},"bookmark_properties/".concat(e))}))]}),(null===k||void 0===k?void 0:k.length)>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{my:2,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(Z.Z,{mr:2,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Manually edit bookmark property values"}),(0,P.jsx)(_.ZP,{default:!0,children:'In order to override the bookmark values for the next sync, you must first select a destination. Then click the toggle to edit the values for the bookmark properties in the table below. Click the "Save" button to save your changes.'})]}),(0,P.jsx)(qr.Z,{checked:Q,disabled:!t,onCheck:function(){return q((function(e){return!e}))}})]})}),Q&&!!t&&(0,P.jsx)(y.Z,{header:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsx)(_.ZP,{bold:!0,default:!0,children:"Bookmark property values"}),(0,P.jsx)(g.Z,{compact:!0,loading:r,onClick:function(){p({block:{bookmark_values:(null===K||void 0===K?void 0:K[R])||{},destination_table:L,tap_stream_id:R}})},pill:!0,secondary:!0,children:"Save"})]}),headerPaddingVertical:$.iI,noPadding:!0,overflowVisible:!0,children:(0,P.jsx)(_e.Z,{columnBorders:!0,columnFlex:[null,1],columns:[{uuid:"Bookmark property"},{uuid:"Value"}],rows:k.map((function(e){var n;return[(0,P.jsx)(_.ZP,{default:!0,monospace:!0,children:e},e),(0,P.jsx)(O.Z,{borderless:!0,monospace:!0,onChange:function(n){n.preventDefault(),X((function(t){return Xr(Xr({},t),{},(0,l.Z)({},R,Xr(Xr({},t[R]),{},(0,l.Z)({},e,n.target.value))))}))},paddingHorizontal:0,placeholder:"Enter value",value:null===K||void 0===K||null===(n=K[R])||void 0===n?void 0:n[e]},"".concat(e,"_value"))]}))})})]})]}),(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsxs)(Z.Z,{mb:1,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Unique constraints"}),(0,P.jsx)(_.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,P.jsxs)(x.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==D&&void 0!==D&&D.length)&&(0,P.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Unique"})," to use a specific column as a unique constraint."]}),null===D||void 0===D?void 0:D.sort().map((function(e){return(0,P.jsx)(Z.Z,{mb:1,mr:1,children:(0,P.jsx)(Qr,{label:e,onClick:function(){v(R,(function(n){return Xr(Xr({},n),{},{unique_constraints:(0,ee.Od)(n.unique_constraints||[],(function(n){return n===e}))})}))},primary:!0})},"unique_constraints/".concat(e))}))]})]}),(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsxs)(Z.Z,{mb:1,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Key properties"}),(0,P.jsx)(_.ZP,{default:!0,children:"Key properties are used as the primary key for the destination table."})]}),(0,P.jsxs)(x.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==S&&void 0!==S&&S.length)&&(0,P.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Key prop"})," to use a specific column as a key property."]}),null===S||void 0===S?void 0:S.sort().map((function(e){return(0,P.jsx)(Z.Z,{mb:1,mr:1,children:(0,P.jsx)(Qr,{label:e,onClick:function(){v(R,(function(n){return Xr(Xr({},n),{},{key_properties:(0,ee.Od)(n.key_properties||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]}),oe&&(0,P.jsxs)(Z.Z,{mb:3,children:[(0,P.jsxs)(Z.Z,{mb:1,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Partition keys"}),(0,P.jsx)(_.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,P.jsxs)(x.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==I&&void 0!==I&&I.length)&&(0,P.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Partition key"})," to use a specific column as a partition key."]}),null===I||void 0===I?void 0:I.sort().map((function(e){return(0,P.jsx)(Z.Z,{mb:1,mr:1,children:(0,P.jsx)(Qr,{label:e,onClick:function(){v(R,(function(n){return Xr(Xr({},n),{},{partition_keys:(0,ee.Od)(n.partition_keys||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]})]})]})},no=["catalog","pipeline","setErrors","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,l.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,oo=function(e){var n,t=e.catalog,i=e.pipeline,r=e.setErrors,l=e.setSelectedStream,c=(0,M.Z)(e,no),u=(0,s.useState)(null),a=u[0],f=u[1],p=(0,s.useMemo)((function(){return(null===t||void 0===t?void 0:t.streams)||[]}),[t]),h=(0,s.useMemo)((function(){return(0,ee.YC)(p,"stream").map((function(e){return{uuid:e.stream}}))}),[p]),m=(0,s.useMemo)((function(){return(0,ee.HK)(p,(function(e){return e.stream}))}),[p]),g=(0,s.useMemo)((function(){return m[null===a||void 0===a?void 0:a.uuid]}),[a,m]),b=(0,s.useMemo)((function(){return(0,ee.sE)((null===i||void 0===i?void 0:i.blocks)||[],(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n}))}),[null===i||void 0===i?void 0:i.blocks]),x=g||{},j=x.destination_table,y=x.tap_stream_id,k=!(!y||!j),O=be.ZP.blocks.pipelines.detail(k?null===i||void 0===i?void 0:i.uuid:null,k?null===b||void 0===b?void 0:b.uuid:null,{destination_table:j,state_stream:y}),C=O.data,E=O.mutate,S=null===C||void 0===C||null===(n=C.block)||void 0===n?void 0:n.bookmarks,w=(0,d.Db)(be.ZP.blocks.pipelines.useUpdate(null===i||void 0===i?void 0:i.uuid,null===b||void 0===b?void 0:b.uuid,{query:{update_state:!0}}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===E||void 0===E||E()},onErrorCallback:function(e,n){return null===r||void 0===r?void 0:r({errors:n,response:e})}})}}),I=(0,o.Z)(w,2),T=I[0],A=I[1].isLoading;(0,s.useEffect)((function(){h.length>0&&(a&&(0,ee.sE)(h,(function(e){var n=e.uuid;return a.uuid===n}))||f(h[0]))}),[a,f,h]);var R=(0,s.useMemo)((function(){var e=[{uuid:"Stream"},{uuid:"Columns Selected"},{uuid:"Replication Method"},{uuid:"Destination Table"},{uuid:"Bookmark Props"},{uuid:"Key Props"},{uuid:"Unique Constraints"},{uuid:"Unique Conflict Method"},{uuid:"Partition Keys"}];return(0,P.jsx)(Yr.cl,{children:(0,P.jsx)(_e.Z,{alignTop:!0,columnBorders:!0,columnFlex:e.map((function(e){return 1})),columns:e,rows:p.map((function(e){var n=e.replication_method,t=e.destination_table,i=e.bookmark_properties,r=e.key_properties,o=e.metadata,l=e.unique_constraints,c=e.unique_conflict_method,u=e.partition_keys,a=e.tap_stream_id,s=o.reduce((function(e,n){var t=n.breadcrumb,i=n.metadata.selected,r=(null===t||void 0===t?void 0:t.length)>0,o=i&&r?1:0,l=r?1:0;return{selectedCount:e.selectedCount+o,totalCount:e.totalCount+l}}),{selectedCount:0,totalCount:0}),d=(0,P.jsx)(_.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,P.jsx)(_.ZP,{bold:0===n,children:Array.isArray(e)?e.sort().join(", "):e},"".concat(a,"_cell_").concat(n))}));return f.slice(0,1).concat(d).concat(f.slice(1))})),stickyFirstColumn:!0,stickyHeader:!0,wrapColumns:!0})})}),[p]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(vt.Z,{allowScroll:!0,noPadding:!0,onClickTab:function(e){f(e),l(e.uuid)},selectedTabUUID:null===a||void 0===a?void 0:a.uuid,tabs:h}),g&&(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsx)(Yr.dE,{children:(0,P.jsx)(eo,io(io({},c),{},{bookmarkValues:S,isLoadingUpdateDestinationBlockState:A,stream:g,streams:p,updateDestinationBlockState:T}))})}),p.length>=1&&(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(Yr.dE,{children:[(0,P.jsx)(Dr.Z,{level:4,children:"Streams Summary"}),(0,P.jsx)(Z.Z,{mt:1}),R]})})]})},lo=t(18776);function co(e){return Object.values(e).filter((function(e){return null!==e})).map((function(e){return e.tap_stream_id}))}function uo(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 ao(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?uo(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):uo(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"}(ro||(ro={}));var so=45*$.iI;var fo=function(e){var n=e.catalog,t=e.isLoading,i=e.onActionCallback,r=e.streams,o=(0,ee.HK)((null===n||void 0===n?void 0:n.streams)||[],(function(e){return e.stream})),c=(0,s.useState)(o),u=c[0],a=c[1],d=(0,s.useState)(null),f=d[0],p=d[1],h=(0,s.useState)(!1),m=h[0],v=h[1],j=(0,s.useState)(ro.ALL),y=j[0],k=j[1],C=(0,s.useRef)(null),E=co(u),S=(0,s.useMemo)((function(){var e=r;return e=e.filter((function(e){var n=e.tap_stream_id;return y===ro.SELECTED?E.includes(n):y!==ro.NOT_SELECTED||!E.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}),[y,f,E,r]),w=(0,s.useMemo)((function(){return r.every((function(e){var n=e.stream;return!!u[n]}))}),[u,r]);return(0,P.jsxs)(lo.Z,{children:[(0,P.jsx)(Yr.cv,{rounded:!0,children:(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Select streams to sync"})}),(0,P.jsx)(Yr.cv,{padding:1.25*$.iI,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsx)(O.Z,{beforeIcon:(0,P.jsx)(X.HN,{}),compact:!0,noBackground:!0,noBorder:!0,onChange:function(e){return p(e.target.value)},placeholder:"Search",value:f}),(0,P.jsx)(Z.Z,{pr:1,children:(0,P.jsx)(Hn.Z,{items:[{label:function(){return ro.ALL},onClick:function(){return k(ro.ALL)},uuid:"all_streams"},{label:function(){return ro.SELECTED},onClick:function(){return k(ro.SELECTED)},uuid:"selected"},{label:function(){return ro.NOT_SELECTED},onClick:function(){return k(ro.NOT_SELECTED)},uuid:"unselected"}],onClickCallback:function(){return v(!1)},onClickOutside:function(){return v(!1)},open:m,parentRef:C,uuid:"SelectStreams/filter",children:(0,P.jsx)(g.Z,{beforeIcon:(0,P.jsx)(X.wn,{}),noBackground:!0,onClick:function(){return v((function(e){return!e}))},ref:C,children:(0,P.jsx)(_.ZP,{children:y})})})})]})}),(0,P.jsx)(Yr.cl,{height:"55vh",hideHorizontalScrollbar:!0,width:"".concat(so,"px"),children:(0,P.jsx)(_e.Z,{borderCollapseSeparate:!0,columnFlex:[1,6],columns:[{label:function(){return(0,P.jsx)(b.Z,{checked:w,onClick:function(){var e=(0,ee.HK)(r||[],(function(e){return e.stream}));a(w?{}:e)}})},uuid:"Selected"},{uuid:"Stream name"}],rows:S.map((function(e){var n=e.stream,t=!!u[n];return[(0,P.jsx)(b.Z,{checked:t,onClick:function(){a((function(i){return ao(ao({},i),{},(0,l.Z)({},n,t?null:e))}))}},"selected-".concat(n)),(0,P.jsx)(_.ZP,{children:n},"stream-".concat(n))]})),stickyHeader:!0})}),(0,P.jsx)(yt.Z,{medium:!0}),(0,P.jsxs)(Z.Z,{p:2,children:[(null===E||void 0===E?void 0:E.length)>50&&(0,P.jsx)(Z.Z,{pb:2,children:(0,P.jsxs)(_.ZP,{danger:!0,maxWidth:so-4*$.iI,rightAligned:!0,whiteSpaceNormal:!0,children:["WARNING: Selecting too many streams (e.g. >50)",(0,P.jsx)("br",{}),"may cause app performance issues."]})}),(0,P.jsx)(x.Z,{justifyContent:"flex-end",children:(0,P.jsx)(g.Z,{loading:t,onClick:function(){return i(u)},primary:!0,children:"Confirm ".concat(co(u).length," streams")})})]})]})};function po(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 ho(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?po(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):po(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var mo=function(e){var n=e.api,t=e.block,i=e.blockContent,r=e.onChangeCodeBlock,c=e.pipeline,u=(0,s.useState)(null),a=u[0],f=u[1];(0,s.useEffect)((function(){i&&!a&&f((0,Ar.Pz)(null===i||void 0===i?void 0:i.config))}),[a,i]);var p=(0,s.useState)(null),h=p[0],m=p[1],b=(0,s.useState)(),j=b[0],y=b[1],k=(0,d.Db)(be.ZP[n].useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var t,i,r=(0,ue.C5)(n);m(null===e||void 0===e||null===(t=e[r])||void 0===t?void 0:t.success),y(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)}})}}),O=(0,o.Z)(k,2),C=O[0],E=O[1].isLoading;return t?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Yr.$W,{children:(0,P.jsx)(Ve.Z,{autoHeight:!0,language:v.t6.YAML,onChange:function(e){f(e),r(t.type,t.uuid,(0,Ar.Pz)(ho(ho({},i),{},{config:(0,Ar.Qc)(e)})))},tabSize:2,value:a||void 0,width:"100%"})}),(0,P.jsxs)(Z.Z,{mt:1,children:[(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(g.Z,{onClick:function(){C((0,l.Z)({},(0,ue.C5)(n),{action_type:"test_connection",config:a,pipeline_uuid:c.uuid})),y(null)},small:!0,success:!0,children:"Test connection"}),(0,P.jsx)(Z.Z,{ml:1,children:E?(0,P.jsx)(Ui.Z,{color:"white",small:!0}):(0,P.jsxs)(P.Fragment,{children:[h&&(0,P.jsx)(_.ZP,{small:!0,success:!0,children:"Connected successfully!"}),!1===h&&(0,P.jsx)(_.ZP,{small:!0,warning:!0,children:"Failed to connect, see error below."})]})})]}),j&&(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsx)(_.ZP,{small:!0,warning:!0,children:j})})]})]}):null};function vo(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 go(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?vo(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):vo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var bo=function(e){var n,t,i,r=e.addNewBlockAtIndex,l=e.blocks,c=e.codeBlocks,u=e.fetchFileTree,a=e.fetchPipeline,f=e.fetchSampleData,p=e.globalVariables,h=e.onChangeCodeBlock,m=e.openSidekickView,b=e.pipeline,j=e.savePipelineContent,y=e.setErrors,k=e.setIntegrationStreams,O=e.setOutputBlocks,C=e.setSelectedBlock,E=e.setSelectedOutputBlock,S=e.setSelectedStream,w=(0,s.useState)(!0),I=w[0],T=w[1],A=(0,s.useState)(!0),R=A[0],D=A[1],M=(0,s.useState)(!0),N=M[0],L=M[1],B=be.ZP.integration_sources.list().data,F=(0,s.useMemo)((function(){return(null===B||void 0===B?void 0:B.integration_sources)||[]}),[B]),H=(0,s.useMemo)((function(){return(0,ee.HK)(F,(function(e){return e.uuid}))}),[F]),z=be.ZP.integration_destinations.list().data,W=(0,s.useMemo)((function(){return(null===z||void 0===z?void 0:z.integration_destinations)||[]}),[z]),G=(0,s.useMemo)((function(){return(0,ee.HK)(W,(function(e){return e.uuid}))}),[W]),V=(0,s.useMemo)((function(){return(0,ee.sE)(l,(function(e){var n=e.type;return v.tf.DATA_LOADER===n}))}),[l]),Q=(0,s.useMemo)((function(){return V?(0,Ar.Qc)(V.content):{}}),[V]),q=(0,s.useMemo)((function(){return(0,P.jsx)(mo,{api:"integration_sources",block:V,blockContent:Q,onChangeCodeBlock:h,pipeline:b})}),[V,Q,h,b]),Y=(0,s.useMemo)((function(){return(0,ee.sE)(l,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n}))}),[l]),K=(0,s.useMemo)((function(){return Y?(0,Ar.Qc)(Y.content):{}}),[Y]),J=(0,s.useMemo)((function(){return(0,P.jsx)(mo,{api:"integration_destinations",block:Y,blockContent:K,onChangeCodeBlock:h,pipeline:b})}),[Y,K,h,b]),ne=(0,s.useMemo)((function(){var e;return(0,xe.Qr)(null===Q||void 0===Q?void 0:Q.catalog)?null===b||void 0===b||null===(e=b.data_integration)||void 0===e?void 0:e.catalog:null===Q||void 0===Q?void 0:Q.catalog}),[Q,null===b||void 0===b||null===(n=b.data_integration)||void 0===n?void 0:n.catalog]),te=((null===ne||void 0===ne?void 0:ne.streams)||[]).every((function(e){return e.auto_add_new_fields})),ie=((null===ne||void 0===ne?void 0:ne.streams)||[]).every((function(e){return e.disable_column_type_check})),re=(0,kt.Z)(ne);(0,s.useEffect)((function(){!re&&ne&&(O((function(){return E(V),[V]})),k((function(e){var n;return e||(null===ne||void 0===ne||null===(n=ne.streams)||void 0===n?void 0:n.map((function(e){return e.tap_stream_id})))})))}),[ne]);var oe=(0,s.useState)(),le=oe[0],ce=oe[1],ue=(0,d.Db)(be.ZP.integration_sources.useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.integration_source;if(n.success){var t=(null===n||void 0===n?void 0:n.streams)||[];O((function(){return E(V),[V]})),t.length>0&&S(t[0]),k((function(e){var n=(e||[]).concat(t);return Array.from(new Set(n)).sort()})),m(U.DATA),f()}else ce(null===n||void 0===n?void 0:n.error_message)},onErrorCallback:function(e,n){return y({errors:n,response:e})}})}}),ae=(0,o.Z)(ue,2),se=ae[0],de=ae[1].isLoading,fe=(0,d.Db)(be.ZP.integration_sources.useUpdate(null===b||void 0===b?void 0:b.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.integration_source,t=n.selected_streams,i=n.streams,r=((null===ne||void 0===ne?void 0:ne.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(Fr.UNSUPPORTED!==i.inclusion){var r;if(e.replication_method||(e.replication_method=wr.FULL_TABLE),e.unique_conflict_method||(e.unique_conflict_method=Pr.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]=go(go({},n),{},{metadata:go(go({},i),{},{selected:!0})})}}))}));var c={streams:r.concat(l)};k(Me.map((function(e){return e.tap_stream_id})));var s=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(s)||h(V.type,V.uuid,(0,Ar.Pz)(go(go({},Q),{},{catalog:{}})));var d={pipeline:go(go({},b),{},{data_integration:go(go({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:c})})};j(d).then((function(){a(),u()}))},onErrorCallback:function(e,n){return y({errors:n,response:e})}})}}),pe=(0,o.Z)(fe,2),he=pe[0],me=pe[1].isLoading,ve=(0,s.useState)(null),ge=ve[0],ye=ve[1],ke=(0,d.Db)(be.ZP.integration_source_streams.useUpdate(null===b||void 0===b?void 0:b.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){ye(e.integration_source_stream)},onErrorCallback:function(e,n){return y({errors:n,response:e})}})}}),Ze=(0,o.Z)(ke,2),Oe=Ze[0],Ce=Ze[1].isLoading,Ee=(0,s.useCallback)((function(e,n){var t=function(e,n){var t,i=[];return e.streams.forEach((function(e){e.tap_stream_id===n?t=e:i.push(e)})),{stream:t,streams:i}}(ne,e),i=t.stream,r=t.streams,o=go(go({},ne),{},{streams:r.concat(n(i))}),l=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(l)||h(V.type,V.uuid,(0,Ar.Pz)(go(go({},Q),{},{catalog:{}})));var c={pipeline:go(go({},b),{},{data_integration:go(go({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:o})})};j(c).then((function(){return a()}))}),[ne,V,Q,a,h,b,j]),Se=(0,s.useCallback)((function(e){if(null!==ne&&void 0!==ne&&ne.streams){var n=go(go({},ne),{},{streams:ne.streams.map((function(n){return e(n)}))}),t=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(t)||h(V.type,V.uuid,(0,Ar.Pz)(go(go({},Q),{},{catalog:{}})));var i={pipeline:go(go({},b),{},{data_integration:go(go({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:n})})};j(i).then((function(){return a()}))}}),[ne,V,Q,a,h,b,j]),we=(0,s.useCallback)((function(e,n,t){Ee(e,(function(e){return e.schema.properties[n]=t,e}))}),[Ee]),Pe=(0,s.useCallback)((function(e,n,t){Ee(e,(function(e){var i=e.metadata;return n.forEach((function(n){var r=i.findIndex((function(e){var t=e.breadcrumb,i=void 0===t?[]:t;return 2===i.length&&"properties"===i[0]&&i[1]===n}));if(r>=0){var o=i[r].metadata;e.metadata[r].metadata=go(go({},o),t)}})),e}))}),[Ee]),Ie=(0,d.Db)(be.ZP.blocks.pipelines.useUpdate(null===b||void 0===b?void 0:b.uuid,null===Y||void 0===Y?void 0:Y.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===a||void 0===a||a()},onErrorCallback:function(e,n){return null===y||void 0===y?void 0:y({errors:n,response:e})}})}}),Te=(0,o.Z)(Ie,1)[0],Ae=(0,s.useMemo)((function(){var e=[];return null===p||void 0===p||p.forEach((function(n){var t=n.variables;return null===t||void 0===t?void 0:t.forEach((function(n){var t=n.uuid,i=n.value,r="\"{{ variables('".concat(t,"') }}\"");if(!t.startsWith("output"))return e.push([(0,P.jsx)(_.ZP,{monospace:!0,children:t},"variable-uuid-".concat(t)),(0,P.jsx)(_.ZP,{monospace:!0,children:i},"variable-uuid-".concat(t,"-{value}")),(0,P.jsx)(_.ZP,{monospace:!0,children:r},"variable-uuid-".concat(t,"-{value}-code")),(0,P.jsx)(Rr.Z,{copiedText:r,monospace:!0,withCopyIcon:!0},"variable-uuid-".concat(t,"-{value}-code-copy"))])}))})),(0,P.jsx)(_e.Z,{alignTop:!0,columnFlex:[null,null,1],columns:[{uuid:"Key"},{uuid:"Value"},{uuid:"Code"}],rows:e})}),[p]),De=(0,s.useCallback)((function(e){return(0,P.jsxs)(Z.Z,{mt:2,children:[(0,P.jsxs)(_.ZP,{default:!0,children:["Use the following variables to interpolate sensitive or dynamic information into the configuration.",(0,P.jsx)("br",{}),"You can also access values from your environment variables by using the following syntax: ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:"\"{{ env_var('MY_ENV_VARIABLE_NAME') }}\""}),(0,P.jsx)("br",{}),"For more information, check out the ",(0,P.jsx)(sn.Z,{href:e,openNewWindow:!0,primary:!0,children:"documentation"}),"."]}),(0,P.jsx)(Z.Z,{mt:1,children:Ae})]})}),[Ae]),Me=(0,s.useMemo)((function(){return(null===ge||void 0===ge?void 0:ge.streams)||[]}),[ge]),Ne=(0,Re.dd)((function(){return(0,P.jsx)(fo,{catalog:ne,isLoading:me,onActionCallback:function(e){var n=Object.entries(e).reduce((function(e,n){var t=(0,o.Z)(n,2),i=t[0];return t[1]?e.concat(i):e}),[]);if(n.length>0)he({integration_source:{streams:n}}),Fe();else{var t=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(t)||h(V.type,V.uuid,(0,Ar.Pz)(go(go({},Q),{},{catalog:{}}))),j({pipeline:go(go({},b),{},{data_integration:go(go({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:null})})}).then((function(){return a()})),Fe()}},streams:Me})}),{},[ne,V,Q,a,me,h,j,Me],{background:!0,uuid:"select_streams"}),Le=(0,o.Z)(Ne,2),Be=Le[0],Fe=Le[1];return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(g.Z,{iconOnly:!0,onClick:function(){return D((function(e){return!e}))},children:(0,P.jsxs)(P.Fragment,{children:[R&&(0,P.jsx)(X.Kh,{size:1.5*$.iI}),!R&&(0,P.jsx)(X._M,{size:1.5*$.iI})]})}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Dr.Z,{children:"Source"}),!R&&(0,P.jsxs)(Dr.Z,{default:!0,inline:!0,children:["\xa0",null===(t=H[null===Q||void 0===Q?void 0:Q.source])||void 0===t?void 0:t.name]})]})]})}),R&&(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsxs)(Yr.dE,{children:[(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsx)(Dr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select source"}),(null===F||void 0===F?void 0:F.length)>0?(0,P.jsxs)(er.Z,{onChange:function(e){var n,t,i=e.target.value;if(i){var o=null===(n=H[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})),V?h(V.type,V.uuid,(0,Ar.Pz)(go(go({},Q),{},{catalog:{},config:o,source:i}))):r({content:(0,Ar.Pz)({config:o,source:i}),language:v.t6.YAML,type:v.tf.DATA_LOADER},0,C),ye(null),j().then((function(){a()}))}},primary:!0,value:null===Q||void 0===Q?void 0:Q.source,children:[(0,P.jsx)("option",{value:""}),F.map((function(e){var n=e.name,t=e.uuid;return(0,P.jsx)("option",{value:t,children:n},t)}))]}):(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Ui.Z,{inverted:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(Dr.Z,{level:5,primary:!0,children:"Loading sources..."})]})]}),V&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsx)(Dr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===Q||void 0===Q?void 0:Q.source)&&(0,P.jsxs)(Z.Z,{mb:2,children:[(0,P.jsxs)(_.ZP,{default:!0,children:["For more information on how to configure this source, read the ",(0,P.jsxs)(sn.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/sources/".concat(Q.source,"/README.md"),openNewWindow:!0,primary:!0,children:[Q.source," documentation"]})]}),De("https://docs.mage.ai/guides/data-integration-pipeline#configure-source")]}),q]}),(0,P.jsxs)("div",{children:[(0,P.jsx)(Dr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select stream"}),(0,P.jsx)(g.Z,{loading:Ce,onClick:function(){j().then((function(){Oe().then((function(){return Be()})),a()}))},primary:!0,small:!0,children:"View and select streams"})]}),le&&(0,P.jsx)(_.ZP,{warning:!0,children:le})]})]}),me&&(0,P.jsx)(Z.Z,{p:2,children:(0,P.jsx)(Ui.Z,{})}),!me&&(0,P.jsx)(Z.Z,{mt:3,children:(0,P.jsx)(oo,{catalog:ne,destination:null===K||void 0===K?void 0:K.destination,isLoadingLoadSampleData:de,loadSampleData:function(e){return se({integration_source:{action_type:"sample_data",pipeline_uuid:null===b||void 0===b?void 0:b.uuid,streams:[e]}})},pipeline:b,setErrors:y,setSelectedStream:S,source:null===Q||void 0===Q?void 0:Q.source,updateAllStreams:Se,updateMetadataForColumns:Pe,updateSchemaProperty:we,updateStream:Ee})})]}),(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(g.Z,{disabled:!V,iconOnly:!0,onClick:function(){return L((function(e){return!e}))},children:(0,P.jsxs)(P.Fragment,{children:[N&&V&&(0,P.jsx)(X.Kh,{size:1.5*$.iI}),(!N||!V)&&(0,P.jsx)(X._M,{disabled:!V,size:1.5*$.iI})]})}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(Dr.Z,{children:"Transformers"})})]})}),N&&V&&(0,P.jsx)(Z.Z,{mb:5,children:(0,P.jsxs)(Yr.dE,{children:[c.length>0&&(0,P.jsx)(Z.Z,{mb:1,children:c.map((function(e,n){return(0,P.jsx)(Z.Z,{mb:1,children:e},n)}))}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsx)(ht,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=[];return V&&i.push(V.uuid),r(go(go({},e),{},{configuration:t,content:n,upstream_blocks:i}),l.length-1,(function(e){Y&&(Te({block:go(go({},Y),{},{upstream_blocks:[e.uuid]})}),C(e))}))},compact:!0,hideCustom:!0,hideDataExporter:!0,hideDataLoader:!0,hideDbt:!0,hideRecommendations:!0,hideScratchpad:!0,hideSensor:!0,hideTransformerDataSources:!0,pipeline:b})})]})}),(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(g.Z,{disabled:!V,iconOnly:!0,onClick:function(){return T((function(e){return!e}))},children:(0,P.jsxs)(P.Fragment,{children:[I&&V&&(0,P.jsx)(X.Kh,{size:1.5*$.iI}),(!I||!V)&&(0,P.jsx)(X._M,{disabled:!V,size:1.5*$.iI})]})}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Dr.Z,{children:"Destination"}),!I&&(0,P.jsxs)(Dr.Z,{default:!0,inline:!0,children:["\xa0",null===(i=G[null===K||void 0===K?void 0:K.destination])||void 0===i?void 0:i.name]})]})]})}),I&&V&&(0,P.jsxs)(Yr.dE,{children:[(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsx)(Dr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select destination"}),(null===W||void 0===W?void 0:W.length)>0?(0,P.jsxs)(er.Z,{onChange:function(e){var n=e.target.value;if(n){if(Y)h(Y.type,Y.uuid,(0,Ar.Pz)(go(go({},K),{},{destination:n})));else{var t,i,o=null===(t=G[n])||void 0===t||null===(i=t.templates)||void 0===i?void 0:i.config;o&&(Object.keys(o).forEach((function(e){o[e]=o[e]||null})),o.hasOwnProperty("table")&&delete o.table);var c=[];if((null===l||void 0===l?void 0:l.length)>=2){var u=l.find((function(e){var n=e.uuid;return(null===V||void 0===V?void 0:V.uuid)!==n}));u&&c.push(u.uuid)}else V&&c.push(V.uuid);r({content:(0,Ar.Pz)({config:o,destination:n}),language:v.t6.YAML,type:v.tf.DATA_EXPORTER,upstream_blocks:c},1,C)}j().then((function(){a()}))}},primary:!0,value:null===K||void 0===K?void 0:K.destination,children:[(0,P.jsx)("option",{value:""}),W.map((function(e){var n=e.name,t=e.uuid;return(0,P.jsx)("option",{value:t,children:n},t)}))]}):(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Ui.Z,{inverted:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(Dr.Z,{level:5,primary:!0,children:"Loading destinations..."})]})]}),Y&&(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsx)(Dr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===K||void 0===K?void 0:K.destination)&&(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(Z.Z,{mb:2,children:[(0,P.jsxs)(_.ZP,{default:!0,children:["For more information on how to configure this destination, read the ",(0,P.jsxs)(sn.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/destinations/".concat(K.destination,"/README.md"),openNewWindow:!0,primary:!0,children:[K.destination," documentation"]}),".",(0,P.jsx)("br",{}),(0,P.jsx)("br",{}),"If your configuration contains a key named ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:"table"}),", it\u2019s optional.",(0,P.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,P.jsx)(_.ZP,{bold:!0,inline:!0,children:"Table name"})," in a previous section."]}),De("https://docs.mage.ai/guides/data-integration-pipeline#configure-destination")]})}),J,(0,P.jsx)(Z.Z,{mt:3,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(Z.Z,{mr:2,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Automatically add new fields"}),(0,P.jsx)(_.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,P.jsx)(qr.Z,{checked:!!te,disabled:!(null!==ne&&void 0!==ne&&ne.streams),onCheck:function(){return Se((function(e){return go(go({},e),{},{auto_add_new_fields:!te})}))}})]})}),(0,P.jsx)(Z.Z,{mt:3,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(Z.Z,{mr:2,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Disable column type check"}),(0,P.jsxs)(_.ZP,{default:!0,children:["By default, the value for each column is validated according to the schema property for that column.",(0,P.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,P.jsx)("br",{}),"Turn this toggle on if you want to disable this strict type checking."]})]}),(0,P.jsx)(qr.Z,{checked:!!ie,disabled:!(null!==ne&&void 0!==ne&&ne.streams),onCheck:function(){return Se((function(e){return go(go({},e),{},{disable_column_type_check:!ie})}))}})]})})]})]})]})};function xo(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 jo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?xo(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):xo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var yo=function(e){var n=e.addNewBlockAtIndex,t=e.addWidget,i=e.anyInputFocused,r=e.autocompleteItems,o=e.blockRefs,c=e.blocks,u=void 0===c?[]:c,a=e.dataProviders,d=e.deleteBlock,f=e.disableShortcuts,p=e.fetchFileTree,h=e.fetchPipeline,m=e.fetchSampleData,g=e.files,b=e.globalVariables,x=e.interruptKernel,j=(e.isPipelineUpdating,e.kernel,e.mainContainerRef),y=e.mainContainerWidth,_=e.messages,O=e.onChangeCallbackBlock,E=e.onChangeCodeBlock,S=e.openSidekickView,I=e.pipeline,T=e.pipelineContentTouched,R=(e.pipelineLastSaved,e.restartKernel),D=e.runBlock,M=e.runningBlocks,N=void 0===M?[]:M,L=e.savePipelineContent,B=e.selectedBlock,F=e.setAnyInputFocused,U=e.setEditingBlock,H=e.setErrors,z=e.setIntegrationStreams,W=(e.setMessages,e.setOutputBlocks),G=e.setPipelineContentTouched,V=e.setRecsWindowOpenBlockIdx,Q=(e.setRunningBlocks,e.setSelectedBlock),q=e.setSelectedOutputBlock,Y=e.setSelectedStream,K=e.setTextareaFocused,X=e.textareaFocused,J=e.widgets,ee=(0,s.useState)(!1),ne=ee[0],te=ee[1],ie=(0,s.useState)(!1),re=ie[0],oe=ie[1],le=(0,s.useState)(!0),ce=le[0],ae=le[1],se=(0,s.useState)(null),de=se[0],fe=se[1],pe=(0,s.useState)(null),he=pe[0],me=pe[1],ve=(0,s.useState)(!1),ge=ve[0],be=ve[1],je=(0,s.useState)(""),ye=je[0],ke=je[1],Ze=(0,s.useMemo)((function(){return N.reduce((function(e,n,t){return jo(jo({},e),{},(0,l.Z)({},n.uuid,jo(jo({},n),{},{priority:t})))}),{})}),[N]),_e=(0,kt.Z)(B),Oe=(0,s.useMemo)((function(){return u.length}),[u]),Ce=(0,s.useMemo)((function(){return k.qL.INTEGRATION===(null===I||void 0===I?void 0:I.type)}),[I]),Ee=(0,s.useMemo)((function(){return k.qL.STREAMING===(null===I||void 0===I?void 0:I.type)}),[I]),Se="PipelineDetail/index",we=(0,Xe.y)(),Pe=we.disableGlobalKeyboardShortcuts,Ie=we.registerOnKeyDown,Te=we.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){Te(Se)}}),[Te,Se]),Ie(Se,(function(e,t,r){if(T&&(0,w.y)([C.zX,C.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()}if(!f&&!Pe)if((0,w.y)([C.zX,C.Um],t)||(0,w.y)([C.PQ,C.Um],t))e.preventDefault(),L();else if(X)t[C.vP]?K(!1):T||C.Z1.find((function(e){return t[e]}))||G(!0);else if(!Ce){if(B){var l=u.findIndex((function(e){var n=e.uuid;return B.uuid===n}));if(t[C.vP])Q(null),V(null);else if(r[0]===C.xD&&r[1]===C.xD)x();else if(r[0]===C.l1&&r[1]===C.l1&&-1!==l)d(B).then((function(e){null!==e&&void 0!==e&&e.error||setTimeout((function(){l===u.length-1?Q(u[l-1]):u.length>=0?Q(u[l+1]):Q(null)}),100)}));else if(t[C.Bu]&&l>=1){var c=u[l-1];if(c){var a,s;Q(c);var p="".concat(c.type,"s/").concat(c.uuid,".py");null===(a=o.current[p])||void 0===a||null===(s=a.current)||void 0===s||s.scrollIntoView()}}else if(t[C.kD]&&l<=Oe-2){var h=u[l+1];if(h){var m,g;Q(h);var b="".concat(h.type,"s/").concat(h.uuid,".py");null===(m=o.current[b])||void 0===m||null===(g=m.current)||void 0===g||g.scrollIntoView()}}else(0,w.y)([C.Uq],t)?K(!0):!i&&(0,w.y)([C.zH],t)?n({type:v.tf.SCRATCHPAD},l,Q):!i&&(0,w.y)([C.Fv],t)&&n({type:v.tf.SCRATCHPAD},l+1,Q)}else _e&&t[C.Uq]&&Q(_e);r[0]===C.OC&&r[1]===C.OC&&R()}}),[n,i,o.current,u,x,Ce,Oe,T,R,L,B,_e,G,Q,K,X]),(0,s.useEffect)((function(){var e=setInterval((function(){T&&L()}),5e3);return function(){clearInterval(e)}}),[T,L]),(0,s.useEffect)((function(){setTimeout((function(){return oe(!0)}),600)}),[I]);var Ae=(0,s.useCallback)((function(e){te(!0),me(e)}),[te,me]),Re=(0,s.useCallback)((function(){te(!1),be(!1),ke("")}),[]),De=(0,s.useMemo)((function(){return u.filter((function(e){var n=e.type;return!Ce||v.tf.TRANSFORMER===n})).map((function(e,i){var l=e.type,c=e.uuid,f=(null===B||void 0===B?void 0:B.uuid)===c,m=Ze[c],v=m?0===m.priority?Qe.uF.BUSY:Qe.uF.QUEUED:Qe.uF.IDLE,g="".concat(l,"s/").concat(c,".py");return o.current[g]=(0,s.createRef)(),(0,P.jsx)(vr,{addNewBlock:function(e){return K(!0),n(e,i+1,Q)},addNewBlockMenuOpenIdx:de,addWidget:t,autocompleteItems:r,block:e,blockIdx:i,blockRefs:o,blocks:u,dataProviders:a,defaultValue:e.content,deleteBlock:function(e){d(e),F(!1)},executionState:v,fetchFileTree:p,fetchPipeline:h,interruptKernel:x,mainContainerRef:j,mainContainerWidth:y,messages:_[c],noDivider:i===Oe-1||Ce,onCallbackChange:function(e){return O(l,c,e)},onChange:function(e){return E(l,c,e)},onClickAddSingleDBTModel:Ae,openSidekickView:S,pipeline:I,ref:o.current[g],runBlock:D,runningBlocks:N,savePipelineContent:L,selected:f,setAddNewBlockMenuOpenIdx:fe,setAnyInputFocused:F,setCreatingNewDBTModel:be,setEditingBlock:U,setErrors:H,setOutputBlocks:W,setRecsWindowOpenBlockIdx:V,setSelected:function(n){return Q(!0===n?e:null)},setSelectedOutputBlock:q,setTextareaFocused:K,textareaFocused:f&&X,widgets:J},c)}))}),[n,de,t,r,o,u,a,d,p,h,x,Ce,j,y,_,Oe,O,E,Ae,S,I,D,N,Ze,L,B,fe,F,U,H,W,V,Q,q,K,X,J]),Me=(0,s.useMemo)((function(){return(0,P.jsx)(bo,{addNewBlockAtIndex:n,blocks:u,codeBlocks:De,fetchFileTree:p,fetchPipeline:h,fetchSampleData:m,globalVariables:b,onChangeCodeBlock:E,openSidekickView:S,pipeline:I,savePipelineContent:L,setErrors:H,setIntegrationStreams:z,setOutputBlocks:W,setSelectedBlock:Q,setSelectedOutputBlock:q,setSelectedStream:Y})}),[n,u,De,p,h,m,b,E,S,I,L,H,z,W,Q,q,Y]),Ne=(0,s.useMemo)((function(){return(0,P.jsx)(ht,{addNewBlock:function(e){var t=u[u.length-1],i=null,r={},o=t?Wi(t,e):[];t&&([v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(t.type)&&v.tf.SCRATCHPAD===e.type&&(i="from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(I.uuid,"', '").concat(t.uuid,"', 'output_0')\n")),v.t6.SQL===t.language&&(r=jo(jo({},(0,xe.GL)(t.configuration,[oi,li,ci,ui,fi])),r))),v.t6.SQL===e.language&&(i=st(i)),i=dt(e,i),n(jo(jo({},e),{},{configuration:r,content:i,upstream_blocks:o}),Oe,Q),K(!0)},hideCustom:Ce||Ee,hideDataExporter:Ce,hideDataLoader:Ce,hideDbt:Ce||Ee,hideRecommendations:Ce,hideScratchpad:Ce,hideSensor:Ce,onClickAddSingleDBTModel:Ae,pipeline:I,setCreatingNewDBTModel:be,setRecsWindowOpenBlockIdx:V})}),[n,u,Ce,Ee,Oe,Ae,I,V,Q,K]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(mn,{children:ce&&(0,P.jsx)(Rn.Z,{classNames:"pipeline-detail",in:re,onEntered:function(){return setTimeout((function(){return ae(!1)}),hn)},timeout:1,children:(0,P.jsx)(vn,{})})}),(0,P.jsxs)(Z.Z,{mt:1,px:$.cd,children:[Ce&&Me,!Ce&&(0,P.jsxs)(P.Fragment,{children:[De,(0,P.jsx)(Z.Z,{mt:$.cd,children:Ne})]}),ne&&(0,P.jsx)(tn.Z,{onClickOutside:Re,open:!0,children:(0,P.jsx)(Tr,{blocks:u,creatingNewDBTModel:ge,dbtModelName:ye,files:g,onClose:Re,onOpenFile:function(e){var t=ge?"".concat(e,"/").concat((0,ue.RA)(ye||(0,ue.Y6)()),".").concat(A.SQL):e,i={configuration:{file_path:t},language:v.t6.SQL,name:(0,ue.wE)(t),type:v.tf.DBT};ge&&(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?Wi(o,i):[];n(jo(jo({},i),{},{upstream_blocks:l}),r?Oe:he+1,Q),Re(),K(!0)},setDbtModelName:ke})})]})]})},ko=t(49894),Zo=t(12344),_o=t(32063),Oo=t(70543),Co=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 So(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,l.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 wo=function(e){var n=e.after,t=e.afterHeader,i=e.afterHidden,r=e.afterSubheader,l=e.before,c=e.beforeHeader,u=e.children,a=e.errors,d=e.headerOffset,f=e.mainContainerHeader,p=e.mainContainerRef,h=e.page,m=e.pipeline,v=e.setAfterHidden,g=e.setAfterWidthForChildren,b=e.setErrors,x=e.setMainContainerWidth,j=(0,Co.i)().width,y=(0,s.useState)((0,S.U2)(S.L8,fn.Zt)),k=y[0],Z=y[1],_=(0,s.useState)((0,S.U2)(S.J3,fn.ve)),O=_[0],C=_[1],E=(0,s.useState)(!!(0,S.U2)(S.Uu)),w=E[0],I=E[1],T=(0,s.useState)(!1),A=T[0],R=T[1],D=(0,s.useState)(!1),M=D[0],N=D[1],L=i,B=v;if(!B){var F=(0,s.useState)(!!(0,S.U2)(S.zg)),U=(0,o.Z)(F,2);L=U[0],B=U[1]}(0,s.useEffect)((function(){null===p||void 0===p||!p.current||A||M||null===x||void 0===x||x(p.current.getBoundingClientRect().width)}),[A,M,L,k,w,O,p,x,j]),(0,s.useEffect)((function(){A||(null===g||void 0===g||g(k),(0,S.t8)(S.L8,k))}),[A,k,g]),(0,s.useEffect)((function(){M||(0,S.t8)(S.J3,O)}),[M,O]);var H=be.ZP.projects.list({},{revalidateOnFocus:!1}).data,z=null===H||void 0===H?void 0:H.projects,W=(0,s.useMemo)((function(){var e,n=[{label:function(){return"Pipelines"},linkProps:{as:"/pipelines",href:"/pipelines"}}];return m&&(n.push.apply(n,[{bold:Oo.b!==h,label:function(){return null===m||void 0===m?void 0:m.name},linkProps:{as:"/pipelines/".concat(null===m||void 0===m?void 0:m.uuid),href:"/pipelines/[pipeline]"}}]),Oo.b===h&&n.push.apply(n,[{bold:!0,label:function(){return(0,ue.kC)(h)}}])),(0,P.jsx)(Zo.Z,{breadcrumbs:n,project:null===z||void 0===z?void 0:z[0],version:null===z||void 0===z||null===(e=z[0])||void 0===e?void 0:e.version})}),[h,m,z]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Zn.Z,{title:null===m||void 0===m?void 0:m.name}),(0,P.jsx)(_o.Z,{after:n,afterHeader:t,afterHidden:L,afterMousedownActive:A,afterSubheader:r,afterWidth:k,before:l,beforeHeader:c,beforeHidden:w,beforeMousedownActive:M,beforeWidth:O,header:W,headerOffset:d,mainContainerHeader:f,mainContainerRef:p,setAfterHidden:B,setAfterMousedownActive:R,setAfterWidth:Z,setBeforeHidden:I,setBeforeMousedownActive:N,setBeforeWidth:C,children:u}),a&&(0,P.jsx)(tn.Z,{disableClickOutside:!0,isOpen:!0,onClickOutside:function(){return b(null)},children:(0,P.jsx)(ko.Z,So(So({},a),{},{onClose:function(){return b(null)}}))})]})},Po=t(41788),Io=t(70001),To=t(26226),Ao=t(29989),Ro=t(53655),Do=t(84181),Mo=t(31969),No=t(2005);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 Bo(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,l.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 Fo=N.default.div.withConfig({displayName:"HeatMap__YAxisLabelContainer",componentId:"sc-h2irj-0"})(["-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-o-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);white-space:nowrap;"]);function Uo(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function Ho(e,n){return Math.min.apply(Math,(0,r.Z)(e.map(n)))}var zo=function(e){return e.bins},Wo=function(e){return e.count},Go={top:0,left:0,right:0,bottom:0};function Vo(e){var n=e.countMidpoint,t=e.data,i=(e.events,e.height),r=e.margin,o=void 0===r?{}:r,l=e.minCount,c=e.width,u=(e.yLabels,(0,s.useContext)(N.ThemeContext)),a=(u.monotone||Mo.Z.monotone).grey300,d=(u.brand||Mo.Z.brand).wind400,f=(u.content||Mo.Z.content).default,p=(u.monotone||Mo.Z.monotone).white,h=Bo(Bo({},Go),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=Uo(m,(function(e){return Uo(zo(e),Wo)})),g=Ho(m,(function(e){return Ho(zo(e),Wo)})),b=Uo(m,(function(e){return zo(e).length})),x="undefined"!==typeof n?n:0,j="undefined"!==typeof l?l:g,y=(0,Do.Z)({domain:[0,m.length]}),k=(0,Do.Z)({domain:[0,b]}),Z=(0,Do.Z)({range:[a,d],domain:[x,v]}),_=(0,Do.Z)({range:[.1,1],domain:[x,v]}),O=(0,Do.Z)({range:[a,d],domain:[j,x]}),C=(0,Do.Z)({range:[1,.1],domain:[j,x]}),E=c-(h.left+h.right),S=i-(h.bottom+h.top),w=E/m.length,I=S/b;return y.range([0,E]),k.range([S,0]),c<10?null:(0,P.jsx)(P.Fragment,{children:(0,P.jsx)("svg",{width:c,height:i,children:(0,P.jsx)(Ao.Z,{left:h.left,top:h.top,children:(0,P.jsx)(Ro.Z,{data:m,xScale:y,yScale:k,colorScale:Z,opacityScale:_,binWidth:w,binHeight:w,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=C(e.count),i=O(e.count)),(0,P.jsxs)("svg",{height:I,width:w,x:e.x,y:e.y-I,children:[(0,P.jsx)("rect",{className:"visx-heatmap-rect",fill:i,fillOpacity:t,height:I,width:w}),(0,P.jsx)("text",{alignmentBaseline:"middle",fill:e.count>=.8*v?p:f,fontFamily:No.ry,fontSize:14,textAnchor:"middle",x:"50%",y:"50%",children:e.count})]},"heatmap-rect-".concat(e.row,"-").concat(e.column))}))}))}})})})})}var Qo=function(e){var n=e.countMidpoint,t=e.data,i=e.height,r=e.margin,o=e.minCount,l=e.xAxisLabel,c=e.xLabels,u=e.yAxisLabel,a=e.yLabels,s=function(e){return e.length>12?"".concat(e.substring(0,12),"..."):e},d=4*$.iI,f=8*$.iI,p=0;return u&&(p+=d+1*$.iI),a&&(p+=f+1*$.iI),(0,P.jsxs)(P.Fragment,{children:[(l||c)&&(0,P.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,P.jsxs)(Z.Z,{mb:{xs:1},children:[l&&(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,xsmall:!0,children:l})}),c&&(0,P.jsx)(x.Z,{children:c.map((function(e){var n=e.label,t=e.linkProps;return(0,P.jsx)(He.Z,{flex:"1",justifyContent:"center",children:t?(0,P.jsx)(sn.Z,{bold:!0,centerAlign:!0,minWidth:70,onClick:t.onClick,xsmall:!0,children:n}):(0,P.jsx)(_.ZP,{bold:!0,center:!0,minWidth:70,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})]})}),(0,P.jsxs)("div",{style:{height:i,display:"flex",width:"100%"},children:[u&&(0,P.jsx)("div",{style:{marginRight:1*$.iI,width:d},children:(0,P.jsx)(x.Z,{alignItems:"center",justifyContent:"center",children:(0,P.jsx)(Fo,{children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,xsmall:!0,children:u})})})}),a&&(0,P.jsx)("div",{style:{marginRight:1*$.iI},children:(0,P.jsx)(x.Z,{alignItems:"center",flexDirection:"column",fullHeight:!0,width:f,children:a.map((function(e){var n=e.label,t=e.linkProps;return(0,P.jsx)(He.Z,{alignItems:"center",flex:"1",children:t?(0,P.jsx)(sn.Z,{bold:!0,centerAlign:!0,onClick:t.onClick,xsmall:!0,children:n}):(0,P.jsx)(_.ZP,{bold:!0,center:!0,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})}),(0,P.jsx)("div",{style:{height:i,width:"100%"},children:(0,P.jsx)(To.Z,{children:function(e){var i=e.width,l=e.height;return(0,P.jsx)(Vo,{countMidpoint:n,data:t,height:l,margin:r,minCount:o,width:i,yLabels:a})}})})]})]})},qo=t(11754);var Yo=function(e){var n=e.afterWidth,t=e.features,i=e.insightsOverview,r=e.statistics,l=i.correlations,c=void 0===l?[]:l,u=n-(2*$.cd*$.iI+pn.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,ue.QV)(n)}));return o.splice(t,0,1),o})),xyLabels:n}}(c),s=a.heatmapData,d=a.xyLabels,f=function(e,n){return(0,ee.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,ee.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,ee.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,o.Z)(t,2),r=i[0],l=i[1];return{feature:e,percentage:Number(l)/n.count,value:r}})),"percentage")}(t,r);return(0,P.jsxs)(x.Z,{flexDirection:"column",children:[(null===f||void 0===f?void 0:f.length)>=1&&(0,P.jsx)(qo.Z,{headerTitle:"Data completion",width:u,children:(0,P.jsx)(Io.Z,{data:f.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*$.iI,50*$.iI),renderTooltipContent:function(e){var n=e.x;return"".concat((0,ue.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,P.jsx)(qo.Z,{headerTitle:"Number of unique values",width:u,children:(0,P.jsx)(Io.Z,{data:p.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*$.iI,50*$.iI),renderTooltipContent:function(e){var n=e.x;return"".concat(n," unique values")},xNumTicks:2,ySerialize:function(e){return e.y}})}),h.length>=1&&(0,P.jsx)(qo.Z,{headerTitle:"Distribution of values",width:u,children:(0,P.jsx)(Io.Z,{data:h.map((function(e){var n=e.feature,t=e.percentage;return{feature:n,value:e.value,x:t,y:n.uuid}})),height:Math.max(3*h.length*$.iI,50*$.iI),renderTooltipContent:function(e){var n=e.value,t=e.x;return"".concat(n," is ").concat((0,ue.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,P.jsx)(qo.Z,{headerTitle:"Correlations",children:(0,P.jsx)(Z.Z,{p:1,children:(0,P.jsx)(Qo,{countMidpoint:0,data:s,height:8*$.iI*d.length,minCount:-1,xLabels:d,yLabels:d})})})]})},Ko=t(92083),Xo=t.n(Ko),Jo=t(84969),$o=t(90948),el=t(65743),nl=t(39048),tl=t(79487),il=t(61655),rl=t(16853),ol=t(65376),ll=t(52359),cl=t(48072),ul=t(24903),al=t(98677),sl=t(73899);function dl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function fl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?dl(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):dl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var pl={bottom:$.iI*(3+$.cd),left:$.iI*$.cd,right:$.iI*$.cd,top:$.iI*$.cd};function hl(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function ml(e){var n=e.data,t=e.height,i=e.keyForYData,o=e.large,l=e.margin,c=void 0===l?{}:l,u=e.orientationVertical,a=void 0!==u&&u,d=e.showTooltip,f=e.width,p=e.yLabelFormat,h=(0,s.useContext)(N.ThemeContext),m=(0,s.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=o?Gr.iD:Gr.J5,b=fl(fl({},pl),c),x=n.slice(Math.max(0,n.length-50)),j=(0,s.useMemo)((function(){return Object.keys((null===x||void 0===x?void 0:x[0])||{}).filter((function(e){return e!==i}))}),[x,i]),y=(0,ul.Z)({domain:j,range:[sl.a$,sl.Ej,sl.hM,sl.ZA,sl.$R,sl.X_,sl.er,sl.hl,sl.nQ]}),k=(0,s.useMemo)((function(){return x.map(m)}),[x,m]),Z=(0,al.Z)({domain:k,padding:.1}),_=(0,al.Z)({domain:j,padding:.1}),O=(0,Do.Z)({domain:[0,hl(x,(function(e){return hl(j,(function(n){return Number(e[n])}))}))]}),C={active:(null===h||void 0===h?void 0:h.content.default)||Oe.Z.content.default,backgroundPrimary:(null===h||void 0===h?void 0:h.chart.backgroundPrimary)||Oe.Z.chart.backgroundPrimary,backgroundSecondary:(null===h||void 0===h?void 0:h.chart.backgroundSecondary)||Oe.Z.chart.backgroundSecondary,muted:(null===h||void 0===h?void 0:h.content.muted)||Oe.Z.content.muted,primary:(null===h||void 0===h?void 0:h.chart.primary)||Oe.Z.chart.primary,tooltipBackground:(null===h||void 0===h?void 0:h.background.navigation)||Oe.Z.background.navigation},E=k;a&&(E=x.reduce((function(e,n){return e.concat(j.map((function(e){var t=n[e];return(0,ue.HW)(t)?parseInt(String(t)):t})))}),[]));var S=Math.min(Math.max.apply(Math,(0,r.Z)(E.map((function(e){return String(e).length})))),20);b.left+=7*S;var w=f-(b.left+b.right),P=t-(b.top+b.bottom);a?(Z.rangeRound([0,w]),O.rangeRound([P,0])):(Z.rangeRound([P,0]),O.rangeRound([0,w])),_.rangeRound([0,Z.bandwidth()]);var I=x.map(m).length,T=0;a||(T=Z(E[I-1]));var A=(0,s.useCallback)((function(e){var n=(0,cl.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-T/2)/(w-T):1-(o-T/2)/(P-T);var c=Math.floor(l*I),u=x[c];"undefined"===typeof u&&(u=x[c-1]),a?r>T&&r<w+b.left-T&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i}):o>T&&o<P-T&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i})}),[x,I,b.left,b.top,a,d,T,w,P]);return{colorScale:y,colors:C,data:x,fontSize:g,handleTooltip:A,margin:b,tempScale:O,tickValues:E,xKeys:j,xMax:w,y1Scale:_,yLabelFormat:v,yMax:P,yScale:Z,ySerialize:m}}var vl=["height","width","xAxisLabel","yAxisLabel"];function gl(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?gl(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):gl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}$.iI,$.iI,$.iI;var xl=(0,il.Z)((function(e){var n=e.data,t=e.height,i=e.hideTooltip,r=e.keyForYData,l=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=ml({data:n,height:t,keyForYData:l,large:c,margin:a,showTooltip:f,width:g,yLabelFormat:j}),k=y.colorScale,Z=y.colors,O=y.data,C=y.fontSize,E=y.handleTooltip,S=y.margin,w=y.tempScale,I=y.tickValues,T=y.xKeys,A=y.xMax,R=y.y1Scale,D=y.yLabelFormat,M=y.yMax,N=y.yScale,L=y.ySerialize;return g<10?null:(0,P.jsxs)("div",{children:[(0,P.jsxs)("svg",{height:t,width:g,children:[s&&!(null!==O&&void 0!==O&&O.length)&&(0,P.jsx)("text",{fill:Z.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:No.ry,fontSize:C,x:"50%",y:"50%",children:s()}),(0,P.jsx)(el.Z,{fill:"transparent",height:t-(S.top+S.bottom),onMouseLeave:function(){return i()},onMouseMove:E,onTouchMove:E,onTouchStart:E,rx:14,width:g-(S.left+S.right),x:S.left,y:S.top}),(null===O||void 0===O?void 0:O.length)&&(0,P.jsxs)(Ao.Z,{left:S.left,top:S.top,children:[(0,P.jsx)(nl.Z,{color:k,data:O,keys:T,width:A,xScale:w,y0:L,y0Scale:N,y1Scale:R,children:function(e){return e.map((function(e){return(0,P.jsx)(Ao.Z,{top:e.y0,children:e.bars.map((function(n){return(0,P.jsx)("g",{children:(0,P.jsx)(P.Fragment,{children:(0,P.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,P.jsx)(Jo.Z,{hideTicks:!0,scale:N,stroke:Z.muted,tickFormat:function(e){return D(e)},tickLabelProps:function(){return{fill:Z.active,fontFamily:No.ry,fontSize:C,style:{width:"10px"},textAnchor:"end"}},tickStroke:Z.muted,tickValues:I,top:2}),(0,P.jsx)($o.Z,{label:b,labelProps:{fill:Z.muted,fontFamily:No.ry,fontSize:C,textAnchor:"middle"},numTicks:x,scale:w,stroke:Z.muted,tickLabelProps:function(){return{fill:Z.active,fontFamily:No.ry,fontSize:C,textAnchor:"middle"}},tickStroke:Z.muted,top:M})]}),p&&(0,P.jsx)("g",{children:(0,P.jsx)(tl.Z,{from:{x:S.left,y:v},pointerEvents:"none",stroke:Z.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:A+S.left,y:v}})})]}),m&&p&&(0,P.jsxs)(rl.Z,{left:h,style:bl(bl({},ol.j),{},{backgroundColor:Z.tooltipBackground}),top:v,children:[d&&d(p),!d&&Object.entries(p).map((function(e){var n=(0,o.Z)(e,2),t=n[0],i=n[1];if(l!==t){var r=i;return(0,ue.HW)(r)&&String(r).split(".").length>=2&&(r=r.toFixed(4)),(0,P.jsxs)(_.ZP,{inverted:!0,small:!0,children:[t,": ",r]},t)}}))]})]})}));var jl=function(e){var n,t=e.height,i=e.width,r=e.xAxisLabel,o=e.yAxisLabel,l=(0,M.Z)(e,vl);return n="undefined"===typeof i?"100%":o?0===i?i:i-28:i,(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{style:{display:"flex",height:t,marginBottom:r?$.iI:null,width:"100%"},children:[o&&(0,P.jsx)(x.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,P.jsx)(ll.Z,{children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:o})})}),(0,P.jsx)("div",{style:{height:t,width:n},children:(0,P.jsx)(To.Z,{children:function(e){var n=e.width,t=e.height;return(0,P.jsx)(xl,bl(bl({},l),{},{height:t,width:n}))}})})]}),r&&(0,P.jsx)("div",{style:{paddingLeft:o?36:0,paddingTop:4},children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:r})})]})},yl=t(95422),kl=["keyForYData"],Zl=["height","width","xAxisLabel","yAxisLabel"];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 Ol(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,l.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}var Cl=(0,il.Z)((function(e){var n=e.keyForYData,t=void 0===n?"__y":n,i=(0,M.Z)(e,kl),r=i.height,l=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=ml(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,O=g.tempScale,C=(g.tickValues,g.xKeys),E=(g.xMax,g.y1Scale),S=g.yLabelFormat,w=g.yMax,I=g.yScale,T=g.ySerialize;return p<10?null:(0,P.jsxs)("div",{children:[(0,P.jsxs)("svg",{height:r,width:p,children:[c&&!(null!==j&&void 0!==j&&j.length)&&(0,P.jsx)("text",{fill:x.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:No.ry,fontSize:y,x:"50%",y:"50%",children:c()}),(null===j||void 0===j?void 0:j.length)&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(el.Z,{fill:"transparent",height:r-(Z.top+Z.bottom),onMouseLeave:function(){return l()},onMouseMove:k,onTouchMove:k,onTouchStart:k,rx:14,width:p-(Z.left+Z.right),x:Z.left,y:2*Z.top}),(0,P.jsxs)(Ao.Z,{top:Z.top,children:[(0,P.jsx)(yl.Z,{color:b,data:j,height:w,keys:C,x0:T,x0Scale:I,x1Scale:E,yScale:O,children:function(e){return e.map((function(e){return(0,P.jsx)(Ao.Z,{left:e.x0+Z.left,top:Z.top,children:e.bars.map((function(n){return(0,P.jsx)("g",{children:(0,P.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,P.jsx)(Jo.Z,{left:Z.left,numTicks:v,scale:O,stroke:x.muted,tickFormat:function(e){return S(e)},tickLabelProps:function(){return{fill:x.active,fontFamily:No.ry,fontSize:y,textAnchor:"end",transform:"translate(-2,2.5)"}},tickStroke:x.muted,top:Z.top}),(0,P.jsx)($o.Z,{hideTicks:!0,left:Z.left,numTicks:m,scale:I,stroke:x.muted,tickFormat:h,tickLabelProps:function(){return{fill:x.active,fontFamily:No.ry,fontSize:y,textAnchor:"middle"}},tickStroke:x.muted,top:w+Z.top})]})]}),a&&(0,P.jsx)("g",{children:(0,P.jsx)(tl.Z,{from:{x:s,y:2*Z.top},pointerEvents:"none",stroke:x.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:s,y:w+2*Z.top}})})]}),d&&a&&(0,P.jsxs)(rl.Z,{left:s,style:Ol(Ol({},ol.j),{},{backgroundColor:x.tooltipBackground}),top:f,children:[u&&u(a),!u&&Object.entries(a).map((function(e){var n=(0,o.Z)(e,2),i=n[0],r=n[1];if(t!==i){var l=r;return(0,ue.HW)(l)&&String(l).split(".").length>=2&&(l=l.toFixed(4)),(0,P.jsxs)(_.ZP,{inverted:!0,small:!0,children:[i,": ",l]},i)}})),(0,P.jsx)("br",{}),(0,P.jsxs)(_.ZP,{inverted:!0,small:!0,children:[h&&h(T(a)),!h&&T(a)]})]})]})}));var El=function(e){var n=e.height,t=e.width,i=e.xAxisLabel,r=e.yAxisLabel,o=(0,M.Z)(e,Zl);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{style:{display:"flex",height:n,marginBottom:i?$.iI:null,width:"100%"},children:[r&&(0,P.jsx)(x.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,P.jsx)(ll.Z,{children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:r})})}),(0,P.jsx)("div",{style:{height:n,width:r?0===t?t:t-28:t},children:(0,P.jsx)(To.Z,{children:function(e){var n=e.height,t=e.width;return(0,P.jsx)(Cl,Ol(Ol({},o),{},{height:n,width:t}))}})})]}),i&&(0,P.jsx)("div",{style:{paddingLeft:r?36:0,paddingTop:4},children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:i})})]})},Sl=t(66872),wl=t(68735),Pl=t(320),Il=40*$.iI,Tl=N.default.div.withConfig({displayName:"indexstyle__ChartBlockStyle",componentId:"sc-1c3ufnj-0"})(["border-radius:","px;margin-left:","px;margin-right:","px;margin-top:","px;",""],Ce.n_,.5*$.iI,.5*$.iI,1*$.iI,(function(e){return"\n background-color: ".concat((e.theme.background||Oe.Z.background).chartBlock,";\n ")})),Al=N.default.div.withConfig({displayName:"indexstyle__ConfigurationOptionsStyle",componentId:"sc-1c3ufnj-1"})(["flex:4;padding-left:","px;padding-right:","px;"],1*$.iI,1*$.iI),Rl=N.default.div.withConfig({displayName:"indexstyle__CodeStyle",componentId:"sc-1c3ufnj-2"})(["padding-top:","px;",""],$.iI/2,(function(e){return"\n background-color: ".concat((e.theme.background||Oe.Z.background).codeTextarea,";\n ")})),Dl=N.default.div.withConfig({displayName:"indexstyle__CodeHelperStyle",componentId:"sc-1c3ufnj-3"})(["margin-bottom:","px;padding-bottom:","px;padding-left:","px;",""],$.cd*$.iI,$.iI,$.iI,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.borders||Oe.Z.borders).medium,";\n ")}));function Ml(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 Nl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ml(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ml(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ll=function(e){var n,t=e.block,i=e.data,r=e.width,c=t.configuration,u=void 0===c?{}:c,a=u||{},s=a.chart_style,d=a.chart_type,f=a.y_sort_order,p=u.height||Il,h=(null===u||void 0===u||null===(n=u.metrics)||void 0===n?void 0:n.map((function(e){return"".concat((n=e).aggregation,"(").concat(n.column,")");var n})))||[],m=Tn.n1,v=u.time_interval;if([ji.HOUR,ji.MINUTE,ji.SECOND].includes(v)&&(m=Tn.OC),Wt.BAR_CHART===d||Wt.TIME_SERIES_BAR_CHART===d){var g=i.x,b=i.y,x=Wt.TIME_SERIES_BAR_CHART===d;if(g&&b&&Array.isArray(g)&&Array.isArray(b)){var j,y=null===(j=u.group_by)||void 0===j?void 0:j.join(", "),k=null===h||void 0===h?void 0:h.join(", ");h.length||h.push(ii);var Z=h[0],O=g.map((function(e,n){return Nl({__y:e},h.reduce((function(e,t,i){var r,o=null===b||void 0===b||null===(r=b[i])||void 0===r?void 0:r[n];return"undefined"===typeof o?e:Nl(Nl({},e),{},(0,l.Z)({},t,o))}),{}))}));xi.ASCENDING===f?O=(0,ee.YC)(O,(function(e){return e[Z]}),{ascending:!1}):xi.DESCENDING===f&&(O=(0,ee.YC)(O,(function(e){return e[Z]}),{ascending:!0}));var C={data:O,height:p,renderNoDataText:function(){return"No data matching query"},width:r,xNumTicks:3};return vi.HORIZONTAL===s?(0,P.jsx)(jl,Nl(Nl({},C),{},{xAxisLabel:k||u.y,yAxisLabel:y||u.x})):(0,P.jsx)(El,Nl(Nl({},C),{},{xAxisLabel:y,xLabelFormat:function(e){return x?Xo()(1e3*e).format(Tn.n1):e},xNumTicks:O.length,yAxisLabel:k,yNumTicks:5}))}}else if(Wt.HISTOGRAM===d){var E,S=i.x,w=i.y,I=null===(E=u.group_by)||void 0===E?void 0:E.join(", ");if(S&&w&&Array.isArray(S))return(0,P.jsx)(Sl.Z,{data:S.map((function(e,n){var t,i=e.max,r=e.min;return[i,null===w||void 0===w||null===(t=w[n])||void 0===t?void 0:t.value,r]})),height:p,width:r,large:!0,margin:{left:5*$.iI,right:1*$.iI,top:3*$.iI},noPadding:!0,renderTooltipContent:function(e){var n=(0,o.Z)(e,3),t=n[0],i=n[1],r=n[2];return(0,P.jsxs)(_.ZP,{inverted:!0,monospace:!0,small:!0,children:["Count : ",i,(0,P.jsx)("br",{}),"Bucket: ",r,"-",t]})},showAxisLabels:!0,showYAxisLabels:!0,showZeroes:!0,sortData:function(e){return(0,ee.YC)(e,"[0]")},xAxisLabel:I||u.x,yAxisLabel:I?"count(".concat(I,")"):u.y})}else if(Wt.LINE_CHART===d||Wt.TIME_SERIES_LINE_CHART===d){var T=i.x,A=i.y,R=Wt.TIME_SERIES_LINE_CHART===d;if(T&&A&&Array.isArray(T)&&Array.isArray(A)&&Array.isArray(null===A||void 0===A?void 0:A[0])){var D,M=h;u.legend_labels&&(M=u.legend_labels.split(",").map((function(e){return e.trim()})));var N=T.map((function(e,n){return{x:e,y:(0,ee.w6)(A.length).map((function(e,t){var i=A[t][n];return"undefined"===typeof i||null===i?0:i}))}})),L=null===(D=u.group_by)||void 0===D?void 0:D.join(", "),B=h.join(", ");return(0,P.jsx)(wl.Z,{data:N,height:p,lineLegendNames:M,margin:{bottom:8*$.iI,left:5*$.iI},noCurve:!0,renderXTooltipContent:function(e){e.index;var n=e.x,t=u.x,i=n;return u.group_by&&(t=u.group_by.map(String).join(", ")),R&&(i=Xo()(1e3*n).format(m)),(0,P.jsxs)(_.ZP,{inverted:!0,small:!0,children:[t,": ",i]})},renderYTooltipContent:function(e,n){var t=e.y;return(0,P.jsxs)(_.ZP,{inverted:!0,small:!0,children:[M&&M[n]&&"".concat(M[n],": "),t&&(0,ue.x6)((0,ue.QV)(t[n],4))]})},width:r?r-3*$.iI:r,xAxisLabel:L||String(u.x),xLabelFormat:function(e){return R?Xo()(1e3*e).format(Tn.n1):e},yAxisLabel:B||String(u.y),yLabelFormat:function(e){return e}})}}else if(Wt.PIE_CHART===d){var F,U=i[String(u.x)],H=null===(F=u.group_by)||void 0===F?void 0:F.join(", ");if(U)return(0,P.jsx)(Pl.Z,{data:Object.entries(U),getX:function(e){var n=(0,o.Z)(e,2),t=n[0],i=n[1];return"".concat(t," (").concat((0,ue.x6)(i),")")},getY:function(e){return(0,o.Z)(e,2)[1]},height:p,width:r,xAxisLabel:H||String(u.x)})}else if(Wt.TABLE===d){var z=i.index,W=i.x,G=i.y;return Array.isArray(W)&&Array.isArray(G)&&Array.isArray(G[0])&&(0,P.jsx)(xt.Z,{columns:W,index:z,height:u.height?null:p,maxHeight:u.height?p:null,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,rows:G,width:r})}return(0,P.jsx)("div",{})},Bl=t(76096);var Fl=function(e){var n=e.children,t=e.onChange,i=(0,s.useState)(s.Children.map(n,(function(){return null}))),r=i[0],o=i[1],l=(0,s.useState)(0),c=l[0],u=l[1];return(0,P.jsx)(x.Z,{children:s.Children.map(n,(function(e,n){return(0,P.jsx)(Z.Z,{ml:n>=1?1:0,style:{display:"flex",flex:1},children:s.cloneElement(e,{onChange:function(e){o((function(i){return i[n]=e.target.value,t(i,{resetValues:function(){return u((function(e){return e+1}))},setValues:o}),i}))},value:r[n]})},"multi-select-child-".concat(n,"-").concat(c))}))})};function Ul(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 Hl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ul(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ul(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function zl(e,n){var t,i,r,c,u=e.autocompleteItems,a=e.block,f=e.blockRefs,p=e.blocks,h=e.deleteWidget,m=e.executionState,g=e.fetchPipeline,b=e.fetchFileTree,y=e.messages,k=void 0===y?[]:y,E=e.onChangeContent,S=e.pipeline,w=e.runBlock,I=e.runningBlocks,T=e.savePipelineContent,A=e.selected,R=e.setAnyInputFocused,D=e.setSelectedBlock,M=e.setTextareaFocused,L=e.textareaFocused,B=e.updateWidget,F=e.width,U=(0,s.useRef)(null),H=(0,s.useContext)(N.ThemeContext),z=be.ZP.blocks.pipelines.detail(null===S||void 0===S?void 0:S.uuid,null===a||void 0===a?void 0:a.upstream_blocks[0]).data,W=(null===z||void 0===z||null===(t=z.block)||void 0===t?void 0:t.outputs)||(null===a||void 0===a?void 0:a.outputs)||[],G=(0,s.useState)(null),V=G[0],Q=G[1],q=(0,s.useState)(null===(i=a.configuration)||void 0===i?void 0:i.chart_type),Y=q[0],K=q[1],J=(0,s.useState)(a.configuration),ne=J[0],te=J[1],ie=(0,s.useState)(a.content),re=ie[0],oe=ie[1],le=(0,s.useState)(!Y||0===W.length),ae=le[0],se=le[1],de=(0,s.useState)(!1),fe=de[0],pe=de[1],he=(0,s.useState)(null),me=he[0],ve=he[1],ge=(0,s.useState)(null===a||void 0===a?void 0:a.upstream_blocks),ye=ge[0],ke=ge[1],Ze=(0,s.useState)((null===W||void 0===W?void 0:W.length)||0),_e=Ze[0],Ce=Ze[1],Ee=(0,s.useState)(a.uuid),Se=Ee[0],we=Ee[1],Pe=Pi[Y],Ie=Ii[Y],Te=(0,s.useMemo)((function(){return null===p||void 0===p?void 0:p.filter((function(e){var n=e.type;return[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(n)}))}),[p]),Ae=(0,s.useMemo)((function(){return(0,ee.HK)(Te,(function(e){return e.uuid}))}),[Te]),Re=!!I.find((function(e){return e.uuid===a.uuid}))||(null===k||void 0===k?void 0:k.length)>=1&&m!==Qe.uF.IDLE,De=(0,s.useMemo)((function(){return null===k||void 0===k?void 0:k.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[k]),Me=!!De.find((function(e){return e.error})),Ne=De.length>=1,Le=(0,s.useMemo)((function(){return{blockType:a.type,hasError:Me,selected:A}}),[a.type,Me,A]);if(null!==De&&void 0!==De&&De.length){var Be,Fe,Ue=De.length-1;c=null===De||void 0===De||null===(Be=De[Ue])||void 0===Be||null===(Fe=Be.data)||void 0===Fe?void 0:Fe[0]}c?(c=(c=c.slice(1,c.length-1)).replaceAll('\\"','"').replaceAll("\\'","'"),(0,ue.Pb)(c)&&(r=JSON.parse(c))):(null===W||void 0===W?void 0:W.length)>=1&&(r={},W.forEach((function(e){var n=e||{},t=n.text_data,i=n.type,o=n.variable_uuid;Qe.Gi.TEXT===i&&(0,ue.Pb)(t)&&(r[o]=JSON.parse(t))})));var ze=(0,s.useCallback)((function(e){var n=Hl(Hl(Hl({},a),e),{},{configuration:Hl(Hl({},a.configuration),e.configuration)});T().then((function(){w({block:n,code:re,ignoreAlreadyRunning:!0,runUpstream:!!ye.find((function(e){var n;return![v.DA.EXECUTED,v.DA.UPDATED].includes(null===(n=Ae[e])||void 0===n?void 0:n.status)}))})})),Ce((function(e){return e+1}))}),[a,Ae,re,Ce,ye]),We=(0,s.useCallback)((function(e){oe(e),E(e)}),[E,oe]),Ge=(0,s.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.autoRun;te((function(n){return Hl(Hl({},n),e)}));var i=Hl(Hl({},a),{},{configuration:Hl(Hl(Hl({},ne),e),{},{chart_type:Y})});B(i);Object.keys(e);_e&&t&&ze(i)}),[a,Y,ne,_e,ze,te,B]);(0,s.useEffect)((function(){Q({python:cr({autocompleteItems:u,block:a,blocks:p,pipeline:S})})}),[u,a,p,S]);var qe=(0,s.useMemo)((function(){return(0,P.jsx)(Ve.Z,{autoHeight:!0,autocompleteProviders:V,onChange:We,selected:A,setSelected:function(e){return D(!0===e?a:null)},setTextareaFocused:M,showLineNumbers:!1,textareaFocused:L||Wt.TABLE===Y&&!ae,value:re,width:"100%"})}),[V,Y,re,ae,A,D,M,L,We]),Ye=(0,s.useMemo)((function(){return Me&&Ne&&(0,P.jsx)(Gt,Hl(Hl({},Le),{},{block:a,contained:!1,hideExtraInfo:!0,isInProgress:Re,messages:De,selected:A}))}),[a,Le,Me,Ne,Re,De,A]),Ke=(0,kt.Z)(ae),Je=(0,kt.Z)(F);(0,s.useEffect)((function(){var e,n=null===U||void 0===U||null===(e=U.current)||void 0===e?void 0:e.getBoundingClientRect();Ke!==ae||Je!==F?(ve(0),setTimeout((function(){var e,n,t=null===U||void 0===U||null===(e=U.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.width;t&&ve(t)}),100)):n&&ve(n.width)}),[ae,Ke,U.current,ve,F,Je]);var $e=(0,s.useMemo)((function(){var e=[];return ye.forEach((function(n,t){var i=Ae[n],r=(0,ce.qn)(null===i||void 0===i?void 0:i.type,{blockColor:null===i||void 0===i?void 0:i.color,theme:H}).accent;e.push((0,P.jsxs)(Z.Z,{ml:2,children:[(0,P.jsxs)(_.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:["df_",t+1]})," ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,P.jsx)(sn.Z,{color:r,inline:!0,onClick:function(){var e,n,t=null===f||void 0===f||null===(e=f.current)||void 0===e?void 0:e["".concat(null===i||void 0===i?void 0:i.type,"s/").concat(null===i||void 0===i?void 0:i.uuid,".py")];null===t||void 0===t||null===(n=t.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,P.jsx)(_.ZP,{color:r,monospace:!0,small:!0,children:n})})]},n))})),e}),[Ae,ye]),en=(0,s.useMemo)((function(){var e,n=[],t=null===Pe||void 0===Pe||null===(e=Pe.code)||void 0===e?void 0:e.reduce((function(e,n){var t=n.uuid;return mi.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=ne[e];if(i){var r,o,l=null===(r=Ti[Y])||void 0===r||null===(o=r[e])||void 0===o?void 0:o.call(r);n.push((0,P.jsxs)(Z.Z,{ml:2,children:[(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:i})," ",l&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,P.jsx)(_.ZP,{default:!0,inline:!0,small:!0,children:l})]})]},i))}})),n}),[ne,Pe]),nn=(0,kt.Z)(Y),tn=(0,kt.Z)(ye);(0,s.useEffect)((function(){if((!nn&&Y&&null!==ye&&void 0!==ye&&ye.length||(null===tn||void 0===tn||!tn.length)&&(null===ye||void 0===ye?void 0:ye.length)>=1&&Y)&&!re&&(0,xe.Qr)(ne)&&Ie){var e=Hl(Hl({},a),{},{upstream_blocks:ye});Ie.configuration&&Ge(Ie.configuration(e)),Ie.content&&We(Ie.content(e))}}),[a,Y,nn,ne,re,Ge,We,ye,tn]);var rn=(0,s.useMemo)((function(){return ne.width_percentage||1}),[ne]),on=(0,s.useMemo)((function(){return Object.entries(Pe||{}).reduce((function(e,n){var t=(0,o.Z)(n,2),i=t[0],r=t[1];return Hl(Hl({},e),{},(0,l.Z)({},i,r.map((function(e){var n,t=e.autoRun,i=e.label,r=e.monospace,o=e.options,c=e.settings,u=void 0===c?{}:c,s=e.type,d=e.uuid,f={fullWidth:!0,key:d,label:(0,ue.kC)(i()),monospace:r,onBlur:function(){return D(a)},onChange:function(e){return Ge((0,l.Z)({},d,e.target.value),{autoRun:t})},onFocus:function(){return D(a)},value:(null===ne||void 0===ne?void 0:ne[d])||""},p=(null!==z&&void 0!==z&&z.block?[z.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(Ei.COLUMNS===s){var h=ne[d]||[];n=(0,P.jsxs)(P.Fragment,{children:[(!u.maxValues||h.length<u.maxValues)&&(0,P.jsxs)(er.Z,Hl(Hl({},f),{},{onChange:function(e){var n=ne[d]||[],i=e.target.value;n.includes(i)?n=(0,ee.Od)(n,(function(e){return e===i})):n.push(i),Ge((0,l.Z)({},d,n),{autoRun:t})},value:null,children:[(0,P.jsx)("option",{value:""}),(0,ee.YC)(p.filter((function(e){return!h.includes(e)})),(function(e){return e})).map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]})),h.map((function(e){return(0,P.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,P.jsx)(Qr,{label:e,onClick:function(){Ge((0,l.Z)({},d,(0,ee.Od)(h,(function(n){return n===e}))),{autoRun:t})}})},e)}))]})}else if(Ei.METRICS===s){var m=ne[d]||[];n=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(_.ZP,{bold:!0,children:"Metrics"}),(0,P.jsx)(_.ZP,{muted:!0,small:!0,children:"Select a column and an aggregation function."}),(0,P.jsxs)(Fl,{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]}))||(Ge((0,l.Z)({},d,m.concat({aggregation:e[0],column:e[1]})),{autoRun:t}),r([null,null]),i()))},children:[(0,P.jsxs)(er.Z,Hl(Hl({},f),{},{label:"aggregation",children:[(0,P.jsx)("option",{value:""}),(0,ee.YC)(Si,(function(e){return e})).map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]})),(0,P.jsxs)(er.Z,Hl(Hl({},f),{},{label:"column",children:[(0,P.jsx)("option",{value:""}),(0,ee.YC)(p,(function(e){return e})).map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]}))]}),m.map((function(e){var n=e.aggregation,i=e.column;return(0,P.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,P.jsx)(Qr,{label:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(_.ZP,{inline:!0,monospace:!0,children:[n,"("]}),i,(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:")"})]}),onClick:function(){Ge((0,l.Z)({},d,(0,ee.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,P.jsx)(er.Z,Hl(Hl({},f),{},{children:o.map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))})):(0,P.jsx)(O.Z,Hl(Hl({},f),{},{type:s}));return(0,P.jsx)(Z.Z,{mb:1,children:n},d)}))))}),{noCode:[]})}),[Ae,ne,Pe,W,D,Ge,ye]),ln=on.code,cn=on.noCode,un=(0,d.Db)(be.ZP.widgets.pipelines.useUpdate(null===S||void 0===S?void 0:S.uuid,a.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){pe(!1),g(),b()},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})},onError:function(e){(0,je.qQ)(e).messages}}),an=(0,o.Z)(un,1)[0],fn="ChartBlock/".concat(a.uuid),pn=(0,Xe.y)(),hn=pn.registerOnKeyDown,mn=pn.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){mn(fn)}}),[mn,fn]),hn(fn,(function(e,n,t){fe&&String(t[0])===String(C.Uq)&&String(t[1])!==String(C.zX)&&an({widget:Hl(Hl({},a),{},{name:Se})})}),[a,fe,Se,an]),(0,P.jsx)(Bl.Z,{sm:12,md:12*rn,children:(0,P.jsxs)(Tl,{ref:n,children:[(0,P.jsx)(Z.Z,{mt:1,pt:1,px:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{flex:1,style:{position:"relative"},children:[(0,P.jsx)(In,{bold:!1,fullWidth:!0,inputValue:Se,notRequired:!0,onBlur:function(){return setTimeout((function(){return pe(!1)}),300)},onChange:function(e){we(e.target.value),e.preventDefault()},onClick:function(){R(!0),pe(!0)},onFocus:function(){R(!0),pe(!0)},small:!0,stacked:!0,value:!fe&&a.uuid}),fe&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(sn.Z,{noWrapping:!0,onClick:function(){return an({widget:Hl(Hl({},a),{},{name:Se})})},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update chart name"})]})]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(er.Z,{compact:!0,onChange:function(e){var n=[e.target.value],t=Hl(Hl({},a),{},{upstream_blocks:n});B(t),ze(t),ke(n)},placeholder:"Source block",small:!0,value:(null===ye||void 0===ye?void 0:ye[0])||"",children:null===Te||void 0===Te?void 0:Te.map((function(e){var n=e.uuid;return(0,P.jsx)("option",{value:n,children:n},n)}))}),(0,P.jsx)(Z.Z,{mr:1}),!Re&&(0,P.jsx)(dn.Z,{appearBefore:!0,default:!0,label:"Run chart block",size:null,widthFitContent:!0,children:(0,P.jsx)(j.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return ze(a)},uuid:"ChartBlock/run/".concat(a.uuid),children:(0,P.jsx)(X.Py,{size:2*$.iI})})}),Qe.uF.QUEUED===m&&(0,P.jsx)(Ui.Z,{color:(H||Oe.Z).content.active,small:!0,type:"cylon"}),Qe.uF.BUSY===m&&(0,P.jsx)(Ui.Z,{color:(H||Oe.Z).content.active,small:!0}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(dn.Z,{appearBefore:!0,default:!0,label:"Edit chart",size:null,widthFitContent:!0,children:(0,P.jsx)(j.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return se((function(e){return!e}))},selected:ae,uuid:"ChartBlock/edit/".concat(a.uuid),children:(0,P.jsx)(X.I8,{size:2*$.iI})})}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(dn.Z,{appearBefore:!0,default:!0,label:"Delete chart",size:null,widthFitContent:!0,children:(0,P.jsx)(j.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return h(a)},uuid:"ChartBlock/delete/".concat(a.uuid),children:(0,P.jsx)(X.rF,{size:2*$.iI})})})]})]})}),(0,P.jsx)(Z.Z,{mt:1}),(0,P.jsxs)(x.Z,{justifyContent:"space-between",fullWidth:!0,children:[(0,P.jsx)(He.Z,{flex:6,ref:U,children:r&&!(0,xe.Qr)(r)&&(0,P.jsx)(Z.Z,{pb:3,children:(0,P.jsx)(Ll,{block:Hl(Hl({},a),{},{configuration:Hl(Hl({},a.configuration),ne)}),data:r,width:me})})}),ae&&(0,P.jsx)(Al,{children:(0,P.jsxs)(x.Z,{flexDirection:"column",fullWidth:!0,children:[(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsx)(er.Z,{onChange:function(e){var n=e.target.value,t=Hl(Hl({},a),{},{configuration:Hl(Hl({},ne),{},{chart_type:n})});B(t),ze(t),K(n)},placeholder:"Select chart type",value:Y,children:bi.map((function(e){return(0,P.jsx)("option",{value:e,children:(0,ue.kC)(e)},e)}))})}),(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsx)(er.Z,{onChange:function(e){return Ge((0,l.Z)({},ni,e.target.value))},placeholder:"Chart width",value:(null===ne||void 0===ne?void 0:ne.width_percentage)||1,children:[["1/2 width",.5],["full width",1]].map((function(e){var n=(0,o.Z)(e,2),t=n[0],i=n[1];return(0,P.jsx)("option",{value:i,children:t},t)}))})}),cn]})})]}),ae&&!(null===ln||void 0===ln||!ln.length)&&v.t6.SQL!==a.language&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Z.Z,{my:1,px:1,children:[(0,P.jsx)(_.ZP,{bold:!0,children:"Custom chart code"}),(0,P.jsxs)(_.ZP,{muted:!0,children:["Write custom logic mapping data to input values for your chart.",(0,P.jsx)("br",{}),"This code is only executed if you don\u2019t have any columns or metrics selected."]})]}),(0,P.jsxs)(Rl,{children:[ye.length>=1&&(0,P.jsxs)(Dl,{children:[(0,P.jsxs)(_.ZP,{muted:!0,small:!0,children:["Variables you can use in your code: ",$e]}),(0,P.jsxs)(_.ZP,{muted:!0,small:!0,children:["Variables that you must define: ",en]})]}),qe]})]}),Ye&&(0,P.jsx)(Z.Z,{px:1,children:Ye})]})})}var Wl=s.forwardRef(zl),Gl=t(97361),Vl=["blockRefs","blocks","chartRefs","deleteWidget","messages","onChangeChartBlock","runBlock","runningBlocks","savePipelineContent","selectedBlock","setAnyInputFocused","setSelectedBlock","setTextareaFocused","textareaFocused","updateWidget","widgets","width"];function Ql(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 ql(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ql(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ql(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Yl,Kl=function(e){var n=e.blockRefs,t=e.blocks,i=e.chartRefs,r=e.deleteWidget,o=e.messages,c=e.onChangeChartBlock,u=e.runBlock,a=e.runningBlocks,d=e.savePipelineContent,f=e.selectedBlock,p=e.setAnyInputFocused,h=e.setSelectedBlock,m=e.setTextareaFocused,v=e.textareaFocused,g=e.updateWidget,b=e.widgets,j=e.width,y=(0,M.Z)(e,Vl),k=(0,s.useMemo)((function(){return a.reduce((function(e,n,t){return ql(ql({},e),{},(0,l.Z)({},n.uuid,ql(ql({},n),{},{priority:t})))}),{})}),[a]);return(0,P.jsxs)(x.Z,{flexDirection:"column",fullWidth:!0,children:[(0,P.jsx)(Gl.Z,{fullHeight:!0,style:{marginLeft:.5*$.iI,marginRight:.5*$.iI},children:null===b||void 0===b?void 0:b.map((function(e){var l=e.uuid,b=k[l],x=b?0===b.priority?Qe.uF.BUSY:Qe.uF.QUEUED:Qe.uF.IDLE;return i.current[l]=(0,s.createRef)(),(0,s.createElement)(Wl,ql(ql({},y),{},{block:e,blockRefs:n,blocks:t,chartRefs:i,deleteWidget:r,executionState:x,key:l,messages:o[l],onChangeContent:function(e){return c(l,e)},ref:i.current[l],runBlock:u,runningBlocks:a,savePipelineContent:d,selected:(null===f||void 0===f?void 0:f.uuid)===l,setAnyInputFocused:p,setSelectedBlock:h,setTextareaFocused:m,textareaFocused:v,updateWidget:g,width:j}))}))}),(0,P.jsx)("div",{style:{height:"80vh"}})]})},Xl=N.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,P.jsxs)(Xl,{height:t*(305/358),viewBox:r,width:t,children:[(0,P.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,P.jsx)("path",{fill:"#000",d:"M118 46h1v216h-1zM178 46h1v216h-1zM238 46h1v216h-1z"}),(0,P.jsx)("path",{fill:"#000",d:"M59 208.25v-1h239v1zM59 154.5v-1h239v1zM59 100.75v-1h239v1z"}),(0,P.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,P.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,P.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,P.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,P.jsx)("circle",{cx:"55.2178",cy:"34.6274",r:"5.2954",fill:"#8ADE00"}),(0,P.jsx)("circle",{cx:"113.818",cy:"106.582",r:"5.2954",fill:"#8ADE00"}),(0,P.jsx)("circle",{cx:"84.2832",cy:"80.6953",r:"5.2954",fill:"#8ADE00"}),(0,P.jsx)("circle",{cx:"117.115",cy:"43.6274",r:"5.2954",fill:"#8ADE00"}),(0,P.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,P.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,P.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,P.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,P.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,P.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,P.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,P.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"})]})};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 ec(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,l.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(e){e.GREAT_EXPECTATIONS="great_expectations"}(Yl||(Yl={}));var nc=function(e){var n,t,i=e.block,r=e.blocks,l=e.onUpdateCallback,c=e.pipeline,u=e.runBlockAndTrack,a=e.setErrors,f=(0,s.useContext)(N.ThemeContext),p=(0,s.useState)(""),h=p[0],m=p[1],j=(0,s.useState)(!1),y=j[0],k=j[1],C=(0,s.useState)(null),E=C[0],S=C[1],w=(0,s.useMemo)((function(){return(0,ee.HK)(r,(function(e){return e.uuid}))}),[r]);(0,s.useEffect)((function(){E||S((0,ee.HK)((null===i||void 0===i?void 0:i.upstream_blocks)||[],(function(e){return e})))}),[i,E]);var I=(0,d.Db)((function(e){var n=e.upstream_blocks;return be.ZP.blocks.pipelines.useUpdate(null===c||void 0===c?void 0:c.uuid,encodeURIComponent(null===i||void 0===i?void 0:i.uuid),{query:{extension_uuid:null===i||void 0===i?void 0:i.extension_uuid}})({block:{upstream_blocks:n}})}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===l||void 0===l||l(),k(!1)},onErrorCallback:function(e,n){return null===a||void 0===a?void 0:a({errors:n,response:e})}})}}),T=(0,o.Z)(I,2),A=T[0],R=T[1].isLoading,D=(0,s.useMemo)((function(){return(null===r||void 0===r?void 0:r.filter((function(e){var n=e.name,t=e.type,i=e.uuid;return((null===n||void 0===n?void 0:n.toLowerCase().includes(null===h||void 0===h?void 0:h.toLowerCase()))||(null===i||void 0===i?void 0:i.toLowerCase().includes(null===h||void 0===h?void 0:h.toLowerCase())))&&[v.tf.DATA_EXPORTER,v.tf.DATA_LOADER,v.tf.DBT,v.tf.TRANSFORMER].includes(t)})))||[]}),[h,r]),M=(0,s.useMemo)((function(){var e=[];return null===D||void 0===D||D.forEach((function(n,t){var i=n.color,r=n.language,o=n.type,l=n.uuid,c=(0,ce.qn)(o,{blockColor:i,theme:f}).accent;t>=1&&e.push((0,P.jsx)(yt.Z,{light:!0},"divider-".concat(l)));var u=!(null===E||void 0===E||!E[l]),a=![v.t6.PYTHON].includes(r);e.push((0,P.jsx)(Z.Z,{px:2,py:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsx)(B.Z,{color:c,size:1.5*$.iI,square:!0}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(_.ZP,{monospace:!0,muted:a,small:!0,children:l})]}),a&&(0,P.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:[r," support coming soon"]}),!a&&(0,P.jsx)(b.Z,{checked:!a&&u,disabled:a,onClick:function(){S((function(e){var n=ec({},e);return u?delete n[l]:n[l]=l,n}))}})]})},"option-".concat(l)))})),e}),[D,f,E]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(tn.Z,{onClickOutside:function(){return k(!1)},open:!0,children:[(0,P.jsx)(O.Z,{beforeIcon:(0,P.jsx)(X.HN,{}),borderless:!0,compact:!0,onChange:function(e){return m(e.target.value)},onClick:function(e){(0,dr.j)(e),k(!0)},onFocus:function(e){(0,dr.j)(e),k(!0)},placeholder:"Select blocks to run expectations on",small:!0,value:h}),y&&(0,P.jsxs)(P.Fragment,{children:[M,(0,P.jsx)(Z.Z,{mx:1,children:(0,P.jsx)(x.Z,{justifyContent:"flex-end",children:(0,P.jsx)(g.Z,{compact:!0,loading:R,onClick:function(){A({upstream_blocks:Object.keys(E)})},small:!0,children:"Save selected blocks"})})})]})]}),!y&&(null===i||void 0===i||null===(n=i.upstream_blocks)||void 0===n?void 0:n.length)>=1&&(0,P.jsxs)(Z.Z,{pb:1,pr:1,children:[(0,P.jsx)(Z.Z,{mt:1,pl:1,children:(0,P.jsx)(_.ZP,{muted:!0,small:!0,children:"Click a block name below to run expectations on it."})}),(0,P.jsx)(x.Z,{alignItems:"center",children:null===i||void 0===i||null===(t=i.upstream_blocks)||void 0===t?void 0:t.map((function(e){var n=null===w||void 0===w?void 0:w[e];if(!n)return(0,P.jsx)("div",{},e);var t=n.color,r=n.type,o=(0,ce.qn)(r,{blockColor:t,theme:f}).accent;return(0,P.jsx)(Z.Z,{ml:1,mt:1,children:(0,P.jsx)(g.Z,{backgroundColor:o,compact:!0,disabled:!u,onClick:function(){null===u||void 0===u||u({block:ec(ec({},i),{},{upstream_blocks:[null===n||void 0===n?void 0:n.uuid]})})},small:!0,children:(0,P.jsx)(_.ZP,{monospace:!0,small:!0,children:e})})},e)}))})]})]})};function tc(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 ic(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?tc(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):tc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var rc=function(e){var n=e.addNewBlockAtIndex,t=e.autocompleteItems,i=e.blockRefs,r=e.blocks,o=e.blocksInNotebook,c=e.deleteBlock,u=e.extensionOption,a=e.fetchFileTree,d=e.fetchPipeline,f=e.interruptKernel,p=e.messages,h=e.onChangeCallbackBlock,m=e.onChangeCodeBlock,g=e.pipeline,b=e.runBlock,x=e.runningBlocks,y=e.savePipelineContent,k=e.selectedBlock,O=e.setAnyInputFocused,E=e.setErrors,S=e.setSelectedBlock,I=e.setTextareaFocused,T=e.textareaFocused,A=(0,s.useRef)(null),R=(0,s.useState)(!1),D=R[0],M=R[1],N=(u||{}).uuid,L=(g||{}).extensions,B=(0,s.useMemo)((function(){return(null===u||void 0===u?void 0:u.templates)||[]}),[u]),F=(0,s.useMemo)((function(){return null===L||void 0===L?void 0:L[N]}),[N,L]),U=(0,s.useMemo)((function(){return(null===F||void 0===F?void 0:F.blocks)||[]}),[F]),H=(0,s.useMemo)((function(){return(0,ee.HK)(U,(function(e){return e.uuid}))}),[U]),z=(0,s.useMemo)((function(){return N===(null===k||void 0===k?void 0:k.extension_uuid)&&H[null===k||void 0===k?void 0:k.uuid]}),[H,N,k]),W=(0,s.useMemo)((function(){return x.reduce((function(e,n,t){return ic(ic({},e),{},(0,l.Z)({},n.uuid,ic(ic({},n),{},{priority:t})))}),{})}),[x]),G=(0,s.useMemo)((function(){return U.map((function(e,n){var l=ic(ic({},e),{},{extension_uuid:N}),u=l.type,v=l.uuid,j=(null===k||void 0===k?void 0:k.uuid)===v,_=W[v],C=_?0===_.priority?Qe.uF.BUSY:Qe.uF.QUEUED:Qe.uF.IDLE,w="".concat(u,"s/").concat(v,".py");return i.current[w]=(0,s.createRef)(),(0,P.jsx)(Z.Z,{mt:$.cd,children:(0,P.jsx)(vr,{autocompleteItems:t,block:l,blockIdx:n,blockRefs:i,blocks:r,defaultValue:l.content,deleteBlock:function(e){c(ic(ic({},e),{},{extension_uuid:N})),O(!1)},executionState:C,extraContent:(0,P.jsx)(nc,{block:l,blocks:o,onUpdateCallback:d,pipeline:g,setErrors:E}),fetchFileTree:a,fetchPipeline:d,hideRunButton:!0,interruptKernel:f,messages:p[v],noDivider:!0,onCallbackChange:function(e){return h(u,v,e)},onChange:function(e){return m(u,v,e)},pipeline:g,ref:i.current[w],runBlock:b,runningBlocks:x,savePipelineContent:y,selected:j,setAnyInputFocused:O,setErrors:E,setSelected:function(e){return S(!0===e?l:null)},setTextareaFocused:I,textareaFocused:j&&T})},v)}))}),[t,i,r,o,c,U,N,a,d,f,p,h,m,g,b,x,W,y,k,O,E,S,I,T]),V="Extensions/GreatExpectations/index",Q=(0,Xe.y)(),q=Q.disableGlobalKeyboardShortcuts,Y=Q.registerOnKeyDown,K=Q.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){K(V)}}),[K,V]),Y(V,(function(e,n){!q&&z&&((0,w.y)([C.zX,C.Um],n)||(0,w.y)([C.PQ,C.Um],n))&&(e.preventDefault(),y())}),[z,y]),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsx)(_.ZP,{default:!0,children:"Add an extension block to start writing expectations for blocks in the current pipeline."}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(_.ZP,{default:!0,children:["When a block in your pipeline runs, it\u2019ll run any tests you define in its code. All associated extension blocks will also run during that phase. Learn more about the ",(0,P.jsx)(sn.Z,{href:"https://docs.mage.ai/development/testing/great-expectations",openNewWindow:!0,children:"Great Expectation power up"}),"."]})}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(_.ZP,{default:!0,children:["For all available expectations, read Great Expectation\u2019s ",(0,P.jsx)(sn.Z,{href:"https://greatexpectations.io/expectations/",openNewWindow:!0,children:"documentation"}),"."]})})]}),G,(0,P.jsx)(Z.Z,{mt:$.cd,children:(0,P.jsx)(tn.Z,{onClickOutside:function(){return M(!1)},open:!0,children:(0,P.jsx)(Hn.Z,{disableKeyboardShortcuts:!0,items:null===B||void 0===B?void 0:B.map((function(e){var t=e.description,i=e.name,r=e.path;return{label:function(){return i},onClick:function(){return n({config:{template_path:r},extension_uuid:N,type:v.tf.EXTENSION},(null===U||void 0===U?void 0:U.length)||0)},tooltip:function(){return t},uuid:e.uuid}})),onClickCallback:function(){return M(!1)},open:D,parentRef:A,uuid:"Extension",children:(0,P.jsx)(j.ZP,{beforeElement:(0,P.jsx)(Gn,{teal:!0,children:(0,P.jsx)(X.mm,{size:Wn})}),inline:!0,onClick:function(e){e.preventDefault(),M(!0)},uuid:"AddNewBlocks/Extension",children:"Extension block"})})})})]})},oc=t(59e3),lc=["pipeline"];function cc(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 uc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?cc(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):cc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ac=function(e){var n=e.pipeline,t=(0,M.Z)(e,lc),i=(0,f.useRouter)(),r=be.ZP.extension_options.list().data,o=(0,s.useMemo)((function(){return(null===r||void 0===r?void 0:r.extension_options)||[]}),[r]),l=(0,s.useMemo)((function(){return(0,ee.HK)(o,(function(e){return e.uuid}))}),[o]),c=(0,s.useState)(null),u=c[0],a=c[1],d=(0,s.useMemo)((function(){return l[u]}),[l,u]),p=(0,s.useMemo)((function(){return uc(uc({},t),{},{pipeline:n})}),[n,t]);return(0,s.useEffect)((function(){var e;a(null===(e=(0,oc.iV)())||void 0===e?void 0:e.extension)}),[i.asPath]),(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(Z.Z,{p:$.cd,children:[!u&&(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsxs)(_.ZP,{default:!0,children:["Power up your pipeline with extensions. Learn more about ",(0,P.jsx)(sn.Z,{href:"https://docs.mage.ai/design/blocks/extension",openNewWindow:!0,children:"extension blocks"}),"."]}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(_.ZP,{default:!0,children:["Click on a power up below to add and configure it for the ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:null===n||void 0===n?void 0:n.uuid})," pipeline."]})})]}),!r&&!u&&(0,P.jsx)(Ui.Z,{}),Yl.GREAT_EXPECTATIONS===u&&n&&(0,P.jsx)(rc,uc(uc({},p),{},{extensionOption:d})),!u&&(null===o||void 0===o?void 0:o.map((function(e){var n=e.description,t=e.name,i=e.uuid;return(0,P.jsx)(sn.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,xn.u7)({extension:i},{pushHistory:!0})},preventDefault:!0,children:(0,P.jsx)(y.Z,{dark:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsx)(lo.Z,{fullWidth:!1,children:(0,P.jsx)(Z.Z,{p:$.cd,children:(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)("img",{alt:t,height:3*$.iI,src:"/images/extensions/".concat(i,"/logo.png"),width:3*$.iI})})})}),(0,P.jsx)(Z.Z,{mr:$.cd}),(0,P.jsxs)(He.Z,{flexDirection:"column",children:[(0,P.jsx)(_.ZP,{bold:!0,children:t}),(0,P.jsx)(_.ZP,{default:!0,small:!0,children:n})]})]}),(0,P.jsx)(X._Q,{})]})})},i)})))]})})},sc=t(88560),dc=(N.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-43nc8t-0"})(["border-radius:","px;",""],Ce.TR,(function(e){return"\n border: 1px solid ".concat((e.theme.interactive||Mo.Z.interactive).defaultBorder,";\n ")})),N.default.div.withConfig({displayName:"indexstyle__ColumnProfileStyle",componentId:"sc-43nc8t-1"})(["",""],(function(e){return"\n background: ".concat((e.theme.background||Mo.Z.background).table,";\n border-bottom: 1px solid ").concat((e.theme.interactive||Mo.Z.interactive).defaultBorder,";\n border-right: 1px solid ").concat((e.theme.interactive||Mo.Z.interactive).defaultBorder,";\n ")}))),fc=(N.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-43nc8t-2"})(["background:",";padding:","px ","px;"," border-top-left-radius:","px;border-top-right-radius:","px;"],sl.Uq,1.75*$.iI,$.tr,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||Mo.Z.interactive).defaultBorder,";\n ")}),Ce.TR,Ce.TR),N.default.div.withConfig({displayName:"indexstyle__FeatureProfileStyle",componentId:"sc-43nc8t-3"})(["",""],(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||Mo.Z.interactive).defaultBorder,";\n ")}))),pc=(N.default.div.withConfig({displayName:"indexstyle__BodyStyle",componentId:"sc-43nc8t-4"})(["border-bottom-left-radius:","px;border-bottom-right-radius:","px;overflow-y:scroll;"],Ce.TR,Ce.TR),N.default.div.withConfig({displayName:"indexstyle__CellStyle",componentId:"sc-43nc8t-5"})([""," padding:","px;"],(function(e){return e.backgroundColor&&"\n background-color: ".concat(e.backgroundColor,";\n ")}),$.iI)),hc=N.default.div.withConfig({displayName:"indexstyle__ScrollOverflowStyle",componentId:"sc-43nc8t-6"})([""," overflow-x:auto;"],pn.w5);function mc(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 vc=["Type","Missing","Unique","Min","Max","Mean","Median","Mode","Invalid","Outliers","Skewness","Std dev"],gc={Missing:0,Invalid:0,Outliers:0,Unique:.9};function bc(e){var n=e.columns,t=e.feature,i=e.shouldLink,r=e.statistics,o=(0,s.useContext)(N.ThemeContext),l=t.columnType,c=t.uuid,u=mc(r,c),a=u.average,d=u.avg_string_length,f=u.avg_word_count,p=u.count,h=u.count_distinct,m=u.invalid_value_count,v=u.invalid_value_rate,g=u.max,b=u.max_character_count,j=u.max_word_count,y=u.min,k=u.min_character_count,O=u.min_word_count,C=u.median,E=u.mode,S=u.null_value_count,w=u.null_value_rate,I=u.outlier_count,T=u.skew,A=u.std,R=u.unique_value_rate,D=[l,S,h,y,g,a,C,E,m,I,T,A],M={Min:O,Max:j,Mean:f},L={Min:"".concat((0,ue._6)("character",k)),Max:"".concat((0,ue._6)("character",b)),Mean:"".concat((0,ue._6)("character",(0,ue.QV)(d)))},B={Invalid:(0,ue.T3)(v),Missing:(0,ue.T3)(w),Unique:(0,ue.T3)(R)},F=Pe.T5[l],U=[o.background.row,o.background.row2],H=U[0],z=U[1],W=i?sn.Z:_.ZP;return(0,P.jsxs)(He.Z,{flexDirection:"column",children:[(0,P.jsx)(fc,{children:(0,P.jsx)(Z.Z,{px:1,py:2,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[F&&(0,P.jsxs)(He.Z,{title:sc.Rp[l],children:[(0,P.jsx)(F,{size:2*$.iI}),"\xa0"]}),(0,P.jsx)(W,{inline:!0,onClick:i?function(){return(0,xn.u7)({column:n.indexOf(c)},{pushHistory:!0})}:void 0,preventDefault:!0,secondary:!0,children:(0,P.jsx)(_.ZP,{bold:!0,default:!i,maxWidth:25*$.iI,monospace:!0,secondary:i,textOverflow:!0,title:c,children:c})})]})})}),D.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"-",n=arguments.length>1?arguments[1]:void 0,t=vc[n],i=l===sc.RL.TEXT&&t in M,r=i?M[t]:e,o=isNaN(r)?r:(0,ue.QV)(r),c=t in gc&&o/p>gc[t];return(0,P.jsx)(pc,{backgroundColor:n%2===0?H:z,children:(0,P.jsxs)(_.ZP,{bold:c,danger:c,default:!0,textOverflow:!0,title:i?L[t]:"",children:[i?"".concat((0,ue._6)("word",o)):o,t in B&&" (".concat(B[t],")")]})},n)}))]})}var xc=function(e){var n=e.features,t=void 0===n?[]:n,i=e.shouldLink,r=e.statistics,o=(0,s.useContext)(N.ThemeContext),l=(0,s.useMemo)((function(){return t.map((function(e){return e.uuid}))}),[t]);return(0,P.jsx)(qo.Z,{headerTitle:"Feature profiles",children:(0,P.jsxs)(x.Z,{children:[(0,P.jsx)(dc,{children:(0,P.jsxs)(He.Z,{flex:1,flexDirection:"column",style:{background:o.background.table},children:[(0,P.jsx)(Z.Z,{mr:1.25*$.iI,mt:"".concat(53,"px")}),vc.map((function(e,n){return(0,P.jsx)(pc,{children:(0,P.jsx)(_.ZP,{default:!i,secondary:i,children:e})},"".concat(e,"-").concat(n))}))]})}),(0,P.jsx)(hc,{children:(0,P.jsx)(x.Z,{children:t.map((function(e,n){return(0,P.jsx)(fc,{children:(0,P.jsx)(bc,{columns:l,feature:e,shouldLink:i,statistics:r})},"".concat(e,"-").concat(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,l.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.onActionCallback,t=e.selectedBlock,i=e.selectedFilePath,r=e.setErrors,c=e.width,u=p("apiReloads"),a=(0,o.Z)(u,2)[1],f=be.ZP.file_versions.files.list(i&&encodeURIComponent(i)),h=f.data,m=f.mutate,v=(0,s.useMemo)((function(){return(null===h||void 0===h?void 0:h.file_versions)||[]}),[h]),b=(0,s.useState)(null),j=b[0],y=b[1],k=(0,s.useMemo)((function(){return null===v||void 0===v?void 0:v[j]}),[j,v]),O=be.ZP.file_contents.detail(k?encodeURIComponent(k.path):null).data,C=(0,s.useMemo)((function(){return null===O||void 0===O?void 0:O.file_content}),[O]),E=(0,s.useMemo)((function(){return Te()}),[]),S=(0,s.useMemo)((function(){var e,n,t;return null===i||void 0===i||null===(e=i.match(E))||void 0===e||null===(n=e[0])||void 0===n||null===(t=n.split("."))||void 0===t?void 0:t[1]}),[i,E]),w=(0,d.Db)(be.ZP.file_contents.useUpdate(i&&encodeURIComponent(i)),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var t;i&&m();var r=null===e||void 0===e||null===(t=e.file_content)||void 0===t?void 0:t.path,o="FileEditor/".concat(r);if(r){var c=r.split("/");if("pipelines"===c[0]){var u=c.slice(1,c.length-1).join("/");o="PipelineDetail/".concat(u)}}a((function(e){return yc(yc({},e),{},(0,l.Z)({},o,Number(new Date)))})),y((function(e){return e+1})),null===n||void 0===n||n(e)},onErrorCallback:function(e,n){return r({errors:n,response:e})}})}}),I=(0,o.Z)(w,2),T=I[0],A=I[1].isLoading,R=(0,s.useMemo)((function(){var e=v.map((function(e){var n=e.name,t=e.path;return[(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{flex:1,children:[(0,P.jsx)(_.ZP,{default:!0,monospace:!0,children:(0,Tn.JX)(n,{withSeconds:!0})}),(0,P.jsx)(Z.Z,{px:2*$.cd,children:(0,P.jsx)(_.ZP,{monospace:!0,children:n})})]}),k&&(null===k||void 0===k?void 0:k.path)===t&&(0,P.jsx)(g.Z,{compact:!0,loading:A,onClick:function(e){(0,dr.j)(e),T({file_content:{version:n}})},small:!0,children:"Replace with this version"})]},n)]}));if(k){var n=(0,P.jsx)(Z.Z,{p:$.cd,children:(0,P.jsx)(Ui.Z,{},"spinner")});if(C&&(null===C||void 0===C?void 0:C.path)===(null===k||void 0===k?void 0:k.path)){var t=C.content,i=void 0===t?"":t;n=(0,P.jsx)(Ve.Z,{autoHeight:!0,language:Y[S],padding:!0,readOnly:!0,value:(0,ue.Pb)(i)?JSON.stringify(JSON.parse(i),null,2):i,width:c})}e=(0,ee.Hk)([n],j+1,e)}return e}),[C,S,v,A,k,j,T,c]);return(0,P.jsxs)("div",{style:{width:c},children:[(0,P.jsxs)(Z.Z,{p:$.cd,children:[(0,P.jsx)(Dr.Z,{level:5,children:"File versions"}),(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:i?decodeURIComponent(i):null===t||void 0===t?void 0:t.uuid})]}),(0,P.jsx)(_e.Z,{buildRowProps:function(e){if(k&&j+1===e)return{renderCell:function(e){return e},renderRow:function(e){return e}}},columnFlex:[1],columns:[{uuid:"Version"}],isSelectedRow:function(e){var n;return(null===(n=v[e])||void 0===n?void 0:n.name)===(null===k||void 0===k?void 0:k.name)},onClickRow:function(e){k?e===j?y(null):e<j?y(e):e>j+1&&y(e-1):y(e)},rows:R})]})},Zc=t(21764),_c=t(22673),Oc=t(1286),Cc=($.iI,Oc.O$,$.iI,Gr.dN,N.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-cr39lf-0"})(["height:calc(100vh - ","px - ","px);width:fit-content;",""],fn.Wi,pn.nn,(function(e){return e.fullWidth&&"\n width: 100%;\n "})),N.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-cr39lf-1"})(["padding:","px;",""],2*$.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "})),N.default.table.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-cr39lf-2"})(["",""],(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}))),Ec=N.default.td.withConfig({displayName:"indexstyle__CellStyle",componentId:"sc-cr39lf-3"})(["display:flex;align-items:center;justify-content:space-between;border:1px solid #1C1C1C;height:100%;",""],(function(e){return!e.noPadding&&"\n padding: 0 ".concat(2*$.iI,"px;\n ")})),Sc=t(19963);var wc=function(e){var n=e.copyText,t=e.deleteVariable,i=e.fetchVariables,r=e.hideEdit,l=e.obfuscate,c=e.pipelineUUID,u=e.variable,a=u.uuid,f=(u.type,u.value),p=(0,s.useRef)(null),h=(0,s.useState)(!1),m=h[0],v=h[1],g=(0,s.useState)(a),b=g[0],x=g[1],y=(0,s.useState)(f),k=y[0],Z=y[1],C=(0,s.useState)(!1),E=C[0],S=C[1],w=(0,d.Db)(be.ZP.variables.pipelines.useUpdate(c,a),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){S(!1),i()}})}}),I=(0,o.Z)(w,1)[0],T=(0,s.useCallback)((function(e){if("Enter"===e.key){var n=k;try{n=JSON.parse(k)}catch(t){}I({variable:{name:b,value:n}})}else"Escape"===e.key&&S(!1)}),[b,k]);(0,s.useEffect)((function(){var e;E&&(null===p||void 0===p||null===(e=p.current)||void 0===e||e.focus())}),[E,p]);var A=n||"kwargs['".concat(a,"']");return(0,P.jsx)("div",{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},children:(0,P.jsxs)(Gl.Z,{children:[(0,P.jsx)(Bl.Z,{md:1,hiddenSmDown:!0,children:(0,P.jsx)(Ec,{noPadding:!0,children:(0,P.jsx)(j.ZP,{backgroundColor:Sc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(A),Zc.Am.success("Successfully copied to clipboard.",{position:Zc.Am.POSITION.BOTTOM_RIGHT,toastId:a})},small:!0,uuid:"Sidekick/GlobalVariables/".concat(a),withIcon:!0,children:(0,P.jsx)(X.CK,{size:2.5*$.iI})})})}),(0,P.jsx)(Bl.Z,{md:4,children:E?(0,P.jsx)(Ec,{children:(0,P.jsx)(O.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){x(e.target.value),e.preventDefault()},onKeyDown:T,paddingHorizontal:0,placeholder:"variable",small:!0,value:b})}):(0,P.jsx)(Ec,{children:(0,P.jsx)(_.ZP,{color:sl.Or,monospace:!0,small:!0,textOverflow:!0,children:a})})}),(0,P.jsx)(Bl.Z,{md:7,children:E?(0,P.jsx)(Ec,{children:(0,P.jsx)(O.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){Z(e.target.value),e.preventDefault()},onKeyDown:T,paddingHorizontal:0,placeholder:"enter value",ref:p,small:!0,value:k})}):(0,P.jsxs)(Ec,{children:[l?(0,P.jsx)(_.ZP,{monospace:!0,small:!0,children:"********"}):(0,P.jsx)(_.ZP,{monospace:!0,small:!0,children:f}),(0,P.jsxs)(He.Z,{children:[!r&&m&&(0,P.jsx)(j.ZP,{backgroundColor:Sc.qJ,borderless:!0,inline:!0,muted:!0,onClick:function(){S(!0)},small:!0,uuid:"Sidekick/GlobalVariables/edit_".concat(a),withIcon:!0,children:(0,P.jsx)(X.I8,{size:2.5*$.iI})}),t&&m&&(0,P.jsx)(j.ZP,{backgroundColor:Sc.qJ,borderless:!0,inline:!0,muted:!0,onClick:t,small:!0,uuid:"Sidekick/GlobalVariables/delete_".concat(a),withIcon:!0,children:(0,P.jsx)(X.rF,{size:2.5*$.iI})})]})]})})]})})},Pc=t(93348),Ic=t(58122);var Tc=function(e){e.blocks;var n=e.fetchVariables,t=e.pipeline,i=e.selectedBlock,r=e.setErrorMessages,l=e.variables,c=e.width,u=(0,s.useState)(!1),a=u[0],f=u[1],p=(0,s.useState)(),h=p[0],m=p[1],g=(0,s.useState)(),b=g[0],y=g[1],k=null===t||void 0===t?void 0:t.uuid,C=(0,d.Db)(be.ZP.variables.pipelines.useCreate(k),{onSuccess:function(e){return(0,je.wD)(e,{onErrorCallback:function(e){var n=e.error,t=n.message,i=n.exception;r((function(e){var n=e||[];return i&&(n=n.concat(i)),t&&(n=n.concat(t)),n}))}})}}),E=(0,o.Z)(C,1)[0],S=(0,d.Db)((function(e){return be.ZP.variables.pipelines.useDelete(k,e)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),w=(0,o.Z)(S,1)[0],I=(0,s.useCallback)((function(e){if("Enter"===e.key){var t=b;try{t=JSON.parse(b)}catch(i){}E({variable:{name:h,value:t}}).then((function(){n(),m(null),y(null)})),f(!1)}else"Escape"===e.key&&f(!1)}),[E,n,h,b]),T=(0,s.useMemo)((function(){return c-4*$.iI}),[c]),A=(0,s.useMemo)((function(){return(0,Ic.wx)(l,(function(e){return"global"===e.uuid}))}),[l]),R=(0,s.useMemo)((function(){return(0,Ic.wx)(l,(function(e){return e.uuid===(null===i||void 0===i?void 0:i.uuid)}))}),[i,l]),D=(0,s.useMemo)((function(){return(0,P.jsxs)(Cc,{width:T,children:[a&&(0,P.jsxs)(Gl.Z,{children:[(0,P.jsx)(Bl.Z,{md:1,children:(0,P.jsx)(Ec,{noPadding:!0,children:(0,P.jsx)(j.ZP,{backgroundColor:Sc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(h),Zc.Am.success("Successfully copied to clipboard.",{position:Zc.Am.POSITION.BOTTOM_RIGHT,toastId:h})},uuid:"Sidekick/GlobalVariables/".concat(h),withIcon:!0,children:(0,P.jsx)(X.CK,{size:2.5*$.iI})})})}),(0,P.jsx)(Bl.Z,{md:4,children:(0,P.jsx)(Ec,{children:(0,P.jsx)(O.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){m(e.target.value),e.preventDefault()},onKeyDown:I,paddingHorizontal:0,placeholder:"variable",small:!0,value:h})})}),(0,P.jsx)(Bl.Z,{md:7,children:(0,P.jsx)(Ec,{children:(0,P.jsx)(O.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){y(e.target.value),e.preventDefault()},onKeyDown:I,paddingHorizontal:0,placeholder:"enter value",small:!0,value:b})})})]}),null===A||void 0===A?void 0:A.map((function(e){return(0,P.jsx)(wc,{deleteVariable:function(){return w(e.uuid)},fetchVariables:n,pipelineUUID:k,variable:e})}))]})}),[w,A,h,b,k,m,y,f,a,T]),M=(0,s.useMemo)((function(){return(0,P.jsx)(Cc,{width:T,children:null===R||void 0===R?void 0:R.map((function(e){return(0,P.jsx)(wc,{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")}(k,null===i||void 0===i?void 0:i.uuid,n))),hideEdit:!0,pipelineUUID:k,variable:e});var n}))})}),[R,i,T]);return(0,P.jsxs)(Z.Z,{p:$.cd,children:[(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Dr.Z,{level:4,monospace:!0,children:"Global Variables"}),(0,P.jsx)(Z.Z,{ml:2}),(0,P.jsx)(j.ZP,{Icon:X.mm,blackBorder:!0,inline:!0,onClick:function(){return f((function(e){return!e}))},uuid:"Sidekick/GlobalVariables/addNewVariable",children:"New"})]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(_.ZP,{muted:!0,children:["Press ",(0,P.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,P.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:D}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_.ZP,{children:"Global variables will be passed into all non-scratchpad blocks as keyword arguments (Python), interpolated variables (SQL), or vector elements (R). To load a global variable, use the following syntax:"})}),(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsxs)(_.ZP,{bold:!0,large:!0,children:["For Python (",(0,P.jsx)(sn.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/runtime-variable",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,P.jsx)(_c.Z,{language:"python",small:!0,source:"\n var = kwargs['variable_name']\n"})]}),(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsxs)(_.ZP,{bold:!0,large:!0,children:["For SQL (",(0,P.jsx)(sn.Z,{href:"https://docs.mage.ai/guides/sql-blocks#variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,P.jsx)(_c.Z,{language:"sql",small:!0,source:"\n {{ variable_name }}\n"})]}),(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsxs)(_.ZP,{bold:!0,large:!0,children:["For R (",(0,P.jsx)(sn.Z,{href:"https://docs.mage.ai/guides/r-blocks#runtime-variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,P.jsx)(_c.Z,{language:"r",small:!0,source:"\n var <- global_vars['variable_name']\n"})]}),(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsx)(Dr.Z,{level:4,monospace:!0,children:"Trigger Runtime Variables"}),(0,P.jsx)(Z.Z,{mb:$.cd}),(0,P.jsx)(_.ZP,{children:"Depending on what kind of trigger you use for this pipeline, some default runtime variables will be provided."})]}),Object.values(Pc.Xm).map((function(e){var n;return(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_.ZP,{large:!0,monospace:!0,children:(0,ue.vg)(null===(n=Pc.Z4[e])||void 0===n?void 0:n.call(Pc.Z4))})}),(0,Ic.JZ)([],e).map((function(e){return(0,P.jsx)(wc,{hideEdit:!0,variable:e,pipelineUUID:k})}))]})})),R&&R.length>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{my:2,children:(0,P.jsx)(Dr.Z,{level:4,monospace:!0,children:"Block Output Variables"})}),(0,P.jsx)(Z.Z,{mb:2,children:M}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(_.ZP,{children:["Output variables can be used in any ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:v.tf.SCRATCHPAD})," block."]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_.ZP,{children:"To load the variable, use the following syntax:"})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_c.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"})})]})]})},Ac=t(37771);function Rc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Dc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Rc(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Rc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Mc=function(e){var n=e.cancelPipeline,t=e.executePipeline,i=e.isPipelineExecuting,r=e.pipelineExecutionHidden,o=e.pipelineMessages,l=e.setPipelineExecutionHidden,c=(0,s.useMemo)((function(){return(null===o||void 0===o?void 0:o.length)||0}),[o]),u=(0,s.useCallback)((function(){var e=!r;l(e),(0,S.t8)(S.Q9,e)}),[r,l]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{children:[(0,P.jsx)(g.Z,{beforeIcon:(0,P.jsx)(X.JM,{inverted:!0,size:2*$.iI}),loading:i,onClick:t,success:!0,children:(0,P.jsx)(_.ZP,{bold:!0,inverted:!0,primary:!1,children:"Execute pipeline"})}),(0,P.jsx)(Z.Z,{ml:1}),i&&(0,P.jsx)(g.Z,{beforeIcon:(0,P.jsx)(X.x8,{inverted:!0,size:2*$.iI}),onClick:n,success:!0,children:(0,P.jsx)(_.ZP,{bold:!0,inverted:!0,primary:!1,children:"Cancel Pipeline"})})]}),(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsx)(_.ZP,{children:"Hide"}),(0,P.jsx)(Z.Z,{pr:1}),(0,P.jsx)(qr.Z,{checked:r,onCheck:u})]})]}),!r&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{mb:1}),(0,P.jsx)(Ac.k,{noScrollbarTrackBackground:!0,children:(0,P.jsx)(Zt,{executedAndIdle:!0,hasError:!1,selected:!0,children:o.map((function(e,n){var t=e.data,i=e.type,r=[],o=(r=(r=Array.isArray(t)?t:[t]).filter((function(e){return e}))).length;return r.map((function(e,t){var r,l={first:0===n&&0===t,last:n===c-1&&t===o-1};return Qe.jU.includes(i)?r=(0,P.jsx)(_t,Dc(Dc({},l),{},{children:(0,P.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,P.jsx)(bt(),{children:e})})})):i===Qe.Gi.IMAGE_PNG&&(r=(0,P.jsx)("div",{style:{backgroundColor:"white"},children:(0,P.jsx)("img",{alt:"Image ".concat(n," from code output"),src:"data:image/png;base64, ".concat(e)})})),(0,P.jsx)("div",{children:r},"code-output-".concat(n,"-").concat(t))}))}))})})]})]})};var Nc=function(e){var n=e.fetchSecrets,t=e.pipelineUUID,i=e.secrets,r=e.setErrorMessages,l=e.width,c=(0,s.useState)(!1),u=c[0],a=c[1],f=(0,s.useState)(),p=f[0],h=f[1],m=(0,s.useState)(),v=m[0],g=m[1],b=(0,s.useMemo)((function(){return l-$.cd*$.iI*2}),[l]),y=(0,d.Db)(be.ZP.secrets.useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{onErrorCallback:function(e){var n=e.error,t=n.message,i=n.exception;r((function(e){var n=e||[];return i&&(n=n.concat(i)),t&&(n=n.concat(t)),n}))}})}}),k=(0,o.Z)(y,1)[0],C=(0,d.Db)((function(e){return be.ZP.secrets.useDelete(e)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),E=(0,o.Z)(C,1)[0],S=(0,s.useCallback)((function(e){"Enter"===e.key?(k({secret:{name:p,value:v}}).then((function(){n(),h(null),g(null)})),a(!1)):"Escape"===e.key&&a(!1)}),[k,n,p,v]);return(0,P.jsxs)(Z.Z,{p:$.cd,children:[(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Dr.Z,{level:4,monospace:!0,children:"Secrets"}),(0,P.jsx)(Z.Z,{ml:2}),(0,P.jsx)(j.ZP,{Icon:X.mm,blackBorder:!0,inline:!0,onClick:function(){return a((function(e){return!e}))},uuid:"Sidekick/Secrets/addNewSecret",children:"New"})]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(_.ZP,{children:[(0,P.jsx)(_.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,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(_.ZP,{muted:!0,children:["Press ",(0,P.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,P.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(Cc,{width:b,children:[u&&(0,P.jsxs)(Gl.Z,{children:[(0,P.jsx)(Bl.Z,{md:1,children:(0,P.jsx)(Ec,{noPadding:!0,children:(0,P.jsx)(j.ZP,{backgroundColor:Sc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText("{{ mage_secret_var(".concat(p,") }}")),Zc.Am.success("Successfully copied to clipboard.",{position:Zc.Am.POSITION.BOTTOM_RIGHT,toastId:p})},uuid:"Sidekick/Secrets/".concat(p),withIcon:!0,children:(0,P.jsx)(X.CK,{size:2.5*$.iI})})})}),(0,P.jsx)(Bl.Z,{md:4,children:(0,P.jsx)(Ec,{children:(0,P.jsx)(O.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){h(e.target.value),e.preventDefault()},onKeyDown:S,paddingHorizontal:0,placeholder:"secret name",small:!0,value:p})})}),(0,P.jsx)(Bl.Z,{md:7,children:(0,P.jsx)(Ec,{children:(0,P.jsx)(O.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){g(e.target.value),e.preventDefault()},onKeyDown:S,paddingHorizontal:0,placeholder:"secret value",small:!0,value:v})})})]}),null===i||void 0===i?void 0:i.map((function(e){return(0,P.jsx)(wc,{deleteVariable:function(){return E(e.name)},fetchVariables:n,hideEdit:!0,obfuscate:!0,pipelineUUID:t,variable:{uuid:e.name,value:e.value}},e.name)}))]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_.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,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_c.Z,{language:"yaml",small:!0,source:"\n {{ mage_secret_var('<secret_name>') }}\n ",maxWidth:b})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_.ZP,{children:"To reference a secret in code, you can import the `get_secret_value` helper method:"})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_c.Z,{language:"python",small:!0,source:"\n from mage_ai.data_preparation.shared.secrets import get_secret_value\n\n get_secret_value('<secret_name>')\n ",maxWidth:b})})]})},Lc=t(66607),Bc=t(15270),Fc=t(64155),Uc=t(72454);function Hc(e){var n=e.activeView,t=e.pipelineUUID;return re.map((function(e){var i=e.key,r=e.label;return{Icon:le[i],id:i,isSelected:function(){return n===i},label:function(){return r},linkProps:{as:"/pipelines/".concat(t,"/edit?").concat(ne,"=").concat(i),href:"/pipelines/[pipeline]/edit"}}}))}var zc=function(e){var n=e.activeView,t=e.addNewBlockAtIndex,i=e.afterWidth,r=e.autocompleteItems,o=e.blockRefs,l=e.blocks,c=e.blocksInNotebook,u=e.cancelPipeline,a=e.chartRefs,d=e.deleteBlock,f=e.deleteWidget,p=e.editingBlock,m=e.executePipeline,v=e.fetchFileTree,b=e.fetchPipeline,j=e.fetchSecrets,y=e.fetchVariables,O=e.globalVariables,C=e.insights,E=e.interruptKernel,w=e.isPipelineExecuting,I=e.messages,T=e.metadata,A=e.onChangeCallbackBlock,R=e.onChangeChartBlock,D=e.onChangeCodeBlock,M=e.pipeline,N=e.pipelineMessages,L=e.runBlock,B=e.runningBlocks,F=e.sampleData,H=e.savePipelineContent,z=e.secrets,W=e.selectedBlock,G=e.selectedFilePath,V=e.setActiveSidekickView,Q=e.setAnyInputFocused,q=e.setDisableShortcuts,Y=e.setEditingBlock,K=e.setErrors,J=e.setSelectedBlock,ne=e.setTextareaFocused,re=e.statistics,oe=e.textareaFocused,le=e.updateWidget,ce=e.widgets,ue=(0,Co.i)().height,ae=fn.uX,se=(0,s.useState)([]),de=se[0],fe=se[1],pe=(0,s.useState)(!!(0,S.U2)(S.Q9)),he=pe[0],me=pe[1],ve=Uc.k1,ge=(0,s.useMemo)((function(){return i-ve}),[i,ve]),be=((null===p||void 0===p?void 0:p.upstreamBlocks)||{}).block,je=((null===F||void 0===F?void 0:F.columns)||[]).slice(0,100),ye=(null===F||void 0===F?void 0:F.rows)||[],ke=(null===T||void 0===T?void 0:T.column_types)||{},Ze=null===je||void 0===je?void 0:je.map((function(e){return{columnType:ke[e],uuid:e}})),_e=(null===C||void 0===C?void 0:C[1])||{},Oe=(0,s.useMemo)((function(){return(0,ee.HK)((null===C||void 0===C?void 0:C[0])||[],(function(e){return e.feature.uuid}))}),[C]),Ce=(0,Ic.v0)({statistics:re}),Ee=(0,Ic.CL)({columnTypes:ke,statistics:re}),Se=!!F,we=(0,s.useMemo)((function(){return k.qL.INTEGRATION===(null===M||void 0===M?void 0:M.type)}),[M]),Pe=we?-78:he?-22:Ac.N,Ie=(0,s.useCallback)((0,Oc.Fk)({columnTypes:ke,columns:je,insightsByFeatureUUID:Oe,insightsOverview:_e,noColumnLinks:!0,statistics:re}),[ke,je,Oe,_e,re]),Te=(0,s.useMemo)((function(){return(0,P.jsx)(Tc,{blocks:l,fetchVariables:y,pipeline:M,selectedBlock:W,setErrorMessages:fe,variables:O,width:ge})}),[ge,l,y,O,M,W]),Ae=(0,s.useMemo)((function(){return(0,P.jsx)(kc,{selectedBlock:W,selectedFilePath:G,setErrors:K,width:ge>pn.nn?ge-pn.nn:ge})}),[ge,W,G,K]),Re=(0,s.useMemo)((function(){return(0,P.jsx)(Nc,{fetchSecrets:j,pipelineUUID:null===M||void 0===M?void 0:M.uuid,secrets:z,setErrorMessages:fe,width:ge})}),[ge,j,M,z]);return(0,P.jsxs)(P.Fragment,{children:[(null===de||void 0===de?void 0:de.length)>=1&&(0,P.jsxs)(Z.Z,{mb:3,mt:2,mx:2,children:[(0,P.jsxs)(x.Z,{justifyContent:"space-between",children:[(0,P.jsx)(_.ZP,{bold:!0,danger:!0,children:"Errors"}),(0,P.jsx)(g.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return fe([])},transparent:!0,children:(0,P.jsx)(X.x8,{muted:!0})})]}),null===de||void 0===de?void 0:de.map((function(e){return(0,P.jsx)(Z.Z,{pb:1,children:(0,P.jsx)(_.ZP,{monospace:!0,xsmall:!0,children:e})},e)}))]}),(0,P.jsxs)(x.Z,{children:[(0,P.jsxs)(Fc.t0,{fullWidth:te.includes(n),heightOffset:U.TERMINAL===n?0:pn.nn,onBlur:function(){return q(!1)},onFocus:function(){return q(!0)},widthOffset:ve,children:[n===U.TREE&&(0,P.jsx)(h,{uuid:"PipelineDetail/".concat(null===M||void 0===M?void 0:M.uuid),children:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(jt.Z,{blockRefs:o,editingBlock:p,enablePorts:!we,fetchPipeline:b,height:ue-ae-Pe,pipeline:M,runningBlocks:B,selectedBlock:W,setEditingBlock:Y,setErrors:K,setSelectedBlock:J}),!be&&k.qL.INTEGRATION!==(null===M||void 0===M?void 0:M.type)&&(0,P.jsx)(Z.Z,{p:1,children:(0,P.jsx)(Mc,{cancelPipeline:u,executePipeline:m,isPipelineExecuting:w,pipelineExecutionHidden:he,pipelineMessages:N,setPipelineExecutionHidden:me})})]})}),n===U.DATA&&je.length>0&&(0,P.jsx)(xt.Z,{columnHeaderHeight:(0,xe.Qr)(ke)&&(0,xe.Qr)(Oe)&&(0,xe.Qr)(_e)?0:Fc.Eh,columns:je,height:ue-ae-fn.OM,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,renderColumnHeader:Ie,rows:ye,width:ge}),n===U.REPORTS&&(0,P.jsx)(Fc.ht,{noPadding:!W||!Se,children:(0,P.jsxs)(x.Z,{flexDirection:"column",fullWidth:!0,children:[Ce&&(0,P.jsx)(Lc.Z,{stats:Ce,title:"Quality metrics"}),Ee&&(0,P.jsx)(Z.Z,{mt:$.cd,children:(0,P.jsx)(Lc.Z,{stats:Ee,title:"Statistics"})}),Ze.length>0&&(0,P.jsx)(Z.Z,{mt:$.cd,children:(0,P.jsx)(xc,{features:Ze,statistics:re})})]})}),n===U.GRAPHS&&(0,P.jsx)(Fc.ht,{noPadding:!W||!Se,children:(0,P.jsx)(Yo,{afterWidth:ge,features:Ze,insightsOverview:_e,statistics:re})}),U.SECRETS===n&&Re,U.VARIABLES===n&&Te,U.FILE_VERSIONS===n&&(0,P.jsx)(h,{uuid:"FileVersions/".concat(G?decodeURIComponent(G):""),children:Ae}),we||W&&Se||!W&&Se&&n===U.DATA?null:ie.includes(n)&&(0,P.jsx)(x.Z,{alignItems:"center",justifyContent:"center",verticalHeight:90,verticalHeightOffset:ae,width:ge,children:(0,P.jsx)(_.ZP,{center:!0,default:!0,disableWordBreak:!0,large:!0,monospace:!0,children:W?!Se&&"No data or insights available":"Select a block for insights"})}),U.CHARTS===n&&(ce.length>0?(0,P.jsx)(Kl,{autocompleteItems:r,blockRefs:o,blocks:l,chartRefs:a,deleteWidget:f,fetchFileTree:v,fetchPipeline:b,messages:I,onChangeChartBlock:R,pipeline:M,runBlock:L,runningBlocks:B,savePipelineContent:H,selectedBlock:W,setAnyInputFocused:Q,setSelectedBlock:J,setTextareaFocused:ne,textareaFocused:oe,updateWidget:le,widgets:ce,width:ge}):(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"center",verticalHeight:90,verticalHeightOffset:ae,width:ge,children:[(0,P.jsx)(Z.Z,{pl:1}),(0,P.jsx)(Jl,{size:358}),(0,P.jsx)(Z.Z,{pr:1})]})),U.TERMINAL===n&&(0,P.jsx)("div",{style:{height:"100%",position:"relative",width:ge},children:(0,P.jsx)(qe.Z,{interruptKernel:E,onFocus:function(){return J(null)},width:ge})}),U.EXTENSIONS===n&&(0,P.jsx)(ac,{addNewBlockAtIndex:t,autocompleteItems:r,blockRefs:o,blocks:l,blocksInNotebook:c,deleteBlock:d,fetchFileTree:v,fetchPipeline:b,interruptKernel:E,messages:I,onChangeCallbackBlock:A,onChangeCodeBlock:D,pipeline:M,runBlock:L,runningBlocks:B,savePipelineContent:H,selectedBlock:W,setAnyInputFocused:Q,setErrors:K,setSelectedBlock:J,setTextareaFocused:ne,textareaFocused:oe})]}),(0,P.jsx)(Uc.lm,{borderLeft:!0,children:(0,P.jsx)(Bc.Z,{aligned:"right",navigationItems:Hc({activeView:n,pipelineUUID:null===M||void 0===M?void 0:M.uuid,setActiveSidekickView:V})})})]})]})},Wc=t(12691),Gc=t.n(Wc);var Vc=function(e){var n=e.activeView,t=e.pipeline,i=null===t||void 0===t?void 0:t.uuid,r=(0,oc.iV)(),o=oe[n],l=(0,P.jsx)(_.ZP,{bold:!0,children:null===o||void 0===o?void 0:o.label}),c=U.EXTENSIONS===n&&(null===r||void 0===r?void 0:r.extension),u=be.ZP.extension_options.list({},{},{pauseFetch:!c}).data,a=(0,s.useMemo)((function(){return(null===u||void 0===u?void 0:u.extension_options)||[]}),[u]),d=(0,s.useMemo)((function(){return(0,ee.HK)(a,(function(e){return e.uuid}))}),[a]);if(!n)return(0,P.jsx)("div",{});if(c){var f=d[null===r||void 0===r?void 0:r.extension];l=(0,P.jsxs)(x.Z,{children:[(0,P.jsx)(Gc(),{as:"/pipelines/".concat(i,"/edit?").concat(ne,"=").concat(U.EXTENSIONS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,P.jsx)(sn.Z,{default:!0,children:null===o||void 0===o?void 0:o.label})}),(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,P.jsx)(_.ZP,{bold:!0,children:null===f||void 0===f?void 0:f.name})]})}return(0,P.jsx)(Z.Z,{px:$.cd,children:l})};function Qc(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 qc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Qc(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Qc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Yc(e){var n,t,i,c=e.page,u=e.pipeline,p=(0,f.useRouter)(),b=(0,Co.i)().height,y=(0,s.useState)(!!(0,S.U2)(S.zg)),_=y[0],O=y[1],C=(0,s.useState)(null),w=C[0],I=C[1],T=(0,s.useState)(null),A=T[0],M=T[1],N=(0,s.useState)(null),L=N[0],B=N[1],F=(0,s.useState)(null),H=F[0],z=F[1],W=(0,s.useState)([]),G=W[0],V=W[1],Q=(0,s.useState)(!1),q=(Q[0],Q[1],(0,s.useState)({})),Y=q[0],J=q[1],te=(0,s.useState)(!1),ie=te[0],re=te[1],oe=(0,s.useState)(!1),le=oe[0],ce=oe[1],ae=(0,s.useState)(!1),se=ae[0],de=ae[1],fe=(0,s.useRef)(null),pe=(0,s.useState)({}),he=pe[0],me=pe[1],ve=(0,s.useState)([]),ge=ve[0],ye=ve[1],ke=be.ZP.kernels.list({},{refreshInterval:5e3,revalidateOnFocus:!0}),Ze=ke.data,_e=ke.mutate,Oe=null===Ze||void 0===Ze?void 0:Ze.kernels,Ce=(null===Oe||void 0===Oe?void 0:Oe.find((function(e){return e.name===k.a_[null===Ne||void 0===Ne?void 0:Ne.type]})))||(null===Oe||void 0===Oe?void 0:Oe[0]),Ee=u.uuid,Se=(0,kt.Z)(Ee),we=be.ZP.pipelines.detail(Ee,{includes_outputs:(0,xe.Qr)(he)}),Pe=we.data,Ie=we.mutate,Te=be.ZP.files.list(),Ae=Te.data,De=Te.mutate,Me=(0,s.useMemo)((function(){return(null===Ae||void 0===Ae?void 0:Ae.files)||[]}),[Ae]),Ne=((0,s.useMemo)((function(){var e;return null===Me||void 0===Me||null===(e=Me[0])||void 0===e?void 0:e.name}),[Me]),null===Pe||void 0===Pe?void 0:Pe.pipeline),Le=(0,s.useMemo)((function(){return k.qL.INTEGRATION===(null===Ne||void 0===Ne?void 0:Ne.type)}),[Ne]);(0,s.useEffect)((function(){null!==Pe&&void 0!==Pe&&Pe.error&&M({errors:(0,je.QZ)(Pe),response:Pe})}),[Pe]);var Be=(0,s.useState)(null),Fe=Be[0],He=Be[1],ze=(0,s.useState)(!1),We=ze[0],Ge=ze[1],Ve=(0,oc.iV)(),qe=Ve.sideview,Xe=Ve.block_uuid,Je=Ve.file_path,$e=(0,s.useMemo)((function(){var e=Ve["file_paths[]"]||[];return Array.isArray(e)||(e=[e]),e}),[Ve]),en=(0,s.useCallback)((function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(0,oc.iV)().sideview!==e&&(0,xn.u7)((0,l.Z)({},ne,e),{pushHistory:n,replaceParams:!0})}),[]);(0,s.useEffect)((function(){qe||en(U.TREE,!1)}),[qe,en]);var tn=(0,s.useCallback)((function(e,n){en(e,n),O(!1)}),[en]),rn=((0,s.useRef)(null),(0,s.useRef)({})),on=(0,s.useRef)({}),ln=(0,s.useRef)({}),cn=(0,s.useRef)({}),un=(0,s.useRef)({}),sn=(0,s.useCallback)((function(e,n,t){var i=ln.current||{};ln.current=qc(qc({},i),{},(0,l.Z)({},e,qc(qc({},i[e]||{}),{},(0,l.Z)({},n,t))))}),[ln]),dn=(0,s.useCallback)((function(e,n,t){var i=cn.current||{};cn.current=qc(qc({},i),{},(0,l.Z)({},e,qc(qc({},i[e]||{}),{},(0,l.Z)({},n,t))))}),[cn]),fn=(0,s.useCallback)((function(e,n,t){sn(e,n,t),Ge(!0)}),[sn,Ge]),pn=(0,s.useCallback)((function(e,n,t){dn(e,n,t),Ge(!0)}),[dn,Ge]),hn=(0,s.useCallback)((function(e){un.current=qc(qc({},un.current),e)}),[un]),mn=(0,s.useCallback)((function(e,n){hn((0,l.Z)({},e,n)),Ge(!0)}),[hn,Ge]),vn=(0,s.useState)(null),gn=vn[0],bn=vn[1],jn=be.ZP.data_providers.list({},{revalidateOnFocus:!0}).data,yn=null===jn||void 0===jn?void 0:jn.data_providers,_n=be.ZP.variables.pipelines.list(Ee),On=_n.data,Cn=_n.mutate,En=null===On||void 0===On?void 0:On.variables,Sn=be.ZP.secrets.list(),wn=Sn.data,Pn=Sn.mutate,In=null===wn||void 0===wn?void 0:wn.secrets,Tn=(0,s.useState)([]),Rn=Tn[0],Dn=Tn[1],Mn=(0,s.useState)([]),Nn=Mn[0],Ln=Mn[1],Bn=(0,s.useRef)({}),Fn=(0,s.useCallback)((function(e){var n;Ge(!0);var t=Bn.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),Bn.current[e.uuid]=qc(qc(qc({},t),e),{},{configuration:qc(qc({},t.configuration),e.configuration),upstream_blocks:i})}),[Ge,Bn]),Un=(0,s.useState)(!1),Hn=Un[0],zn=Un[1],Wn=(0,s.useState)({upstreamBlocks:null}),Gn=Wn[0],Vn=Wn[1],Qn=(0,s.useState)([]),qn=Qn[0],Yn=Qn[1],Kn=(0,s.useState)(null),Xn=Kn[0],Jn=Kn[1],$n=(0,s.useState)(null),et=$n[0],nt=$n[1],tt=function(e,n){var t=(0,ee.HK)(n,(function(e){return e.uuid}));return e.map((function(e){return t[e]})).filter((function(e){return!!e}))}(Ut(Ee),Rn),it=(0,s.useState)(tt),rt=it[0],ot=it[1],lt=(0,s.useState)(),ct=lt[0],ut=lt[1],at=(0,s.useState)(),st=at[0],dt=at[1],ft=(0,s.useState)(null),pt=ft[0],ht=ft[1],mt=(0,kt.Z)(rt),vt=(0,s.useCallback)((function(){Vn({upstreamBlocks:{block:null,values:[]}}),me({}),Ge(!1),He(null),Yn([]),Jn(null)}),[]);(0,s.useEffect)((function(){Ee!==Se&&(ln.current={},cn.current={})}),[Ee,Se]);var gt=be.ZP.blocks.pipelines.outputs.detail(!_&&Ee,(null===pt||void 0===pt?void 0:pt.type)!==v.tf.SCRATCHPAD&&(null===pt||void 0===pt?void 0:pt.type)!==v.tf.CHART&&(null===pt||void 0===pt?void 0:pt.uuid)&&encodeURIComponent(null===pt||void 0===pt?void 0:pt.uuid)),bt=gt.data,xt=gt.mutate,jt=(0,s.useMemo)((function(){var e,n,t;return Le?null===(e=(0,ee.sE)(null===bt||void 0===bt?void 0:bt.outputs,(function(e){return e.variable_uuid==="output_sample_data_".concat(st)})))||void 0===e?void 0:e.sample_data:null===bt||void 0===bt||null===(n=bt.outputs)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.sample_data}),[bt,Le,st]),yt=be.ZP.blocks.pipelines.analyses.detail(!_&&Ee,(null===pt||void 0===pt?void 0:pt.type)!==v.tf.SCRATCHPAD&&(null===pt||void 0===pt?void 0:pt.type)!==v.tf.CHART&&(null===pt||void 0===pt?void 0:pt.uuid)&&encodeURIComponent(null===pt||void 0===pt?void 0:pt.uuid)),Zt=yt.data,_t=yt.mutate,Ot=(null===Zt||void 0===Zt||null===(n=Zt.analyses)||void 0===n?void 0:n[0])||{},Ct=Ot.insights,Et=void 0===Ct?{}:Ct,St=Ot.metadata,Pt=void 0===St?{}:St,It=Ot.statistics,Tt=void 0===It?{}:It,At=be.ZP.blocks.pipelines.analyses.detail(Ee,(null===Xn||void 0===Xn?void 0:Xn.type)!==v.tf.CHART&&null!==et&&(null===Xn||void 0===Xn?void 0:Xn.uuid)),Rt=At.data;At.mutate,null===Rt||void 0===Rt||null===(t=Rt.analyses)||void 0===t||null===(i=t[0])||void 0===i||i.suggestions;(0,s.useEffect)((function(){0===qn.length&&(_t(),xt(),Cn())}),[_t,xt,Cn,qn]),(0,s.useEffect)((function(){if(0===rt.length)ht(null);else if((null===mt||void 0===mt?void 0:mt.length)!==(null===rt||void 0===rt?void 0:rt.length)&&(null===rt||void 0===rt?void 0:rt.length)<(null===mt||void 0===mt?void 0:mt.length)){var e=mt.findIndex((function(e){return e.uuid===(null===pt||void 0===pt?void 0:pt.uuid)})),n=mt.length-1===e?e-1:e+1;ht(mt[Math.max(0,n)])}}),[rt,mt,null===pt||void 0===pt?void 0:pt.uuid]),(0,s.useEffect)((function(){var e;null!==(e=Gn.upstreamBlocks)&&void 0!==e&&e.block&&(O(!1),en(U.TREE))}),[Gn.upstreamBlocks,en]);var Dt=be.ZP.autocomplete_items.list({},{refreshInterval:!1,revalidateOnFocus:!0}),Mt=Dt.data,Nt=Dt.mutate,Ht=null===Mt||void 0===Mt?void 0:Mt.autocomplete_items;(0,s.useEffect)((function(){z(Je)}),[Je]),(0,s.useEffect)((function(){(0,ee.fS)($e,G)||V($e)}),[$e,G]);var zt=(0,d.Db)(be.ZP.pipelines.useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.pipeline.uuid;p.push("/pipelines/[pipeline]/edit","/pipelines/".concat(n,"/edit")),De()},onErrorCallback:function(e,n){return M({errors:n,response:e})}})}}),Wt=(0,o.Z)(zt,1)[0],Gt=(0,d.Db)(be.ZP.pipelines.useUpdate(Ee,{update_content:!0}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){return Ge(!1)},onErrorCallback:function(e,n){return M({errors:n,response:e})}})}}),Vt=(0,o.Z)(Gt,2),Qt=Vt[0],qt=Vt[1].isLoading,Yt=(0,s.useCallback)((function(e,n){var t=e||{},i=t.block,r=t.pipeline,l=void 0===r?{extensions:{}}:r,c=(n||{}).contentOnly;He(new Date);var u={},a=[];Rn.forEach((function(e){var n,t,r,l=e.extension_uuid,s=e.type,d=e.uuid,f=null===(n=cn.current[s])||void 0===n?void 0:n[d];"undefined"===typeof f&&(f=e.content);var p,h=null===(t=ln.current[s])||void 0===t?void 0:t[d];"undefined"===typeof h&&(h=e.callback_content);var m=null===(r=he[d])||void 0===r?void 0:r.filter((function(e){return!!e})),g=null===m||void 0===m?void 0:m.find((function(e){return e.error}));if(m){var b=[];m.forEach((function(n){var t=n.data,i=n.type;(v.tf.SCRATCHPAD===e.type||g||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(wt)?e:e.concat(n)}),[])),b.push(n))})),p=b.map((function(e,n){return{text_data:JSON.stringify(e),variable_uuid:"".concat(d,"_").concat(n)}}))}var x=qc(qc({},e),{},{callback_content:h,content:f,outputs:p});if((null===i||void 0===i?void 0:i.uuid)===d&&Object.entries(i).forEach((function(e){var n=(0,o.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,o.Z)(e,2),i=n[0],r=n[1];x[t]||(x[t]={}),x[t][i]=r})):x[t]=i})),c)return{callback_content:x.callback_content,content:x.content,outputs:x.outputs,uuid:x.uuid};[v.tf.EXTENSION].includes(s)?(u[l]||(u[l]=[]),u[l].push(x)):a.push(x)}));var s=qc(qc({},null===Ne||void 0===Ne?void 0:Ne.extensions),null===l||void 0===l?void 0:l.extensions);return Object.entries(u).forEach((function(e){var n=(0,o.Z)(e,2),t=n[0],i=n[1];s[t]||(s[t]={}),s[t].blocks=i})),Qt({pipeline:qc(qc(qc({},Ne),l),{},{blocks:a,extensions:s,widgets:Nn.map((function(e){var n,t,i=un.current[e.uuid],r=Bn.current[e.uuid]||{};"undefined"===typeof i&&(i=e.content);var o=null===(n=he[e.uuid])||void 0===n?void 0:n.filter((function(e){return!!e})),l=null===o||void 0===o?void 0:o.find((function(e){return e.error}));if(o){var c=[];o.forEach((function(n){var t=n.data,i=n.type;(v.tf.SCRATCHPAD===e.type||l||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(wt)?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 qc(qc(qc({},e),r),{},{configuration:qc(qc({},e.configuration),r.configuration),content:i,outputs:t})}))})})}),[Rn,he,Ne,He,Qt,Nn]),Kt=(0,s.useCallback)((function(e){Yt();var n=encodeURIComponent(e),t=(0,oc.iV)()["file_paths[]"]||[];Array.isArray(t)||(t=[t]),t.includes(n)||t.push(n),(0,xn.u7)({"file_paths[]":t,file_path:n})}),[Yt]),Xt=(0,s.useMemo)((function(){var e=[],n=[];return Rn.forEach((function(t){v.tf.EXTENSION===t.type?n.push(t):e.push(t)})),{blocksInNotebook:e,blocksInSidekick:n}}),[Rn]),Jt=Xt.blocksInNotebook,$t=Xt.blocksInSidekick,ei=(0,s.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;Ee!==r?window.location.href="/pipelines/".concat(r,"/edit"):(De(),n!==(null===Ne||void 0===Ne?void 0:Ne.type)&&Ie(),Bt(Jt,Ee,r),Bt($t,Ee,r))}else null!==e&&void 0!==e&&null!==(i=e.data)&&void 0!==i&&i.error&&M((function(e){return qc(qc({},e),{},{links:[{label:"Check pipeline configuration",onClick:function(){Kt("pipelines/".concat(Ee,"/").concat(R.METADATA_YAML)),M(null)}}]})}))}))}),[Jt,$t,De,Ie,Kt,null===Ne||void 0===Ne?void 0:Ne.type,Ee,Yt]),ni=(0,d.Db)((function(e){var n=e.extension_uuid,t=e.uuid,i={};return n&&(i.extension_uuid=n),be.ZP.blocks.pipelines.useDelete(Ee,encodeURIComponent(t),i)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.block,t=n.type,i=n.uuid;Dn((function(e){return(0,ee.oM)(e,e.findIndex((function(e){var n=e.type,r=e.uuid;return t===n&&i===r})))})),Ie(),Jn(null),t===v.tf.SCRATCHPAD&&De()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;M({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&me((function(e){return qc(qc({},e),{},(0,l.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:Qe.Gi.TEXT_PLAIN}}))))}))}})}}),ti=(0,o.Z)(ni,1)[0],ii=(0,d.Db)((function(e){var n=e.uuid;return be.ZP.widgets.pipelines.useDelete(Ee,n)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.widget.uuid;Ln((function(e){return(0,ee.oM)(e,e.findIndex((function(e){var t=e.uuid;return n===t})))})),Ie(),De()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;M({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&me((function(e){return qc(qc({},e),{},(0,l.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:Qe.Gi.TEXT_PLAIN}}))))}))}})}}),ri=(0,o.Z)(ii,1)[0],oi=(0,d.Db)((function(e){var n=e.language,t=e.type,i=e.uuid,r="".concat(t,"/").concat(i);return n&&K[n]&&(r="".concat(r,".").concat(K[n].toLowerCase())),be.ZP.blocks.useDelete(encodeURIComponent(r))()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){Nt(),Ie(),De()},onErrorCallback:function(e,n){return M({displayMessage:"Error deleting block file. Check that there are no downstream blocks, then try again.",errors:n,response:e})}})}}),li=(0,o.Z)(oi,1)[0],ci=(0,d.Db)(be.ZP.kernels.useUpdate(null===Ce||void 0===Ce?void 0:Ce.id),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){return _e()},onErrorCallback:function(e,n){return M({errors:n,response:e})}})}}),ui=(0,o.Z)(ci,1)[0],ai=(0,s.useCallback)((function(){return ui({kernel:{action_type:"restart"}})}),[ui]),si=(0,s.useCallback)((function(){return ui({kernel:{action_type:"interrupt"}})}),[ui]),di=((0,s.useCallback)((function(){window.confirm("Do you want to restart the kernel? All variables will be cleared.")&&ai()}),[ai]),(0,d.Db)(be.ZP.blocks.pipelines.useCreate(Ee))),fi=(0,o.Z)(di,1)[0],pi=(0,s.useCallback)((function(e,n,t){var i,l,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,ue.Y6)();e.converted_from_type&&e.converted_from_uuid&&(i=null===(l=cn.current[e.converted_from_type])||void 0===l?void 0:l[e.converted_from_uuid]);var u=e.language,a=e.type;if(Le){var s=(0,ee.HK)((null===Ne||void 0===Ne?void 0:Ne.blocks)||[],(function(e){return e.type})),d=s[v.tf.DATA_EXPORTER],f=s[v.tf.DATA_LOADER],p=s[v.tf.TRANSFORMER];if(v.tf.DATA_LOADER===a){if(v.t6.YAML!==u)return void M({displayMessage:"The source you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(f)return void M({displayMessage:"Pipeline ".concat(null===Ne||void 0===Ne?void 0:Ne.uuid," already has a source: ").concat(null===f||void 0===f?void 0:f.uuid,".")})}else if(v.tf.TRANSFORMER===a){if(p)return void M({displayMessage:"Pipeline ".concat(null===Ne||void 0===Ne?void 0:Ne.uuid," already has a transformer: ").concat(null===p||void 0===p?void 0:p.uuid,".")})}else if(v.tf.DATA_EXPORTER===a){if(v.t6.YAML!==u)return void M({displayMessage:"The destination you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(d)return void M({displayMessage:"Pipeline ".concat(null===Ne||void 0===Ne?void 0:Ne.uuid," already has a destination: ").concat(null===d||void 0===d?void 0:d.uuid,".")})}}return fi({block:qc({content:i,name:c,priority:n},e)}).then((function(e){(0,je.wD)(e,{callback:function(){var n=e.data.block;null===t||void 0===t||t(n),nt(null),De(),Ie().then((function(e){var n=e.pipeline,t=n.blocks,i=n.extensions;return Dn((function(e){var n=(0,r.Z)(t);Object.entries(i||{}).forEach((function(e){var t=(0,o.Z)(e,2),i=t[0],l=t[1].blocks;l&&n.push.apply(n,(0,r.Z)(l.map((function(e){return qc(qc({},e),{},{extension_uuid:i})}))))}));var l=(0,ee.HK)(e,(function(e){return e.uuid})),c=[];return n.forEach((function(e){var n=l[e.uuid];n?c.push(n):c.push(e)})),c}))}))},onErrorCallback:function(e,n){return M({errors:n,response:e})}})}))}),[fi,De,Ie,Le,Dn,M,Ne]),hi=(0,s.useState)(!1),mi=hi[0],vi=hi[1];(0,s.useEffect)((function(){vi(!!(0,S.U2)(E.k))}),[]);var gi=(0,Re.dd)((function(e){var n=e.block,t=e.idx,i=e.name,r=void 0===i?(0,ue.Y6)():i,o=e.onCreateCallback;return(0,P.jsx)(D,{block:n,defaultName:r,onClose:ji,onSave:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return pi(n,t,o,null===e||void 0===e?void 0:e.name).then((function(){return ji()}))},pipeline:Ne})}),{},[pi,Ne],{background:!0,uuid:"configure_block_name_and_create"}),bi=(0,o.Z)(gi,2),xi=bi[0],ji=bi[1],yi=be.ZP.widgets.pipelines.list(!_&&Ee),ki=(yi.data,yi.mutate,(0,d.Db)(be.ZP.widgets.pipelines.useCreate(Ee))),Zi=(0,o.Z)(ki,1)[0],_i=(0,s.useCallback)((function(e,n,t){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,ue.Y6)();return Zi({widget:qc({name:i,priority:n,type:v.tf.CHART},e)}).then((function(e){return(0,je.wD)(e,{callback:function(){var n=e.data.widget;null===t||void 0===t||t(n),De(),Ie(),en(U.CHARTS),B(n)},onErrorCallback:function(e,n){return M({errors:n,response:e})}})}))}),[De,Ie,Zi,en]);(0,s.useEffect)((function(){if(L){var e,n=null===(e=on.current[L.uuid])||void 0===e?void 0:e.current;n&&(n.scrollIntoView(),B(null))}}),[L,B]),(0,s.useEffect)((function(){Se!==Ee&&(Dn([]),Ln([]),ot([]),ye([]))}),[Ee,Se]),(0,s.useEffect)((function(){if("undefined"!==typeof(null===Ne||void 0===Ne?void 0:Ne.blocks)||"undefined"!==typeof(null===Ne||void 0===Ne?void 0:Ne.extensions)){var e=[];"undefined"!==typeof(null===Ne||void 0===Ne?void 0:Ne.blocks)&&e.push.apply(e,(0,r.Z)(null===Ne||void 0===Ne?void 0:Ne.blocks)),"undefined"!==typeof(null===Ne||void 0===Ne?void 0:Ne.extensions)&&Object.entries((null===Ne||void 0===Ne?void 0:Ne.extensions)||{}).forEach((function(n){var t=(0,o.Z)(n,2),i=t[0],l=t[1].blocks;l&&e.push.apply(e,(0,r.Z)(l.map((function(e){return qc(qc({},e),{},{extension_uuid:i})}))))})),Dn(e)}}),[null===Ne||void 0===Ne?void 0:Ne.blocks,null===Ne||void 0===Ne?void 0:Ne.extensions]),(0,s.useEffect)((function(){"undefined"!==typeof(null===Ne||void 0===Ne?void 0:Ne.widgets)&&Ln(Ne.widgets)}),[null===Ne||void 0===Ne?void 0:Ne.widgets]),(0,s.useEffect)((function(){(null===tt||void 0===tt?void 0:tt.length)>0&&0===(null===rt||void 0===rt?void 0:rt.length)&&(ot(tt),ht(tt[0]))}),[rt,tt]);var Oi=(0,kt.Z)(Rn);(0,s.useEffect)((function(){if("undefined"!==typeof(null===Ne||void 0===Ne?void 0:Ne.blocks)&&(!Rn.length||!(0,ee.fS)(null===Oi||void 0===Oi?void 0:Oi.map((function(e){return e.uuid})).sort(),null===Rn||void 0===Rn?void 0:Rn.map((function(e){return e.uuid})).sort()))){var e=Lt(Ne.blocks),n=e.content,t=e.messages;cn.current=n,me((function(e){return qc(qc({},t),e)}))}}),[Rn,Oi,null===Ne||void 0===Ne?void 0:Ne.blocks,Dn,me]),(0,s.useEffect)((function(){if(!Nn.length&&"undefined"!==typeof(null===Ne||void 0===Ne?void 0:Ne.widgets)){var e=Lt(Ne.widgets),n=e.content,t=e.messages;un.current=n,me((function(e){return qc(qc({},t),e)}))}}),[null===Ne||void 0===Ne?void 0:Ne.widgets,Dn,me,Nn]);var Ci=(0,s.useCallback)((function(e,n,t){var i=Rn.find((function(t){var i=t.type,r=t.uuid;return i===n&&r===e}));if(i){if(Jn(i),null!==rn&&void 0!==rn&&rn.current){var r,o=rn.current["".concat(i.type,"s/").concat(i.uuid,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}(0,xn.u7)({file_path:null,"file_paths[]":[]})}else if(n===v.tf.CHART){var l=Nn.find((function(n){return n.uuid===e}));if(l&&(Jn(l),null!==on&&void 0!==on&&on.current)){var c,u=on.current[l.uuid];null===u||void 0===u||null===(c=u.current)||void 0===c||c.scrollIntoView()}}else t&&Kt(t)}),[Rn,Kt,Nn]);(0,s.useEffect)((function(){if(Xe&&!Xn){var e=Rn.find((function(e){var n=e.uuid;return Xe===n}));e&&Ci(e.uuid,e.type,null)}else(null===Oi||void 0===Oi?void 0:Oi.length)!==(null===Rn||void 0===Rn?void 0:Rn.length)&&Xn&&Ci(Xn.uuid,Xn.type,null)}),[Xe,null===Oi||void 0===Oi?void 0:Oi.length,Rn,Ci,Xn]);var Ei=(0,s.useMemo)((function(){return new m.Z}),[]),Si=(0,s.useMemo)((function(){return{api_key:Ye.l,token:Ei.decodedToken.token}}),[Ei]),wi=(0,a.ZP)((0,Ke.Ib)(),{onMessage:function(e){if(e){var n=JSON.parse(e.data),t=n.block_type,i=n.execution_state,o=n.msg_type,c=n.uuid,u=Rn.find((function(e){var n=e.type,i=e.uuid;return t===n&&c===i}));"stream_pipeline"!==o?me((function(e){var t=e[c]||[];return qc(qc({},e),{},(0,l.Z)({},c,t.concat(n)))})):(ye((function(e){return[].concat((0,r.Z)(e),[n])})),Qe.uF.IDLE===i&&(Yn([]),Ie(),c||zn(!1))),Qe.uF.BUSY===i?Yn((function(e){return e.find((function(e){var n=e.uuid;return c===n}))||!u?e:e.concat(u)})):Qe.uF.IDLE===i&&Yn((function(e){return e.filter((function(e){var n=e.uuid;return c!==n}))})),Ge(!0)}},onOpen:function(){return console.log("socketUrlPublish opened")},shouldReconnect:function(e){return console.log("Attempting to reconnect..."),!0}}).sendMessage,Pi=(0,s.useCallback)((function(){Yt().then((function(){zn(!0),ye([]),wi(JSON.stringify(qc(qc({},Si),{},{execute_pipeline:!0,pipeline_uuid:Ee})))}))}),[Ee,Yt,wi,Si]),Ii=(0,s.useCallback)((function(){wi(JSON.stringify(qc(qc({},Si),{},{cancel_pipeline:!0,pipeline_uuid:Ee})))}),[Ee,wi,Si]),Ti=(0,s.useCallback)((function(e){var n=e.block,t=e.code,i=e.ignoreAlreadyRunning,r=e.runDownstream,o=void 0!==r&&r,l=e.runSettings,c=void 0===l?{}:l,u=e.runUpstream,a=void 0!==u&&u,s=e.runTests,d=void 0!==s&&s,f=n.extension_uuid,p=n.upstream_blocks,h=n.uuid;qn.find((function(e){var n=e.uuid;return h===n}))&&!i||(wi(JSON.stringify(qc(qc({},Si),{},{code:t,extension_uuid:f,pipeline_uuid:null===Ne||void 0===Ne?void 0:Ne.uuid,run_downstream:o,run_settings:c,run_tests:d,run_upstream:a,type:n.type,upstream_blocks:p,uuid:h}))),me((function(e){return delete e[h],e})),re(!1),Yn((function(e){return e.find((function(e){var n=e.uuid;return h===n}))?e:e.concat(n)}))),Ie()}),[Ie,Ne,qn,wi,me,Yn,re,Si]),Ai=(0,s.useCallback)((function(e){var n=e.block;return Yt({block:{outputs:[],uuid:n.uuid}},{contentOnly:!0}).then((function(){return Ti(e)}))}),[Ti,Yt]),Ri=(0,s.useMemo)((function(){return(0,P.jsx)(zc,{activeView:qe,addNewBlockAtIndex:function(e,n,t,i){return new Promise((function(){return xi({block:e,idx:n,name:i,onCreateCallback:t})}))},afterWidth:w,autocompleteItems:Ht,blockRefs:rn,blocks:Rn,blocksInNotebook:Jt,cancelPipeline:Ii,chartRefs:on,deleteBlock:ti,deleteWidget:ri,editingBlock:Gn,executePipeline:Pi,fetchFileTree:De,fetchPipeline:Ie,fetchSecrets:Pn,fetchVariables:Cn,globalVariables:En,insights:Et,interruptKernel:si,isPipelineExecuting:Hn,messages:he,metadata:Pt,onChangeCallbackBlock:fn,onChangeChartBlock:mn,onChangeCodeBlock:pn,pipeline:Ne,pipelineMessages:ge,runBlock:Ai,runningBlocks:qn,sampleData:jt,savePipelineContent:Yt,secrets:In,selectedBlock:Xn,selectedFilePath:H,setActiveSidekickView:en,setAnyInputFocused:ce,setDisableShortcuts:de,setEditingBlock:Vn,setErrors:M,setSelectedBlock:Jn,setTextareaFocused:re,statistics:Tt,textareaFocused:ie,updateWidget:Fn,widgets:Nn})}),[qe,w,Ht,rn,Rn,Jt,Ii,ti,ri,Gn,Pi,De,Ie,Pn,Cn,En,Et,si,Hn,he,Pt,fn,mn,pn,Ne,ge,Ai,qn,jt,Yt,In,Xn,H,en,ce,Vn,M,re,xi,Tt,ie,Fn,Nn]),Di=(0,s.useMemo)((function(){return(0,P.jsx)(yo,{addNewBlockAtIndex:mi?pi:function(e,n,t,i){return new Promise((function(r,o){v.tf.DBT===(null===e||void 0===e?void 0:e.type)&&v.t6.SQL===(null===e||void 0===e?void 0:e.language)?pi(e,n,t,i):xi({block:e,idx:n,name:i,onCreateCallback:t})}))},addWidget:function(e,n){var t=n.onCreateCallback;return _i(e,Nn.length,t)},anyInputFocused:le,autocompleteItems:Ht,blockRefs:rn,blocks:Jt,dataProviders:yn,deleteBlock:ti,disableShortcuts:se,fetchFileTree:De,fetchPipeline:Ie,fetchSampleData:xt,files:Me,globalVariables:En,interruptKernel:si,isPipelineUpdating:qt,kernel:Ce,mainContainerRef:fe,mainContainerWidth:gn,messages:he,onChangeCallbackBlock:fn,onChangeCodeBlock:pn,openSidekickView:tn,pipeline:Ne,pipelineContentTouched:We,pipelineLastSaved:Fe,restartKernel:ai,runBlock:Ai,runningBlocks:qn,savePipelineContent:Yt,selectedBlock:Xn,setAnyInputFocused:ce,setEditingBlock:Vn,setErrors:M,setIntegrationStreams:ut,setMessages:me,setOutputBlocks:ot,setPipelineContentTouched:Ge,setRecsWindowOpenBlockIdx:nt,setRunningBlocks:Yn,setSelectedBlock:Jn,setSelectedOutputBlock:ht,setSelectedStream:dt,setTextareaFocused:re,textareaFocused:ie,widgets:Nn})}),[pi,_i,le,Ht,mi,rn,Jt,yn,ti,se,De,Ie,xt,Me,En,si,qt,Ce,fe,gn,he,fn,pn,tn,Ne,We,Fe,ai,Ai,qn,Yt,Xn,ce,Vn,M,me,Ge,Yn,Jn,re,xi,ie,Nn]),Mi=(0,s.useMemo)((function(){if(c===Oo.b)return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(An,{filePaths:G,filesTouched:Y,isBusy:qn.length>=1,isPipelineUpdating:qt,kernel:Ce,pipeline:Ne,pipelineContentTouched:We,pipelineLastSaved:Fe,restartKernel:ai,savePipelineContent:Yt,selectedFilePath:H,setErrors:M,updatePipelineMetadata:ei}),(null===G||void 0===G?void 0:G.length)>0&&(0,P.jsx)(kn,{filePaths:G,filesTouched:Y,savePipelineContent:Yt,selectedFilePath:H})]})}),[Y,qt,Ce,c,Ne,We,Fe,ai,qn,Yt,H,G,M,ei]),Ni=(0,s.useMemo)((function(){var e;return null===ct||void 0===ct||null===(e=ct.filter((function(e){return(0,ee.sE)(null===bt||void 0===bt?void 0:bt.outputs,(function(n){return n.variable_uuid==="output_sample_data_".concat(e)}))})))||void 0===e?void 0:e.map((function(e){return(0,P.jsx)(Z.Z,{pl:1,children:(0,P.jsx)(j.ZP,{blackBorder:!0,compact:!0,muted:!0,onClick:function(){return dt(e)},selected:st===e,uuid:e,children:e})},e)}))}),[bt,ct,st]),Li=(0,s.useRef)(null),Bi=(0,s.useMemo)((function(){return(0,P.jsx)(Ue,{addNewBlock:function(e,n){pi(e,Rn.length,n,e.name),(null===$e||void 0===$e?void 0:$e.length)>=1&&p.push("/pipelines/".concat(Ee,"/edit"))},blocks:Rn,deleteBlockFile:li,deleteWidget:ri,fetchFileTree:De,fetchPipeline:Ie,files:Me,onSelectBlockFile:Ci,openFile:Kt,openPipeline:function(e){vt(),p.push("/pipelines/[pipeline]/edit","/pipelines/".concat(e,"/edit"))},openSidekickView:tn,pipeline:Ne,ref:Li,setErrors:M,setSelectedBlock:Jn,widgets:Nn})}),[pi,Rn,li,ri,De,Ie,null===$e||void 0===$e?void 0:$e.length,Me,Ci,Kt,tn,Ne,Ee,vt,p,M,Jn,Nn]),Fi=(0,s.useMemo)((function(){if(c===Oo.b)return(0,P.jsx)(an,{cancelPipeline:Ii,createPipeline:Wt,executePipeline:Pi,interruptKernel:si,isPipelineExecuting:Hn,restartKernel:ai,savePipelineContent:Yt,setMessages:me})}),[Ii,Wt,Pi,si,Hn,c,ai,Yt,me]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Zn.Z,{title:null===Ne||void 0===Ne?void 0:Ne.name}),(0,P.jsxs)(wo,{after:Ri,afterHeader:(0,P.jsx)(Vc,{activeView:qe,pipeline:Ne}),afterHidden:_,afterSubheader:(null===rt||void 0===rt?void 0:rt.length)>0&&qe===U.DATA&&(0,P.jsxs)(x.Z,{alignItems:"center",fullHeight:!0,fullWidth:!0,children:[!Le&&rt.map((function(e){var n=e.uuid,t=(null===pt||void 0===pt?void 0:pt.uuid)===n;return(0,P.jsx)(Z.Z,{pl:1,children:(0,P.jsx)(j.ZP,{afterElement:t?(0,P.jsx)(g.Z,{basic:!0,highlightOnHover:!0,onClick:function(){!function(e,n){var t=Ut(e).filter((function(e){return e!==n}));(0,S.t8)(Ft(e),t)}(Ee,e.uuid),ot((function(e){return e.filter((function(e){return e.uuid!==n}))}))},padding:"2px",transparent:!0,children:(0,P.jsx)(X.x8,{muted:!0,size:1.25*$.iI})}):null,blackBorder:!0,compact:!0,muted:!0,onClick:function(){return ht(e)},selected:t,uuid:n,children:n})},n)})),Le&&Ni]}),before:Bi,beforeHeader:Fi,errors:A,headerOffset:(null===G||void 0===G?void 0:G.length)>0?36:0,mainContainerHeader:Mi,mainContainerRef:fe,page:c,pipeline:Ne,setAfterHidden:O,setAfterWidthForChildren:I,setErrors:M,setMainContainerWidth:bn,children:[(0,P.jsx)("div",{style:{height:H?0:null,opacity:H?0:null,visibility:H?"hidden":null},children:(0,P.jsx)(h,{uuid:"PipelineDetail/".concat(Ee),children:Di})}),null===$e||void 0===$e?void 0:$e.map((function(e){return(0,P.jsx)("div",{style:{display:H===e?null:"none"},children:(0,P.jsx)(h,{uuid:"FileEditor/".concat(decodeURIComponent(e)),children:(0,P.jsx)(nn,{active:H===e,addNewBlock:function(e,n){pi(e,Rn.length,n,e.name),p.push("/pipelines/".concat(Ee,"/edit"))},fetchPipeline:Ie,fetchVariables:Cn,filePath:e,openSidekickView:tn,pipeline:Ne,selectedFilePath:H,setErrors:M,setFilesTouched:J,setSelectedBlock:Jn})})},e)})),(0,P.jsx)(Z.Z,{pb:Je?0:Math.max(Math.floor(b*(2/3)/$.iI),0)})]})]})}Yc.getInitialProps=function(){var e=(0,i.Z)(u().mark((function e(n){var t,i,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.query.pipeline,i=Oo.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 Kc=(0,Po.Z)(Yc)},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){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r().unix(e).format(null!==n&&void 0!==n&&n.withSeconds?o: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")}},33766:function(e,n,t){"use strict";t.d(n,{g_:function(){return f},u7:function(){return d}});var i=t(75582),r=t(82394),o=t(34376),l=t.n(o),c=t(59e3),u=t(24224);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,r.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}function d(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 a=o?l().push:l().replace,d=s(s({},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 a(l().router.pathname,p,{shallow:!0})}function f(e,n,t){var r=t.addingMultipleValues,o=t.isList,l=t.itemsPerPage,c=t.pushHistory,a=void 0!==c&&c,f=t.resetLimitParams,p=s({},e);r?Object.entries(n).forEach((function(e){var n=(0,i.Z)(e,2),t=n[0],r=n[1];if(Array.isArray(r)){var o="".concat(t,"[]");p[o]=r.map(String)}})):o?Object.entries(n).forEach((function(e){var n=(0,i.Z)(e,2),t=n[0],r=n[1],o=String(r),l="".concat(t,"[]"),c=p[l];c&&Array.isArray(c)?(c=c.map(String)).includes(o)?p[l]=(0,u.Od)(c,(function(e){return e===o})):p[l]=c.concat(o):p[l]=[o]})):p=s(s({},p),n),f&&(p._limit=l||20,p._offset=0),d(p,{pushHistory:a})}},76419:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/pipelines/[pipeline]/edit",function(){return t(946)}])}},function(e){e.O(0,[3662,3850,2083,5896,4804,1774,5872,2524,9565,2714,2125,7011,6085,8789,4538,2344,9386,6166,8180,6532,1286,4261,5141,839,9774,2888,179],(function(){return n=76419,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
|