mage-ai 0.8.79__py3-none-any.whl → 0.8.80__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mage-ai might be problematic. Click here for more details.
- mage_ai/api/policies/PipelineRunPolicy.py +1 -0
- mage_ai/api/presenters/StatusPresenter.py +1 -0
- mage_ai/api/resources/StatusResource.py +2 -0
- mage_ai/data_preparation/executors/streaming_pipeline_executor.py +73 -57
- mage_ai/data_preparation/models/constants.py +2 -0
- mage_ai/data_preparation/models/widget/charts.py +23 -4
- mage_ai/orchestration/notification/sender.py +18 -5
- 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/{idk86oPaHvilJ9Afk8jIL → K62oaHK5x3k16vVxdvIWf}/_buildManifest.js +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/8312-71137409aea5d028.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-d90d32812b2be89e.js +1 -0
- mage_ai/server/frontend_dist/index.html +2 -2
- mage_ai/server/frontend_dist/manage.html +2 -2
- mage_ai/server/frontend_dist/pipeline-runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills/[...slug].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/edit.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/logs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runtime.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs/[run].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/settings.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/syncs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers/[...slug].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline].html +2 -2
- mage_ai/server/frontend_dist/pipelines.html +2 -2
- mage_ai/server/frontend_dist/settings/account/profile.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/preferences.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/sync-data.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/users.html +2 -2
- mage_ai/server/frontend_dist/settings.html +2 -2
- mage_ai/server/frontend_dist/sign-in.html +2 -2
- mage_ai/server/frontend_dist/terminal.html +2 -2
- mage_ai/server/frontend_dist/test.html +3 -3
- mage_ai/server/frontend_dist/triggers.html +2 -2
- mage_ai/server/kernel_output_parser.py +5 -0
- mage_ai/services/gcp/cloud_run/cloud_run.py +37 -18
- mage_ai/services/gcp/cloud_run/config.py +2 -1
- mage_ai/tests/orchestration/notification/test_sender.py +6 -4
- mage_ai/usage_statistics/logger.py +2 -0
- {mage_ai-0.8.79.dist-info → mage_ai-0.8.80.dist-info}/METADATA +1 -1
- {mage_ai-0.8.79.dist-info → mage_ai-0.8.80.dist-info}/RECORD +53 -53
- mage_ai/server/frontend_dist/_next/static/chunks/8312-ade1ed2fd71120f8.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-22d76e8fa386ba37.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{idk86oPaHvilJ9Afk8jIL → K62oaHK5x3k16vVxdvIWf}/_middlewareManifest.js +0 -0
- /mage_ai/server/frontend_dist/_next/static/{idk86oPaHvilJ9Afk8jIL → K62oaHK5x3k16vVxdvIWf}/_ssgManifest.js +0 -0
- {mage_ai-0.8.79.dist-info → mage_ai-0.8.80.dist-info}/LICENSE +0 -0
- {mage_ai-0.8.79.dist-info → mage_ai-0.8.80.dist-info}/WHEEL +0 -0
- {mage_ai-0.8.79.dist-info → mage_ai-0.8.80.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.8.79.dist-info → mage_ai-0.8.80.dist-info}/top_level.txt +0 -0
mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-d90d32812b2be89e.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2551],{55106:function(e,n,t){"use strict";t.d(n,{Z:function(){return g}});var i=t(82394),r=t(75582),o=t(17717),l=t(82684),c=t(83455),u=t(9518),a=t(77011),s=t(28598);function d(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 f(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?d(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var p=u.default.div.withConfig({displayName:"MultiFileInput__DropzoneStyle",componentId:"sc-1l6yd2y-0"})(["&:hover{cursor:pointer;}"]);var h=function(e){var n=e.children,t=e.inputOnChange,i=e.inputProps,r=e.onDragActiveChange,o=e.setFiles,c=(0,l.useCallback)((function(e){o(e)}),[o]),u=(0,a.uI)({onDrop:c}),d=u.getInputProps,h=u.getRootProps,m=u.isDragActive,v=d(),b=v.accept,g=v.autoComplete,x=v.multiple,j=v.onChange,y=v.onClick,k=v.ref,Z=v.style,O=v.tabIndex,_=v.type,C=f(f({},i),{},{accept:b,autoComplete:g,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:O,type:_});return(0,l.useEffect)((function(){null===r||void 0===r||r(m)}),[m,r]),(0,s.jsxs)(p,f(f({},h()),{},{children:[(0,s.jsx)("input",f(f({},C),{},{directory:"",webkitdirectory:""})),n]}))},m=t(82531);function v(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function b(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?v(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var g=function(e){var n=e.children,t=e.directoryPath,u=e.onDragActiveChange,a=e.setFileUploadProgress,d=e.setUploadedFiles,f=(0,c.Db)(m.ZP.files.useCreate({onUploadProgress:function(e,n){var t,r=n.body,l=[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(o.sep);null===a||void 0===a||a((function(n){return b(b({},n),{},(0,i.Z)({},l,e.loaded/e.total))}))}})),p=(0,r.Z)(f,1)[0],v=(0,l.useCallback)((function(e){e.forEach((function(e){var n=e.name,r=e.path,l=[t],c=r.split(o.sep).filter((function(e){return e&&e!==n})).join(o.sep);c&&l.push(c);var u=[],s=l.join(o.sep);(null===s||void 0===s?void 0:s.length)>=1&&l.push(s),u.push(n);var f=u.join(o.sep);p({dir_path:s,file:e,overwrite:!1}).then((function(e){var n=e.data,t=n.error,r=n.file;d((function(e){return b(b({},e),{},(0,i.Z)({},f,r||t))}))})),a((function(e){return b(b({},e),{},(0,i.Z)({},f,0))}))}))}),[p,t,a,d]);return(0,s.jsx)(h,{onDragActiveChange:u,setFiles:v,children:n})}},70543:function(e,n,t){"use strict";t.d(n,{IY:function(){return o},Jf:function(){return r},NR:function(){return l},b7:function(){return i}});var i="edit",r={uuid:"All files"},o={uuid:"Files in pipeline"},l=[r,o]},59920:function(e,n,t){"use strict";var i;t.d(n,{M:function(){return i}}),function(e){e.BACKFILLS="backfills",e.BLOCK_RUNS="block_runs",e.EDIT="edit",e.MONITOR="monitor",e.PIPELINE_LOGS="pipeline_logs",e.PIPELINE_RUNS="pipeline_runs",e.RUNS="runs",e.SETTINGS="settings",e.SYNCS="syncs",e.TRIGGERS="triggers"}(i||(i={}))},36405:function(e,n,t){"use strict";t.d(n,{H:function(){return c}});var i=t(98781),r=t(10503),o=t(59920),l=t(9736);function c(e,n,t){var c=(n||{}).uuid||t,u=[{Icon:r.Bf,id:o.M.TRIGGERS,isSelected:function(){return o.M.TRIGGERS===e},label:function(){return"Triggers"},linkProps:{as:"/pipelines/".concat(c,"/triggers"),href:"/pipelines/[pipeline]/triggers"}},{Icon:r.Pf,id:o.M.RUNS,isSelected:function(){return o.M.RUNS===e},label:function(){return"Runs"},linkProps:{as:"/pipelines/".concat(c,"/runs"),href:"/pipelines/[pipeline]/runs"}},{Icon:r.dE,id:o.M.BACKFILLS,isSelected:function(){return o.M.BACKFILLS===e},label:function(){return"Backfills"},linkProps:{as:"/pipelines/".concat(c,"/backfills"),href:"/pipelines/[pipeline]/backfills"}},{Icon:r.UL,id:o.M.PIPELINE_LOGS,isSelected:function(){return o.M.PIPELINE_LOGS===e},label:function(){return"Logs"},linkProps:{as:"/pipelines/".concat(c,"/logs"),href:"/pipelines/[pipeline]/logs"}},{Icon:r.ug,id:o.M.MONITOR,isSelected:function(){return o.M.MONITOR===e},label:function(){return"Monitor"},linkProps:{as:"/pipelines/".concat(c,"/monitors"),href:"/pipelines/[pipeline]/monitors"}}];return i.qL.INTEGRATION===(null===n||void 0===n?void 0:n.type)&&u.unshift({Icon:r.Nt,id:o.M.SYNCS,isSelected:function(){return o.M.SYNCS===e},label:function(){return"Syncs"},linkProps:{as:"/pipelines/".concat(c,"/syncs"),href:"/pipelines/[pipeline]/syncs"}}),(0,l.Ct)()||(u.unshift({Icon:r.EK,disabled:!c,id:o.M.EDIT,isSelected:function(){return o.M.EDIT===e},label:function(){return"Edit pipeline"},linkProps:{as:"/pipelines/".concat(c,"/edit"),href:"/pipelines/[pipeline]/edit"}}),u.push({Icon:r.Zr,id:o.M.SETTINGS,isSelected:function(){return o.M.SETTINGS===e},label:function(){return"Pipeline settings"},linkProps:{as:"/pipelines/".concat(c,"/settings"),href:"/pipelines/[pipeline]/settings"}})),u}},58122:function(e,n,t){"use strict";t.d(n,{CL:function(){return p},FS:function(){return h},JZ:function(){return v},e7:function(){return b},v0:function(){return f},wx:function(){return m}});var i=t(75582),r=t(82394),o=t(43313),l=t(93348),c=t(1286),u=t(90211),a=t(84779);function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function d(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){(0,r.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function f(e){var n=e.statistics,t=Object.keys(n),i=Array(o.Dy.length).fill(0);return 0===t.length?null:(t.forEach((function(e){if(o.Dy.includes(e)){var t=o.CC[e],r=n[e],l=r,c=!1,u=[2,3],s=o.Ub[e],d=o.oH[e],f=o.OD[e];if(o.y_.includes(e))c=!0,u=[2,1,2];else if(e in o.Sq){r=(0,a.Jw)(r,0);var p=o.Sq[e];l=n[p]}var h={columnFlexNumbers:u,name:t,progress:c,rate:l,successDirection:d,warning:f};o.y_.includes(e)||(h.value=r),i[s]=h}})),i)}function p(e){var n=e.columnTypes,t=void 0===n?{}:n,i=e.statistics,r=Object.keys(i);if(0===r.length)return null;var l=Object.values(t),a=l.length,s=[];s.push({name:"Column count",successDirection:o.oH.column_count,value:(0,u.x6)(a)}),r.forEach((function(e){if(o.Zu.includes(e)){var n=o.CC[e],t=i[e],r=o.OD[e];s.push({name:n,successDirection:o.oH[e],value:(0,u.x6)(t),warning:r})}}));var d=(0,c.QO)(l),f=d.countCategory,p=d.countDatetime,h=d.countNumerical;return s.push({name:"Categorical Features",rate:f/a,value:(0,u.x6)(f)},{name:"Numerical Features",rate:h/a,value:(0,u.x6)(h)},{name:"Datetime Features",rate:p/a,value:(0,u.x6)(p)}),s}function h(e){return"string"===typeof e?e:JSON.stringify(e)}function m(e,n){var t,i;return null===e||void 0===e||null===(t=e.find((function(e){var t=e.block;return n(t)})))||void 0===t||null===(i=t.variables)||void 0===i?void 0:i.map((function(e){var n=e.value;return d(d({},e),{},{value:h(n)})}))}function v(e,n){return n===l.Xm.TIME?e.push({uuid:"execution_date",value:"<run datetime>"}):n===l.Xm.EVENT&&e.push({uuid:"event",value:"<trigger event>"}),e}function b(e){return e?Object.entries(e).reduce((function(e,n){var t=(0,i.Z)(n,2),o=t[0],l=t[1],c=l;try{c=JSON.parse(l)}catch(u){}return d(d({},e),{},(0,r.Z)({},o,c))}),{}):e}},76096:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(33591)),l=t(28598),c=["children","fullHeight","gutter","style"];function u(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?u(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.fullHeight,i=e.gutter,u=e.style,s=void 0===u?{}:u,d=(0,r.Z)(e,c),f=a({},s);return i&&(f.paddingLeft=i,f.paddingRight=f.paddingLeft),t&&(f.height="100%"),(0,l.jsx)(o.Col,a(a({},d),{},{style:f,children:n}))}},97361:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=t(82684),l=t(33591),c=t(28598),u=["children","fullHeight","gutter","justifyContent","style"];function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.fullHeight,i=e.gutter,a=e.justifyContent,d=e.style,f=void 0===d?{}:d,p=(0,r.Z)(e,u),h=s({},f);return i&&(h.marginLeft=-1*i,h.marginRight=h.marginLeft),t&&(h.height="100%"),(0,c.jsx)(l.Row,s(s({},p),{},{justifyContent:a,style:h,children:o.Children.map(n,(function(e,n){return e&&o.cloneElement(e,{gutter:i,key:n})}))}))}},93348:function(e,n,t){"use strict";t.d(n,{TR:function(){return d},U5:function(){return u},Xm:function(){return o},Z4:function(){return s},fq:function(){return c},kJ:function(){return a}});var i,r,o,l=t(82394);!function(e){e.API="api",e.EVENT="event",e.TIME="time"}(o||(o={}));var c,u,a,s=(i={},(0,l.Z)(i,o.API,(function(){return"API"})),(0,l.Z)(i,o.EVENT,(function(){return"event"})),(0,l.Z)(i,o.TIME,(function(){return"schedule"})),i);!function(e){e.ACTIVE="active",e.INACTIVE="inactive"}(c||(c={})),function(e){e.ONCE="@once",e.HOURLY="@hourly",e.DAILY="@daily",e.WEEKLY="@weekly",e.MONTHLY="@monthly"}(u||(u={})),function(e){e.CREATED_AT="created_at",e.NAME="name",e.PIPELINE="pipeline_uuid",e.STATUS="status",e.TYPE="schedule_type"}(a||(a={}));var d=(r={},(0,l.Z)(r,a.CREATED_AT,"Created at"),(0,l.Z)(r,a.NAME,"Name"),(0,l.Z)(r,a.PIPELINE,"Pipeline"),(0,l.Z)(r,a.STATUS,"Status"),(0,l.Z)(r,a.TYPE,"Type"),r)},98781:function(e,n,t){"use strict";t.d(n,{$1:function(){return u},G7:function(){return s},QK:function(){return c},a_:function(){return d},qL:function(){return o},r0:function(){return a}});var i,r,o,l=t(82394);!function(e){e.INTEGRATION="integration",e.PYTHON="python",e.PYSPARK="pyspark",e.STREAMING="streaming"}(o||(o={}));var c,u,a,s=(i={},(0,l.Z)(i,o.INTEGRATION,"Integration"),(0,l.Z)(i,o.PYTHON,"Standard"),(0,l.Z)(i,o.PYSPARK,"PySpark"),(0,l.Z)(i,o.STREAMING,"Streaming"),i);!function(e){e.ACTIVE="active",e.INACTIVE="inactive",e.NO_SCHEDULES="no_schedules",e.RETRY="retry"}(c||(c={})),function(e){e.GROUP="group_by",e.STATUS="status[]",e.TYPE="type[]"}(u||(u={})),function(e){e.STATUS="status",e.TYPE="type"}(a||(a={}));var d=(r={},(0,l.Z)(r,o.PYTHON,"python3"),(0,l.Z)(r,o.PYSPARK,"pysparkkernel"),r)},52769:function(e,n,t){"use strict";t.d(n,{C:function(){return i}});var i="global"},65730:function(e,n,t){"use strict";var i,r=t(82394),o=(t(82684),t(64866)),l=t(21764),c=t(67971),u=t(10919),a=t(86673),s=t(19711),d=t(46261),f=t(10503),p=t(49125),h=t(28598);function m(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function v(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?m(Object(t),!0).forEach((function(n){(0,r.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}!function(e){e.LEFT="left",e.RIGHT="right"}(i||(i={})),n.Z=function(e){var n,t=e.children,r=e.copiedText,m=e.iconPosition,b=void 0===m?i.LEFT:m,g=e.inverted,x=e.linkProps,j=e.linkText,y=e.monospace,k=e.muted,Z=e.small,O=e.toastMessage,_=e.withCopyIcon;return t?n=(0,h.jsx)("span",{children:t}):_&&(n=(0,h.jsx)(u.Z,v(v({href:"#",inline:!0,muted:k,preventDefault:!0,sameColorAsText:!0,small:Z},x),{},{children:(0,h.jsxs)(c.Z,{alignItems:"center",children:[b===i.LEFT&&(0,h.jsx)(a.Z,{mr:j?1:0,children:(0,h.jsx)(c.Z,{alignItems:"center",children:(0,h.jsx)(f.CK,{inverted:g,muted:k,size:2*p.iI})})}),j&&(0,h.jsx)(s.ZP,{inverted:g,monospace:y,muted:k,small:Z,children:j}),b===i.RIGHT&&(0,h.jsx)(a.Z,{ml:j?1:0,children:(0,h.jsx)(c.Z,{alignItems:"center",children:(0,h.jsx)(f.CK,{inverted:g,muted:k})})})]})}))),(0,h.jsx)(d.Z,{block:!0,label:"Copy",size:null,widthFitContent:!0,children:(0,h.jsx)(o.CopyToClipboard,{onCopy:function(){return l.Am.success(O||"Successfully copied to clipboard.",{position:l.Am.POSITION.BOTTOM_RIGHT,toastId:r})},text:r,children:n})})}},30264:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(47999)),l=t(62084),c=t(28598),u=["children","items","open","onClickCallback","onClickOutside","parentRef","uuid"];function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.items,i=e.open,a=e.onClickCallback,d=e.onClickOutside,f=e.parentRef,p=e.uuid,h=(0,r.Z)(e,u),m=(0,c.jsxs)("div",{style:{position:"relative",zIndex:d?3:2},children:[(0,c.jsx)("div",{ref:f,children:n}),(0,c.jsx)(l.Z,s(s({},h),{},{items:t,onClickCallback:a,open:i,parentRef:f,uuid:p}))]});return d?(0,c.jsx)(o.Z,{onClickOutside:d,open:!0,children:m}):m}},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!e.borderless&&"\n border: 1px solid ".concat((e.theme.interactive||c.Z.interactive).defaultBorder,";\n ")}),(function(e){return e.success&&"\n background-color: ".concat((e.theme.background||c.Z.background).successLight,";\n ")}),(function(e){return e.success&&!e.borderless&&"\n border: 1px solid ".concat((e.theme.background||c.Z.background).success,";\n ")}),(function(e){return!e.dark&&!e.success&&"\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,b=e.fullWidth,g=void 0===b||b,x=e.header,j=e.headerHeight,y=e.headerIcon,k=e.headerPaddingVertical,Z=e.headerTitle,O=e.maxHeight,_=e.maxWidth,C=e.minWidth,P=e.noPadding,S=e.overflowVisible,E=e.subtitle,w=e.success;return(0,d.jsxs)(p,{borderless:n,dark:u,fullHeight:f,fullWidth:g,maxHeight:O,maxWidth:_,minWidth:C,overflowVisible:S,ref:i,success:w,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:O,noPadding:P,overflowVisible:S,ref:c,children:[E&&(0,d.jsx)(o.Z,{mb:2,children:(0,d.jsx)(l.ZP,{default:!0,children:E})}),t]}),a&&(0,d.jsx)(v,{children:a})]})}},59455:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return wu}});var i=t(77837),r=t(21831),o=t(82394),l=t(75582),c=t(38860),u=t.n(c),a=t(56085),s=t(82684),d=t(83455),f=t(34376),p=(0,t(44152).r)({apiReloads:{}}).useGlobalState;var h=function(e){var n=e.children,t=e.uuid,i=e.uuids,o=void 0===i?[]:i,c=p("apiReloads"),u=(0,l.Z)(c,1)[0],a=(0,r.Z)(o);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),b=t(9518),g=t(38341),x=t(16634),j=t(34744),y=t(93461),k=t(67971),Z=t(10919),O=t(86673),_=t(19711),C=t(49125),P=t(44162),S=t(28598);function E(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function w(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?E(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):E(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var I=function(e){var n=e.blockRefs,t=e.hiddenBlocks,i=e.pipeline,r=e.setHiddenBlocks,l=(0,s.useContext)(b.ThemeContext),c=(0,s.useMemo)((function(){return(null===i||void 0===i?void 0:i.blocks)||[]}),[i]),u=(0,s.useMemo)((function(){var e=[],n=[];return c.forEach((function(i){var r=i.uuid;null!==t&&void 0!==t&&t[r]?e.push(i):n.push(i)})),{blocksHidden:e,blocksVisible:n}}),[c,t]),a=u.blocksHidden,d=u.blocksVisible,f=(0,s.useMemo)((function(){return(null===c||void 0===c?void 0:c.length)>=1&&0===d.length}),[c,d]),p=(0,s.useMemo)((function(){return(null===c||void 0===c?void 0:c.length)>=1&&0===a.length}),[c,a]),h=(0,s.useCallback)((function(e){var t=e.type,i=e.uuid;if(null!==n&&void 0!==n&&n.current){var r,o=n.current["".concat(t,"s/").concat(i,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}}),[n]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{p:1,children:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(y.Z,{flex:1,justifyContent:"center",children:(0,S.jsx)(g.Z,{checked:p,label:"Show all",onClick:function(){return r((function(){return{}}))}})}),(0,S.jsx)(y.Z,{flex:1,justifyContent:"center",children:(0,S.jsx)(g.Z,{checked:f,label:"Hide all",onClick:function(){return r((function(){return c.reduce((function(e,n){var t=n.uuid;return w(w({},e),{},(0,o.Z)({},t,!0))}),{})}))}})})]})}),(0,S.jsx)(j.Z,{medium:!0}),null===c||void 0===c?void 0:c.map((function(e){var n=e.uuid,i=(0,P.qn)(e.type,{blockColor:e.color,theme:l}).accent,c=!(null!==t&&void 0!==t&&t[n]);return(0,S.jsx)(Z.Z,{block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){r((function(e){return w(w({},e),{},(0,o.Z)({},n,c))})),c||setTimeout((function(){return h(e)}),1)},preventDefault:!0,children:(0,S.jsx)(O.Z,{mt:1,px:1,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(O.Z,{pr:1,children:(0,S.jsx)(g.Z,{checked:c})}),(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(x.Z,{color:i,size:1.5*C.iI,square:!0}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(_.ZP,{default:!0,monospace:!0,noWrapping:!0,small:!0,children:n})]})]})})},n)}))]})},T=t(60328),A=t(32316),D=t(11135),R=t(29237),M=t(98781),N=t(82944),B=t(16115),L=t(11366),F=t(91427),U=t(51504);var H,G,z,W,Y=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,F.U2)(L.kY)),f=d[0],p=d[1];(0,s.useEffect)((function(){var e;null===l||void 0===l||null===(e=l.current)||void 0===e||e.focus()}),[]);var h=(0,s.useMemo)((function(){return M.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,S.jsxs)(R.Z,{children:[(0,S.jsxs)(_.ZP,{bold:!0,children:[m," block name"]}),(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsx)(N.Z,{monospace:!0,onChange:function(e){return a(e.target.value)},ref:l,value:u})}),(0,S.jsx)(O.Z,{mt:2,children:(0,S.jsx)(k.Z,{alignItems:"center",children:(0,S.jsx)(g.Z,{checked:f,label:(0,S.jsxs)(_.ZP,{muted:!0,small:!0,children:["Automatically use randomly generated name",(0,S.jsx)("br",{}),"for blocks created in the future"]}),onClick:function(){p(!f),(0,F.t8)(L.kY,!f)}})})}),(0,S.jsx)(O.Z,{mt:3,children:(0,S.jsxs)(k.Z,{children:[(0,S.jsx)(D.ZP,{bold:!0,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,U.y)([B.Uq],n)},onClick:function(){return r({name:u||t})},primary:!0,tabIndex:0,uuid:"ConfigureBlock/SaveAndAddBlock",children:"Save and add block"}),(0,S.jsx)(O.Z,{ml:1,children:(0,S.jsx)(T.Z,{onClick:i,tabIndex:0,children:"Cancel"})})]})})]})},q=t(26304),Q=t(62084);!function(e){e.JSON="json",e.MD="md",e.PY="py",e.R="r",e.SQL="sql",e.TXT="txt",e.YAML="yaml",e.YML="yml"}(z||(z={})),function(e){e.INIT_PY="__init__.py",e.METADATA_YAML="metadata.yaml",e.REQS_TXT="requirements.txt"}(W||(W={}));var K=[z.PY,z.SQL],V=[z.JSON,z.MD,z.PY,z.R,z.SQL,z.TXT,z.YAML,z.YML],X=new RegExp(V.map((function(e){return".".concat(e,"$")})).join("|")),J=new RegExp(V.map((function(e){return".".concat(e,"$")})).join("|")),$="charts",ee="pipelines",ne=(H={},(0,o.Z)(H,z.MD,v.t6.MARKDOWN),(0,o.Z)(H,z.JSON,z.JSON),(0,o.Z)(H,z.PY,v.t6.PYTHON),(0,o.Z)(H,z.R,v.t6.R),(0,o.Z)(H,z.SQL,v.t6.SQL),(0,o.Z)(H,z.TXT,"text"),(0,o.Z)(H,z.YAML,v.t6.YAML),(0,o.Z)(H,z.YML,v.t6.YAML),H),te=(G={},(0,o.Z)(G,v.t6.MARKDOWN,z.MD),(0,o.Z)(G,v.t6.PYTHON,z.PY),(0,o.Z)(G,v.t6.R,z.R),(0,o.Z)(G,v.t6.SQL,z.SQL),(0,o.Z)(G,v.t6.YAML,z.YAML),(0,o.Z)(G,"text",z.TXT),G),ie=t(10503),re=t(43032),oe=t(60701),le=t(17717),ce=t(90211);function ue(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),ue(e.parent,r.join(le.sep))}return i}function ae(e){return null===e||void 0===e?void 0:e.split(le.sep).slice(1).join(le.sep)}function se(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=ue(e,n,t);return ae(i)}function de(e){var n,t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=ue(e,i).split(le.sep);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(le.sep))&&(n=r[0]===v.tf.CUSTOM?r[0]:(0,ce.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,ce.C5)(o||"")}if(!r)return null;var l="";l=r.length>=3?r.slice(2,r.length).join(le.sep):r[r.length-1];var c=["\\.".concat(z.PY),"\\.".concat(z.R),"\\.".concat(z.SQL),"\\.".concat(z.YAML),"\\.".concat(z.YML)].join("|"),u=new RegExp("".concat(c,"$"));if(v.$W.concat(v.tf.DBT).includes(n)&&l.match(u)){var a=l.lastIndexOf("."),s=l.slice(a+1);return{language:ne[s],type:n,uuid:l.slice(0,a)}}}function fe(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=ue(e,n).split(le.sep);if(t[1]){var i=(0,ce.C5)(t[n?0:1]);t[1]===v.tf.DBT&&(i=v.tf.DBT);var r=t[t.length-1],o=new RegExp(".".concat(z.YAML,"$")),l=new RegExp(".".concat(z.R,"$")),c=new RegExp(".".concat(z.SQL,"$")),u=new RegExp(".".concat(z.MD,"$"));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 a=r.replace(/[.]/g,"_"),s=i===v.tf.DBT?t.slice(2,-1).join("_").concat("_".concat(a)):r.replace(c,"");return{type:i,uuid:s}}return r.match(u)&&i===v.tf.MARKDOWN?{type:i,uuid:r.replace(u,"")}:void 0}}var pe=t(24224);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,o.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 be=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,b=n.setContextItem,g=n.setCoordinates,j=n.setDraggingFile,y=n.setSelectedFile,k=n.theme,Z=n.timeout,O=n.uncollapsed,E=n.useRootFolder,w=o.children,I=o.disabled,T=o.name,A=o.parent;T||(o.name=ve);var D,R=E?ue(o):se(o),M=(null===A||void 0===A?void 0:A.name)===ee,N=(0,s.useMemo)((function(){return w?(0,pe.YC)(w,(function(e){return e.children?0:1})):w}),[w]),B=l?l(R,N):I||"__init__.py"===T||!(null===T||void 0===T||!T.match(/^\./))||!T.match(J)&&!w,L=l?l(R,N):I||"__init__.py"===T||!(null===T||void 0===T||!T.match(/^\./))&&!N||!T.match(J)&&!w,U="".concat(c,"/").concat(T),H=(h.includes(function(e){var n=e.name.split("."),t=n[n.length-1];return K.includes(t)&&n.pop(),n.join("")}(o)),(0,s.useState)("undefined"===typeof O?(0,F.U2)(U,!1):!O)),G=H[0],z=H[1],W=ie.iU;1===c&&T===ee?W=ie.B_:T===$?W=ie.er:N&&(W=ie.gt),N&&v.$W.includes((0,ce.C5)(T))&&(0,ce.C5)(T)!==v.tf.CHART&&(D=(0,P.qn)((0,ce.C5)(T),{theme:k}).accent);var Y=(0,s.useMemo)((function(){return null===N||void 0===N?void 0:N.map((function(n){return(0,S.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:b,setCoordinates:g,setDraggingFile:j,setSelectedFile:y,theme:k,timeout:Z,uncollapsed:O,useRootFolder:E},"".concat(U,"/").concat((null===n||void 0===n?void 0:n.name)||ve))}))}),[t,N,i,r,o,l,c,u,a,d,f,p,h,m,b,g,j,y,k,Z,O,E,U]),q=(0,s.useMemo)((function(){var e=[];return(0,pe.w6)(c).forEach((function(n,t){var i,r=re.Cl-1;e.push((0,S.jsx)("div",{style:{borderLeft:"1px solid ".concat(null===k||void 0===k||null===(i=k.content)||void 0===i?void 0:i.disabled),height:22,marginLeft:r/2-2,paddingLeft:r/2+2}},"line-".concat(U,"-").concat(t)))})),e}),[c,k,U]);return(0,S.jsxs)(S.Fragment,{children:[!a&&(0,S.jsxs)("div",{className:"row",onClick:function(e){if(e.preventDefault(),!L){if((null===A||void 0===A?void 0:A.name)===$){null===p||void 0===p||p(oe.cH.CHARTS);var n=de(o);n&&(null===u||void 0===u||u(n.uuid,n.type,se(o)))}var i=fe(o);if(N)t?m(R):z((function(e){return(0,F.t8)(U,!e),!e}));else if(i)null===u||void 0===u||u(i.uuid,i.type,se(o));else if(T.match(X))d(R);else{var r=de(o);r&&(null===u||void 0===u||u(r.uuid,r.type,se(o)))}}},onContextMenu:function(e){var n;clearTimeout(Z.current),null!==i&&void 0!==i&&null!==(n=i.current)&&void 0!==n&&n.contains(e.target)&&!r&&(e.preventDefault(),g({x:e.pageX,y:e.pageY}),j(null),y(o))},onMouseDown:function(e){var n,t=o?de(o):null;null===i||void 0===i||null===(n=i.current)||void 0===n||!n.contains(e.target)||!t||(null===N||void 0===N?void 0:N.length)>=1||r||L||M||(e.preventDefault(),clearTimeout(Z.current),Z.current=setTimeout((function(){g({x:e.pageX,y:e.pageY}),j(o),y(null)}),300))},style:{alignItems:"center",cursor:"default",display:"flex",minWidth:c*re.Cl+o.name.length*C.Fo+2*C.iI,paddingRight:C.iI/4},children:[q,N&&!G&&(0,S.jsx)(ie._M,{muted:!0,size:re.ZG}),N&&G&&(0,S.jsx)(ie._Q,{muted:!0,size:re.ZG}),!N&&(0,S.jsx)("div",{style:{width:re.ZG}}),(0,S.jsxs)("div",{style:{marginLeft:C.iI/2,marginRight:C.iI/2},children:[!D&&(0,S.jsx)(W,{disabled:B,size:re.ZG}),D&&(0,S.jsx)(x.Z,{color:D,size:re.ZG,square:!0})]}),(0,S.jsx)(_.ZP,{color:D,default:!D&&!L,disabled:L,monospace:!0,small:!0,children:T})]}),(0,S.jsx)("div",{style:{display:G?"none":"block"},children:Y})]})},ge=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,o=e.setErrors,c=(0,s.useRef)(null),u=(0,xe.Qr)(t)?null:t,a=(0,s.useState)(u?se(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(se(r))}),[r]);var b=(0,d.Db)(ge.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 o({errors:n,response:e})}})}}),g=(0,l.Z)(b,1)[0],x=(0,d.Db)(ge.ZP.files.useUpdate(u&&encodeURIComponent(se(u))),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===n||void 0===n||n(),i()},onErrorCallback:function(e,n){return o({errors:n,response:e})}})}}),j=(0,l.Z)(x,1)[0];return(0,S.jsxs)(R.Z,{footer:(0,S.jsxs)(k.Z,{children:[(0,S.jsxs)(D.ZP,{bold:!0,disabled:!m,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,U.y)([B.Uq],n)},onClick:function(){return u?j({file:{dir_path:f,name:m},file_json_only:!0}):g({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,S.jsx)(O.Z,{ml:1,children:(0,S.jsx)(T.Z,{onClick:function(){return i()},tabIndex:0,children:"Cancel"})})]}),headerTitle:u?"Rename file":"New file",children:[(0,S.jsx)(N.Z,{disabled:!!u,label:"Directory",monospace:!0,onChange:function(e){return p(e.target.value)},setContentOnMount:!0,value:f}),(0,S.jsx)(O.Z,{mt:2,children:(0,S.jsx)(N.Z,{label:"Filename",monospace:!0,onChange:function(e){return v(e.target.value)},ref:c,required:!0,value:m})})]})},ke=t(62609),Ze=t(55106),Oe=t(66176),_e=t(58180),Ce=t(23831),Pe=t(73942),Se=(C.iI,b.default.div.withConfig({displayName:"indexstyle__DropZoneStyle",componentId:"sc-1g3zz7z-0"})(["border-radius:","px;padding:","px;max-width:","px;min-width:","px;",""],Pe.n_,8*C.iI,100*C.iI,55*C.iI,(function(e){return"\n border: 1px dashed ".concat((e.theme.borders||Ce.Z.borders).contrast,";\n ")}))),Ee=b.default.div.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-1g3zz7z-1"})(["max-width:","px;min-width:","px;"],100*C.iI,55*C.iI);var we=function(e){var n=e.fetchFileTree,t=e.onCancel,i=e.selectedFolder,r=(0,s.useState)(!1),o=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,pe.YC)(Object.entries(a),(function(e){var n=(0,l.Z)(e,2),t=n[0];n[1];return t})).forEach((function(n){var t=(0,l.Z)(n,2),i=t[0],r=t[1],o=p[i],c=null===o||void 0===o?void 0:o.message;e.push([(0,S.jsxs)("div",{children:[(0,S.jsx)(_.ZP,{overflowWrap:!0,preWrap:!0,children:i}),c&&(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsx)(_.ZP,{danger:!0,small:!0,children:c})})]},"name-".concat(i)),(0,S.jsx)(Oe.Z,{danger:!!c,progress:100*r},"progress-".concat(i))])})),(0,S.jsx)(_e.Z,{columnFlex:[1,4],columns:[{uuid:"Filename"},{uuid:"Upload progress"}],rows:e,uuid:"block-runs"})}),[a,p]);return(0,S.jsxs)(R.Z,{footer:(0,S.jsxs)(k.Z,{fullWidth:!0,children:[(0,S.jsx)(T.Z,{onClick:function(){return t()},children:"Close"}),m&&(0,S.jsx)(O.Z,{ml:1,children:(0,S.jsx)(T.Z,{onClick:function(){d({}),h({})},children:"Clear files and retry"})})]}),headerTitle:"Upload files",children:[m&&(0,S.jsx)(Ee,{children:v}),!m&&(0,S.jsx)(Ze.Z,{directoryPath:i?se(i):"",onDragActiveChange:c,setFileUploadProgress:d,setUploadedFiles:function(e){h(e),null===n||void 0===n||n()},children:(0,S.jsx)(Se,{children:(0,S.jsxs)(_.ZP,{center:!0,children:[o&&"Drop to upload",!o&&"Click or drop files and folders to upload"]})})})]})},Ie=t(86585),Te=function(e){var n=e[0];return n===v.tf.DBT||n===v.tf.CUSTOM?n:e[0].slice(0,-1)};function Ae(){return new RegExp(Object.keys(ne).map((function(e){return".(".concat(e,")$")})).join("|"))}function De(e,n,t){var i,o,l=null===e||void 0===e||null===(i=e.path.match(Ae())[0])||void 0===i?void 0:i.split(".")[1],c=t.type===M.qL.INTEGRATION,u=(0,pe.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(le.sep),s=e.path.split(le.sep)[0]===v.tf.DBT,d=(o=a)[0]===v.tf.DBT?o.slice(1).join(le.sep):function(e){return e.at(-1)}(o).split(".")[0];if(a.length>=3&&!s){var f=a.slice(1,a.length-1).join(le.sep);d="".concat(f,"/").concat(d)}var p=Te(e.path.split(le.sep)),h={configuration:{file_path:s?d:null},language:ne[l],name:(0,ce.wE)(d),type:p};if(p===v.tf.CUSTOM&&(h.color=v.Lq.TEAL),c){var m=(0,pe.sE)(t.blocks,(function(e){var n=e.type;return v.tf.DATA_LOADER===n})),b=(0,pe.sE)(t.blocks,(function(e){var n=e.type;return v.tf.TRANSFORMER===n})),g=[];b?g.push(b.uuid):null!==u&&void 0!==u&&u.upstream_blocks?g.push.apply(g,(0,r.Z)(u.upstream_blocks)):m&&g.push(m.uuid),h.upstream_blocks=g}return h}var Re=t(99497),Me=["addNewBlock","blocks","deleteWidget","fetchAutocompleteItems","fetchFileTree","fetchPipeline","files","pipeline","setErrors","setSelectedBlock","widgets"];function Ne(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Be(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ne(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ne(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Le,Fe=20*C.iI;function Ue(e,n){var t=e.addNewBlock,i=e.blocks,r=void 0===i?[]:i,o=e.deleteWidget,c=e.fetchAutocompleteItems,u=e.fetchFileTree,a=e.fetchPipeline,f=e.files,p=e.pipeline,h=e.setErrors,m=e.setSelectedBlock,g=e.widgets,x=void 0===g?[]:g,j=(0,q.Z)(e,Me),y=(0,s.useRef)(null),k=(0,s.useContext)(b.ThemeContext),Z=(0,s.useState)(null),O=Z[0],P=Z[1],E=(0,s.useState)(null),w=E[0],I=E[1],T=(0,s.useState)(null),A=T[0],D=T[1],R=ge.ZP.statuses.list().data,N=(0,s.useMemo)((function(){var e,n;return null===R||void 0===R||null===(e=R.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.repo_path}),[R]),B=(0,d.Db)((function(e){return ge.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})}})}}),L=(0,l.Z)(B,1)[0],F=(0,Re.dd)((function(e){var n=e.block;e.exception;return(0,S.jsx)(ke.Z,{centerOnScreen:!0,danger:!0,onClick:function(){return W({block:n,force:!0}).then((function(){return G()}))},onCancel:G,subtitle:"Deleting this block file is dangerous. This block may have dependencies in active pipelines. Press confirm to delete this block anyway and remove it as a dependency from downstream blocks.",title:"Delete ".concat(n.uuid," anyway?"),width:34*C.iI})})),U=(0,l.Z)(F,2),H=U[0],G=U[1],z=(0,d.Db)((function(e){var n=e.block,t=n.language,i=n.type,r=n.uuid,o=e.force,l=void 0!==o&&o,c="".concat(i,"/").concat(r);return t&&te[t]&&(c="".concat(c,".").concat(te[t].toLowerCase())),ge.ZP.blocks.useDelete(encodeURIComponent(c),{force:l})()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){c(),a(),u()},onErrorCallback:function(e){var n=e.error,t=n.exception;n.message.includes("raise HasDownstreamDependencies")&&H({block:ee,exception:t})}})}}),W=(0,l.Z)(z,1)[0],Y=(0,pe.sE)(null===p||void 0===p?void 0:p.blocks,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n})),K=(0,d.Db)(ge.ZP.blocks.pipelines.useUpdate(null===p||void 0===p?void 0:p.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 h({errors:n,response:e})}})}}),V=(0,l.Z)(K,1)[0],X=(0,s.useCallback)((function(){return D(null)}),[D]);(0,s.useEffect)((function(){var e,i,r,o=function(e){if(clearTimeout(y.current),I(null),w&&p&&t){var i,r,o=(null===n||void 0===n||null===(i=n.current)||void 0===i||null===(r=i.getBoundingClientRect)||void 0===r?void 0:r.call(i))||{},l=o.width,c=o.x;if(e.pageX>c+l){var u=(null===p||void 0===p?void 0:p.type)===M.qL.INTEGRATION,a=De(Be(Be({},w),{},{path:se(w)}),N,p);null===t||void 0===t||t(a,(function(e){u&&Y&&V({block:Be(Be({},Y),{},{upstream_blocks:[e.uuid]})}),null===m||void 0===m||m(e)}))}}},l=function(e){w&&P({x:e.pageX,y:e.pageY})};return null===(e=document)||void 0===e||e.addEventListener("click",X),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",X),null===(n=document)||void 0===n||n.removeEventListener("mousemove",l),null===(t=document)||void 0===t||t.removeEventListener("mouseup",o)}}),[t,Y,w,X,p,n,N,m,y,V]);var J=(0,s.useMemo)((function(){return r.concat(x).map((function(e){return e.uuid}))}),[r,x]),$=(0,s.useMemo)((function(){return null===f||void 0===f?void 0:f.map((function(e){return(0,s.createElement)(be,Be(Be({},j),{},{containerRef:n,file:e,key:e.name,level:0,pipelineBlockUuids:J,setCoordinates:P,setDraggingFile:I,setSelectedFile:D,theme:k,timeout:y}))}))}),[f,J,j,n,k,y]),ee=(0,s.useMemo)((function(){return A&&de(A)}),[A]),ne=(0,s.useMemo)((function(){return w&&de(w)}),[w]),ie=(0,s.useMemo)((function(){return A&&"undefined"!==typeof(null===A||void 0===A?void 0:A.children)&&A}),[A]),oe=(0,Re.dd)((function(){return(0,S.jsx)(we,{fetchFileTree:u,onCancel:ue,selectedFolder:ie})}),{},[u,ie],{background:!0,uuid:"upload_files"}),le=(0,l.Z)(oe,2),ce=le[0],ue=le[1],ae=(0,Re.dd)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return(0,S.jsx)(ye,{fetchFileTree:u,file:e,onCancel:me,selectedFolder:ie,setErrors:h})}),{},[u,ie,h],{background:!0,disableClickOutside:!0,uuid:"new_file"}),fe=(0,l.Z)(ae,2),he=fe[0],me=fe[1],ve=(0,s.useMemo)((function(){var e;if(!ee&&!A&&!ie)return(0,S.jsx)("div",{});var t=(null===n||void 0===n||null===(e=n.current)||void 0===e?void 0:e.getBoundingClientRect())||{},i=t.x,r=t.width,l=O||{},c=l.x,u=void 0===c?0:c,a=l.y,s=void 0===a?0:a,d=u;u+Fe>=i+r&&(d=i+r-(Fe+C.iI)),d<0&&(d=0);var f=[];return ie?f.push.apply(f,[{label:function(){return"Upload files"},onClick:function(){ce()},uuid:"upload_files"},{label:function(){return"New file"},onClick:function(){he({})},uuid:"new_file"}]):ee?f.push({label:function(){return"Delete block file"},onClick:function(){ee.type===v.tf.CHART?window.confirm("Are you sure you want to delete widget ".concat(ee.uuid,"?"))&&o(ee):window.confirm("Are you sure you want to delete block ".concat(ee.uuid,"?"))&&W({block:ee})},uuid:"delete_block_file"}):A&&f.push.apply(f,[{label:function(){return"Rename file"},onClick:function(){he(A)},uuid:"rename_file"},{label:function(){return"Delete file"},onClick:function(){var e=se(A);window.confirm("Are you sure you want to delete file ".concat(e,"?"))&&L(encodeURIComponent(e))},uuid:"delete_file"}]),(0,S.jsx)("div",{style:{left:d,position:"fixed",top:s+C.iI/2,zIndex:Ie.bf+100},children:(0,S.jsx)(Q.Z,{items:f,open:!0,parentRef:void 0,uuid:"FileBrowser/ContextMenu",width:Fe})})}),[O,W,L,o,n,ce,he,ee,A,ie]);return(0,S.jsxs)(re.Nk,{ref:n,children:[$,(ee||A||ie)&&ve,ne&&(0,S.jsx)("div",{style:{left:(null===O||void 0===O?void 0:O.x)-C.iI,position:"fixed",top:(null===O||void 0===O?void 0:O.y)-C.iI,zIndex:Ie.bf+100},children:(0,S.jsx)(_.ZP,{cursor:"grabbing",monospace:!0,children:null===ne||void 0===ne?void 0:ne.uuid})})]})}!function(e){e.BLOCK_FILE="block_file",e.DISABLED="disabled",e.FILE="file",e.FOLDER="folder",e.PIPELINE="pipeline"}(Le||(Le={}));var He=s.forwardRef(Ue),Ge=b.default.div.withConfig({displayName:"ButtonGroup__ButtonGroupStyle",componentId:"sc-15vbmc8-0"})([""]),ze=b.default.div.withConfig({displayName:"ButtonGroup__VerticalDivider",componentId:"sc-15vbmc8-1"})(["width:1px;"]),We=function(e){var n=e.children,t=e.divider,i=s.Children.toArray(n).length;return(0,S.jsx)(Ge,{children:(0,S.jsx)(k.Z,{children:s.Children.map(n,(function(e,n){return e&&(0,S.jsxs)(y.Z,{children:[n>=1&&t&&(0,S.jsx)(ze,{}),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))}))})})},Ye=t(57722),qe=t(94353),Qe=t(41150);function Ke(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 Ve(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ke(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ke(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Xe,Je=function(e){var n=e.active,t=e.addNewBlock,i=e.fetchPipeline,r=e.fetchVariables,c=e.filePath,u=e.openSidekickView,a=e.pipeline,f=e.selectedFilePath,h=e.sendTerminalMessage,b=e.setDisableShortcuts,g=e.setErrors,x=e.setFilesTouched,j=e.setSelectedBlock,y=p("apiReloads"),Z=(0,l.Z)(y,2)[1],_=(0,s.useState)(null),C=_[0],P=_[1],E=(0,s.useState)(!1),w=E[0],I=(E[1],(0,s.useRef)(null)),A=(0,s.useMemo)((function(){return new m.Z}),[]),R=(0,s.useMemo)((function(){return{api_key:qe.l,token:A.decodedToken.token}}),[A]),N=ge.ZP.statuses.list().data,L=(0,s.useMemo)((function(){var e,n;return null===N||void 0===N||null===(e=N.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.repo_path}),[N]),F=ge.ZP.file_contents.detail(c).data;(0,s.useEffect)((function(){null!==F&&void 0!==F&&F.file_content&&P(F.file_content)}),[F]);var H=(0,s.useState)(null===C||void 0===C?void 0:C.content),G=H[0],Y=H[1],q=(0,s.useState)(!1),Q=q[0],K=q[1];(0,s.useEffect)((function(){n&&b(!0)}),[n,b]),(0,s.useEffect)((function(){var e;f&&(null===I||void 0===I||null===(e=I.current)||void 0===e||e.scrollIntoView())}),[f]);var V=(0,d.Db)(ge.ZP.file_contents.useUpdate((null===C||void 0===C?void 0:C.path)&&encodeURIComponent(null===C||void 0===C?void 0:C.path)),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){Z((function(e){return Ve(Ve({},e),{},(0,o.Z)({},"FileVersions/".concat(null===C||void 0===C?void 0:C.path),Number(new Date)))}))},onErrorCallback:function(e,n){return null===g||void 0===g?void 0:g({errors:n,response:e})}})}}),X=(0,l.Z)(V,1)[0],J=(0,s.useCallback)((function(e,n){X({file_content:Ve(Ve({},n),{},{content:e})}).then((function(){decodeURIComponent(c).split(le.sep).pop()===W.METADATA_YAML&&r()})),x((function(e){return Ve(Ve({},e),{},(0,o.Z)({},null===n||void 0===n?void 0:n.path,!1))})),K(!1)}),[r,c,x,X]),$=(0,s.useMemo)((function(){return Ae()}),[]),ee=(0,s.useMemo)((function(){var e;return null===C||void 0===C||null===(e=C.path.match($)[0])||void 0===e?void 0:e.split(".")[1]}),[$,C]),te=(0,s.useMemo)((function(){if(null!==C&&void 0!==C&&C.path)return(0,S.jsx)(Ye.Z,{autoHeight:!0,language:ne[ee],onChange:function(e){Y(e),x((function(e){return Ve(Ve({},e),{},(0,o.Z)({},null===C||void 0===C?void 0:C.path,!0))})),K(!0)},onSave:function(e){J(e,C)},selected:!0,textareaFocused:!0,value:(0,ce.Pb)(null===C||void 0===C?void 0:C.content)?JSON.stringify(JSON.parse(null===C||void 0===C?void 0:C.content),null,2):null===C||void 0===C?void 0:C.content,width:"100%"})}),[C,ee,J,x]),ie=(0,pe.sE)(null===a||void 0===a?void 0:a.blocks,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n})),re=(0,d.Db)(ge.ZP.blocks.pipelines.useUpdate(null===a||void 0===a?void 0:a.uuid,null===ie||void 0===ie?void 0:ie.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===i||void 0===i||i()}})}}),ue=(0,l.Z)(re,1)[0],ae=(ee===z.PY||ee===z.SQL||(ee===z.YAML||ee===z.R)&&fe(C,null===C||void 0===C?void 0:C.path))&&Te(C.path.split(le.sep))!==v.tf.SCRATCHPAD&&de(C)&&(0,S.jsx)(T.Z,{onClick:function(){var e=a.type===M.qL.INTEGRATION,n=De(C,L,a);t(n,(function(n){e&&ie&&ue({block:Ve(Ve({},ie),{},{upstream_blocks:[n.uuid]})}),j(n)}))},primary:!0,children:"Add to current pipeline"}),se=(0,S.jsx)(O.Z,{m:2,children:(0,S.jsx)(D.ZP,{disabled:!L,inline:!0,loading:w,onClick:function(){u(oe.cH.TERMINAL),h(JSON.stringify(Ve(Ve({},R),{},{command:["stdin","pip install -r ".concat(L,"/requirements.txt\r")]})))},title:L?"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"})}),he="FileEditor/".concat(null===C||void 0===C?void 0:C.path),me=(0,Qe.y)(),ve=me.registerOnKeyDown,be=me.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){be(he)}}),[be,he]),ve(he,(function(e,t,i){if(n)if((0,U.y)([B.zX,B.Um],t)||(0,U.y)([B.PQ,B.Um],t))e.preventDefault(),J(G,C);else if(Q&&(0,U.y)([B.zX,B.hS],t)){e.preventDefault();var r="".concat(C.path," has changes that are unsaved. ")+"Click cancel and save your changes before reloading page.";"undefined"!==typeof location&&window.confirm(r)&&location.reload()}}),[n,G,C,J,Q]),(0,S.jsxs)("div",{ref:I,children:[(0,S.jsx)(O.Z,{p:2,children:(0,S.jsxs)(k.Z,{justifyContent:"space-between",children:[(0,S.jsxs)(We,{children:[ae,(0,S.jsx)(T.Z,{disabled:!G,onClick:function(e){e.preventDefault(),J(G,C)},title:G?null:"No changes have been made to this file.",children:"Save file content"})]}),(0,S.jsx)(We,{children:(0,S.jsx)(T.Z,{compact:!0,onClick:function(){u(oe.cH.FILE_VERSIONS)},small:!0,title:"View previous changes to this file.",children:"Show versions"})})]})}),te,c===W.REQS_TXT&&se]})},$e=t(47999),en=t(64318);!function(e){e.ANDROID="Android",e.CHROME_OS="ChromeOS",e.IOS="iOS",e.LINUX="Linux",e.MAC="macOS",e.WINDOWS="Windows"}(Xe||(Xe={}));var nn=Xe;function tn(){return function(){var e,n,t,i,r,o,l,c=nn.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=nn.MAC:["Win32","Win64","Windows","WinCE"].includes(a)?c=nn.WINDOWS:["iPhone","iPad","iPod"].includes(a)&&(c=nn.IOS):u&&(u.includes("Macintosh")?c=nn.MAC:u.includes("Windows")?c=nn.WINDOWS:u.includes("Linux")&&u.includes("X11")?c=nn.LINUX:/(iPhone|iPad)/.test(u)?c=nn.IOS:u.includes("Android")&&u.includes("Mobi")?c=nn.ANDROID:u.includes("CrOS")&&(c=nn.CHROME_OS)),c}()===nn.MAC}function rn(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 on(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?rn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):rn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ln=function(e){var n=e.cancelPipeline,t=e.children,i=e.createPipeline,r=e.executePipeline,l=e.interruptKernel,c=e.isPipelineExecuting,u=e.pipeline,a=e.restartKernel,d=e.savePipelineContent,f=(e.setActiveSidekickView,e.setMessages),p=(0,s.useState)(null),h=p[0],m=p[1],v=(0,s.useRef)(null),b=(0,s.useRef)(null),g=(0,s.useRef)(null),x=[{label:function(){return"New standard pipeline"},onClick:function(){return i({pipeline:{name:(0,ce.Y6)()}})},uuid:"new_standard_pipeline"},{label:function(){return"New streaming pipeline"},onClick:function(){return i({pipeline:{name:(0,ce.Y6)(),type:M.qL.STREAMING}})},uuid:"new_streaming_pipeline"},{keyTextGroups:[[tn()?B.RJ:B.hE,B.SS]],label:function(){return"Save pipeline"},onClick:function(){return d()},uuid:"save_pipeline"}],j=(0,s.useMemo)((function(){var e=[{label:function(){return"Interrupt kernel"},keyTextGroups:[[B.kA],[B.kA]],onClick:function(){return l()},uuid:"Interrupt kernel"},{label:function(){return"Restart kernel"},keyTextGroups:[[B.t_[B.OC]],[B.t_[B.OC]]],onClick:function(){return a()},uuid:"Restart kernel"},{label:function(){return"Clear all outputs"},onClick:function(){return f((function(e){return Object.keys(e).reduce((function(e,n){return on(on({},e),{},(0,o.Z)({},n,[]))}),{})}))},uuid:"Clear all outputs"}];return c?e.push({label:function(){return"Cancel pipeline"},onClick:function(){return n()},uuid:"Cancel pipeline"}):e.push({label:function(){return"Execute pipeline"},onClick:function(){return r()},uuid:"Execute pipeline"}),e}),[n,r,l,c,a,f]),y=(0,s.useMemo)((function(){return[{label:function(){return"Pipeline settings"},linkProps:{as:"/pipelines/".concat(null===u||void 0===u?void 0:u.uuid,"/settings"),href:"/pipelines/[pipeline]/settings"},uuid:"Pipeline settings"}]}),[u]),Z="FileHeaderMenu/index",O=(0,Qe.y)(),C=O.registerOnKeyDown,P=O.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){P(Z)}}),[P,Z]),C(Z,(function(e,n,t){null!==h&&(n[B.QK]?m((function(e){return 0===e?2:e-1})):n[B.DY]&&m((function(e){return 2===e?0:e+1})))}),[h,m]),(0,S.jsx)($e.Z,{onClickOutside:function(){return m(null)},open:!0,style:{position:"relative"},children:(0,S.jsxs)(k.Z,{children:[(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(en.u,{highlighted:0===h,onClick:function(){return m((function(e){return 0===e?null:0}))},onMouseEnter:function(){return m((function(e){return null!==e?0:null}))},ref:v,children:(0,S.jsx)(_.ZP,{children:"File"})}),(0,S.jsx)(Q.Z,{items:x,onClickCallback:function(){return m(null)},open:0===h,parentRef:v,uuid:"FileHeaderMenu/file_items"})]}),(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(en.u,{highlighted:1===h,onClick:function(){return m((function(e){return 1===e?null:1}))},onMouseEnter:function(){return m((function(e){return null!==e?1:null}))},ref:b,children:(0,S.jsx)(_.ZP,{children:"Run"})}),(0,S.jsx)(Q.Z,{items:j,onClickCallback:function(){return m(null)},open:1===h,parentRef:b,uuid:"FileHeaderMenu/run_items"})]}),(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(en.u,{highlighted:2===h,onClick:function(){return m((function(e){return 2===e?null:2}))},onMouseEnter:function(){return m((function(e){return null!==e?2:null}))},ref:g,children:(0,S.jsx)(_.ZP,{children:"Edit"})}),(0,S.jsx)(Q.Z,{items:y,onClickCallback:function(){return m(null)},open:2===h,parentRef:g,uuid:"FileHeaderMenu/edit_items"})]}),t]})})},cn=t(46261),un=t(82386),an=t(37391),sn=300,dn=b.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;}"],sn,sn),fn=b.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||Ce.Z.background).codeArea,";\n ")})),pn=b.default.div.withConfig({displayName:"indexstyle__PipelineHeaderStyle",componentId:"sc-1sv9513-2"})(["height:","px;position:sticky;top:","px;width:100%;z-index:5;"," "," "," ",""],un.Wi,un.Wi,(function(e){return"\n background-color: ".concat((e.theme.background||Ce.Z.background).panel,";\n border-bottom: 1px solid ").concat((e.theme.borders||Ce.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(un.Wi,"px;\n overflow-x: auto;\n z-index: 3;\n ")}),(0,an.y$)()),hn=b.default.div.withConfig({displayName:"indexstyle__FileTabStyle",componentId:"sc-1sv9513-3"})(["border-left:1px solid transparent;height:100%;padding:","px ","px;"," "," "," ",""],C.iI,C.cd*C.iI,(function(e){return"\n &:hover {\n cursor: default;\n\n p {\n color: ".concat((e.theme.content||Ce.Z.content).active," !important;\n cursor: default;\n }\n }\n ")}),(function(e){return e.selected&&"\n background-color: ".concat((e.theme.interactive||Ce.Z.interactive).hoverBackground,";\n ")}),(function(e){return!e.selected&&"\n border-color: ".concat((e.theme.borders||Ce.Z.borders).light," !important;\n ")}),(function(e){return e.last&&"\n border-right: 1px solid transparent;\n "})),mn=t(33766);var vn,bn,gn=function(e){var n=e.filePaths,t=e.filesTouched,i=e.savePipelineContent,r=e.selectedFilePath,o=(0,s.useContext)(b.ThemeContext),l=(0,s.useMemo)((function(){return n.map((function(e){return decodeURIComponent(e)}))}),[n]);return(0,S.jsx)(pn,{relativePosition:!0,secondary:!0,children:(0,S.jsx)(k.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,S.jsx)(k.Z,{flexDirection:"column",fullHeight:!0,onClick:function(n){n.preventDefault(),c||(i(),(0,mn.u7)({file_path:encodeURIComponent(e)}))},children:(0,S.jsx)(hn,{last:n===l.length-1,selected:c,children:(0,S.jsxs)(k.Z,{alignItems:"center",fullHeight:!0,children:[!t[e]&&(0,S.jsx)(ie.iU,{muted:!c,size:1.5*C.iI}),t[e]&&(0,S.jsx)(cn.Z,{label:"Unsaved changes",size:null,widthFitContent:!0,children:(0,S.jsx)("div",{style:{padding:1},children:(0,S.jsx)(x.Z,{borderColor:(o||Ce.Z).borders.danger,size:1.25*C.iI})})}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(_.ZP,{muted:!c,children:e}),(0,S.jsx)(O.Z,{mr:2}),c&&(0,S.jsx)(cn.Z,{appearAbove:!0,label:"Close",size:null,widthFitContent:!0,children:(0,S.jsx)(Z.Z,{autoHeight:!0,block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){var n=(0,pe.Od)(l,(function(n){return n===e})).map((function(e){return encodeURIComponent(e)}));(0,mn.u7)({file_path:n[n.length-1]||null,"file_paths[]":n},{pushHistory:!0})},preventDefault:!0,children:(0,S.jsx)(ie.x8,{size:1.25*C.iI})})}),!c&&(0,S.jsx)("div",{style:{width:1.25*C.iI}})]})})},e)}))})})},xn=t(57384);!function(e){e.CREATE_NEW_CLUSTER="create_new_cluster",e.SET_ACTIVE_CLUSTER="set_active_cluster"}(vn||(vn={})),function(e){e.BOOTSTRAPPING="BOOTSTRAPPING",e.STARTING="STARTING",e.WAITING="WAITING"}(bn||(bn={}));var jn,yn=t(90686),kn=t(66166);!function(e){e.EMR="emr"}(jn||(jn={}));var Zn=t(42305);var On=function(e){var n,t=e.children,i=(e.filePaths,e.filesTouched,e.isBusy),o=e.isPipelineUpdating,c=e.kernel,u=e.pipeline,a=e.pipelineContentTouched,f=e.pipelineLastSaved,p=(e.restartKernel,e.savePipelineContent,e.selectedFilePath),h=e.setErrors,m=e.setRunningBlocks,v=e.updatePipelineMetadata,g=(0,s.useContext)(b.ThemeContext),j=c||{},P=j.alive,E=j.usage,w=(0,s.useState)(!1),I=w[0],T=w[1],A=(0,s.useState)(""),R=A[0],N=A[1],L=(0,s.useState)(jn.EMR),U=L[0],H=(L[1],(0,s.useState)(!1)),G=H[0],z=H[1],W=(0,s.useState)(!1),Y=W[0],q=W[1],K=(0,s.useRef)(null),V=ge.ZP.clusters.detail(U,{},{revalidateOnFocus:!1}),X=V.data,J=V.mutate,$=(0,s.useMemo)((function(){var e;return(null===X||void 0===X||null===(e=X.cluster)||void 0===e?void 0:e.clusters)||[]}),[X]),ee=(0,s.useMemo)((function(){return(0,pe.sE)($,(function(e){return e.is_active}))}),[$]),ne=(0,d.Db)(ge.ZP.clusters.useUpdate(U),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){J()},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),te=(0,l.Z)(ne,1)[0];(0,s.useEffect)((function(){null!==u&&void 0!==u&&u.uuid&&N(u.uuid)}),[null===u||void 0===u?void 0:u.uuid]),n=a?"Unsaved changes":o?"Saving changes...":f?"Last saved ".concat((0,Zn.JX)(Number(f)/1e3)):"All changes saved";var re="KernelStatus",oe=(0,Qe.y)(),le=oe.registerOnKeyDown,ce=oe.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){ce(re)}}),[ce,re]),le(re,(function(e,n,t){I&&String(t[0])===String(B.Uq)&&String(t[1])!==String(B.zX)&&((null===u||void 0===u?void 0:u.uuid)===R?e.target.blur():(v(R),T(!1)))}),[I,R,T,v]);var ue=(0,s.useMemo)((function(){return null===E||void 0===E?void 0:E.pid}),[null===E||void 0===E?void 0:E.pid]),ae=(0,kn.Z)(ue),se=(0,s.useMemo)((function(){if(null!==E&&void 0!==E&&E.kernel_memory){var e=E.kernel_memory,n=Math.floor(Math.log(e)/Math.log(1024));return"".concat(parseFloat((e/Math.pow(1024,n)).toFixed(2))).concat(["B","KB","MB","GB","TB","PB","EB","ZB","YB"][n])}}),[null===E||void 0===E?void 0:E.kernel_memory]),de=(0,Re.dd)((function(){return(0,S.jsx)(ke.Z,{cancelText:"Close",centerOnScreen:!0,confirmText:"Don't show again",neutral:!0,onCancel:me,onClick:function(){(0,F.t8)(F.DU,1),me()},subtitle:"You may need to refresh your page to continue using the notebook. Unexpected kernel restarts may be caused by your kernel running out of memory.",title:"The kernel has restarted",width:34*C.iI})}),{},[],{background:!0,uuid:"restart_kernel_warning"}),fe=(0,l.Z)(de,2),he=fe[0],me=fe[1];(0,s.useEffect)((function(){var e=(0,F.U2)(F.DU,0);ue!==ae&&i&&!e&&(he(),m([]))}),[i,ue,ae,m]);var ve=(0,s.useMemo)((function(){return(0,S.jsx)("div",{ref:K,style:{position:"relative"},children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(null===u||void 0===u?void 0:u.type)===M.qL.PYSPARK&&(0,S.jsxs)(O.Z,{mr:1,children:[(0,S.jsxs)(Z.Z,{muted:!!ee,onClick:function(){return z(!0)},preventDefault:!0,sameColorAsText:!ee,underline:!ee,children:[ee&&ee.id,!ee&&"Select cluster"]}),(0,S.jsx)($e.Z,{disableEscape:!0,onClickOutside:function(){return z(!1)},open:G,children:(0,S.jsx)(Q.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select cluster"},uuid:"select_cluster"}].concat((0,r.Z)($.map((function(e){var n=e.id,t=e.is_active,i=e.status;return{label:function(){return(0,S.jsxs)(k.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,S.jsx)(y.Z,{flex:1,children:(0,S.jsx)(_.ZP,{muted:!t&&bn.WAITING!==i,children:n})}),t&&(0,S.jsx)(ie.Jr,{size:2*C.iI,success:!0}),!t&&(0,S.jsx)(_.ZP,{monospace:!0,muted:!0,children:i})]})},onClick:t||bn.WAITING!==i?null:function(){return te({cluster:{id:n,is_active:!0}})},uuid:n}})))),onClickCallback:function(){return z(!1)},open:G,parentRef:K,uuid:"KernelStatus/select_cluster",width:40*C.iI})})]}),(0,S.jsx)(D.ZP,{beforeElement:(0,S.jsx)(x.Z,{color:i?(g||Ce.Z).borders.info:P?(g||Ce.Z).borders.success:(g||Ce.Z).borders.danger,size:C.iI}),blackBorder:!0,compact:!0,inline:!0,onClick:function(){return q(!0)},uuid:"Pipeline/KernelStatus/kernel",children:(null===u||void 0===u?void 0:u.type)||M.qL.PYTHON}),(0,S.jsx)($e.Z,{disableEscape:!0,onClickOutside:function(){return q(!1)},open:Y,children:(0,S.jsx)(Q.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select kernel"},uuid:"select_kernel"}].concat((0,r.Z)(Object.keys(M.a_).filter((function(e){return(null===u||void 0===u?void 0:u.type)!=e})).map((function(e){return{label:function(){return e},onClick:function(){return v(null===u||void 0===u?void 0:u.name,e)},uuid:e}})))),onClickCallback:function(){return q(!1)},open:Y,parentRef:K,uuid:"KernelStatus/select_kernel",width:25*C.iI})})]})})}),[P,$,i,u,ee,z,q,G,Y,g,te]);return(0,S.jsx)(pn,{relativePosition:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",fullHeight:!0,justifyContent:"space-between",children:[(0,S.jsxs)(k.Z,{alignItems:"center",fullHeight:!0,justifyContent:"flex-start",children:[(0,S.jsxs)(O.Z,{px:C.cd,children:[p&&(0,S.jsx)(Z.Z,{noHoverUnderline:!0,noOutline:!0,onClick:p?function(){return(0,mn.u7)({file_path:null})}:null,preventDefault:!0,children:t}),!p&&(0,S.jsxs)(k.Z,{alignItems:"center",children:[t,I&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{ml:1}),(0,S.jsx)(Z.Z,{onClick:function(){v(R),T(!1)},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]})]}),E&&(0,S.jsx)(O.Z,{mr:C.cd,children:(0,S.jsxs)(y.Z,{flexDirection:"column",children:[(0,S.jsxs)(_.ZP,{monospace:!0,muted:!0,xsmall:!0,children:["CPU: ",null===E||void 0===E?void 0:E.kernel_cpu,"undefined"!==typeof(null===E||void 0===E?void 0:E.kernel_cpu)&&"%"]}),(0,S.jsxs)(_.ZP,{monospace:!0,muted:!0,xsmall:!0,children:["Memory: ",se]})]})})]}),(0,S.jsx)(O.Z,{px:C.cd,children:(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(cn.Z,{appearBefore:!0,block:!0,description:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(_.ZP,{default:!0,inline:!0,children:"Press"}),"\xa0",(0,S.jsx)(yn.Z,{inline:!0,keyText:tn()?B.RJ:B.hE}),"\xa0",(0,S.jsx)(_.ZP,{default:!0,inline:!0,children:"+"}),"\xa0",(0,S.jsx)(yn.Z,{inline:!0,keyText:B.SS}),"\xa0",(0,S.jsx)(_.ZP,{default:!0,inline:!0,children:"to save changes."}),(0,S.jsx)("br",{})]}),(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsxs)(_.ZP,{default:!0,children:["Or, go to ",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,children:"File"})," \u203a ",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,children:"Save pipeline"}),"."]})})]}),size:null,widthFitContent:!0,children:(0,S.jsx)(_.ZP,{muted:!0,children:n})}),(0,S.jsx)(O.Z,{ml:2}),ve]})})]})})},_n=t(82635),Cn=t(16910),Pn=t(65701),Sn=t(1254);var En,wn,In,Tn,An,Dn,Rn=function(e){var n=e.size;return(0,S.jsx)("svg",{fill:"none",height:n,preserveAspectRatio:"xMidYMid",viewBox:"0 0 256 256",width:n,xmlns:"http://www.w3.org/2000/svg",children:(0,S.jsx)("path",{d:"M245.121138,10.6473813 C251.139129,16.4340053 255.074133,24.0723342 256,32.4050489 C256,35.8769778 255.074133,38.1917867 252.990862,42.5895822 C250.907876,46.9873778 225.215147,91.4286933 217.57696,103.696213 C213.179164,110.871609 210.864356,119.435947 210.864356,127.768462 C210.864356,136.3328 213.179164,144.6656 217.57696,151.840996 C225.215147,164.108516 250.907876,208.781084 252.990862,213.179164 C255.074133,217.57696 256,219.659947 256,223.131876 C255.074133,231.464676 251.370667,239.103147 245.352676,244.658347 C239.565938,250.676338 231.927751,254.611342 223.826489,255.305671 C220.35456,255.305671 218.039751,254.379804 213.873493,252.296533 C209.706951,250.213262 164.340053,225.215147 152.072249,217.57696 C151.146382,217.113884 150.220516,216.419556 149.063396,215.95648 L88.4195556,180.079502 C89.8082133,191.652693 94.9006222,202.763093 103.233138,210.864356 C104.853618,212.484551 106.473813,213.873493 108.325547,215.262151 C106.936604,215.95648 105.316409,216.651093 103.927751,217.57696 C91.6599467,225.215147 46.9873778,250.907876 42.5895822,252.990862 C38.1917867,255.074133 36.1085156,256 32.4050489,256 C24.0723342,255.074133 16.4340053,251.370667 10.8788338,245.352676 C4.86075733,239.565938 0.925858133,231.927751 0,223.594951 C0.231464676,220.123022 1.1573248,216.651093 3.00905244,213.641956 C5.09223822,209.24416 30.7848533,164.571307 38.42304,152.303787 C42.82112,145.128391 45.1356444,136.795591 45.1356444,128.231538 C45.1356444,119.6672 42.82112,111.3344 38.42304,104.159004 C30.7848533,91.4286933 4.86075733,46.75584 3.00905244,42.3580444 C1.1573248,39.3489067 0.231464676,35.8769778 0,32.4050489 C0.925858133,24.0723342 4.62930489,16.4340053 10.6473813,10.6473813 C16.4340053,4.62930489 24.0723342,0.925858133 32.4050489,0 C35.8769778,0.231464676 39.3489067,1.1573248 42.5895822,3.00905244 C46.2930489,4.62930489 78.9293511,23.6094009 96.28928,33.7939911 L100.224284,36.1085156 C101.612942,37.0343822 102.770347,37.7287111 103.696213,38.1917867 L105.547947,39.3489067 L167.348907,75.9204978 C165.960249,62.0324978 158.784853,49.3019022 147.674453,40.7378489 C149.063396,40.04352 150.683591,39.3489067 152.072249,38.42304 C164.340053,30.7848533 209.012622,4.86075733 213.410418,3.00905244 C216.419556,1.1573248 219.891484,0.231464676 223.594951,0 C231.696213,0.925858133 239.334684,4.62930489 245.121138,10.6473813 Z M131.240391,144.434062 L144.434062,131.240391 C146.285796,129.388658 146.285796,126.611342 144.434062,124.759609 L131.240391,111.565938 C129.388658,109.714204 126.611342,109.714204 124.759609,111.565938 L111.565938,124.759609 C109.714204,126.611342 109.714204,129.388658 111.565938,131.240391 L124.759609,144.434062 C126.379804,146.054258 129.388658,146.054258 131.240391,144.434062 Z",fill:"#FF694A"})})},Mn=t(30264),Nn=t(80906),Bn=C.cd*C.iI,Ln=b.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;"," "," "," "," "," "," "," "," "," ",""],Pe.BG,(function(e){return e.border&&"\n border: 1px dotted ".concat((e.theme.content||Ce.Z.content).active,";\n ")}),(function(e){return e.grey&&"\n background-color: ".concat((0,P.qn)(v.tf.SCRATCHPAD,e).accent,";\n ")}),(function(e){return e.blue&&"\n background-color: ".concat((0,P.qn)(v.tf.DATA_LOADER,e).accent,";\n ")}),(function(e){return e.purple&&"\n background-color: ".concat((0,P.qn)(v.tf.TRANSFORMER,e).accent,";\n ")}),(function(e){return e.sky&&"\n background-color: ".concat((0,P.qn)(v.tf.MARKDOWN,e).accent,";\n ")}),(function(e){return e.teal&&"\n background-color: ".concat((0,P.qn)(v.tf.EXTENSION,e).accent,";\n ")}),(function(e){return e.rose&&"\n background-color: ".concat((0,P.qn)(v.tf.CALLBACK,e).accent,";\n ")}),(function(e){return e.yellow&&"\n background-color: ".concat((0,P.qn)(v.tf.DATA_EXPORTER,e).accent,";\n ")}),(function(e){return!e.compact&&"\n height: ".concat(Bn+C.iI/2,"px;\n width: ").concat(Bn+C.iI/2,"px;\n ")}),(function(e){return e.compact&&"\n height: ".concat(Bn/2+C.iI,"px;\n width: ").concat(Bn/2+C.iI,"px;\n ")})),Fn=b.default.div.withConfig({displayName:"indexstyle__ButtonWrapper",componentId:"sc-oyfjzc-1"})(["position:relative;margin-bottom:","px;margin-right:","px;",""],C.iI,C.iI,(function(e){return e.increasedZIndex&&"\n z-index: 3;\n "})),Un=(Nn.Q0.AVERAGE,Nn.Q0.CLEAN_COLUMN_NAME,Nn.Q0.COUNT,Nn.Q0.COUNT_DISTINCT,Nn.Q0.CUSTOM,Nn.Q0.DIFF,Nn.Q0.FIRST,Nn.Q0.FIX_SYNTAX_ERRORS,Nn.Q0.IMPUTE,Nn.Q0.LAST,Nn.Q0.MAX,Nn.Q0.MEDIAN,Nn.Q0.MIN,Nn.Q0.NORMALIZE,Nn.Q0.REFORMAT,Nn.Q0.REMOVE,Nn.Q0.REMOVE_OUTLIERS,Nn.Q0.SELECT,Nn.Q0.SHIFT_DOWN,Nn.Q0.SHIFT_UP,Nn.Q0.STANDARDIZE,Nn.Q0.SUM,[Nn.Q0.DROP_DUPLICATE,Nn.Q0.FILTER,Nn.Q0.SORT,Nn.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"}(Dn||(Dn={}));var Hn,Gn,zn,Wn=(wn={},(0,o.Z)(wn,Nn.qs.COLUMN,(En={},(0,o.Z)(En,Dn.AGGREGATE,[Nn.Q0.AVERAGE,Nn.Q0.COUNT,Nn.Q0.COUNT_DISTINCT,Nn.Q0.FIRST,Nn.Q0.LAST,Nn.Q0.MAX,Nn.Q0.MEDIAN,Nn.Q0.MIN,Nn.Q0.SUM]),(0,o.Z)(En,Dn.FORMATTING,[Nn.Q0.CLEAN_COLUMN_NAME,Nn.Q0.FIX_SYNTAX_ERRORS,Nn.Q0.REFORMAT]),(0,o.Z)(En,Dn.COLUMN_REMOVAL,[Nn.Q0.REMOVE,Nn.Q0.SELECT]),(0,o.Z)(En,Dn.SHIFT_ROWS,[Nn.Q0.SHIFT_DOWN,Nn.Q0.SHIFT_UP]),(0,o.Z)(En,Dn.MISC,[Nn.Q0.DIFF,Nn.Q0.IMPUTE,Nn.Q0.REMOVE_OUTLIERS]),(0,o.Z)(En,Dn.FEATURE_SCALING,[Nn.Q0.NORMALIZE,Nn.Q0.STANDARDIZE]),En)),(0,o.Z)(wn,Nn.qs.ROW,(0,o.Z)({},Dn.MISC,[].concat(Un))),wn),Yn=Object.keys(Wn[Nn.qs.COLUMN]),qn=[Dn.MISC],Qn=(An={},(0,o.Z)(An,Nn.qs.COLUMN,(In={},(0,o.Z)(In,Nn.Q0.ADD,"Add column"),(0,o.Z)(In,Nn.Q0.AVERAGE,"Aggregate by average value"),(0,o.Z)(In,Nn.Q0.CLEAN_COLUMN_NAME,"Clean column name"),(0,o.Z)(In,Nn.Q0.COUNT_DISTINCT,"Aggregate by distinct count"),(0,o.Z)(In,Nn.Q0.COUNT,"Aggregate by total count"),(0,o.Z)(In,Nn.Q0.DIFF,"Difference"),(0,o.Z)(In,Nn.Q0.FIRST,"Aggregate by first value"),(0,o.Z)(In,Nn.Q0.FIX_SYNTAX_ERRORS,"Fix syntax errors"),(0,o.Z)(In,Nn.Q0.IMPUTE,"Fill in missing values"),(0,o.Z)(In,Nn.Q0.NORMALIZE,"Normalize Data"),(0,o.Z)(In,Nn.Q0.STANDARDIZE,"Standardize Data"),(0,o.Z)(In,Nn.Q0.LAST,"Aggregate by last value"),(0,o.Z)(In,Nn.Q0.MAX,"Aggregate by maximum value"),(0,o.Z)(In,Nn.Q0.MEDIAN,"Aggregate by median value"),(0,o.Z)(In,Nn.Q0.MIN,"Aggregate by mininum value"),(0,o.Z)(In,Nn.Q0.REFORMAT,"Reformat"),(0,o.Z)(In,Nn.Q0.REMOVE_OUTLIERS,"Remove outliers"),(0,o.Z)(In,Nn.Q0.REMOVE,"Remove column(s)"),(0,o.Z)(In,Nn.Q0.SELECT,"Keep columns"),(0,o.Z)(In,Nn.Q0.SHIFT_DOWN,"Shift rows down in a column"),(0,o.Z)(In,Nn.Q0.SHIFT_UP,"Shift rows up in a column"),(0,o.Z)(In,Nn.Q0.SUM,"Aggregate by sum of values"),In)),(0,o.Z)(An,Nn.qs.ROW,(Tn={},(0,o.Z)(Tn,Nn.Q0.DROP_DUPLICATE,"Drop duplicates"),(0,o.Z)(Tn,Nn.Q0.FILTER,"Filter"),(0,o.Z)(Tn,Nn.Q0.SORT,"Sort"),(0,o.Z)(Tn,Nn.Q0.REMOVE,"Remove rows"),Tn)),An);!function(e){e.AMAZON_SQS="amazon_sqs",e.API="api",e.AZURE_BLOB_STORAGE="azure_blob_storage",e.AZURE_EVENT_HUB="azure_event_hub",e.BIGQUERY="bigquery",e.DRUID="druid",e.DUMMY="dummy",e.FILE="file",e.GENERIC="generic",e.GOOGLE_CLOUD_PUBSUB="google_cloud_pubsub",e.GOOGLE_CLOUD_STORAGE="google_cloud_storage",e.KAFKA="kafka",e.KINESIS="kinesis",e.MONGODB="mongodb",e.MYSQL="mysql",e.OPENSEARCH="opensearch",e.POSTGRES="postgres",e.RABBITMQ="rabbitmq",e.REDSHIFT="redshift",e.S3="s3",e.SNOWFLAKE="snowflake"}(zn||(zn={}));var Kn=(Hn={},(0,o.Z)(Hn,zn.AMAZON_SQS,"Amazon SQS"),(0,o.Z)(Hn,zn.API,"API"),(0,o.Z)(Hn,zn.AZURE_BLOB_STORAGE,"Azure Blob Storage"),(0,o.Z)(Hn,zn.AZURE_EVENT_HUB,"Azure Event Hub"),(0,o.Z)(Hn,zn.BIGQUERY,"Google BigQuery"),(0,o.Z)(Hn,zn.DRUID,"Druid"),(0,o.Z)(Hn,zn.DUMMY,"Dummy"),(0,o.Z)(Hn,zn.FILE,"Local file"),(0,o.Z)(Hn,zn.GENERIC,"Generic (no template)"),(0,o.Z)(Hn,zn.GOOGLE_CLOUD_PUBSUB,"Google Cloud PubSub"),(0,o.Z)(Hn,zn.GOOGLE_CLOUD_STORAGE,"Google Cloud Storage"),(0,o.Z)(Hn,zn.KAFKA,"Kafka"),(0,o.Z)(Hn,zn.KINESIS,"Kinesis"),(0,o.Z)(Hn,zn.MONGODB,"MongoDB"),(0,o.Z)(Hn,zn.MYSQL,"MySQL"),(0,o.Z)(Hn,zn.OPENSEARCH,"OpenSearch"),(0,o.Z)(Hn,zn.POSTGRES,"PostgreSQL"),(0,o.Z)(Hn,zn.RABBITMQ,"RabbitMQ"),(0,o.Z)(Hn,zn.REDSHIFT,"Amazon Redshift"),(0,o.Z)(Hn,zn.S3,"Amazon S3"),(0,o.Z)(Hn,zn.SNOWFLAKE,"Snowflake"),Hn),Vn=(Gn={},(0,o.Z)(Gn,v.tf.DATA_LOADER,[zn.GENERIC,zn.FILE,zn.API,zn.AZURE_BLOB_STORAGE,zn.BIGQUERY,zn.DRUID,zn.GOOGLE_CLOUD_STORAGE,zn.MYSQL,zn.POSTGRES,zn.REDSHIFT,zn.S3,zn.SNOWFLAKE]),(0,o.Z)(Gn,v.tf.DATA_EXPORTER,[zn.GENERIC,zn.FILE,zn.AZURE_BLOB_STORAGE,zn.BIGQUERY,zn.GOOGLE_CLOUD_STORAGE,zn.MYSQL,zn.POSTGRES,zn.REDSHIFT,zn.S3,zn.SNOWFLAKE]),(0,o.Z)(Gn,v.tf.TRANSFORMER,[zn.BIGQUERY,zn.POSTGRES,zn.REDSHIFT,zn.SNOWFLAKE]),(0,o.Z)(Gn,v.tf.SENSOR,[zn.GENERIC,zn.BIGQUERY,zn.MYSQL,zn.POSTGRES,zn.REDSHIFT,zn.S3,zn.SNOWFLAKE]),Gn),Xn=zn;function Jn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}var $n=function(e,n,t){var i=t===M.qL.STREAMING&&(e===v.tf.DATA_LOADER||e===v.tf.DATA_EXPORTER);return(function(e){var n;return e===M.qL.STREAMING?(n={},(0,o.Z)(n,v.tf.DATA_LOADER,[Xn.AMAZON_SQS,Xn.AZURE_EVENT_HUB,Xn.GOOGLE_CLOUD_PUBSUB,Xn.KAFKA,Xn.KINESIS,Xn.RABBITMQ]),(0,o.Z)(n,v.tf.DATA_EXPORTER,[Xn.DUMMY,Xn.S3,Xn.KAFKA,Xn.KINESIS,Xn.MONGODB,Xn.OPENSEARCH]),(0,o.Z)(n,v.tf.TRANSFORMER,[Xn.GENERIC]),n):Vn}(t)[e]||[]).map((function(t){return{indent:e===v.tf.TRANSFORMER,label:function(){return Kn[t]},onClick:function(){n({config:{data_source:t===Xn.GENERIC?null:t},language:i?v.t6.YAML:v.t6.PYTHON,type:e})},uuid:"".concat(e,"/").concat(t)}}))};function et(e,n){return{label:function(){return"SQL"},onClick:function(){return e({language:v.t6.SQL,type:n})},uuid:"".concat(n,"/sql")}}function nt(e,n){return{label:function(){return"R"},onClick:function(){return e({language:v.t6.R,type:n})},uuid:"".concat(n,"/r")}}var tt=function(e,n){return[et(e,n),nt(e,n)]};function it(e,n){var t={};return null===e||void 0===e||e.forEach((function(e){var i=e.block_type,r=e.description,l=e.groups,c=e.language,u=e.name,a=e.path;t[i]||(t[i]={}),t[i][c]||(t[i][c]={items:[],label:function(){return c},uuid:"".concat(i,"/").concat(c)});var s={label:function(){return u},onClick:function(){return n({config:{template_path:a},language:c,type:i})},tooltip:function(){return r},uuid:a};if((null===l||void 0===l?void 0:l.length)>=1){var d=function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Jn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Jn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},t[i][c]),f=[null],p=[d];l.forEach((function(e,n){var t="".concat(i,"/").concat(c,"/").concat(l.slice(0,n+1).join("/")),r=p[n],o=r.items.findIndex((function(e){var n=e.uuid;return t===n})),u=o>=0?r.items[o]:null;u||(u={items:[],label:function(){return e},uuid:t}),f.push(o),p.push(u)})),f.push(-1),p.push(s);var h=p.length;t[i][c]=p.reduce((function(e,n,t){var i=h-t,r=p[i-2],o=p[i-1],l=f[i-1];return r?(l>=0?r.items[l]=o:r.items.push(o),r):o}),{})}else t[i][c].items.push(s)})),t}var rt=function(e,n,t,i){var r=i||{},o=r.blockTemplatesByBlockType,l=r.languages,c=Object.fromEntries(v.Ut.map((function(n){return[n,$n(n,e,t)]})));if(t===M.qL.PYSPARK||t===M.qL.PYTHON&&n===v.tf.TRANSFORMER||t===M.qL.STREAMING||n===v.tf.SENSOR)return c[n];var u,a,s=(null===o||void 0===o||null===(u=o[n])||void 0===u||null===(a=u[v.t6.PYTHON])||void 0===a?void 0:a.items)||[],d=[{items:(c[n]||[]).concat(s),label:function(){return"Python"},uuid:"".concat(n,"/").concat(v.t6.PYTHON)}];return(!l||null!==l&&void 0!==l&&l.includes(v.t6.SQL))&&d.push(et(e,n)),(!l||null!==l&&void 0!==l&&l.includes(v.t6.R))&&d.push(nt(e,n)),d};function ot(e,n,t){return e.map((function(e){return{indent:!0,label:function(){return Qn[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 lt(e,n,t){var i=[];return e.forEach((function(e){if(e!==Dn.MISC)i.push({indent:!0,items:ot(Wn[n][e],n,t),label:function(){return e},uuid:"".concat(n,"_grouping_").concat((0,ce.RA)(e))});else{var o=ot(Wn[n][e],n,t);i.push.apply(i,(0,r.Z)(o))}})),i}var ct=function(e,n,t){return Object.values(v.Lq).map((function(i){return{label:function(){return(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(ie.mm,{fill:(0,P.qn)(v.tf.CUSTOM,{blockColor:i}).accent,size:16}),"\xa0",(0,S.jsx)(_.ZP,{children:(0,ce.kC)(i)})]})},leftAligned:!0,onClick:function(){e({color:i,language:t,type:n})},uuid:"".concat(t,"_").concat(i)}}))},ut=function(e){return"-- Docs: https://docs.mage.ai/guides/sql-blocks\n"+(e||"")};function at(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 st(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 dt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?st(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ft=function(e){var n=e.addNewBlock,t=e.blockIdx,i=e.blockTemplates,o=e.compact,l=e.hideCustom,c=e.hideDataExporter,u=(e.hideDataLoader,e.hideDbt),a=e.hideMarkdown,d=e.hideScratchpad,f=e.hideSensor,p=e.hideTransformer,h=e.hideTransformerDataSources,m=e.onClickAddSingleDBTModel,b=e.pipeline,g=e.setAddNewBlockMenuOpenIdx,x=e.setCreatingNewDBTModel,j=(0,s.useState)(null),y=j[0],Z=j[1],O=(0,s.useRef)(null),_=(0,s.useRef)(null),P=(0,s.useRef)(null),E=(0,s.useRef)(null),w=(0,s.useRef)(null),I=(0,s.useRef)(null),T={compact:o,inline:!0},A=null===b||void 0===b?void 0:b.type,R=A===M.qL.STREAMING,N=o?Bn/2:Bn,B=25*C.iI,L=lt(Yn,Nn.qs.COLUMN,n),F=[{label:function(){return"Generic (no template)"},onClick:function(){n({language:v.t6.PYTHON,type:v.tf.TRANSFORMER})},uuid:"generic_transformer_action"},{bold:!0,items:lt(qn,Nn.qs.ROW,n),label:function(){return"Row actions"},uuid:"row_actions_grouping"},{isGroupingTitle:!0,label:function(){return"Column actions"},uuid:"column_actions_grouping"}].concat((0,r.Z)(L));h||F.splice(1,0,{bold:!0,items:rt(n,v.tf.TRANSFORMER,A),label:function(){return"Data sources"},uuid:"data_sources_grouping"});var U=(0,s.useCallback)((function(){return Z(null)}),[]),H=(0,s.useCallback)((function(e){return null===g||void 0===g?void 0:g((function(n){return null===n||y!==e?t:null}))}),[t,y,g]),G=M.qL.PYSPARK===A,z=(0,s.useMemo)((function(){return it(i,n)}),[n,i]),W=(0,s.useMemo)((function(){return rt(n,v.tf.DATA_LOADER,A,{blockTemplatesByBlockType:z})}),[n,z,A]),Y=(0,s.useMemo)((function(){return rt(n,v.tf.DATA_EXPORTER,A,{blockTemplatesByBlockType:z})}),[n,z,A]);return(0,S.jsx)(k.Z,{flexWrap:"wrap",inline:!0,children:(0,S.jsx)($e.Z,{onClickOutside:U,open:!0,children:(0,S.jsxs)(k.Z,{flexWrap:"wrap",children:[!c&&(0,S.jsx)(Fn,{increasedZIndex:0===y,children:(0,S.jsx)(Mn.Z,{disableKeyboardShortcuts:!0,items:W,onClickCallback:U,open:0===y,parentRef:O,uuid:"data_loader_button",children:(0,S.jsx)(D.ZP,dt(dt({},T),{},{beforeElement:(0,S.jsx)(Ln,{blue:!0,compact:o,children:(0,S.jsx)(ie.mm,{size:N})}),onClick:function(e){e.preventDefault(),Z((function(e){return 0===e?null:0})),H(0)},uuid:"AddNewBlocks/Data_loader",children:"Data loader"}))})}),!p&&(0,S.jsx)(Fn,{increasedZIndex:1===y,children:(0,S.jsx)(Mn.Z,{disableKeyboardShortcuts:!0,items:G||M.qL.INTEGRATION===A?F:R?[{items:rt(n,v.tf.TRANSFORMER,A),label:function(){return"Python"},uuid:"transformers/python"}]:[{items:F,label:function(){return"Python"},uuid:"transformers/python_all"}].concat((0,r.Z)(tt(n,v.tf.TRANSFORMER))),onClickCallback:U,open:1===y,parentRef:_,uuid:"transformer_button",children:(0,S.jsx)(D.ZP,dt(dt({},T),{},{beforeElement:(0,S.jsx)(Ln,{compact:o,purple:!0,children:(0,S.jsx)(ie.mm,{size:N})}),onClick:function(e){e.preventDefault(),Z((function(e){return 1===e?null:1})),H(1)},uuid:"AddNewBlocks/Transformer",children:"Transformer"}))})}),!c&&(0,S.jsx)(Fn,{increasedZIndex:2===y,children:(0,S.jsx)(Mn.Z,{disableKeyboardShortcuts:!0,items:Y,onClickCallback:U,open:2===y,parentRef:P,uuid:"data_exporter_button",children:(0,S.jsx)(D.ZP,dt(dt({},T),{},{beforeElement:(0,S.jsx)(Ln,{compact:o,yellow:!0,children:(0,S.jsx)(ie.mm,{inverted:!0,size:N})}),onClick:function(e){e.preventDefault(),Z((function(e){return 2===e?null:2})),H(2)},uuid:"AddNewBlocks/Data_exporter",children:"Data exporter"}))})}),!u&&(0,S.jsx)(Fn,{increasedZIndex:3===y,children:(0,S.jsx)(Mn.Z,{disableKeyboardShortcuts:!0,items:[{label:function(){return"New model"},onClick:function(){null===x||void 0===x||x(!0),null===m||void 0===m||m(t)},uuid:"dbt/new_model"},{label:function(){return"Single model (from file)"},onClick:function(){return null===m||void 0===m?void 0:m(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:U,open:3===y,parentRef:E,uuid:"dbt_button",children:(0,S.jsx)(D.ZP,dt(dt({},T),{},{beforeElement:(0,S.jsx)(Rn,{size:Bn*(o?.75:1.25)}),onClick:function(e){e.preventDefault(),Z((function(e){return 3===e?null:3})),H(3)},uuid:"AddNewBlocks/DBT",children:"DBT model"}))})}),!l&&(0,S.jsx)(Fn,{increasedZIndex:4===y,children:(0,S.jsx)(Mn.Z,{disableKeyboardShortcuts:!0,items:[{items:ct(n,v.tf.CUSTOM,v.t6.PYTHON),label:function(){return"Python"},uuid:"custom_block_python"},{items:ct(n,v.tf.CUSTOM,v.t6.SQL),label:function(){return"SQL"},uuid:"custom_block_sql"}],onClickCallback:U,open:4===y,parentRef:w,uuid:"custom_block_button",children:(0,S.jsx)(cn.Z,{block:!0,label:"Add a custom code block with a designated color.",maxWidth:B,size:null,children:(0,S.jsx)(D.ZP,dt(dt({},T),{},{beforeElement:(0,S.jsx)(Ln,{compact:o,grey:!0,children:(0,S.jsx)(ie.mm,{inverted:!0,size:N})}),onClick:function(e){e.preventDefault(),Z((function(e){return 4===e?null:4})),H(4)},uuid:"AddNewBlocks/Scratchpad",children:"Custom"}))})})}),!d&&(0,S.jsx)(Fn,{children:(0,S.jsx)(cn.Z,{block:!0,label:"Write experimental code that doesn\u2019t get executed when you run your pipeline.",maxWidth:B,size:null,children:(0,S.jsx)(D.ZP,dt(dt({},T),{},{beforeElement:(0,S.jsx)(Ln,{border:!0,compact:o,children:(0,S.jsx)(ie.mm,{size:N})}),onClick:function(e){e.preventDefault(),n({type:v.tf.SCRATCHPAD})},uuid:"AddNewBlocks/Scratchpad",children:"Scratchpad"}))})}),!R&&!f&&(0,S.jsx)(Fn,{increasedZIndex:6===y,children:(0,S.jsx)(Mn.Z,{disableKeyboardShortcuts:!0,items:rt(n,v.tf.SENSOR,A),onClickCallback:U,open:6===y,parentRef:I,uuid:"sensor_button",children:(0,S.jsx)(D.ZP,dt(dt({},T),{},{beforeElement:(0,S.jsx)(Ln,{compact:o,children:(0,S.jsx)(ie.LM,{pink:!0,size:Bn*(o?.75:1.25)})}),onClick:function(e){e.preventDefault(),Z((function(e){return 6===e?null:6})),H(6)},uuid:"AddNewBlocks/Sensor",children:"Sensor"}))})}),!a&&(0,S.jsx)(Fn,{children:(0,S.jsx)(D.ZP,dt(dt({},T),{},{beforeElement:(0,S.jsx)(Ln,{compact:o,sky:!0,children:(0,S.jsx)(ie.mm,{inverted:!0,size:N})}),onClick:function(e){e.preventDefault(),n({language:v.t6.MARKDOWN,type:v.tf.MARKDOWN})},uuid:"AddNewBlocks/Markdown",children:"Markdown"}))})]})})})},pt=t(10975),ht=t(14567),mt=t(18283);var vt=function(e){var n=e.block,t=e.blocks,i=e.openSidekickView,r=(0,s.useContext)(b.ThemeContext),o=(0,s.useMemo)((function(){return(0,pe.HK)(t,(function(e){return e.uuid}))}),[t]),l=(0,s.useMemo)((function(){var e;return null===n||void 0===n||null===(e=n.callback_blocks)||void 0===e?void 0:e.reduce((function(e,n){var t=null===o||void 0===o?void 0:o[n];return t?e.concat(t):e}),[])}),[n,o]);return(0,S.jsx)(S.Fragment,{children:(null===l||void 0===l?void 0:l.length)>=1&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{px:1,children:(0,S.jsx)(_.ZP,{bold:!0,muted:!0,children:"Callbacks"})}),(0,S.jsx)(k.Z,{alignItems:"center",children:null===l||void 0===l?void 0:l.map((function(e){var n=e.color,t=e.type,o=e.uuid,l=(0,P.qn)(t,{blockColor:n,theme:r}).accentLight;return(0,S.jsx)(O.Z,{ml:1,mt:1,children:(0,S.jsx)(T.Z,{backgroundColor:l,compact:!0,onClick:function(){i(oe.cH.CALLBACKS,!0,{blockUUID:o})},small:!0,children:(0,S.jsx)(_.ZP,{monospace:!0,small:!0,children:o})})},o)}))})]})})},bt=t(89565),gt=t.n(bt),xt=t(62976),jt=t(48957),yt=b.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;"," "," ",""],P.Kf,(function(e){return e.addBottomPadding&&"\n padding-bottom: ".concat(2*C.tr,"px;\n ")}),(function(e){return"\n background-color: ".concat((e.theme.background||Ce.Z.background).table,";\n ")}),(function(e){return!e.executedAndIdle&&"\n border-bottom-left-radius: ".concat(Pe.n_,"px;\n border-bottom-right-radius: ").concat(Pe.n_,"px;\n border-bottom-style: solid;\n border-bottom-width: 2px;\n ")})),kt=b.default.div.withConfig({displayName:"indexstyle__OutputRowStyle",componentId:"sc-n38rkq-1"})([""," "," ",""],(function(e){return e.first&&"\n padding-top: ".concat(C.iI*C.cd,"px;\n ")}),(function(e){return e.last&&"\n padding-bottom: ".concat(C.iI*C.cd,"px;\n ")}),(function(e){return e.contained&&"\n padding-left: ".concat(P.oh,"px;\n padding-right: ").concat(C.iI*C.cd,"px;\n ")})),Zt=b.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{","}"],P.Kf,(function(e){return"\n color: ".concat((e.theme.interactive||Ce.Z.interactive).linkPrimary,";\n ")})),Ot=b.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;",""],P.Kf,(function(e){return"\n background-color: ".concat((e.theme.borders||Ce.Z.borders).light,";\n border-bottom-left-radius: ").concat(Pe.n_,"px;\n border-bottom-right-radius: ").concat(Pe.n_,"px;\n ")})),_t=b.default.div.withConfig({displayName:"indexstyle__ExtraInfoContentStyle",componentId:"sc-n38rkq-4"})(["padding-bottom:","px;padding-left:","px;padding-right:","px;padding-top:","px;"],C.iI,P.oh,C.iI*C.cd,C.iI),Ct=b.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||Ce.Z.borders).medium,";\n ")})),Pt=/\[__internal_output__\]/,St=/\[__internal_test__\]/,Et={uuid:"Preview results"},wt={uuid:"Logs"},It={uuid:"SQL"},Tt={uuid:"Lineage"},At=[Et,wt,It,Tt],Dt=2.5*C.iI,Rt="CodeBlock_HiddenBlock";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,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Mt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Bt(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,ce.Pb)(r)?JSON.parse(r):r}))),t[o]||(t[o]={}),t[o][l]=i})),{content:t,messages:n}}function Lt(e,n,t){e.forEach((function(e){(0,F.t8)("".concat(t,"/").concat(e.uuid,"/codeCollapsed"),(0,F.Od)("".concat(n,"/").concat(e.uuid,"/codeCollapsed"))),(0,F.t8)("".concat(t,"/").concat(e.uuid,"/outputCollapsed"),(0,F.Od)("".concat(n,"/").concat(e.uuid,"/outputCollapsed")))}))}function Ft(e){return"".concat(e,"/").concat(F.kP)}function Ut(e){return(0,F.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 Gt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ht(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ht(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var zt,Wt=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,g=e.openSidekickView,Z=e.pipeline,P=e.runCount,E=e.runEndTime,w=e.runStartTime,I=e.selected,A=e.selectedTab,D=e.setCollapsed,R=e.setOutputBlocks,N=e.setSelectedOutputBlock,B=e.setSelectedTab,L=n.status,U=n.type,H=(0,s.useMemo)((function(){return(null===b||void 0===b?void 0:b.length)||0}),[b]),G=v.DA.EXECUTED===L||!h&&0===P&&H>=1||!h&&P>=1&&E>=w,W=(0,s.useState)(),Y=W[0],q=W[1],Q=(0,s.useState)(),K=Q[0],V=Q[1];(0,s.useEffect)((function(){h||V(100)}),[h]);var X=function(e){return Array.isArray(e)?e.join("\n"):e},J=(0,s.useMemo)((function(){return b.reduce((function(e,n){var t=e.at(-1);if(_n.jU.includes(null===t||void 0===t?void 0:t.type)&&(null===t||void 0===t?void 0:t.type)===n.type&&!X(null===n||void 0===n?void 0:n.data).match(Pt)){if(Array.isArray(t.data))t.data.concat(n.data);else if("string"===typeof t.data){var i=X(n.data)||"";t.data=[t.data,i].join("\n")}}else _n.jU.includes(null===n||void 0===n?void 0:n.type)&&!X(null===n||void 0===n?void 0:n.data).match(Pt)?e.push(Gt(Gt({},n),{},{data:X(n.data)})):e.push(Gt({},n));return e}),[])}),[b]),$=(0,s.useMemo)((function(){return(0,S.jsx)(Oe.Z,{progress:K})}),[K]),ee=v.tf.DBT===(null===n||void 0===n?void 0:n.type),ne=(0,kn.Z)(d);(0,s.useEffect)((function(){ee&&!ne&&d&&B(wt)}),[d,ne,ee,B]);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&&q(o),r.length>=1&&(0,S.jsx)(xt.Z,{columns:t,disableScrolling:!c,index:i,maxHeight:60*C.iI,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!l,rows:r,width:m-(2+C.cd*C.iI*2+2+an.nn)},"data-table-".concat(i))},n=[],t=[],i=[];return null===J||void 0===J||J.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===J.length-1&&r===f-1},s=l>=1;if("string"===typeof n&&n.match(St)){var d=n.split("\n"),h=[];d.forEach((function(e){if(e.match(St)){var t=e.split("[__internal_test__]"),r=t[t.length-1];(0,ce.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(Pt)){var m=n.split("[__internal_output__]"),v=m[m.length-1],b=v.split("FloatProgress");if(m.length>=2&&(v=b[0]),(0,ce.Pb)(v)){var g=JSON.parse(v),x=g.data,j=g.type;if(_n.Gi.TABLE===j){!0;var y=e(x,{borderTop:s,selected:I});t.push(y),ee||(o=y)}}}else if(a===_n.Gi.TABLE){!0;var k=e((0,ce.Pb)(n)?JSON.parse(n):n,{borderTop:s,selected:I});t.push(k),ee||(o=k)}else if(_n.jU.includes(a)){var Z,O=null===(Z=n)||void 0===Z?void 0:Z.split("\\n");o=(0,S.jsx)(kt,Gt(Gt({},u),{},{children:O.map((function(e){return(0,S.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,S.jsx)(gt(),{children:e})},e)}))}))}else if(a===_n.Gi.TEXT_HTML)o=(0,S.jsx)(kt,Gt(Gt({},u),{},{children:(0,S.jsx)(Zt,{children:(0,S.jsx)(_.ZP,{dangerouslySetInnerHTML:{__html:n},monospace:!0})})}));else if(a===_n.Gi.IMAGE_PNG)o=(0,S.jsx)("div",{style:{backgroundColor:"white"},children:(0,S.jsx)("img",{alt:"Image ".concat(l," from code output"),src:"data:image/png;base64, ".concat(n)})});else if(a===_n.Gi.PROGRESS){var C=parseInt(n);V(C>90?90:C)}o&&p.push((0,S.jsx)("div",{children:o},"code-output-".concat(l,"-").concat(r)))}})),p.length>=1&&n.push(p)}})),h&&(null===Z||void 0===Z?void 0:Z.type)===M.qL.PYSPARK&&n.unshift([(0,S.jsx)(kt,{contained:!0,children:(0,S.jsx)(O.Z,{mt:1,children:$})},"progress_bar")]),{content:n,tableContent:t,testContent:i}}),[J,c,ee,h,m,Z,$,I]),re=te.content,le=te.tableContent,ue=te.testContent,ae=(null===Y||void 0===Y?void 0:Y[1])||0,se=ae>30?" (30 out of ".concat(ae," columns displayed)"):"",de=(0,s.useMemo)((function(){var e;if(ee&&A){var n=A.uuid;if(Et.uuid===n)(null===le||void 0===le?void 0:le.length)>=1?e=le:h||(e=(0,S.jsx)(O.Z,{px:2,py:1,children:(0,S.jsx)(_.ZP,{muted:!0,children:d?"Error, check logs.":"No preview to display yet, try running the block."})}));else if(wt.uuid===n)(null===re||void 0===re?void 0:re.length)>=1?e=re:h||(e=(0,S.jsx)(O.Z,{px:2,py:1,children:(0,S.jsx)(_.ZP,{muted:!0,children:d?"Error, check logs.":"No logs to display yet, try running the block."})}));else if(It.uuid===n){var r,o=null===t||void 0===t||null===(r=t.dbt)||void 0===r?void 0:r.sql;e=o?(0,S.jsx)(Ye.Z,{autoHeight:!0,language:z.SQL,padding:!0,readOnly:!0,value:o,width:"100%"}):null}else if(Tt.uuid===n){var l,c=null===t||void 0===t||null===(l=t.dbt)||void 0===l?void 0:l.lineage;e=c?(0,S.jsx)(jt.Z,{disabled:!0,enablePorts:!1,height:55*C.iI,pannable:I,pipeline:Gt(Gt({},Z),{},{blocks:c}),zoomable:I}):null}}else e=re;return(0,S.jsxs)(S.Fragment,{children:[i,e]})}),[t,i,re,d,ee,h,Z,I,A,le]);return i||d||f?(0,S.jsxs)(S.Fragment,{children:[c&&(0,S.jsxs)(yt,{addBottomPadding:h&&(null===Z||void 0===Z?void 0:Z.type)===M.qL.PYSPARK,blockType:U,dynamicBlock:u,dynamicChildBlock:a,executedAndIdle:G,hasError:d,selected:I,children:[!o&&(null===ue||void 0===ue?void 0:ue.length)>=1&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{py:2,children:(0,S.jsx)(kt,{contained:!0,children:ue.map((function(e,n){var t=e.error,i=e.message,r=e.stacktrace;return(0,S.jsxs)(O.Z,{mt:n>=1?3:0,children:[(0,S.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,S.jsx)(gt(),{children:"".concat(i).concat(t?" "+t:"")})}),null===r||void 0===r?void 0:r.map((function(e){return(0,S.jsx)(_.ZP,{default:!0,monospace:!0,preWrap:!0,small:!0,children:(0,S.jsx)(gt(),{children:e})},e)}))]},i)}))})}),(0,S.jsx)(O.Z,{mb:d?2:0,children:(0,S.jsx)(j.Z,{medium:!0})})]}),!o&&de]}),!c&&de,G&&!p&&(0,S.jsxs)(Ot,{blockType:U,dynamicBlock:u,dynamicChildBlock:a,hasError:d,selected:I,children:[(0,S.jsx)(Ct,{}),(0,S.jsxs)(k.Z,{justifyContent:"space-between",children:[D&&(0,S.jsx)(y.Z,{alignItems:"center",px:1,children:(0,S.jsx)(T.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return D(!o)},transparent:!0,children:o?(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(ie._M,{muted:!0,size:2*C.iI}),"\xa0",(0,S.jsx)(_.ZP,{default:!0,children:"Expand output"})]}):(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(ie.Kh,{muted:!0,size:2*C.iI}),Y&&(0,S.jsx)(O.Z,{ml:2,children:(0,S.jsx)(_.ZP,{children:"".concat(Y[0]," rows x ").concat(Y[1]," columns").concat(se)})})]})})}),(0,S.jsx)(_t,{children:(0,S.jsxs)(k.Z,{alignItems:"center",fullWidth:!0,justifyContent:"flex-end",children:[(0,S.jsx)(cn.Z,{appearAbove:!0,appearBefore:!0,block:!0,label:P>=1&&w?"Last run at ".concat(new Date(w.valueOf()).toLocaleString()):d?"Block executed with errors":"Block executed successfully",size:null,widthFitContent:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[P>=1&&Number(E)>Number(w)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(_.ZP,{small:!0,children:[(Number(E)-Number(w))/1e3,"s"]}),(0,S.jsx)(O.Z,{mr:1})]}),!d&&(0,S.jsx)(ie.Jr,{size:2*C.iI,success:!0}),d&&(0,S.jsx)(x.Z,{danger:!0,size:2*C.iI,children:(0,S.jsx)(_.ZP,{bold:!0,monospace:!0,small:!0,children:"!"})})]})}),!d&&!v.Qj.includes(U)&&(0,S.jsx)(O.Z,{pl:1,children:(0,S.jsx)(T.Z,{afterIcon:(0,S.jsx)(ie.M0,{muted:!0,size:1.75*C.iI}),basic:!0,noPadding:!0,onClick:function(){!function(e,n){var t=Ut(e);t.includes(n)||(0,F.t8)(Ft(e),[].concat((0,r.Z)(t),[n]))}(null===Z||void 0===Z?void 0:Z.uuid,n.uuid),null===g||void 0===g||g(oe.cH.DATA),null===R||void 0===R||R((function(e){return e.find((function(e){return e.uuid===n.uuid}))?e:(null===N||void 0===N||N(n),e.concat(n))}))},transparent:!0,children:(0,S.jsx)(_.ZP,{default:!0,children:"Expand table"})})})]})})]})]})]}):null},Yt="buckets",qt="chart_style",Qt="group_by",Kt="height",Vt="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_profile_target",di="dbt_project_name",fi="export_write_policy",pi="limit",hi="unique_upstream_table_name",mi="upstream_block_configuration",vi="table_name",bi="use_raw_sql",gi=[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"}(zt||(zt={}));var xi,ji,yi=[zt.BAR_CHART,zt.HISTOGRAM,zt.LINE_CHART,zt.PIE_CHART,zt.TABLE,zt.TIME_SERIES_BAR_CHART,zt.TIME_SERIES_LINE_CHART];!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(xi||(xi={})),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"}(ji||(ji={}));var ki,Zi,Oi,_i,Ci,Pi,Si,Ei,wi,Ii=[ji.AVERAGE,ji.COUNT,ji.COUNT_DISTINCT,ji.MAX,ji.MEDIAN,ji.MIN,ji.MODE,ji.SUM];!function(e){e.ASCENDING="ascending",e.DESCENDING="descending"}(ki||(ki={})),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"}(Zi||(Zi={})),function(e){e.COLUMNS="columns",e.METRICS="metrics",e.NUMBER="number"}(wi||(wi={}));var Ti={noCode:[{label:function(){return"time column"},settings:{maxValues:1},type:wi.COLUMNS,uuid:Qt},{label:function(){return"time interval"},options:[Zi.ORIGINAL,Zi.SECOND,Zi.MINUTE,Zi.HOUR,Zi.DAY,Zi.WEEK,Zi.MONTH,Zi.YEAR],uuid:ei},{label:function(){return"metrics"},type:wi.METRICS,uuid:$t}]},Ai=(Oi={},(0,o.Z)(Oi,zt.BAR_CHART,{noCode:[{label:function(){return"group by columns"},type:wi.COLUMNS,uuid:Qt},{label:function(){return"metrics"},type:wi.METRICS,uuid:$t},{autoRun:!0,label:function(){return"chart style"},options:[xi.HORIZONTAL,xi.VERTICAL],uuid:qt},{autoRun:!0,label:function(){return"sort direction"},options:[null,ki.ASCENDING,ki.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,o.Z)(Oi,zt.HISTOGRAM,{noCode:[{label:function(){return"number column for chart"},settings:{maxValues:1},type:wi.COLUMNS,uuid:Qt},{autoRun:!0,label:function(){return"Number of buckets"},type:wi.NUMBER,uuid:Yt}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:ti}]}),(0,o.Z)(Oi,zt.LINE_CHART,{noCode:[{label:function(){return"group by columns"},settings:{maxValues:1},type:wi.COLUMNS,uuid:Qt},{label:function(){return"metrics"},type:wi.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,o.Z)(Oi,zt.PIE_CHART,{noCode:[{label:function(){return"column for chart"},settings:{maxValues:1},type:wi.COLUMNS,uuid:Qt},{autoRun:!0,label:function(){return"Number of slices"},type:wi.NUMBER,uuid:Yt}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:ti}]}),(0,o.Z)(Oi,zt.TABLE,{noCode:[{label:function(){return"columns"},type:wi.COLUMNS,uuid:Qt},{label:function(){return"max number of rows"},type:wi.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,o.Z)(Oi,zt.TIME_SERIES_BAR_CHART,Ti),(0,o.Z)(Oi,zt.TIME_SERIES_LINE_CHART,Ti),Oi),Di=(_i={},(0,o.Z)(_i,zt.BAR_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,ti,"x"),(0,o.Z)(n,ii,"y"),(0,o.Z)(n,qt,xi.VERTICAL),n},content:function(e){return"columns = df_1.columns\nx = df_1.columns[:7]\ny = [[v] for v in [len(df_1[col].unique()) for col in x]]\n"}}),(0,o.Z)(_i,zt.HISTOGRAM,{configuration:function(e){var n;return n={},(0,o.Z)(n,Yt,10),(0,o.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,o.Z)(_i,zt.LINE_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,ti,"x"),(0,o.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,o.Z)(_i,zt.PIE_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,Yt,7),(0,o.Z)(n,ti,"x"),n},content:function(e){return"x = df_1[df_1.columns[0]]"}}),(0,o.Z)(_i,zt.TABLE,{configuration:function(e){var n;return n={},(0,o.Z)(n,Jt,10),(0,o.Z)(n,ti,"x"),(0,o.Z)(n,ii,"y"),n},content:function(e){return"x = df_1.columns\ny = df_1.to_numpy()"}}),(0,o.Z)(_i,zt.TIME_SERIES_BAR_CHART,{configuration:function(e){return(0,o.Z)({},ei,Zi.ORIGINAL)}}),(0,o.Z)(_i,zt.TIME_SERIES_LINE_CHART,{configuration:function(e){return(0,o.Z)({},ei,Zi.ORIGINAL)}}),_i),Ri=(Ei={},(0,o.Z)(Ei,zt.BAR_CHART,(Ci={},(0,o.Z)(Ci,ti,(function(){return"must be a list of booleans, dates, integers, floats, or strings."})),(0,o.Z)(Ci,ii,(function(){return"must be a list of lists containing integers or floats."})),Ci)),(0,o.Z)(Ei,zt.HISTOGRAM,(0,o.Z)({},ti,(function(){return"must be a list of integers or floats."}))),(0,o.Z)(Ei,zt.LINE_CHART,(Pi={},(0,o.Z)(Pi,ti,(function(){return"must be a list of integers or floats."})),(0,o.Z)(Pi,ii,(function(){return"must be a list of lists containing integers or floats. Each list is a single line in the chart."})),Pi)),(0,o.Z)(Ei,zt.PIE_CHART,(0,o.Z)({},ti,(function(){return"must be a list of booleans, dates, integers, floats, or strings."}))),(0,o.Z)(Ei,zt.TABLE,(Si={},(0,o.Z)(Si,ti,(function(){return"must be a list of strings."})),(0,o.Z)(Si,ii,(function(){return"must be a list of lists containing booleans, dates, integers, floats, or strings."})),Si)),Ei),Mi=[{label:function(){return"% of missing values"},widgetTemplate:function(e){var n,t=e.block;return{name:"missing values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,ti,"columns_with_mising_values"),(0,o.Z)(n,ii,"percentage_of_missing_values"),(0,o.Z)(n,qt,xi.HORIZONTAL),(0,o.Z)(n,ri,ki.DESCENDING),(0,o.Z)(n,"chart_type",zt.BAR_CHART),n),content:"number_of_rows = len(df_1.index)\ncolumns_with_mising_values = []\npercentage_of_missing_values = []\nfor col in df_1.columns:\n missing = df_1[col].isna().sum()\n if missing > 0:\n columns_with_mising_values.append(col)\n percentage_of_missing_values.append(100 * missing / number_of_rows)\n"}}},{label:function(){return"Unique values"},widgetTemplate:function(e){var n,t=e.block;return{name:"unique values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,ti,"columns"),(0,o.Z)(n,ii,"number_of_unique_values"),(0,o.Z)(n,qt,xi.HORIZONTAL),(0,o.Z)(n,ri,ki.DESCENDING),(0,o.Z)(n,"chart_type",zt.BAR_CHART),n),content:"columns = df_1.columns\nnumber_of_unique_values = [df_1[col].nunique() for col in columns]\n"}}},{label:function(){return"Most frequent values"},widgetTemplate:function(e){var n,t=e.block;return{name:"most frequent values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,Kt,3e3),(0,o.Z)(n,Vt,"column_index"),(0,o.Z)(n,ti,"columns"),(0,o.Z)(n,ii,"rows"),(0,o.Z)(n,"chart_type",zt.TABLE),n),content:"columns = ['mode value', 'frequency', '% of values']\n\ncolumn_index = []\nrows = []\nfor col in df_1.columns:\n value_counts = df_1[col].value_counts()\n if len(value_counts.index) == 0:\n continue\n column_value = value_counts.index[0]\n value = value_counts[column_value]\n number_of_rows = df_1[col].count()\n column_index.append(col)\n rows.append([\n column_value,\n f'{round(100 * value / number_of_rows, 2)}%',\n value,\n ])\n"}}},{label:function(){return"Summary overview"},widgetTemplate:function(e){var n,t=e.block;return{name:"summary overview for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,Kt,3e3),(0,o.Z)(n,Vt,"stats"),(0,o.Z)(n,ti,"headers"),(0,o.Z)(n,ii,"rows"),(0,o.Z)(n,"chart_type",zt.TABLE),n),content:"from mage_ai.data_cleaner.column_types.column_type_detector import infer_column_types\n\n\nheaders = ['value']\nstats = ['Columns', 'Rows']\nrows = [[len(df_1.columns)], [len(df_1.index)]]\n\ncol_counts = {}\nfor col, col_type in infer_column_types(df_1).items():\n col_type_name = col_type.value\n if not col_counts.get(col_type_name):\n col_counts[col_type_name] = 0\n col_counts[col_type_name] += 1\n\nfor col_type, count in sorted(col_counts.items()):\n stats.append(f'# of {col_type}')\n rows.append([count])\n"}}},{label:function(){return"Feature profiles"},widgetTemplate:function(e){var n,t=e.block;return{name:"feature profiles for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,Kt,3e3),(0,o.Z)(n,Vt,"stats"),(0,o.Z)(n,ti,"columns"),(0,o.Z)(n,ii,"rows"),(0,o.Z)(n,"chart_type",zt.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 Ni(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Bi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ni(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ni(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Li=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 yi.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=Di[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,ce.vg)(e)},onClick:function(){return n(Bi(Bi({},o),{},{name:"".concat(s," ").concat((0,ce.Mp)()),configuration:Bi(Bi({},o.configuration),c),content:u}),{onCreateCallback:function(e){t&&v.t6.SQL!==t.language&&([v.DA.EXECUTED,v.DA.UPDATED].includes(t.status)?null===a||void 0===a||a({block:e,code:u,disableReset:!0}):null===a||void 0===a||a({block:t,runDownstream:!0}))}})},uuid:e}}))}),[yi,t,a]),p=(0,s.useMemo)((function(){return Mi.map((function(e){var i=e.label,r=Bi(Bi({},(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)?null===a||void 0===a||a({block:e,code:e.content,disableReset:!0}):null===a||void 0===a||a({block:t,runDownstream:!0}))}})},uuid:i()}}))}),[Mi,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,S.jsx)(Q.Z,{items:h,left:i,onClickCallback:l,open:c,parentRef:u,rightOffset:o,topOffset:d,uuid:"CommandButtons/add_charts",width:25*C.iI})},Fi=t(40656),Ui=b.default.svg.withConfig({displayName:"Convert__SVGStyle",componentId:"sc-fmw0vr-0"})([""]),Hi=function(e){var n=e.fill,t=e.opacity,i=e.size,r=void 0===i?Fi.C:i,o=e.style,l=e.viewBox,c=void 0===l?"0 0 12 12":l;return(0,S.jsxs)(Ui,{fill:n,height:r,opacity:t,style:o,viewBox:c,width:r,children:[(0,S.jsx)("path",{clipRule:"evenodd",d:"M2.5 1C1.67157 1 1 1.67157 1 2.5v.0625c0 .27614-.223858.5-.5.5s-.5-.22386-.5-.5V2.5C0 1.11929 1.11929 0 2.5 0h7C10.8807 0 12 1.11929 12 2.5v7c0 1.3807-1.1193 2.5-2.5 2.5h-7C1.11929 12 0 10.8807 0 9.5v-.0625c0-.27614.223858-.5.5-.5s.5.22386.5.5V9.5c0 .8284.67157 1.5 1.5 1.5h7c.8284 0 1.5-.6716 1.5-1.5v-7c0-.82843-.6716-1.5-1.5-1.5h-7z",fill:"url(#paint0_linear_1332_60037)",fillRule:"evenodd"}),(0,S.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.05806 3.55806c.24408-.24408.6398-.24408.88388 0l2 2c.24408.24408.24408.6398 0 .88388l-2 2c-.24408.24408-.6398.24408-.88388 0-.24408-.24408-.24408-.6398 0-.88388l.93306-.93306H1C.654822 6.625.375 6.34518.375 6s.279822-.625.625-.625h5.99112l-.93306-.93306c-.24408-.24408-.24408-.6398 0-.88388z",fill:"#fff"}),(0,S.jsx)("defs",{children:(0,S.jsxs)("linearGradient",{id:"paint0_linear_1332_60037",x1:"-.618557",y1:"-.000001",x2:"10.5709",y2:".83113",gradientUnits:"userSpaceOnUse",children:[(0,S.jsx)("stop",{stopColor:"#FFCC19"}),(0,S.jsx)("stop",{offset:".585938",stopColor:"#2ECDF7"}),(0,S.jsx)("stop",{offset:"1",stopColor:"#9E7BFF"})]})})]})},Gi=t(79749),zi=t(54283),Wi=t(75968);function Yi(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?Yi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Yi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Qi,Ki=function(e){var n=e.addNewBlock,t=e.addWidget,i=e.block,r=e.blocks,o=e.deleteBlock,c=e.executionState,u=e.fetchFileTree,a=e.fetchPipeline,f=e.interruptKernel,p=e.isEditingBlock,h=e.pipeline,m=e.runBlock,g=e.setIsEditingBlock,j=e.savePipelineContent,y=e.setErrors,Z=e.setOutputCollapsed,E=i.all_upstream_blocks_executed,w=void 0===E||E,I=i.color,A=i.type,D=i.uuid,R=(0,s.useRef)(null),N=(0,s.useRef)(null),L=(0,s.useRef)(null),F=(0,s.useRef)(null),U=null===h||void 0===h?void 0:h.type,H=(0,s.useState)(!1),G=H[0],z=H[1],W=(0,s.useState)(!1),Y=W[0],q=W[1],K=(0,s.useState)(!1),V=K[0],X=K[1],J=(0,s.useState)(!1),$=J[0],ee=J[1],ne=(0,s.useContext)(b.ThemeContext),te=_n.uF.IDLE!==c,re=(0,P.qn)(A,{blockColor:I,theme:ne}).accent,oe=(0,s.useMemo)((function(){return U===M.qL.STREAMING}),[U]),le=(0,s.useMemo)((function(){return U===M.qL.INTEGRATION}),[U]),ce=(0,s.useMemo)((function(){return(0,Wi.Ts)(i,r,"CommandButtons",n).map((function(e){return qi(qi({},e),{},{onClick:function(){return j().then((function(){return e.onClick()}))}})}))}),[n,i,r,j]),ue=(0,s.useMemo)((function(){return(0,pe.HK)(r,(function(e){return e.uuid}))}),[r]),ae=(0,s.useMemo)((function(){return v.tf.DBT===(null===i||void 0===i?void 0:i.type)}),[i]),se=(0,s.useMemo)((function(){return v.tf.MARKDOWN===(null===i||void 0===i?void 0:i.type)}),[i]),de=(0,d.Db)(ge.ZP.pipelines.useUpdate(null===h||void 0===h?void 0:h.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){a()},onErrorCallback:function(e,n){return y({errors:n,response:e})}})}}),fe=(0,l.Z)(de,2),he=fe[0];return fe[1].isLoading,(0,S.jsxs)(k.Z,{alignItems:"center",children:[_n.uF.QUEUED===c&&(0,S.jsx)(zi.Z,{color:(ne||Ce.Z).content.active,type:"cylon"}),_n.uF.BUSY===c&&(0,S.jsx)(zi.Z,{color:(ne||Ce.Z).content.active}),m&&!te&&!oe&&(0,S.jsxs)(S.Fragment,{children:[!ae&&(0,S.jsx)(cn.Z,{appearBefore:!0,default:!0,label:(0,S.jsxs)(_.ZP,{children:["Run block \xa0 \xa0",(0,S.jsx)(Gi.Z,{inline:!0,keyTextGroups:[[tn()?B.RJ:B.hE,B.Lz]],monospace:!0,uuidForKey:D})]}),size:3*C.iI,widthFitContent:!0,children:(0,S.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){w?m({block:i}):X(!0)},children:(0,S.jsx)(x.Z,{color:re,size:3*C.iI,children:(0,S.jsx)(ie.Py,{black:!0,size:1.5*C.iI})})})}),ae&&(0,S.jsx)(T.Z,{backgroundColor:re,beforeIcon:(0,S.jsx)(ie.Py,{size:1.5*C.iI}),compact:!0,onClick:function(){w?m({block:i}):X(!0)},small:!0,children:"Compile & preview"}),(0,S.jsx)($e.Z,{disableEscape:!0,onClickOutside:function(){return X(!1)},open:V,children:(0,S.jsx)(Q.Z,{items:[{label:function(){return"Execute block"},onClick:function(){return m({block:i})},uuid:"execute_block"},{label:function(){return"Execute with upstream blocks"},onClick:function(){return m({block:i,runUpstream:!0})},uuid:"execute_upstream"}],onClickCallback:function(){return X(!1)},open:V,parentRef:L,rightOffset:13.25*C.iI,topOffset:4.5*C.iI,uuid:"execute_actions",width:25*C.iI})})]}),te&&(0,S.jsx)(O.Z,{ml:C.cd,children:(0,S.jsx)(cn.Z,{appearBefore:!0,default:!0,label:(0,S.jsxs)(_.ZP,{children:["Interrupt kernel \xa0 \xa0",(0,S.jsx)(Gi.Z,{inline:!0,keyTextGroups:[[B.kA],[B.kA]],monospace:!0,uuidForKey:D})]}),size:Dt,widthFitContent:!0,children:(0,S.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return f()},children:(0,S.jsx)(x.Z,{borderSize:1.5,size:Dt,children:(0,S.jsx)(ie.x8,{size:1*C.iI})})})})}),v.tf.SCRATCHPAD===i.type&&!oe&&(0,S.jsx)(O.Z,{ml:C.cd,children:(0,S.jsx)(Mn.Z,{items:ce,onClickCallback:function(){return q(!1)},onClickOutside:function(){return q(!1)},open:Y,parentRef:N,rightOffset:0,topOffset:4,uuid:"CommandButtons/convert_block",children:(0,S.jsx)(cn.Z,{appearBefore:!0,default:!0,label:(0,S.jsx)(_.ZP,{children:"Convert block"}),size:Dt,widthFitContent:!0,children:(0,S.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return q(!Y)},ref:N,children:(0,S.jsx)(Hi,{size:Dt})})})})}),[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(i.type)&&!oe&&!le&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{ml:C.cd,ref:R,children:(0,S.jsx)(cn.Z,{appearBefore:!0,default:!0,label:"Add chart",size:2.25*C.iI,widthFitContent:!0,children:(0,S.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return z((function(e){return!e}))},children:(0,S.jsx)(ie.GQ,{size:2.25*C.iI})})})}),t&&(0,S.jsx)($e.Z,{disableEscape:!0,onClickOutside:function(){return z(!1)},open:G,children:(0,S.jsx)(Li,{addWidget:t,block:i,onClickCallback:function(){return z(!1)},open:G,parentRef:R,rightOffset:9*C.iI,runBlock:m,topOffset:2*C.iI})})]}),se&&(0,S.jsx)(O.Z,{ml:C.cd,children:(0,S.jsx)(cn.Z,{appearBefore:!0,default:!0,label:p?"Close editor":"Edit",size:Dt,widthFitContent:!0,children:(0,S.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return g((function(e){return!e}))},children:p?(0,S.jsx)(ie.Jr,{size:Dt,success:!0}):(0,S.jsx)(ie.I8,{size:Dt})})})}),(0,S.jsx)("div",{ref:F,children:(0,S.jsx)(O.Z,{ml:C.cd,children:(0,S.jsx)(cn.Z,{appearBefore:!0,default:!0,label:(0,S.jsx)(_.ZP,{children:"More actions"}),size:Dt,widthFitContent:!0,children:(0,S.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return ee((function(e){return!e}))},children:(0,S.jsx)(x.Z,{borderSize:1.5,size:Dt,children:(0,S.jsx)(ie.mH,{size:C.iI})})})})})}),(0,S.jsx)($e.Z,{disableEscape:!0,onClickOutside:function(){return ee(!1)},open:$,children:(0,S.jsx)(Q.Z,{items:(0,Wi.J8)(i,m,o,Z,oe||le,{blocksMapping:ue,fetchFileTree:u,fetchPipeline:a,savePipelineContent:j,updatePipeline:he}),onClickCallback:function(){return ee(!1)},open:$,parentRef:F,rightOffset:4.75*C.iI,topOffset:2*C.iI,uuid:"FileHeaderMenu/file_items"})})]})};!function(e){e.APPEND="append",e.FAIL="fail",e.REPLACE="replace"}(Qi||(Qi={}));var Vi,Xi=[Qi.APPEND,Qi.FAIL,Qi.REPLACE];!function(e){e.BIGQUERY="bigquery",e.CLICKHOUSE="clickhouse",e.DRUID="druid",e.MYSQL="mysql",e.POSTGRES="postgres",e.REDSHIFT="redshift",e.SNOWFLAKE="snowflake",e.TRINO="trino"}(Vi||(Vi={}));var Ji=["bold","defaultColor","description","disableWordBreak","fullWidth","inputValue","inputWidth","invertedTheme","label","labelColor","menuOpen","monospace","muted","onClick","notRequired","selectedTextProps","small","stacked","suffixValue","tooltipProps","value"];function $i(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?$i(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var nr=b.default.div.withConfig({displayName:"LabelWithValueClicker__LabelStyle",componentId:"sc-1hzpn4h-0"})(["margin-bottom:","px;"],.25*C.iI),tr=b.default.div.withConfig({displayName:"LabelWithValueClicker__DescriptionStyle",componentId:"sc-1hzpn4h-1"})([""]);var ir=function(e){var n=e.bold,t=void 0===n||n,i=e.defaultColor,r=e.description,o=e.disableWordBreak,l=e.fullWidth,c=e.inputValue,u=e.inputWidth,a=e.invertedTheme,d=e.label,f=e.labelColor,p=e.menuOpen,h=void 0!==p&&p,m=e.monospace,v=e.muted,b=e.onClick,g=e.notRequired,x=e.selectedTextProps,j=e.small,C=e.stacked,P=e.suffixValue,E=e.tooltipProps,w=e.value,I=(0,q.Z)(e,Ji),T=(0,s.useRef)(null),A=(0,s.useState)(!1),D=A[0],R=A[1],M=(0,s.useState)(!1),B=M[0],L=M[1],F=d&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_.ZP,{bold:t,color:f,inverted:a,lineHeight:20,monospace:m,muted:v,small:j,children:d}),E&&(0,S.jsx)(O.Z,{ml:1,children:(0,S.jsx)(cn.Z,er({muted:!0},E))})]}),U=(0,S.jsxs)(y.Z,{flex:l?"1":"none",children:[w&&(0,S.jsx)(Z.Z,{block:!0,danger:null===x||void 0===x?void 0:x.danger,fullWidth:!0,muted:v,onClick:function(){b(),T.current&&T.current.focus(),R(!0)},preventDefault:!0,sameColorAsText:v||!(null!==x&&void 0!==x&&x.primary)&&!(null!==x&&void 0!==x&&x.danger)&&!(null!==x&&void 0!==x&&x.warning),underline:null===x||void 0===x?void 0:x.underline,warning:null===x||void 0===x?void 0:x.warning,children:(0,S.jsx)(_.ZP,er(er({inverted:a,muted:v},x),{},{disableWordBreak:o,monospace:m,small:j,width:u,children:w}))}),(0,S.jsx)(N.Z,er(er({},I),{},{basic:!0,defaultColor:i,fullWidth:l,invertedTheme:a,monospace:m,onBlur:function(e){R(!1),I.onBlur&&I.onBlur(e),B||L(!0)},onFocus:function(e){R(!0),I.onFocus&&I.onFocus(e)},ref:T,small:j,value:c,visible:!w}))]}),H=r&&(0,S.jsx)(tr,{children:(0,S.jsx)(_.ZP,{dangerouslySetInnerHTML:{__html:r},monospace:m,muted:!0,small:j})}),G=(0,s.useMemo)((function(){return(0,S.jsx)(_.ZP,{default:!0,small:j,children:P})}),[j,P]);return(0,S.jsxs)(S.Fragment,{children:[C&&(0,S.jsxs)(S.Fragment,{children:[F&&(0,S.jsxs)(nr,{children:[(0,S.jsx)(k.Z,{alignItems:"center",fullHeight:!1,fullWidth:!0,children:F}),H]}),(0,S.jsxs)(k.Z,{fullWidth:l,children:[U,P&&G]})]}),!C&&(0,S.jsxs)(k.Z,{alignItems:"center",fullWidth:!0,children:[F&&(0,S.jsxs)(S.Fragment,{children:[F,(0,S.jsx)(O.Z,{ml:1})]}),U,P&&G]}),B&&!D&&!w&&!h&&!g&&(0,S.jsx)(_.ZP,{danger:!0,small:j,children:"This field is required."})]})},rr=t(68792),or=t(5882),lr=t(87372),cr=t(2005),ur=t(31012),ar="0.75em",sr=b.default.div.withConfig({displayName:"indexstyle__MarkdownContainer",componentId:"sc-j72mol-0"})(["font-family:",";margin:0 ","px;overflow:auto;"," "," p{margin:0.5em 0;}blockquote{margin:"," 0;padding:","px 0;","}blockquote:before{content:'';font-size:","px;line-height:0.1em;margin-right:0.25em;vertical-align:-0.4em;}blockquote p{display:inline;}pre{border-radius:","px;white-space:pre;margin:"," 0;padding:","px;overflow-x:auto;"," "," span{padding:0;}}ul,ol{margin-bottom:",";padding-left:","px;}li{","}li > input[type='checkbox']{pointer-events:none;}table{"," margin:",";thead{font-family:",";","}th,td{padding:","px ","px;","}}"],cr.ry,C.iI,an.w5,(function(e){return"\n color: ".concat((e.theme||Ce.Z).content.active,";\n ")}),ar,C.iI,(function(e){return"\n border-left: ".concat(.5*C.iI,"px solid ").concat((e.theme||Ce.Z).content.active,";\n ")}),3*C.l4,Pe.BG,ar,C.iI,an.w5,(function(e){return"\n background-color: ".concat((e.theme||Ce.Z).interactive.defaultBorder,";\n ")}),ar,3*C.iI,ur.iD,ur.iD,ar,cr.nF,(function(e){return"\n border-bottom: ".concat(Pe.YF,"px solid ").concat((e.theme||Ce.Z).content.active,";\n ")}),.5*C.iI,.75*C.iI,(function(e){return"\n border: ".concat(Pe.YF,"px solid ").concat((e.theme||Ce.Z).content.muted,";\n ")}));var dr=function(e){var n=e.children;return(0,S.jsx)(sr,{children:(0,S.jsx)(rr.D,{components:{a:function(e){var n=e.children,t=e.href;return(0,S.jsx)(Z.Z,{href:t,inline:!0,openNewWindow:!0,primary:!0,children:n})},code:function(e){var n=e.children;return(0,S.jsx)(_.ZP,{backgroundColor:Ce.Z.interactive.defaultBorder,inline:!0,monospace:!0,pre:!0,style:{fontSize:"13px"},children:n})},em:function(e){var n=e.children;return(0,S.jsx)(_.ZP,{inline:!0,italic:!0,children:n})},h1:function(e){var n=e.children;return(0,S.jsx)(lr.Z,{level:1,children:n})},h2:function(e){var n=e.children;return(0,S.jsx)(lr.Z,{level:2,children:n})},h3:function(e){var n=e.children;return(0,S.jsx)(lr.Z,{level:3,children:n})},h4:function(e){var n=e.children;return(0,S.jsx)(lr.Z,{level:4,children:n})},h5:function(e){var n=e.children;return(0,S.jsx)(lr.Z,{level:5,children:n})},p:function(e){var n=e.children;return(0,S.jsx)(_.ZP,{children:n})},strong:function(e){var n=e.children;return(0,S.jsx)(_.ZP,{bold:!0,inline:!0,children:n})}},remarkPlugins:[or.Z],children:n})})},fr=t(55378),pr=t(66653);function hr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function mr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?hr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):hr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var vr,br=function(e){var n=e.block,t=e.blockConfiguration,i=e.blockRefs,r=e.blocks,l=e.updateBlockConfiguration,c=(0,s.useContext)(b.ThemeContext),u=v.t6.R===(null===n||void 0===n?void 0:n.language),a=v.t6.SQL===(null===n||void 0===n?void 0:n.language),d=null===r||void 0===r?void 0:r.find((function(e){var n=e.language;return v.t6.PYTHON===n})),f=(0,s.useMemo)((function(){var e=[null];return a&&d?e.push.apply(e,[null,1]):e.push(1),e}),[d,a]),p=(0,s.useMemo)((function(){var e=[{tooltipMessage:null,uuid:"Variable"},{tooltipMessage:null,uuid:"Block"}];return a&&d&&e.push({tooltipMessage:"Customize the full table name that this block gets created in. Include database, schema, and table name where applicable.",uuid:"Table name"}),e}),[d,a]),h=(0,s.useMemo)((function(){return null===r||void 0===r?void 0:r.map((function(e,n){var r,s=e.color,f=e.language,p=e.type,h=e.uuid,m=(0,P.qn)(p,{blockColor:s,theme:c}).accent,b=v.t6.PYTHON===f;r=a?"{{ df_".concat(n+1," }}"):u?"df".concat(n+1):"data".concat(n>=1?"_".concat(n+1):null);var g=[(0,S.jsx)(_.ZP,{default:!0,monospace:!0,small:!0,children:r},"variable-".concat(h)),(0,S.jsx)(Z.Z,{color:m,onClick:function(){var e,n,t=null===i||void 0===i||null===(e=i.current)||void 0===e?void 0:e["".concat(p,"s/").concat(h,".py")];null===t||void 0===t||null===(n=t.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,S.jsx)(_.ZP,{color:m,monospace:!0,small:!0,children:h})},"block-".concat(h))];if(a){var x="table-name-input-".concat(h),j=(null===t||void 0===t?void 0:t.upstream_block_configuration)||{},y=(null===j||void 0===j?void 0:j[h])||{};b?g.push((0,S.jsx)(N.Z,{borderless:!0,compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;l((0,o.Z)({},mi,mr(mr({},j),{},(0,o.Z)({},h,mr(mr({},y),{},(0,o.Z)({},vi,n))))))},onClick:pr.j,placeholder:"[database_optional].[schema_optional].[table]",small:!0,value:(null===y||void 0===y?void 0:y.table_name)||""},x)):d&&g.push((0,S.jsx)(_.ZP,{italic:!0,muted:!0,small:!0,children:"Table name is defined in upstream block."},x))}return g}))}),[d,t,i,r,u,a,c,l]);return(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(_e.Z,{columnFlex:f,columns:p,compact:!0,noBorder:!0,rows:h,uuid:"CodeBlock/UpstreamBlockSettings/".concat(null===n||void 0===n?void 0:n.uuid)})})};!function(e){e.DATA_EXPORTER="data_exporter",e.DATA_LOADER="data_loader",e.MAGE_LIBRARY="mage_library",e.TRANSFORMER="transformer",e.USER_LIBRARY="user_library"}(vr||(vr={}));var gr=t(5677);function xr(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 jr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?xr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):xr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function yr(e,n){var t=e;t.includes("__init__")||t.push("__init__");var i,r=t.length;return(0,pe.w6)(r).forEach((function(e,o){if(i)return i;var l=t.slice(0,r-o).join(le.sep);i=n["".concat(l,".py")]})),i}function kr(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 Zr(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 Or(e){var n=e.autocompleteItems,t=e.block,i=e.blocks,o=e.pipeline,c=t.type,u=t.upstream_blocks,a=(0,pe.HK)(n,(function(e){return e.id}));return function(t){return function(s,d){var f=[],p=s.getValueInRange({endColumn:d.column,endLineNumber:d.lineNumber,startColumn:1,startLineNumber:1}),h=s.getWordUntilPosition(d),m=h.endColumn,b=h.startColumn,g={endColumn:m,endLineNumber:d.lineNumber,startColumn:b,startLineNumber:d.lineNumber},x=function(e,n,t){var i=(0,gr.Yn)(e),r=(0,gr.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,gr.S0)(e)[l];if(c){var u,a=yr(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,gr.rW)(c,l);return null===a||void 0===a||null===(u=a.methods_for_class)||void 0===u?void 0:u[s]}}return[]}(p,g,a);if((null===x||void 0===x?void 0:x.length)>=1){var j=Zr(h,x.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Method,label:e,range:g}})));if(j.length>=1)return{suggestions:j}}var y=function(e,n,t){var i=(0,gr.M4)(e,n);if(i=i.match(/([\w_]+)./)){var r=(0,gr.S0)(e)[i[1]];if(r){var o=yr(r.split(" as ")[0].replace("from ","").replace("import ","").split(" ").reduce((function(e,n){return n.trim()?e.concat(n):e}),[]).join(".").split("."),t);if(null!==o&&void 0!==o&&o.functions)return null===o||void 0===o?void 0:o.functions}}return[]}(p,g,a);if((null===y||void 0===y?void 0:y.length)>=1){var k=Zr(h,y.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Function,label:e,range:g}})));if(k.length>=1)return{suggestions:k}}if((null===u||void 0===u?void 0:u.length)>=1){var Z=new RegExp("\n@".concat(c));p.match(Z)&&f.push.apply(f,(0,r.Z)(Zr(h,function(e,n,t){var i=t.block,r=t.blocks,o=i.upstream_blocks,l=(0,pe.HK)(r,(function(e){return e.uuid}));return o.map((function(t,i){var r=l[t].type,o=0===i?"output_0":"args[".concat(i-1,"]");return{label:"df ".concat(t," ").concat(r," block"),kind:e.languages.CompletionItemKind.Variable,documentation:"Variable for ".concat(r," ").concat(t," data."),insertText:o,range:n}}))}(t,g,e))))}if(h.word.match(/i|f/)){var O=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,t=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,o=(arguments.length>2?arguments[2]:void 0).word,c=new Set,u={};e.forEach((function(e){var n=e.group,t=e.id,i=e.imports;if([vr.MAGE_LIBRARY,vr.USER_LIBRARY].includes(n)){var r=t;r.match(/__init__.py/)&&(r=r.replace(/\/__init__.py/,"")),r=r.split(".py")[0].replaceAll(le.sep,"."),u[r]=e}var o=t.replace(".py","").replace("/__init__","").split(le.sep);if(1===o.length)c.add("import ".concat(o[0]));else if(o.length>=2){var l=o.slice(0,o.length-1).join(".");c.add("from ".concat(l," import ").concat(o[o.length-1]))}i.forEach((function(e){return c.add(e)}))}));var a,s="i"===o,d="f"===o,f=s?"import":d?"from":"",p=(0,gr.M4)(n,i);if(s&&p.match(/from/)&&(a=p.match(/from ([A-Za-z0-9_.]+) /)[1]),a&&u[a]){var h=u[a],m=h.classes,v=h.constants,b=h.files,g=h.functions,x=[];return[[v,t.languages.CompletionItemKind.Constant],[m,t.languages.CompletionItemKind.Class],[g,t.languages.CompletionItemKind.Function]].forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],r=n[1];t.forEach((function(e){x.push({filterText:"import ".concat(e),insertText:"import ".concat(e),kind:r,label:e,range:i})}))})),b.forEach((function(e){var n=e.split(le.sep),r=n[n.length-1].split(".py")[0];x.push({filterText:"import ".concat(r),insertText:"import ".concat(r),kind:t.languages.CompletionItemKind.Variable,label:r,range:i})})),x}return(0,r.Z)(c).map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.File,label:e,range:i}})).concat(Object.entries(u).map((function(e){var n=(0,l.Z)(e,2),r=n[0];return n[1],{filterText:"".concat(f," ").concat(r),insertText:"".concat(f," ").concat(r," "),kind:t.languages.CompletionItemKind.File,label:"".concat(r),range:jr({},i)}})))}(n,p,h,t,g,e);f.push.apply(f,(0,r.Z)(O))}if(v.tf.CHART===c||v.tf.SCRATCHPAD===c){var _=[];if(v.tf.CHART===c?u.forEach((function(e,n){_.push({block:i.find((function(n){var t=n.uuid;return e===t})),matchIndex:0,variableName:"df_".concat(n+1)})})):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,o).forEach((function(e){var n=e.block,t=e.regex,i=p.matchAll(t);(0,r.Z)(i).forEach((function(e){var t=null===e||void 0===e?void 0:e.index,i=null===e||void 0===e?void 0:e[1];i&&_.push({block:n,matchIndex:t,variableName:i})}))})),_.length>=1){var C,P=null===(C=p.split("\n")[d.lineNumber-1])||void 0===C?void 0:C.slice(0,h.startColumn-1);if(P){var S=[];if(_.forEach((function(e){var n=e.block,i=e.matchIndex,r=e.variableName,o=new RegExp("".concat(r,"\\["));P.match(o)&&S.push({items:kr(t,g,n),matchIndex:i})})),S.length>=1)return{suggestions:Zr(h,(0,pe.YC)(S,"matchIndex",{ascending:!1})[0].items)}}}1===b&&(v.tf.CHART===c?f.push.apply(f,(0,r.Z)(Zr(h,u.map((function(e,n){var i="df_".concat(n+1);return{label:"".concat(i," ").concat(e," block"),kind:t.languages.CompletionItemKind.Snippet,insertText:i,range:g}}))))):v.tf.SCRATCHPAD===c&&f.push.apply(f,(0,r.Z)(Zr(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,g,e)))))}var E=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 E.add(e[1])}))}));var w=(0,r.Z)(E);if(w.length){var I=w.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Variable,label:e,range:g}}));f.push.apply(f,(0,r.Z)(Zr(h,I)))}return{suggestions:f}}}}var _r=t(32365),Cr=t(80636),Pr=t(25958),Sr=t(87323);function Er(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 wr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Er(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Er(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Ir(e,n){var t,i,c=e.addNewBlock,u=e.addNewBlockMenuOpenIdx,a=e.addWidget,f=e.allBlocks,p=e.allowCodeBlockShortcuts,h=e.autocompleteItems,m=e.block,E=e.blockIdx,w=e.blockRefs,I=e.blockTemplates,D=e.blocks,R=e.dataProviders,L=e.defaultValue,H=void 0===L?"":L,G=e.deleteBlock,z=e.disableShortcuts,W=e.executionState,Y=e.extraContent,q=e.fetchFileTree,Q=e.fetchPipeline,K=e.height,V=e.hideRunButton,X=e.interruptKernel,J=e.mainContainerRef,$=e.mainContainerWidth,ee=e.messages,ne=void 0===ee?[]:ee,te=e.noDivider,re=e.onCallbackChange,oe=e.onChange,le=e.onClickAddSingleDBTModel,ue=e.onDrop,ae=e.openSidekickView,se=e.pipeline,de=e.runBlock,fe=e.runningBlocks,he=e.savePipelineContent,me=e.selected,ve=e.setAddNewBlockMenuOpenIdx,be=e.setAnyInputFocused,ye=e.setCreatingNewDBTModel,ke=e.setEditingBlock,Ze=e.setErrors,Oe=e.setOutputBlocks,_e=e.setSelected,Ce=e.setSelectedOutputBlock,Pe=e.setTextareaFocused,Se=e.textareaFocused,Ee=e.widgets,we=(0,s.useContext)(b.ThemeContext),Ie=m||{},Te=Ie.callback_content,Ae=Ie.configuration,De=void 0===Ae?{}:Ae,Re=Ie.color,Me=Ie.error,Ne=Ie.has_callback,Be=Ie.language,Le=Ie.type,Fe=Ie.upstream_blocks,Ue=void 0===Fe?[]:Fe,He=Ie.uuid,Ge=(0,s.useMemo)((function(){return De}),[De]),ze=(0,s.useState)(!1),We=ze[0],qe=ze[1],Ke=(0,s.useState)(null),Ve=Ke[0],Xe=Ke[1],Je=(0,s.useState)(!1),$e=Je[0],en=Je[1],nn=(0,s.useState)(!1),tn=nn[0],rn=nn[1],on=(0,s.useState)(H),ln=on[0],un=on[1],an=(0,s.useState)(null),sn=an[0],dn=an[1],fn=se||{},pn=fn.type,hn=fn.uuid,mn=(0,s.useMemo)((function(){return M.qL.STREAMING===pn}),[pn]),vn=v.tf.DBT===Le,bn=v.t6.SQL===Be,gn=v.t6.R===Be,xn=v.tf.MARKDOWN===Le,jn=Ge.limit;bn&&void 0===jn&&(jn=1e3);var yn=(0,s.useState)(wr(wr({},Ge),{},(t={},(0,o.Z)(t,oi,Ge.data_provider),(0,o.Z)(t,li,Ge.data_provider_database),(0,o.Z)(t,ci,Ge.data_provider_profile),(0,o.Z)(t,ui,Ge.data_provider_schema),(0,o.Z)(t,ai,Ge.data_provider_table),(0,o.Z)(t,si,Ge.dbt_profile_target),(0,o.Z)(t,di,Ge.dbt_project_name),(0,o.Z)(t,fi,Ge.export_write_policy||Qi.APPEND),(0,o.Z)(t,pi,jn),(0,o.Z)(t,hi,Ge.unique_upstream_table_name),(0,o.Z)(t,bi,!!Ge.use_raw_sql),t))),Zn=yn[0],On=yn[1],Cn=(0,s.useState)(null),Pn=Cn[0],Sn=Cn[1],En=(0,s.useState)(xn),wn=En[0],In=En[1],Tn=(0,s.useState)(!1),An=Tn[0],Dn=Tn[1],Rn=(0,s.useState)(He),Nn=Rn[0],Bn=Rn[1],Ln=(0,s.useState)(!1),Fn=Ln[0],Un=Ln[1],Hn=(0,s.useState)(0),Gn=Hn[0],Wn=Hn[1],Yn=(0,s.useState)(null),qn=Yn[0],Qn=Yn[1],Kn=(0,s.useState)(null),Vn=Kn[0],Xn=Kn[1],Jn=(0,s.useState)(ne),$n=Jn[0],et=Jn[1],nt=(0,s.useState)(At[0]),tt=nt[0],it=nt[1],rt=(0,pt.c)((function(){return{collect:function(e){return{isDragging:!!e.isDragging()}},item:m,type:Rt}}),[m]),ot=(0,l.Z)(rt,2),lt=ot[0],ct=ot[1],st=(0,ht.L)((function(){return{accept:Rt,drop:function(e){return null===ue||void 0===ue?void 0:ue(m,e)}}}),[m]),dt=(0,l.Z)(st,2)[1],bt=(0,s.useMemo)((function(){var e;return(null===m||void 0===m||null===(e=m.metadata)||void 0===e?void 0:e.dbt)||{project:null,projects:{}}}),[m]),gt=(0,s.useMemo)((function(){return bt.projects||{}}),[bt]),xt=(0,s.useMemo)((function(){return bt.project||Zn.dbt_project_name}),[Zn,bt]),jt=(0,s.useMemo)((function(){return gt[xt]||{target:null,targets:[]}}),[xt,gt]),yt=(0,s.useMemo)((function(){return jt.targets||[]}),[jt]),kt=(0,s.useMemo)((function(){return Zn.dbt_profile_target}),[Zn]),Zt=(0,s.useState)(kt&&!(null!==yt&&void 0!==yt&&yt.includes(kt))),Ot=Zt[0],_t=Zt[1],Ct=(0,s.useState)(null),Pt=Ct[0],St=Ct[1];(0,s.useEffect)((function(){Te!==Pt&&St(Te)}),[Pt,Te]);var Et=(0,kn.Z)(m);(0,s.useEffect)((function(){if(JSON.stringify(m)!=JSON.stringify(Et)){var e,n=Bt([m]).messages,t=null===n||void 0===n||null===(e=n[Le])||void 0===e?void 0:e[He];(null===t||void 0===t?void 0:t.length)>=1&&et(t)}}),[m,Le,He,Et,et]);var Dt=(0,kn.Z)(ne);(0,s.useEffect)((function(){"undefined"!==typeof ne&&ne.length!==(null===Dt||void 0===Dt?void 0:Dt.length)&&et(ne)}),[ne,Dt,et]);var Mt=(0,s.useMemo)((function(){var e=new Set;return null===R||void 0===R||R.forEach((function(n){var t=n.profiles;e=new Set([].concat((0,r.Z)(e),(0,r.Z)(t)))})),(0,r.Z)(e)}),[R]),Nt=(0,s.useMemo)((function(){return"".concat(hn,"/").concat(He,"/codeCollapsed")}),[hn,He]),Lt=(0,s.useMemo)((function(){return"".concat(hn,"/").concat(He,"/outputCollapsed")}),[hn,He]);(0,s.useEffect)((function(){rn((0,F.U2)(Nt,!1)),Un((0,F.U2)(Lt,!1))}),[Nt,Lt]);var Ft=(0,s.useRef)(null),Ut=(0,s.useMemo)((function(){return(0,pe.HK)(D,(function(e){return e.uuid}))}),[D]),Ht=(0,s.useMemo)((function(){return!(null===Ee||void 0===Ee||!Ee.find((function(e){return e.upstream_blocks.includes(He)})))}),[He,Ee]),Gt=(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)}vn&&wt!==tt&&it(wt),de({block:t,code:i||ln,runDownstream:o||Ht,runSettings:l,runTests:u||!1,runUpstream:c||!1}),r||(Wn(1+Number(Gn)),Qn(null),Un(!1))}),[ln,Ht,vn,de,Gn,tt,Wn,Qn,it]),zt=!(null===fe||void 0===fe||!fe.find((function(e){return e.uuid===He})))||(null===$n||void 0===$n?void 0:$n.length)>=1&&W!==_n.uF.IDLE;(0,s.useEffect)((function(){zt&&Xn(Number(new Date))}),[zt,Xn]);var Yt=(0,kn.Z)(W);(0,s.useEffect)((function(){W===_n.uF.IDLE&&W!==Yt&&Qn(Number(new Date))}),[W,Yt,Qn]);var qt=(0,s.useCallback)((function(e){var n=e.editorRect.top,t=e.position.lineNumberTop;if(null!==J&&void 0!==J&&J.current){var i=J.current.getBoundingClientRect().height;if(n+t>i){var r=J.current.scrollTop+(t-i+n);J.current.scrollTo(0,r)}else if(t+n<_r.aU){var o=J.current.scrollTop+(t+n-_r.aU);J.current.scrollTo(0,o)}}}),[J]),Qt=(0,s.useMemo)((function(){return(null===Pn||void 0===Pn?void 0:Pn.length)>=0?Pn.map((function(e){return{data:e,execution_state:_n.uF.IDLE,type:_n.Gi.TEXT_PLAIN}})):$n.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[Pn,$n]),Kt=!!Qt.find((function(e){return e.error})),Vt=(0,P.qn)(Le,{blockColor:Re,theme:we}).accent,Xt=(null===Ue||void 0===Ue?void 0:Ue.length)||0,Jt=(0,Sr.cU)([m],D)[0],$t=Jt.dynamic,ei=Jt.dynamicUpstreamBlock,ni=Jt.reduceOutput,ti=Jt.reduceOutputUpstreamBlock,ii=(0,s.useMemo)((function(){return(0,Wi._o)({block:m,dynamic:$t,dynamicUpstreamBlock:ei,hasError:Kt,reduceOutput:ni,reduceOutputUpstreamBlock:ti,selected:me})}),[m,$t,ei,Kt,ni,ti,me]),ri=ii.borderColorShareProps,mi=ii.tags,vi=Qt.length>=1,gi=(0,s.useCallback)((function(){me||(null===be||void 0===be||be(!1),null===_e||void 0===_e||_e(!0))}),[me,be,_e]),xi=ge.ZP.blocks.pipelines.detail(hn,Tt.uuid===(null===tt||void 0===tt?void 0:tt.uuid)||It.uuid===(null===tt||void 0===tt?void 0:tt.uuid)?encodeURIComponent(He):null,{_format:"dbt"},{revalidateOnFocus:!0}),ji=xi.data,yi=xi.mutate,ki=(0,s.useMemo)((function(){var e;return(null===ji||void 0===ji||null===(e=ji.block)||void 0===e?void 0:e.metadata)||{}}),[ji]),Zi=(0,d.Db)(ge.ZP.blocks.pipelines.useUpdate(hn,He),{onError:function(e){var n=(0,je.qQ)(e).messages;Sn(n)},onSuccess:function(e){return(0,je.wD)(e,{callback:function(){Dn(!1),Q(),q(),un(ln)},onErrorCallback:function(e,n){return Ze({errors:n,response:e})}})}}),Oi=(0,l.Z)(Zi,1)[0],_i="CodeBlock/".concat(He),Ci=(0,Qe.y)(),Pi=Ci.registerOnKeyDown,Si=Ci.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){Si(_i)}}),[Si,_i]),Pi(_i,(function(e,n,t){z&&!p||(An&&String(t[0])===String(B.Uq)&&String(t[1])!==String(B.zX)?He===Nn?e.target.blur():Oi({block:wr(wr({},m),{},{name:Nn})}):me&&!V&&((0,U.y)([B.zX,B.Uq],n)||(0,U.y)([B.PQ,B.Uq],n)?Gt({block:m}):(0,U.y)([B.XR,B.Uq],n)&&c&&(e.preventDefault(),c({language:Be,type:Le,upstream_blocks:[He]}),Gt({block:m}))))}),[c,m,V,An,Nn,Gt,me,Oi]),(0,s.useEffect)((function(){var e;return Vn&&(e=setInterval((function(){return dn(Number(new Date))}),1e3)),sn&&!zt&&clearInterval(e),function(){return clearInterval(e)}}),[sn,zt,Vn]);var Ei=(0,s.useCallback)((function(e){return(0,o.Z)({},v.tf.SCRATCHPAD,(0,r.Z)((0,Wi.Ts)(e,D,"block_menu/scratchpad",c)).map((function(e){return wr(wr({},e),{},{onClick:function(){return he().then((function(){return e.onClick()}))}})})))[e.type]}),[c,D,he]),wi=(0,s.useMemo)((function(){return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Ye.Z,{autoHeight:!0,autocompleteProviders:Ve,block:m,height:K,language:Be,onChange:function(e){un(e),null===oe||void 0===oe||oe(e)},onDidChangeCursorPosition:qt,placeholder:v.tf.DBT===Le&&v.t6.YAML===Be?"e.g. --select ".concat(xt||"project","/models --exclude ").concat(xt||"project","/models/some_dir"):"Start typing here...",selected:me,setSelected:_e,setTextareaFocused:Pe,shortcuts:[function(e,n){return(0,Cr.Q)(e,(function(){V||Gt({block:m,code:n.getValue()})}))}],textareaFocused:Se,value:ln,width:"100%"}),Ne&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(j.Z,{}),(0,S.jsxs)(O.Z,{mt:1,children:[(0,S.jsxs)(P.y9,{normalPadding:!0,children:[(0,S.jsx)(_.ZP,{small:!0,children:"Callback block: define @on_success or @on_failure callbacks for this block."}),(0,S.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["kwargs",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:" \u2192 "}),"global variables"]})]}),(0,S.jsx)(Ye.Z,{autoHeight:!0,autocompleteProviders:Ve,language:"python",onChange:function(e){St(e),null===re||void 0===re||re(e)},onDidChangeCursorPosition:qt,placeholder:"Start typing here...",selected:me,setSelected:_e,setTextareaFocused:Pe,textareaFocused:Se,value:Pt,width:"100%"})]})]})]})}),[Ve,m,Be,Le,Pt,ln,xt,Ne,K,V,re,oe,qt,Gt,me,un,_e,Pe,Se]);(0,s.useEffect)((function(){Xe({python:Or({autocompleteItems:h,block:m,blocks:D,pipeline:se})})}),[h,m,D,se]);var Ii=(0,s.useMemo)((function(){return vn?(0,S.jsx)(O.Z,{py:1,children:(0,S.jsx)(A.Z,{onClickTab:function(e){it(e),Tt.uuid!==e.uuid&&It.uuid!==e.uuid||yi()},selectedTabUUID:null===tt||void 0===tt?void 0:tt.uuid,small:!0,tabs:At})}):null}),[yi,vn,tt]),Ti=(0,s.useMemo)((function(){return(0,S.jsx)(Wt,wr(wr({},ri),{},{block:m,blockMetadata:ki,buttonTabs:Ii,collapsed:Fn,hasOutput:vi,isInProgress:zt,mainContainerWidth:$,messages:Qt,openSidekickView:ae,pipeline:se,runCount:Gn,runEndTime:qn,runStartTime:Vn,selected:me,selectedTab:tt,setCollapsed:function(e){Un((function(){return(0,F.t8)(Lt,e),e}))},setOutputBlocks:Oe,setSelectedOutputBlock:Ce,setSelectedTab:it}))}),[m,ki,ri,Ii,vi,zt,$,Qt,ae,Fn,Lt,se,Gn,qn,Vn,me,tt,Oe,Un,Ce]),Ai=(0,s.useCallback)((function(){return en(!1)}),[]),Di=(0,s.useRef)(null),Ri=(0,s.useCallback)((function(e){clearTimeout(Di.current),On((function(n){return wr(wr({},n),e)})),Di.current=setTimeout((function(){var n=wr(wr({},Zn),e);("undefined"!==typeof n.data_provider&&"undefined"!==n.data_provider_profile||"undefined"!==typeof n.dbt_profile_target||"undefined"!==typeof n.dbt_project_name||"undefined"!==typeof n.limit)&&he({block:{configuration:n,uuid:He}})}),1e3)}),[He,Zn,he]),Mi=zn.BIGQUERY===Zn.data_provider||zn.SNOWFLAKE===Zn.data_provider,Ni=(0,s.useMemo)((function(){return(null===D||void 0===D?void 0:D.length)||0}),[D]),Bi=(0,s.useMemo)((function(){return ln?(0,S.jsx)(dr,{children:ln}):(0,S.jsx)(O.Z,{px:1,children:(0,S.jsx)(_.ZP,{monospace:!0,muted:!0,children:"Double-click to edit"})})}),[ln]);(0,s.useEffect)((function(){xn&&wn&&!me&&In(!1)}),[wn,xn,me]);var Li=(0,s.useMemo)((function(){return(0,S.jsx)(N.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){be(!1)}),300)},onChange:function(e){be(!0),Ri((0,o.Z)({},pi,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){be(!0)},small:!0,type:"number",value:Zn.limit||"",width:11*C.iI})}),[Zn,be,Ri]);return(0,S.jsx)("div",{ref:dt,children:(0,S.jsxs)("div",{ref:n,style:{position:"relative",zIndex:E===u?Ni+9:null},children:[(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(P.nz,wr(wr({},wr(wr({},ri),lt)),{},{bottomBorder:xn,onClick:function(){return gi()},ref:ct,zIndex:Ni+1-(E||0),children:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(y.Z,{alignItems:"center",flex:1,children:[(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(mt.Z,{monospace:!0,children:v.dO[Be]}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(x.Z,{color:Vt,size:1.5*C.iI,square:!0}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(Mn.Z,{items:Ei(m),onClickCallback:Ai,onClickOutside:Ai,open:$e,parentRef:Ft,uuid:"CodeBlock/block_menu",children:(0,S.jsx)(_.ZP,{color:Vt,monospace:!0,children:null===(i=vn?v.tf.DBT:v.V4[Le])||void 0===i?void 0:i.toUpperCase()})}),v.tf.SCRATCHPAD===Le&&(0,S.jsxs)(S.Fragment,{children:["\xa0",(0,S.jsx)(T.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return en(!0)},transparent:!0,children:(0,S.jsx)(ie.K5,{muted:!0})})]})]}),(0,S.jsx)(O.Z,{mr:C.cd}),(0,S.jsx)(ie.iU,{size:1.5*C.iI}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsxs)(k.Z,{alignItems:"center",children:[vn&&v.t6.YAML!==Be&&(0,S.jsx)(cn.Z,{block:!0,label:(0,Pr.$1)(m,{fullPath:!0}),size:null,children:(0,S.jsx)(_.ZP,{monospace:!0,muted:!0,children:(0,Pr.$1)(m)})}),(!vn||v.t6.YAML===Be)&&(0,S.jsx)(ir,{bold:!1,inputValue:Nn,monospace:!0,muted:!0,notRequired:!0,onBlur:function(){return setTimeout((function(){be(!1),Dn(!1)}),300)},onChange:function(e){Bn(e.target.value),e.preventDefault()},onClick:function(){be(!0),Dn(!0)},onFocus:function(){be(!0),Dn(!0)},stacked:!0,value:!An&&He}),An&&!vn&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{ml:1}),(0,S.jsx)(Z.Z,{onClick:function(){return he({block:{name:Nn,uuid:He}}).then((function(){Dn(!1),Q(),q()}))},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]}),(0,S.jsx)(O.Z,{mr:2}),!v.iZ.includes(Le)&&$>700&&(0,S.jsx)(cn.Z,{appearBefore:!0,block:!0,label:"\n ".concat((0,ce._6)("parent block",Xt),". ").concat(0===Xt?"Click to select 1 or more blocks to depend on.":"Edit parent blocks.","\n "),size:null,widthFitContent:Xt>=1,children:(0,S.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){_e(!0),ke({upstreamBlocks:{block:m,values:null===Ue||void 0===Ue?void 0:Ue.map((function(e){return{uuid:e}}))}})},children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsxs)(_.ZP,{monospace:Xt>=1,small:Xt>=1,underline:0===Xt,children:[0===Xt&&"Edit parent blocks",Xt>=1&&(0,ce._6)("parent block",Xt)]}),(0,S.jsx)(O.Z,{mr:1}),0===Xt&&(0,S.jsx)(ie.Jj,{size:3*C.iI}),Xt>=1&&(0,S.jsx)(ie.eV,{size:3*C.iI})]})})})]}),(0,S.jsx)(Ki,{addNewBlock:c,addWidget:a,block:m,blocks:D,deleteBlock:G,executionState:W,fetchFileTree:q,fetchPipeline:Q,interruptKernel:X,isEditingBlock:wn,pipeline:se,runBlock:V?null:Gt,savePipelineContent:he,setErrors:Ze,setIsEditingBlock:In,setOutputCollapsed:Un}),(0,S.jsx)(O.Z,{px:1,children:(0,S.jsx)(T.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){rn((function(e){return(0,F.t8)(Nt,!e),!e})),tn||Un((function(){return(0,F.t8)(Lt,!0),!0}))},transparent:!0,children:tn?(0,S.jsx)(ie._M,{muted:!0,size:2*C.iI}):(0,S.jsx)(ie.Kh,{muted:!0,size:2*C.iI})})})]})})),(0,S.jsxs)(P.Nk,{onClick:function(){return gi()},children:[(0,S.jsxs)(P.jv,wr(wr({},ri),{},{className:me&&Se?"selected":null,hasOutput:!!Ii||vi,lightBackground:xn&&!wn,onDoubleClick:function(){xn&&!wn&&In(!0)},children:[v.tf.DBT===Le&&!tn&&(0,S.jsxs)(P.y9,{normalPadding:!0,children:[(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(y.Z,{alignItems:"center",children:[v.t6.YAML===Be&&(0,S.jsxs)(fr.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){be(!1)}),300)},onChange:function(e){var n;Ri((n={},(0,o.Z)(n,si,""),(0,o.Z)(n,di,e.target.value),n)),e.preventDefault()},onClick:pr.j,onFocus:function(){be(!0)},placeholder:"Project",small:!0,value:Zn.dbt_project_name||"",children:[(0,S.jsx)("option",{value:""}),Object.keys(gt||{}).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))]}),v.t6.YAML!==Be&&(0,S.jsx)(_.ZP,{monospace:!0,small:!0,children:xt}),(0,S.jsx)(O.Z,{mr:2}),(0,S.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Target"}),(0,S.jsx)("span",{children:"\xa0"}),!Ot&&(0,S.jsxs)(fr.Z,{compact:!0,disabled:!xt,monospace:!0,onBlur:function(){return setTimeout((function(){be(!1)}),300)},onChange:function(e){Ri((0,o.Z)({},si,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){be(!0)},placeholder:xt?bn?null===jt||void 0===jt?void 0:jt.target:null:"Select project first",small:!0,value:kt||"",children:[(0,S.jsx)("option",{value:""}),null===yt||void 0===yt?void 0:yt.map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))]}),Ot&&(0,S.jsx)(N.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){be(!1)}),300)},onChange:function(e){Ri((0,o.Z)({},si,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){be(!0)},placeholder:xt?bn?null===jt||void 0===jt?void 0:jt.target:null:"Select project first",small:!0,value:kt||"",width:21*C.iI}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(k.Z,{alignItems:"center",children:(0,S.jsx)(cn.Z,{block:!0,description:(0,S.jsxs)(_.ZP,{default:!0,inline:!0,children:["Manually type the name of the target you want to use in the profile.",(0,S.jsx)("br",{}),"Interpolate environment variables and global variables using the following syntax:",(0,S.jsx)("br",{}),(0,S.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:"{{ env_var('NAME') }}"})," or ",(0,S.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:"{{ variables('NAME') }}"})]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(g.Z,{checked:Ot,label:(0,S.jsx)(_.ZP,{muted:!0,small:!0,children:"Manually enter target"}),onClick:function(e){(0,pr.j)(e),_t(!Ot)}}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(ie.kI,{muted:!0})]})})})]}),v.t6.YAML!==Be&&(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(cn.Z,{appearBefore:!0,block:!0,description:(0,S.jsxs)(_.ZP,{default:!0,inline:!0,children:["Limit the number of results that are returned",(0,S.jsx)("br",{}),"when running this block in the notebook.",(0,S.jsx)("br",{}),"This limit won\u2019t affect the number of results",(0,S.jsx)("br",{}),"returned when running the pipeline end-to-end."]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(ie.kI,{muted:!0}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Sample limit"}),(0,S.jsx)("span",{children:"\xa0"})]})}),Li,(0,S.jsx)(O.Z,{mr:5})]})]}),v.t6.YAML===Be&&(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsxs)(y.Z,{flex:1,children:[(0,S.jsxs)(_.ZP,{default:!0,monospace:!0,small:!0,children:["dbt run ",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,small:!0,children:"[type your --select and --exclude syntax below]"})]}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["(paths start from ",(null===Zn||void 0===Zn?void 0:Zn.dbt_project_name)||"project"," folder)"]})]}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(_.ZP,{muted:!0,small:!0,children:(0,S.jsx)(Z.Z,{href:"https://docs.getdbt.com/reference/node-selection/syntax#examples",openNewWindow:!0,small:!0,children:"Examples"})}),(0,S.jsx)(O.Z,{mr:5})]})})]}),bn&&!tn&&v.tf.DBT!==Le&&(0,S.jsx)(P.y9,{normalPadding:!0,children:(0,S.jsxs)(k.Z,{flexWrap:"wrap",style:{marginTop:"-8px"},children:[(0,S.jsxs)(k.Z,{style:{marginTop:"8px"},children:[(0,S.jsxs)(fr.Z,{compact:!0,label:"Connection",onChange:function(e){return Ri((0,o.Z)({},oi,e.target.value))},onClick:pr.j,small:!0,value:Zn.data_provider,children:[(0,S.jsx)("option",{value:""}),null===R||void 0===R?void 0:R.map((function(e){var n=e.id,t=e.value;return(0,S.jsx)("option",{value:t,children:n},n)}))]}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsxs)(fr.Z,{compact:!0,label:"Profile",onChange:function(e){return Ri((0,o.Z)({},ci,e.target.value))},onClick:pr.j,small:!0,value:Zn.data_provider_profile,children:[(0,S.jsx)("option",{value:""}),null===Mt||void 0===Mt?void 0:Mt.map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))]}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(k.Z,{alignItems:"center",children:(0,S.jsx)(cn.Z,{block:!0,description:(0,S.jsxs)(_.ZP,{default:!0,inline:!0,children:["If checked, you\u2019ll have to write your own custom",(0,S.jsx)("br",{}),"CREATE TABLE commands and INSERT commands.",(0,S.jsx)("br",{}),"Separate your commands using a semi-colon: ",(0,S.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:";"})]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(g.Z,{checked:Zn.use_raw_sql,label:(0,S.jsx)(_.ZP,{muted:!0,small:!0,children:"Use raw SQL"}),onClick:function(e){(0,pr.j)(e),Ri((0,o.Z)({},bi,!Zn.use_raw_sql))}}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(ie.kI,{muted:!0})]})})}),!Zn.use_raw_sql&&(0,S.jsxs)(S.Fragment,{children:[Mi&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(k.Z,{alignItems:"center",children:(0,S.jsx)(N.Z,{compact:!0,label:"Database",monospace:!0,onBlur:function(){return setTimeout((function(){be(!1)}),300)},onChange:function(e){Ri((0,o.Z)({},li,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){be(!0)},small:!0,value:Zn.data_provider_database,width:10*C.iI})})]}),(0,S.jsx)(O.Z,{mr:1}),![Vi.CLICKHOUSE,Vi.MYSQL].includes(Zn.data_provider)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(cn.Z,{block:!0,description:(0,S.jsxs)(_.ZP,{default:!0,inline:!0,children:["Schema that is used when creating a table and inserting values.",(0,S.jsx)("br",{}),"This field is required."]}),size:null,widthFitContent:!0,children:(0,S.jsx)(k.Z,{alignItems:"center",children:(0,S.jsx)(N.Z,{compact:!0,label:"Schema",monospace:!0,onBlur:function(){return setTimeout((function(){be(!1)}),300)},onChange:function(e){Ri((0,o.Z)({},ui,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){be(!0)},small:!0,value:Zn.data_provider_schema,width:10*C.iI})})}),(0,S.jsx)(O.Z,{mr:1})]}),(0,S.jsx)(cn.Z,{block:!0,description:(0,S.jsxs)(_.ZP,{default:!0,inline:!0,children:["This value will be used as the table name.",(0,S.jsx)("br",{}),"If blank, the default table name will be:",(0,S.jsx)("br",{}),(0,S.jsxs)(_.ZP,{inline:!0,monospace:!0,children:[hn,"_",He]}),(0,S.jsx)("br",{}),"This field is optional."]}),size:null,widthFitContent:!0,children:(0,S.jsx)(k.Z,{alignItems:"center",children:(0,S.jsx)(N.Z,{compact:!0,label:"Table (optional)",monospace:!0,onBlur:function(){return setTimeout((function(){be(!1)}),300)},onChange:function(e){Ri((0,o.Z)({},ai,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){be(!0)},small:!0,value:Zn.data_provider_table,width:20*C.iI})})})]}),(0,S.jsx)(O.Z,{mr:1})]}),!Zn.use_raw_sql&&(0,S.jsxs)(k.Z,{alignItems:"center",style:{marginTop:"8px"},children:[(0,S.jsx)(cn.Z,{block:!0,description:(0,S.jsxs)(_.ZP,{default:!0,inline:!0,children:["Limit the number of results that are returned",(0,S.jsx)("br",{}),"when running this block in the notebook.",(0,S.jsx)("br",{}),"This limit won\u2019t affect the number of results",(0,S.jsx)("br",{}),"returned when running the pipeline end-to-end."]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(ie.kI,{muted:!0}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Limit"}),(0,S.jsx)("span",{children:"\xa0"})]})}),Li,(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(cn.Z,{autoWidth:!0,block:!0,description:(0,S.jsxs)(_.ZP,{default:!0,inline:!0,children:["How do you want to handle existing data with the same",Mi?" database,":""," schema, and table name?",(0,S.jsx)("br",{}),(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Append"}),": add rows to the existing table.",(0,S.jsx)("br",{}),(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Replace"}),": delete the existing data.",(0,S.jsx)("br",{}),(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Fail"}),": raise an error during execution."]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(ie.kI,{muted:!0}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Write policy:"}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsxs)(fr.Z,{compact:!0,label:"strategy",onChange:function(e){return Ri((0,o.Z)({},fi,e.target.value))},onClick:pr.j,small:!0,value:Zn.export_write_policy,children:[(0,S.jsx)("option",{value:""}),null===Xi||void 0===Xi?void 0:Xi.map((function(e){return(0,S.jsx)("option",{value:e,children:(0,ce.kC)(e)},e)}))]})]})}),(0,S.jsx)(O.Z,{mr:1})]}),(null===Zn||void 0===Zn?void 0:Zn.data_provider)===Vi.TRINO&&Ue.length>=1&&(0,S.jsxs)(k.Z,{alignItems:"center",style:{marginTop:"8px"},children:[(0,S.jsx)(cn.Z,{appearBefore:!0,block:!0,description:(0,S.jsxs)(_.ZP,{default:!0,inline:!0,children:["If checked, upstream blocks that aren\u2019t SQL blocks",(0,S.jsx)("br",{}),"will have their data exported into a table that is",(0,S.jsx)("br",{}),"uniquely named upon each block run. For example,",(0,S.jsx)("br",{}),(0,S.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:"[pipeline_uuid]_[block_uuid]_[unique_timestamp]"}),"."]}),size:null,widthFitContent:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(g.Z,{checked:Zn.unique_upstream_table_name,label:(0,S.jsx)(_.ZP,{muted:!0,small:!0,children:"Unique upstream table names"}),onClick:function(e){(0,pr.j)(e),Ri((0,o.Z)({},hi,!Zn.unique_upstream_table_name))}}),(0,S.jsx)("span",{children:"\xa0"}),(0,S.jsx)(ie.kI,{muted:!0})]})}),(0,S.jsx)(O.Z,{mr:1})]})]})}),mi.length>=1&&(0,S.jsx)(P.y9,{normalPadding:!0,children:(0,S.jsx)(k.Z,{children:mi.map((function(e,n){var t=e.description,i=e.title;return(0,S.jsx)(O.Z,{ml:n>=1?1:0,children:(0,S.jsx)(cn.Z,{block:!0,description:t,size:null,widthFitContent:!0,children:(0,S.jsx)(mt.Z,{children:i})})},i)}))})}),Ue.length>=1&&!tn&&v.f2.includes(Le)&&!mn&&(0,S.jsxs)(P.y9,{normalPadding:!0,children:[(0,S.jsx)(O.Z,{mr:5,children:(0,S.jsxs)(_.ZP,{muted:!0,small:!0,children:[!bn&&"Positional arguments for ".concat(gn?"":"decorated ","function:"),bn&&(0,S.jsxs)(S.Fragment,{children:["The interpolated tables below are available in queries from upstream blocks.",(0,S.jsx)("br",{}),"Example: ",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,small:!0,children:"SELECT * FROM {{ df_1 }}"})," to insert all rows from ",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,small:!0,children:null===Ue||void 0===Ue?void 0:Ue[0]})," into a table."]})]})}),(0,S.jsxs)(O.Z,{mt:1,children:[!bn&&!gn&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:[v.tf.DATA_EXPORTER===Le&&"@data_exporter",v.tf.DATA_LOADER===Le&&"@data_loader",v.tf.TRANSFORMER===Le&&"@transformer",v.tf.CUSTOM===Le&&"@custom"]}),(0,S.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["def ",(v.tf.DATA_EXPORTER===Le?"export_data":v.tf.DATA_LOADER===Le&&"load_data")||v.tf.TRANSFORMER===Le&&"transform"||v.tf.CUSTOM===Le&&"transform_custom","(",Ue.map((function(e,n){return n>=1?"data_".concat(n+1):"data"})).join(", "),"):"]})]}),gn&&(0,S.jsx)(S.Fragment,{children:(0,S.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:[v.tf.DATA_EXPORTER===Le?"export_data":v.tf.TRANSFORMER===Le&&"transform","\xa0\u2190 function(",Ue.map((function(e,n){return"df_".concat(n+1)})).join(", "),"):"]})}),bn&&(null===Ue||void 0===Ue?void 0:Ue.length)>=1&&(0,S.jsx)(br,{block:m,blockConfiguration:Zn,blockRefs:w,blocks:null===Ue||void 0===Ue?void 0:Ue.map((function(e){return null===Ut||void 0===Ut?void 0:Ut[e]})),updateBlockConfiguration:Ri}),!bn&&Ue.map((function(e,n){var t=Ut[e],i=(0,P.qn)(null===t||void 0===t?void 0:t.type,{blockColor:null===t||void 0===t?void 0:t.color,theme:we}).accent,r="{{ df_".concat(n+1," }}");return(0,S.jsxs)("div",{children:[!bn&&!gn&&(0,S.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0data",n>=1?"_".concat(n+1):null]}),bn&&(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:r}),gn&&(0,S.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0","df".concat(n+1)]})," ",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"\u2192"})," ",(0,S.jsx)(Z.Z,{color:i,onClick:function(){var e,n,i=null===w||void 0===w||null===(e=w.current)||void 0===e?void 0:e["".concat(null===t||void 0===t?void 0:t.type,"s/").concat(null===t||void 0===t?void 0:t.uuid,".py")];null===i||void 0===i||null===(n=i.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,S.jsx)(_.ZP,{color:i,inline:!0,monospace:!0,small:!0,children:e})})]},e)}))]})]}),!Me&&(0,S.jsx)(S.Fragment,{children:tn?(0,S.jsx)(O.Z,{px:1,children:(0,S.jsxs)(_.ZP,{monospace:!0,muted:!0,children:["(",(0,ce._6)("line",null===ln||void 0===ln?void 0:ln.split(/\r\n|\r|\n/).length)," collapsed)"]})}):!xn||wn?wi:Bi}),Y&&s.cloneElement(Y,{runBlockAndTrack:Gt}),Me&&(0,S.jsxs)(O.Z,{p:C.cd,children:[(0,S.jsx)(_.ZP,{bold:!0,danger:!0,children:null===Me||void 0===Me?void 0:Me.error}),(0,S.jsx)(_.ZP,{muted:!0,children:null===Me||void 0===Me?void 0:Me.message})]}),zt&&sn&&sn>Vn&&(0,S.jsx)(P.HC,{children:(0,S.jsxs)(_.ZP,{muted:!0,children:["".concat(Math.round((sn-Vn)/1e3)),"s"]})}),!tn&&![v.tf.CALLBACK,v.tf.EXTENSION].includes(Le)&&(0,S.jsx)(vt,{block:m,blocks:f,openSidekickView:ae})]})),Ti]})]}),!te&&(0,S.jsxs)(P.gE,{additionalZIndex:Ni-E,onMouseEnter:function(){return qe(!0)},onMouseLeave:function(){qe(!1),null===ve||void 0===ve||ve(null)},children:[We&&c&&(0,S.jsx)(O.Z,{mt:2,children:(0,S.jsx)(ft,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=(0,Wi.eY)(m,e),r=(0,Wi.fA)(m,e);return[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(Le)&&v.tf.SCRATCHPAD===e.type&&(n="from mage_ai.data_preparation.variable_manager import get_variable\n\n\n df = get_variable('".concat(hn,"', '").concat(He,"', 'output_0')")),n=at(e,n),v.t6.SQL===Be&&(t=wr(wr({},(0,xe.GL)(Ge,[oi,li,ci,ui,fi])),t)),v.t6.SQL===e.language&&(n=ut(n)),c(wr(wr({},e),{},{configuration:t,content:n,upstream_blocks:i}),r)},blockIdx:E,blockTemplates:I,compact:!0,hideCustom:mn,hideDbt:mn,onClickAddSingleDBTModel:le,pipeline:se,setAddNewBlockMenuOpenIdx:ve,setCreatingNewDBTModel:ye})}),(0,S.jsx)(P.t1,{className:"block-divider-inner"})]})]})})}var Tr=s.forwardRef(Ir),Ar=t(90880),Dr=6.25*C.iI,Rr=(C.iI,100*C.iI),Mr=b.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%);",""],Pe.n_,Rr,(function(e){return"\n box-shadow: ".concat((e.theme||Ce.Z).shadow.window,";\n background-color: ").concat((e.theme||Ce.Z).background.panel,";\n ")})),Nr=(0,b.css)(["display:flex;align-items:center;justify-content:space-between;height:","px;padding:","px ","px;",""],Dr,C.iI,C.cd*C.iI,(function(e){return"\n background-color: ".concat((e.theme||Ce.Z).background.output,";\n ")})),Br=b.default.div.withConfig({displayName:"indexstyle__WindowHeaderStyle",componentId:"sc-g0cszf-1"})([""," border-top-left-radius:","px;border-top-right-radius:","px;",""],Nr,Pe.n_,Pe.n_,(function(e){return"\n border-bottom: ".concat(Pe.YF,"px ").concat(Pe.M8," ").concat((e.theme||Ce.Z).borders.medium,";\n ")})),Lr=b.default.div.withConfig({displayName:"indexstyle__WindowContentStyle",componentId:"sc-g0cszf-2"})(["overflow:auto;padding:","px 0;"," "," "," ",""],C.iI,an.w5,(0,Ar.eR)(),(function(e){return e.minMaxHeight&&"\n max-height: ".concat(7*C.iI,"px;\n ")}),(function(e){return!e.minMaxHeight&&"\n max-height: calc(100vh - ".concat(6.5*Dr,"px);\n ")})),Fr=b.default.div.withConfig({displayName:"indexstyle__WindowFooterStyle",componentId:"sc-g0cszf-3"})([""," justify-content:flex-end;border-bottom-left-radius:","px;border-bottom-right-radius:","px;",""],Nr,Pe.n_,Pe.n_,(function(e){return"\n border-top: ".concat(Pe.YF,"px ").concat(Pe.M8," ").concat((e.theme||Ce.Z).borders.medium,";\n ")})),Ur=b.default.div.withConfig({displayName:"indexstyle__InputRowStyle",componentId:"sc-g0cszf-4"})(["padding:","px ","px;",""],.75*C.iI,2*C.iI,(function(e){return"\n border-bottom: ".concat(Pe.YF,"px ").concat(Pe.M8," ").concat((e.theme||Ce.Z).borders.medium,";\n ")}));function Hr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Gr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Hr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Hr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var zr=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,pe.sE)((null===r||void 0===r||null===(n=r[0])||void 0===n?void 0:n.children)||[],(function(e){return"dbt"===e.name})))||void 0===e?void 0:e.children,i=[];return null===t||void 0===t||t.forEach((function(e){var n=e.children,t=(void 0===n?[]:n).filter((function(e){return"models"===e.name}));t.length>=1&&i.push(Gr(Gr({},e),{},{children:t}))})),i}),[r]),b=(0,s.useMemo)((function(){return(0,pe.HK)(n,(function(e){return e.configuration.file_path}))}),[n]);return(0,S.jsxs)(Mr,{children:[(0,S.jsxs)(Br,{children:[(0,S.jsx)(y.Z,{alignItems:"center",children:(0,S.jsx)(_.ZP,{disableWordBreak:!0,monospace:!0,children:t?"Create new DBT model":"Select DBT model file"})}),(0,S.jsx)(T.Z,{iconOnly:!0,onClick:o,children:(0,S.jsx)(ie.x8,{muted:!0})})]}),t&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Ur,{children:(0,S.jsx)(ir,{dynamicSizing:!0,inputValue:i,label:"Model name (cannot be changed):",labelColor:Ce.Z.accent.dbt,notRequired:!0,onBlur:function(){d(!1)},onChange:function(e){c(e.target.value),e.preventDefault()},onClick:function(){d(!0)},onFocus:function(){d(!0)},placeholder:"Enter name",required:!0,stacked:!0,suffixValue:".".concat(v.t6.SQL),value:!a&&i})}),(0,S.jsxs)(Ur,{children:[(0,S.jsx)(_.ZP,{bold:!0,color:Ce.Z.accent.dbt,children:"Select folder location:"}),(0,S.jsx)(_.ZP,{bold:!0,muted:!p,children:p?"dbt".concat(le.sep).concat(p):"Choose folder below"})]})]}),(0,S.jsx)(Lr,{children:(0,S.jsx)(He,{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,S.jsx)(Fr,{children:(0,S.jsx)(T.Z,{backgroundColor:i&&p?Ce.Z.accent.dbt:Ce.Z.monotone.grey500,disabled:!i||!p,onClick:function(){return l(p)},padding:"6px 8px",children:"Create model"})})]})};function Wr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Yr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Wr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Wr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function qr(e,n){var t,i=e.block,r=e.blocks,o=e.onClick,c=e.onDrop,u=i.type,a=(0,pt.c)((function(){return{collect:function(e){return{isDragging:!!e.isDragging()}},item:i,type:Rt}}),[i]),d=(0,l.Z)(a,3),f=d[0],p=d[1],h=(d[2],(0,ht.L)((function(){return{accept:Rt,drop:function(e){return null===c||void 0===c?void 0:c(i,e)}}}),[i])),m=(0,l.Z)(h,2)[1],g=(0,s.useContext)(b.ThemeContext),j=(0,P.qn)(u,{blockColor:i.color,theme:g}).accent,E=(0,Sr.cU)([i],r)[0],w=E.dynamic,I=E.dynamicUpstreamBlock,T=E.reduceOutput,A=E.reduceOutputUpstreamBlock,D=(0,s.useMemo)((function(){return(0,Wi._o)({block:i,dynamic:w,dynamicUpstreamBlock:I,reduceOutput:T,reduceOutputUpstreamBlock:A})}),[i,w,I,T,A]).borderColorShareProps,R=(0,s.useMemo)((function(){return v.tf.DBT===(null===i||void 0===i?void 0:i.type)}),[i]);return(0,S.jsx)(O.Z,{pb:1,ref:m,children:(0,S.jsx)(P.PY,Yr(Yr({},Yr(Yr({},D),f)),{},{ref:p,children:(0,S.jsx)(Z.Z,{noHoverUnderline:!0,noOutline:!0,onClick:function(){return o()},preventDefault:!0,ref:n,children:(0,S.jsx)(O.Z,{p:1,children:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(y.Z,{alignItems:"center",flex:1,children:[(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(mt.Z,{monospace:!0,children:v.dO[i.language]}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(x.Z,{color:j,size:1.5*C.iI,square:!0}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(_.ZP,{color:j,monospace:!0,children:null===(t=R?v.tf.DBT:v.V4[i.type])||void 0===t?void 0:t.toUpperCase()})]}),(0,S.jsx)(O.Z,{mr:C.cd}),(0,S.jsx)(ie.iU,{size:1.5*C.iI}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(_.ZP,{monospace:!0,muted:!0,children:null===i||void 0===i?void 0:i.uuid})]}),(0,S.jsx)(cn.Z,{appearAbove:!0,appearBefore:!0,block:!0,label:"Show ".concat(null===i||void 0===i?void 0:i.uuid," block"),size:2*C.iI,widthFitContent:!0,children:(0,S.jsx)(ie.Db,{muted:!0,size:2*C.iI})})]})})})}))})}var Qr,Kr,Vr,Xr,Jr=s.forwardRef(qr),$r=t(4804),eo=t(65730);!function(e){e.FULL_TABLE="FULL_TABLE",e.INCREMENTAL="INCREMENTAL",e.LOG_BASED="LOG_BASED"}(Kr||(Kr={})),function(e){e.IGNORE="IGNORE",e.UPDATE="UPDATE"}(Vr||(Vr={})),function(e){e.DATE_TIME="date-time",e.UUID="uuid"}(Xr||(Xr={}));var no,to="datetime",io=(Qr={},(0,o.Z)(Qr,Xr.DATE_TIME,to),(0,o.Z)(Qr,Xr.UUID,Xr.UUID),Qr);!function(e){e.ARRAY="array",e.BOOLEAN="boolean",e.INTEGER="integer",e.NULL="null",e.NUMBER="number",e.OBJECT="object",e.STRING="string"}(no||(no={}));var ro,oo,lo,co,uo,ao=[no.ARRAY,no.BOOLEAN,to,no.INTEGER,no.NULL,no.NUMBER,no.OBJECT,no.STRING,Xr.UUID];!function(e){e.PROPERTIES="properties"}(ro||(ro={})),function(e){e.AUTOMATIC="automatic",e.AVAILABLE="available",e.UNSUPPORTED="unsupported"}(oo||(oo={})),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"}(lo||(lo={})),function(e){e.AMPLITUDE="amplitude",e.BIGQUERY="bigquery",e.CHARGEBEE="chargebee",e.GOOGLE_ADS="google_ads",e.GOOGLE_SEARCH_CONSOLE="google_search_console",e.GOOGLE_SHEETS="google_sheets",e.INTERCOM="intercom",e.MYSQL="mysql",e.PIPEDRIVE="pipedrive",e.POSTGRESQL="postgresql",e.REDSHIFT="redshift",e.SALESFORCE="salesforce",e.STRIPE="stripe"}(co||(co={})),function(e){e.BIGQUERY="bigquery",e.DELTA_LAKE_S3="delta_lake_s3",e.MYSQL="mysql",e.POSTGRESQL="postgresql",e.SNOWFLAKE="snowflake"}(uo||(uo={}));var so=b.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||Ce.Z.background).popup,";\n ")}),(function(e){return e.primary&&"\n background-color: ".concat((e.theme.chart||Ce.Z.chart).primary,";\n ")}),(function(e){return!e.small&&"\n border-radius: ".concat((C.iI+ur.Al)/2,"px;\n height: ").concat(1.5*C.iI+ur.Al,"px;\n padding: ").concat(C.iI/1.5,"px ").concat(1.25*C.iI,"px;\n ")}),(function(e){return e.small&&"\n border-radius: ".concat((C.iI/2+ur.Al)/2,"px;\n height: ").concat(ur.Al+C.iI/2+2,"px;\n padding: ").concat(C.iI/4,"px ").concat(C.iI,"px;\n ")}),(function(e){return e.border&&"\n border: 1px solid ".concat((e.theme.content||Ce.Z.content).muted,";\n ")})),fo=function(e){var n=e.border,t=e.children,i=e.label,r=e.onClick,o=e.primary,l=e.small;return(0,S.jsx)(so,{border:n,primary:o,small:l,children:(0,S.jsx)(T.Z,{basic:!0,noPadding:!0,noBackground:!0,onClick:r,transparent:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[t,i&&(0,S.jsx)(_.ZP,{small:l,children:i}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(ie.x8,{default:o,muted:!o,size:l?C.iI:1.25*C.iI})]})})})},po=t(70902),ho=t(85307);function mo(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 vo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?mo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):mo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var bo="4px",go=[uo.BIGQUERY,uo.DELTA_LAKE_S3];var xo=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,b=(0,s.useRef)(null),x=a.bookmark_properties,j=a.destination_table,Z=void 0===j?"":j,P=a.key_properties,E=a.metadata,w=a.partition_keys,I=a.replication_method,A=a.schema.properties,D=a.tap_stream_id,M=a.unique_constraints,B=a.unique_conflict_method,L=(0,s.useState)(Z),F=L[0],U=L[1],H=(0,s.useState)(!1),G=H[0],z=H[1],W=(0,s.useState)(null),Y=W[0],q=W[1],Q=(0,s.useState)(!1),K=Q[0],V=Q[1],X=(0,s.useState)((0,o.Z)({},D,n||{})),J=X[0],$=X[1],ee=(0,kn.Z)(D);(0,s.useEffect)((function(){ee!==D&&(U(Z),q(null))}),[Z,I,D,ee,B]),(0,s.useEffect)((function(){var e=null===J||void 0===J?void 0:J[D];(null===x||void 0===x?void 0:x.length)>0&&((0,xe.Qr)(e)||!(0,xe.Xy)(n,e))&&$((function(e){return vo(vo({},e),{},(0,o.Z)({},D,n))}))}),[null===x||void 0===x?void 0:x.length,n,D]);var ne=(0,s.useMemo)((function(){return(0,pe.HK)(E,(function(e){return e.breadcrumb.join("/")}))}),[E]),te=(0,s.useMemo)((function(){var e;return null===(e=(0,pe.sE)(E,(function(e){return 0===e.breadcrumb.length})))||void 0===e?void 0:e.metadata}),[E]),ie=(0,s.useMemo)((function(){return te[lo.KEY_PROPERTIES]||[]}),[te]),re=(0,s.useMemo)((function(){return te[lo.REPLICATION_KEYS]||[]}),[te]),oe=go.includes(t),le=d.length>1,ue=(0,s.useCallback)((function(e){var n=vo({},null===J||void 0===J?void 0:J[D]);n.hasOwnProperty(e)&&delete n[e],$((function(e){return vo(vo({},e),{},(0,o.Z)({},D,vo({},n)))})),p({block:{bookmark_values:n,destination_table:F,tap_stream_id:D}})}),[J,F,D,p]),ae=(0,s.useMemo)((function(){var e=[],n=[],i=(0,pe.mr)(Object.entries(A)).map((function(i,r){var o=(0,l.Z)(i,2),c=o[0],u=o[1],a=u.anyOf,s=void 0===a?[]:a,d=u.format,p=u.type,b=void 0===p?[]:p,j=new Set(Array.isArray(b)?b:[b]),Z=new Set(j);s.forEach((function(e){var n=e.format,t=(e.items,e.type);Array.isArray(t)?t.forEach((function(e){j.add(e),Z.add(e)})):(j.add(t),Z.add(t),n&&Z.add(n))}));var E=Array.from(j);d&&Z.add(d);var I=(ne["properties/".concat(c)]||{}).metadata,A=(I.inclusion,I.selected);e.push(A),n.push(c);var R=ao.reduce((function(e,n){return E.indexOf(n)>=0||to===String(n)&&Xr.DATE_TIME===d||Xr.UUID===String(n)&&Xr.UUID===d?e:e.concat((0,S.jsx)("option",{value:n,children:n},n))}),[]),N=E.findIndex((function(e){return e===no.STRING})),B=[(0,S.jsx)(g.Z,{checked:A,onClick:function(){h(D,[c],{selected:!A})}},"".concat(D,"/").concat(c,"/selected")),(0,S.jsx)(_.ZP,{children:c},"".concat(D,"/").concat(c,"/name")),(0,S.jsxs)(k.Z,{children:[(0,S.jsx)(y.Z,{flex:1,children:(0,S.jsx)(k.Z,{alignItems:"center",flexWrap:"wrap",fullWidth:!0,children:E.map((function(e,n){return(0,S.jsx)(O.Z,{mb:1,mr:1,children:(0,S.jsx)(fo,{border:!0,label:d&&no.STRING===e&&N===n?io[d]:e,onClick:function(){var n={format:d,type:E.filter((function(n){return n!==e}))};Xr.DATE_TIME!==d&&Xr.UUID!==d||no.STRING!==e||(n.format=null),m(D,c,n)},small:!0})},"".concat(D,"/").concat(c,"/").concat(e,"/").concat(n,"/chip"))}))})}),R.length>=1&&(0,S.jsxs)(fr.Z,{compact:!0,onChange:function(e){var n=e.target.value,t={format:d,type:E};to===String(n)?(t.format=Xr.DATE_TIME,t.type.push(no.STRING)):Xr.UUID===String(n)?(t.format=Xr.UUID,t.type.push(no.STRING)):t.type.push(n),m(D,c,t)},primary:!0,small:!0,value:"",width:10*C.iI,children:[(0,S.jsx)("option",{value:""}),R]})]},"".concat(D,"/").concat(c,"/type")),(0,S.jsx)(g.Z,{checked:!(null===M||void 0===M||!M.includes(c)),disabled:ie.length>=1&&!ie.includes(c),onClick:ie.length>=1&&!ie.includes(c)?null:function(){return v(D,(function(e){var n;return null!==(n=e.unique_constraints)&&void 0!==n&&n.includes(c)?e.unique_constraints=(0,pe.Od)(e.unique_constraints,(function(e){return c===e})):e.unique_constraints=[c].concat(e.unique_constraints||[]),e}))}},"".concat(D,"/").concat(c,"/unique")),(0,S.jsx)(g.Z,{checked:!(null===x||void 0===x||!x.includes(c)),disabled:re.length>=1&&!re.includes(c),onClick:re.length>=1&&!re.includes(c)?null:function(){return v(D,(function(e){var n;return null!==(n=e.bookmark_properties)&&void 0!==n&&n.includes(c)?(ue(c),e.bookmark_properties=(0,pe.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),e}))}},"".concat(D,"/").concat(c,"/bookmark")),(0,S.jsx)(g.Z,{checked:!(null===P||void 0===P||!P.includes(c)),onClick:function(){return v(D,(function(e){var n;return null!==(n=e.key_properties)&&void 0!==n&&n.includes(c)?e.key_properties=(0,pe.Od)(e.key_properties,(function(e){return c===e})):e.key_properties=[c].concat(e.key_properties||[]),e}))}},"".concat(D,"/").concat(c,"/key_property"))];if(oe){var L=t!==uo.DELTA_LAKE_S3,F=L&&(ie.includes(c)||!Z.has(Xr.DATE_TIME));B.push((0,S.jsx)(g.Z,{checked:!(null===w||void 0===w||!w.includes(c)),disabled:F,onClick:F?null:function(){return v(D,(function(e){var n,t;null!==(n=e.partition_keys)&&void 0!==n&&n.includes(c)?e.partition_keys=(0,pe.Od)(e.partition_keys,(function(e){return c===e})):L&&1===(null===(t=e.partition_keys)||void 0===t?void 0:t.length)?e.partition_keys=[c]:e.partition_keys=[c].concat(e.partition_keys||[]);return e}))}},"".concat(D,"/").concat(c,"/partition_key")))}if(le){var U=Y===r;B.push((0,S.jsx)(T.Z,{compact:!0,disabled:U,onClick:function(){q(r),setTimeout((function(){return q(null)}),2e3),f((function(e){var n,t;if((null===e||void 0===e?void 0:e.tap_stream_id)!==D&&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:E};var h=null===(i=(0,pe.sE)((null===e||void 0===e?void 0:e.metadata)||[],(function(e){return 0===e.breadcrumb.length})))||void 0===i?void 0:i.metadata,m=h[lo.REPLICATION_KEYS]||[],v=h[lo.KEY_PROPERTIES]||[];null===M||void 0===M||!M.includes(c)||null!==e&&void 0!==e&&null!==(r=e.unique_constraints)&&void 0!==r&&r.includes(c)||!v.includes(c)?null!==M&&void 0!==M&&M.includes(c)||null===e||void 0===e||null===(o=e.unique_constraints)||void 0===o||!o.includes(c)||(e.unique_constraints=(0,pe.Od)(e.unique_constraints,(function(e){return c===e}))):e.unique_constraints=[c].concat(e.unique_constraints||[]),null===x||void 0===x||!x.includes(c)||null!==e&&void 0!==e&&null!==(l=e.bookmark_properties)&&void 0!==l&&l.includes(c)||!m.includes(c)?null!==x&&void 0!==x&&x.includes(c)||null===e||void 0===e||null===(u=e.bookmark_properties)||void 0===u||!u.includes(c)||(e.bookmark_properties=(0,pe.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),null===P||void 0===P||!P.includes(c)||null!==e&&void 0!==e&&null!==(a=e.key_properties)&&void 0!==a&&a.includes(c)?null!==P&&void 0!==P&&P.includes(c)||null===e||void 0===e||null===(s=e.key_properties)||void 0===s||!s.includes(c)||(e.key_properties=(0,pe.Od)(e.key_properties,(function(e){return c===e}))):e.key_properties=[c].concat(e.key_properties||[]),null===w||void 0===w||!w.includes(c)||null!==e&&void 0!==e&&null!==(f=e.partition_keys)&&void 0!==f&&f.includes(c)?null!==w&&void 0!==w&&w.includes(c)||null===e||void 0===e||null===(p=e.partition_keys)||void 0===p||!p.includes(c)||(e.partition_keys=(0,pe.Od)(e.partition_keys,(function(e){return c===e}))):e.partition_keys=[c].concat(e.partition_keys||[])}return vo({},e)}))},pill:!0,secondary:!0,children:(0,S.jsx)(_.ZP,{success:U,children:U?"Applied!":"Apply"})}))}return B})),r=e.every((function(e){return e})),o=[null,2,1,null,null,null],c=[{label:function(){return(0,S.jsx)(g.Z,{checked:r,onClick:function(){h(D,n,{selected:!r})}})},uuid:"Selected"},{uuid:"Name"},{uuid:"Type"},{uuid:"Unique"},{uuid:"Bookmark"},{uuid:"Key prop"}];return oe&&(o.push(null),c.push({uuid:"Partition key"})),le&&(o.push(null),c.push({tooltipMessage:"This will apply this individual feature's schema settings to all selected streams that have the same feature. Unique features must be valid key properties in other streams. Bookmark features must be valid replication keys in other streams.",uuid:"All streams"})),(0,S.jsx)(ho.cl,{children:(0,S.jsx)(_e.Z,{alignTop:!0,columnFlex:o,columns:c,rows:i,stickyHeader:!0})})}),[x,t,le,Y,P,ne,w,A,oe,D,M,f,h,m,v,ie,re]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(lr.Z,{condensed:!0,level:4,spacingBelow:!0,children:[(0,S.jsx)(lr.Z,{condensed:!0,inline:!0,level:4,monospace:!0,children:D})," schema"]}),(0,S.jsx)(O.Z,{mb:3,children:(0,S.jsx)(R.Z,{headerTitle:"Output",overflowVisible:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(_.ZP,{children:"Destination table name"}),(0,S.jsx)(O.Z,{ml:bo}),(0,S.jsx)(cn.Z,{label:(0,S.jsxs)(_.ZP,{children:["By default, this stream will be saved to your destination under the table named ",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:D}),". To change the table name, enter in a different value."]}),lightBackground:!0,primary:!0}),(0,S.jsx)(O.Z,{ml:1}),(0,S.jsx)(N.Z,{compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;U(n),clearTimeout(b.current),b.current=setTimeout((function(){v(D,(function(e){return vo(vo({},e),{},{destination_table:n})}))}),300)},value:F||"",width:45*C.iI})]})})}),(0,S.jsx)(O.Z,{mb:3,children:(0,S.jsx)(R.Z,{headerTitle:"Usage",overflowVisible:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(_.ZP,{children:"Replication method"}),(0,S.jsx)(O.Z,{ml:bo}),(0,S.jsx)(cn.Z,{label:(0,S.jsxs)(_.ZP,{children:["Do you want to synchronize the entire stream (",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Kr.FULL_TABLE}),") on each integration pipeline run or only new records (",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Kr.INCREMENTAL}),")?",u===co.POSTGRESQL&&(0,S.jsxs)(_.ZP,{children:["Log-based incremental replication (",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Kr.LOG_BASED}),") is also available for PostgreSQL sources."]})]}),lightBackground:!0,primary:!0}),(0,S.jsx)(O.Z,{ml:1}),(0,S.jsxs)(fr.Z,{compact:!0,onChange:function(e){v(D,(function(n){return vo(vo({},n),{},{replication_method:e.target.value})}))},primary:!0,value:I,children:[(0,S.jsx)("option",{value:""}),Object.values(Kr).filter((function(e){return u===co.POSTGRESQL||e!==Kr.LOG_BASED})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))]}),(0,S.jsx)(O.Z,{ml:3}),(0,S.jsx)(_.ZP,{children:"Unique conflict method"}),(0,S.jsx)(O.Z,{ml:bo}),(0,S.jsx)(cn.Z,{label:(0,S.jsxs)(_.ZP,{wordBreak:!0,children:["If a new record has the same value as an existing record in the ",(0,ce._6)("column",null===M||void 0===M?void 0:M.length),(null===M||void 0===M?void 0:M.length)>0&&(0,S.jsx)(S.Fragment,{children:"\xa0"}),null===M||void 0===M?void 0:M.sort().map((function(e,n){return(0,S.jsxs)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:[1!==(null===M||void 0===M?void 0:M.length)&&n===(null===M||void 0===M?void 0:M.length)-1?(0,S.jsx)(_.ZP,{inline:!0,children:" and "},e):n>=1&&(0,S.jsx)(S.Fragment,{children:",\xa0"}),e]},e)})),", how do you want to resolve the conflict? The conflict method ",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Vr.IGNORE})," will skip the new record if it\u2019s a duplicate of an existing record. The conflict method ",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Vr.UPDATE})," will not save the new record and instead update the existing record with the new record\u2019s properties."]}),lightBackground:!0,primary:!0}),(0,S.jsx)(O.Z,{ml:1}),(0,S.jsxs)(fr.Z,{compact:!0,inputWidth:11*C.iI,onChange:function(e){v(D,(function(n){return vo(vo({},n),{},{unique_conflict_method:e.target.value})}))},primary:!0,value:B,children:[(0,S.jsx)("option",{value:""}),(0,S.jsx)("option",{value:Vr.IGNORE,children:Vr.IGNORE}),(0,S.jsx)("option",{value:Vr.UPDATE,children:Vr.UPDATE})]})]}),le&&(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(_.ZP,{default:!0,children:"All streams"}),(0,S.jsx)(O.Z,{ml:bo}),(0,S.jsx)(cn.Z,{appearBefore:!0,label:(0,S.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,S.jsx)(O.Z,{ml:1}),(0,S.jsx)(T.Z,{compact:!0,disabled:G,onClick:function(){z(!0),setTimeout((function(){return z(!1)}),2e3),f((function(e){return vo(vo({},e),{},{replication_method:I,unique_conflict_method:B})}))},pill:!0,secondary:!0,children:(0,S.jsx)(_.ZP,{bold:!G,success:G,children:G?"Applied!":"Apply"})})]})]})})}),(0,S.jsx)(R.Z,{headerTitle:"Features",noPadding:!0,children:ae}),(0,S.jsx)(O.Z,{mt:2,children:(0,S.jsx)(T.Z,{loading:i,onClick:function(){return c(D)},primary:!0,small:!0,children:"Load sample data"})}),(0,S.jsxs)(O.Z,{mt:5,children:[(0,S.jsx)(lr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Settings"}),Kr.INCREMENTAL===I&&(0,S.jsxs)(O.Z,{mb:5,children:[(0,S.jsxs)(O.Z,{mb:1,children:[(0,S.jsx)(_.ZP,{bold:!0,large:!0,children:"Bookmark properties"}),(0,S.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,S.jsx)("br",{}),"On the next run, the synchronization will start after the bookmarked record."]})]}),(0,S.jsxs)(k.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==x&&void 0!==x&&x.length)&&(0,S.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Bookmark"})," to use a specific column as a bookmark property."]}),null===x||void 0===x?void 0:x.sort().map((function(e){return(0,S.jsx)(O.Z,{mb:1,mr:1,children:(0,S.jsx)(fo,{label:e,onClick:function(){ue(e),v(D,(function(n){return vo(vo({},n),{},{bookmark_properties:(0,pe.Od)(n.bookmark_properties||[],(function(n){return n===e}))})}))},primary:!0})},"bookmark_properties/".concat(e))}))]}),(null===x||void 0===x?void 0:x.length)>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{my:2,children:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(O.Z,{mr:2,children:[(0,S.jsx)(_.ZP,{bold:!0,large:!0,children:"Manually edit bookmark property values"}),(0,S.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,S.jsx)(po.Z,{checked:K,disabled:!t,onCheck:function(){return V((function(e){return!e}))}})]})}),K&&!!t&&(0,S.jsx)(R.Z,{header:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(_.ZP,{bold:!0,default:!0,children:"Bookmark property values"}),(0,S.jsx)(T.Z,{compact:!0,loading:r,onClick:function(){p({block:{bookmark_values:(null===J||void 0===J?void 0:J[D])||{},destination_table:F,tap_stream_id:D}})},pill:!0,secondary:!0,children:"Save"})]}),headerPaddingVertical:C.iI,noPadding:!0,overflowVisible:!0,children:(0,S.jsx)(_e.Z,{columnBorders:!0,columnFlex:[null,1],columns:[{uuid:"Bookmark property"},{uuid:"Value"}],rows:x.map((function(e){var n;return[(0,S.jsx)(_.ZP,{default:!0,monospace:!0,children:e},e),(0,S.jsx)(N.Z,{borderless:!0,monospace:!0,onChange:function(n){n.preventDefault(),$((function(t){return vo(vo({},t),{},(0,o.Z)({},D,vo(vo({},t[D]),{},(0,o.Z)({},e,n.target.value))))}))},paddingHorizontal:0,placeholder:"Enter value",value:null===J||void 0===J||null===(n=J[D])||void 0===n?void 0:n[e]},"".concat(e,"_value"))]}))})})]})]}),(0,S.jsxs)(O.Z,{mb:5,children:[(0,S.jsxs)(O.Z,{mb:1,children:[(0,S.jsx)(_.ZP,{bold:!0,large:!0,children:"Unique constraints"}),(0,S.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,S.jsxs)(k.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==M&&void 0!==M&&M.length)&&(0,S.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Unique"})," to use a specific column as a unique constraint."]}),null===M||void 0===M?void 0:M.sort().map((function(e){return(0,S.jsx)(O.Z,{mb:1,mr:1,children:(0,S.jsx)(fo,{label:e,onClick:function(){v(D,(function(n){return vo(vo({},n),{},{unique_constraints:(0,pe.Od)(n.unique_constraints||[],(function(n){return n===e}))})}))},primary:!0})},"unique_constraints/".concat(e))}))]})]}),(0,S.jsxs)(O.Z,{mb:5,children:[(0,S.jsxs)(O.Z,{mb:1,children:[(0,S.jsx)(_.ZP,{bold:!0,large:!0,children:"Key properties"}),(0,S.jsx)(_.ZP,{default:!0,children:"Key properties are used as the primary key for the destination table."})]}),(0,S.jsxs)(k.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==P&&void 0!==P&&P.length)&&(0,S.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Key prop"})," to use a specific column as a key property."]}),null===P||void 0===P?void 0:P.sort().map((function(e){return(0,S.jsx)(O.Z,{mb:1,mr:1,children:(0,S.jsx)(fo,{label:e,onClick:function(){v(D,(function(n){return vo(vo({},n),{},{key_properties:(0,pe.Od)(n.key_properties||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]}),oe&&(0,S.jsxs)(O.Z,{mb:3,children:[(0,S.jsxs)(O.Z,{mb:1,children:[(0,S.jsx)(_.ZP,{bold:!0,large:!0,children:"Partition keys"}),(0,S.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,S.jsxs)(k.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==w&&void 0!==w&&w.length)&&(0,S.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Partition key"})," to use a specific column as a partition key."]}),null===w||void 0===w?void 0:w.sort().map((function(e){return(0,S.jsx)(O.Z,{mb:1,mr:1,children:(0,S.jsx)(fo,{label:e,onClick:function(){v(D,(function(n){return vo(vo({},n),{},{partition_keys:(0,pe.Od)(n.partition_keys||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]})]})]})},jo=["catalog","pipeline","setErrors","setSelectedStream"];function yo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ko(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?yo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):yo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Zo=function(e){var n,t=e.catalog,i=e.pipeline,r=e.setErrors,o=e.setSelectedStream,c=(0,q.Z)(e,jo),u=(0,s.useState)(null),a=u[0],f=u[1],p=(0,s.useMemo)((function(){return(null===t||void 0===t?void 0:t.streams)||[]}),[t]),h=(0,s.useMemo)((function(){return(0,pe.YC)(p,"stream").map((function(e){return{uuid:e.stream}}))}),[p]),m=(0,s.useMemo)((function(){return(0,pe.HK)(p,(function(e){return e.stream}))}),[p]),b=(0,s.useMemo)((function(){return m[null===a||void 0===a?void 0:a.uuid]}),[a,m]),g=(0,s.useMemo)((function(){return(0,pe.sE)((null===i||void 0===i?void 0:i.blocks)||[],(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n}))}),[null===i||void 0===i?void 0:i.blocks]),x=b||{},j=x.destination_table,y=x.tap_stream_id,k=!(!y||!j),Z=ge.ZP.blocks.pipelines.detail(k?null===i||void 0===i?void 0:i.uuid:null,k?null===g||void 0===g?void 0:g.uuid:null,{destination_table:j,state_stream:y}),C=Z.data,P=Z.mutate,E=null===C||void 0===C||null===(n=C.block)||void 0===n?void 0:n.bookmarks,w=(0,d.Db)(ge.ZP.blocks.pipelines.useUpdate(null===i||void 0===i?void 0:i.uuid,null===g||void 0===g?void 0:g.uuid,{query:{update_state:!0}}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===P||void 0===P||P()},onErrorCallback:function(e,n){return null===r||void 0===r?void 0:r({errors:n,response:e})}})}}),I=(0,l.Z)(w,2),T=I[0],D=I[1].isLoading;(0,s.useEffect)((function(){h.length>0&&(a&&(0,pe.sE)(h,(function(e){var n=e.uuid;return a.uuid===n}))||f(h[0]))}),[a,f,h]);var R=(0,s.useMemo)((function(){var e=[{uuid:"Stream"},{uuid:"Columns Selected"},{uuid:"Replication Method"},{uuid:"Destination Table"},{uuid:"Bookmark Props"},{uuid:"Key Props"},{uuid:"Unique Constraints"},{uuid:"Unique Conflict Method"},{uuid:"Partition Keys"}];return(0,S.jsx)(ho.cl,{children:(0,S.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,S.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,S.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,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(A.Z,{allowScroll:!0,noPadding:!0,onClickTab:function(e){f(e),o(e.uuid)},selectedTabUUID:null===a||void 0===a?void 0:a.uuid,tabs:h}),b&&(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsx)(ho.dE,{children:(0,S.jsx)(xo,ko(ko({},c),{},{bookmarkValues:E,isLoadingUpdateDestinationBlockState:D,stream:b,streams:p,updateDestinationBlockState:T}))})}),p.length>=1&&(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsxs)(ho.dE,{children:[(0,S.jsx)(lr.Z,{level:4,children:"Streams Summary"}),(0,S.jsx)(O.Z,{mt:1}),R]})})]})},Oo=b.default.div.withConfig({displayName:"indexstyle__PanelStyle",componentId:"sc-1rfr5wd-0"})(["border-radius:","px;"," ",""],Pe.n_,(function(e){return"\n background-color: ".concat((e.theme.background||Ce.Z.background).panel,";\n ")}),(function(e){return e.fullWidth&&"\n width: 100%;\n "}));var _o,Co=function(e){var n=e.children,t=e.fullWidth,i=void 0===t||t;return(0,S.jsx)(Oo,{fullWidth:i,children:n})};function Po(e){return Object.values(e).filter((function(e){return null!==e})).map((function(e){return e.tap_stream_id}))}function So(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 Eo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?So(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):So(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"}(_o||(_o={}));var wo=45*C.iI;var Io=function(e){var n=e.catalog,t=e.isLoading,i=e.onActionCallback,r=e.streams,l=(0,pe.HK)((null===n||void 0===n?void 0:n.streams)||[],(function(e){return e.stream})),c=(0,s.useMemo)((function(){var e=new Set(r.map((function(e){return e.stream})));return Object.values(l).filter((function(n){var t=n.stream;return!e.has(t)})).map((function(e){return Eo(Eo({},e),{},{isMissingStream:!0})}))}),[l,r]),u=Eo({},l);c.forEach((function(e){var n=e.stream;delete u[n]}));var a=(0,s.useState)(u),d=a[0],f=a[1],p=(0,s.useState)(null),h=p[0],m=p[1],v=(0,s.useState)(!1),b=v[0],x=v[1],y=(0,s.useState)(_o.ALL),Z=y[0],P=y[1],E=(0,s.useRef)(null),w=Po(d),I=(0,s.useMemo)((function(){var e=r;return e=e.filter((function(e){var n=e.tap_stream_id;return Z===_o.SELECTED?w.includes(n):Z!==_o.NOT_SELECTED||!w.includes(n)})),h?e.filter((function(e){var n=e.tap_stream_id;return null===n||void 0===n?void 0:n.toLowerCase().includes(null===h||void 0===h?void 0:h.toLowerCase())})):e}),[Z,h,w,r]),A=(0,s.useMemo)((function(){return r.every((function(e){var n=e.stream;return!!d[n]}))}),[d,r]);return(0,S.jsxs)(Co,{children:[(0,S.jsx)(ho.cv,{rounded:!0,children:(0,S.jsx)(_.ZP,{bold:!0,large:!0,children:"Select streams to sync"})}),(0,S.jsx)(ho.cv,{padding:1.25*C.iI,children:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(N.Z,{beforeIcon:(0,S.jsx)(ie.HN,{}),compact:!0,noBackground:!0,noBorder:!0,onChange:function(e){return m(e.target.value)},placeholder:"Search",value:h}),(0,S.jsx)(O.Z,{pr:1,children:(0,S.jsx)(Mn.Z,{items:[{label:function(){return _o.ALL},onClick:function(){return P(_o.ALL)},uuid:"all_streams"},{label:function(){return _o.SELECTED},onClick:function(){return P(_o.SELECTED)},uuid:"selected"},{label:function(){return _o.NOT_SELECTED},onClick:function(){return P(_o.NOT_SELECTED)},uuid:"unselected"}],onClickCallback:function(){return x(!1)},onClickOutside:function(){return x(!1)},open:b,parentRef:E,uuid:"SelectStreams/filter",children:(0,S.jsx)(T.Z,{beforeIcon:(0,S.jsx)(ie.wn,{}),noBackground:!0,onClick:function(){return x((function(e){return!e}))},ref:E,children:(0,S.jsx)(_.ZP,{children:Z})})})})]})}),(0,S.jsx)(ho.cl,{height:"55vh",hideHorizontalScrollbar:!0,width:"".concat(wo,"px"),children:(0,S.jsx)(_e.Z,{borderCollapseSeparate:!0,columnFlex:[1,6],columns:[{label:function(){return(0,S.jsx)(g.Z,{checked:A,onClick:function(){var e=(0,pe.HK)(r||[],(function(e){return e.stream}));f(A?{}:e)}})},uuid:"Selected"},{uuid:"Stream name"}],rows:I.concat(c).map((function(e){var n=e.isMissingStream,t=e.stream,i=!!d[t];return[(0,S.jsx)(g.Z,{checked:i,disabled:!i&&n,onClick:function(){f((function(n){return Eo(Eo({},n),{},(0,o.Z)({},t,i?null:e))}))}},"selected-".concat(t)),(0,S.jsxs)(_.ZP,{danger:n,title:t,width:wo-48-32,children:[t,n?" (no longer available)":""]},"stream-".concat(t))]})),stickyHeader:!0})}),(0,S.jsx)(j.Z,{medium:!0}),(0,S.jsxs)(O.Z,{p:2,children:[(null===w||void 0===w?void 0:w.length)>50&&(0,S.jsx)(O.Z,{pb:2,children:(0,S.jsxs)(_.ZP,{danger:!0,maxWidth:wo-4*C.iI,rightAligned:!0,whiteSpaceNormal:!0,children:["WARNING: Selecting too many streams (e.g. >50)",(0,S.jsx)("br",{}),"may cause app performance issues."]})}),(0,S.jsx)(k.Z,{justifyContent:"flex-end",children:(0,S.jsx)(T.Z,{loading:t,onClick:function(){return i(d)},primary:!0,children:"Confirm ".concat(Po(d).length," streams")})})]})]})};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 Ao(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,o.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 Do=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,$r.Pz)(null===i||void 0===i?void 0:i.config))}),[a,i]);var p=(0,s.useState)(null),h=p[0],m=p[1],b=(0,s.useState)(),g=b[0],x=b[1],j=(0,d.Db)(ge.ZP[n].useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var t,i,r=(0,ce.C5)(n);m(null===e||void 0===e||null===(t=e[r])||void 0===t?void 0:t.success),x(null===e||void 0===e||null===(i=e[r])||void 0===i?void 0:i.error_message)},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})}}),y=(0,l.Z)(j,2),Z=y[0],C=y[1].isLoading;return t?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(ho.$W,{children:(0,S.jsx)(Ye.Z,{autoHeight:!0,language:v.t6.YAML,onChange:function(e){f(e),r(t.type,t.uuid,(0,$r.Pz)(Ao(Ao({},i),{},{config:(0,$r.Qc)(e)})))},tabSize:2,value:a||void 0,width:"100%"})}),(0,S.jsxs)(O.Z,{mt:1,children:[(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(T.Z,{onClick:function(){Z((0,o.Z)({},(0,ce.C5)(n),{action_type:"test_connection",config:a,pipeline_uuid:c.uuid})),x(null)},small:!0,success:!0,children:"Test connection"}),(0,S.jsx)(O.Z,{ml:1,children:C?(0,S.jsx)(zi.Z,{color:"white",small:!0}):(0,S.jsxs)(S.Fragment,{children:[h&&(0,S.jsx)(_.ZP,{small:!0,success:!0,children:"Connected successfully!"}),!1===h&&(0,S.jsx)(_.ZP,{small:!0,warning:!0,children:"Failed to connect, see error below."})]})})]}),g&&(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsx)(_.ZP,{small:!0,warning:!0,children:g})})]})]}):null};function Ro(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Mo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ro(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ro(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var No=function(e){var n,t,i,r=e.addNewBlockAtIndex,o=e.blocks,c=e.codeBlocks,u=e.fetchFileTree,a=e.fetchPipeline,f=e.fetchSampleData,p=e.globalVariables,h=e.onChangeCodeBlock,m=e.openSidekickView,b=e.pipeline,g=e.savePipelineContent,x=e.setErrors,j=e.setIntegrationStreams,y=e.setOutputBlocks,P=e.setSelectedBlock,E=e.setSelectedOutputBlock,w=e.setSelectedStream,I=(0,s.useState)(!0),A=I[0],D=I[1],R=(0,s.useState)(!0),M=R[0],N=R[1],B=(0,s.useState)(!0),L=B[0],F=B[1],U=ge.ZP.integration_sources.list({},{revalidateOnFocus:!1}).data,H=(0,s.useMemo)((function(){return(null===U||void 0===U?void 0:U.integration_sources)||[]}),[U]),G=(0,s.useMemo)((function(){return(0,pe.HK)(H,(function(e){return e.uuid}))}),[H]),z=ge.ZP.integration_destinations.list({},{revalidateOnFocus:!1}).data,W=(0,s.useMemo)((function(){return(null===z||void 0===z?void 0:z.integration_destinations)||[]}),[z]),Y=(0,s.useMemo)((function(){return(0,pe.HK)(W,(function(e){return e.uuid}))}),[W]),q=(0,s.useMemo)((function(){return(0,pe.sE)(o,(function(e){var n=e.type;return v.tf.DATA_LOADER===n}))}),[o]),Q=(0,s.useMemo)((function(){return q?(0,$r.Qc)(q.content):{}}),[q]),K=(0,s.useMemo)((function(){return(0,S.jsx)(Do,{api:"integration_sources",block:q,blockContent:Q,onChangeCodeBlock:h,pipeline:b})}),[q,Q,h,b]),V=(0,s.useMemo)((function(){return(0,pe.sE)(o,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n}))}),[o]),X=(0,s.useMemo)((function(){return V?(0,$r.Qc)(V.content):{}}),[V]),J=(0,s.useMemo)((function(){return(0,S.jsx)(Do,{api:"integration_destinations",block:V,blockContent:X,onChangeCodeBlock:h,pipeline:b})}),[V,X,h,b]),$=(0,s.useMemo)((function(){return(0,pe.sE)(o,(function(e){var n=e.type;return v.tf.TRANSFORMER===n}))}),[o]),ee=(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]),ne=((null===ee||void 0===ee?void 0:ee.streams)||[]).every((function(e){return e.auto_add_new_fields})),te=((null===ee||void 0===ee?void 0:ee.streams)||[]).every((function(e){return e.disable_column_type_check})),re=(0,kn.Z)(ee);(0,s.useEffect)((function(){!re&&ee&&(y((function(){return E(q),[q]})),j((function(e){var n;return e||(null===ee||void 0===ee||null===(n=ee.streams)||void 0===n?void 0:n.map((function(e){return e.tap_stream_id})))})))}),[ee]);var le=(0,s.useState)(),ce=le[0],ue=le[1],ae=(0,d.Db)(ge.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)||[];y((function(){return E(q),[q]})),t.length>0&&w(t[0]),j((function(e){var n=(e||[]).concat(t);return Array.from(new Set(n)).sort()})),m(oe.cH.DATA),f()}else ue(null===n||void 0===n?void 0:n.error_message)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),se=(0,l.Z)(ae,2),de=se[0],fe=se[1].isLoading,he=(0,d.Db)(ge.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===ee||void 0===ee?void 0:ee.streams)||[]).filter((function(e){var n=e.tap_stream_id;return t.includes(n)})),o=r.map((function(e){return e.tap_stream_id})),l=i.filter((function(e){var n=e.tap_stream_id;return t.includes(n)&&!o.includes(n)}));l.forEach((function(e){e.metadata.forEach((function(n,t){var i=n.metadata;if(oo.UNSUPPORTED!==i.inclusion){var r;if(e.replication_method||(e.replication_method=Kr.FULL_TABLE),e.unique_conflict_method||(e.unique_conflict_method=Vr.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]=Mo(Mo({},n),{},{metadata:Mo(Mo({},i),{},{selected:!0})})}}))}));var c={streams:r.concat(l)};j(Be.map((function(e){return e.tap_stream_id})));var s=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(s)||h(q.type,q.uuid,(0,$r.Pz)(Mo(Mo({},Q),{},{catalog:{}})));var d={pipeline:Mo(Mo({},b),{},{data_integration:Mo(Mo({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:c})})};g(d).then((function(){a(),u()}))},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),me=(0,l.Z)(he,2),ve=me[0],be=me[1].isLoading,ye=(0,s.useState)(null),ke=ye[0],Ze=ye[1],Oe=(0,d.Db)(ge.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){Ze(e.integration_source_stream)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),Ce=(0,l.Z)(Oe,2),Pe=Ce[0],Se=Ce[1].isLoading,Ee=(0,s.useCallback)((function(e,n){var t=function(e,n){var t,i=[];return e.streams.forEach((function(e){e.tap_stream_id===n?t=e:i.push(e)})),{stream:t,streams:i}}(ee,e),i=t.stream,r=t.streams,o=Mo(Mo({},ee),{},{streams:r.concat(n(i))}),l=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(l)||h(q.type,q.uuid,(0,$r.Pz)(Mo(Mo({},Q),{},{catalog:{}})));var c={pipeline:Mo(Mo({},b),{},{data_integration:Mo(Mo({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:o})})};g(c).then((function(){return a()}))}),[ee,q,Q,a,h,b,g]),we=(0,s.useCallback)((function(e){if(null!==ee&&void 0!==ee&&ee.streams){var n=Mo(Mo({},ee),{},{streams:ee.streams.map((function(n){return e(n)}))}),t=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(t)||h(q.type,q.uuid,(0,$r.Pz)(Mo(Mo({},Q),{},{catalog:{}})));var i={pipeline:Mo(Mo({},b),{},{data_integration:Mo(Mo({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:n})})};g(i).then((function(){return a()}))}}),[ee,q,Q,a,h,b,g]),Ie=(0,s.useCallback)((function(e,n,t){Ee(e,(function(e){return e.schema.properties[n]=t,e}))}),[Ee]),Te=(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=Mo(Mo({},o),t)}})),e}))}),[Ee]),Ae=(0,d.Db)(ge.ZP.blocks.pipelines.useUpdate(null===b||void 0===b?void 0:b.uuid,null===V||void 0===V?void 0:V.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===a||void 0===a||a()},onErrorCallback:function(e,n){return null===x||void 0===x?void 0:x({errors:n,response:e})}})}}),De=(0,l.Z)(Ae,1)[0],Me=(0,s.useMemo)((function(){var e=[];return null===p||void 0===p||p.forEach((function(n){var t=n.variables;return null===t||void 0===t?void 0:t.forEach((function(n){var t=n.uuid,i=n.value,r="\"{{ variables('".concat(t,"') }}\"");if(!t.startsWith("output"))return e.push([(0,S.jsx)(_.ZP,{monospace:!0,children:t},"variable-uuid-".concat(t)),(0,S.jsx)(_.ZP,{monospace:!0,children:i},"variable-uuid-".concat(t,"-{value}")),(0,S.jsx)(_.ZP,{monospace:!0,children:r},"variable-uuid-".concat(t,"-{value}-code")),(0,S.jsx)(eo.Z,{copiedText:r,monospace:!0,withCopyIcon:!0},"variable-uuid-".concat(t,"-{value}-code-copy"))])}))})),(0,S.jsx)(_e.Z,{alignTop:!0,columnFlex:[null,null,1],columns:[{uuid:"Key"},{uuid:"Value"},{uuid:"Code"}],rows:e})}),[p]),Ne=(0,s.useCallback)((function(e){return(0,S.jsxs)(O.Z,{mt:2,children:[(0,S.jsxs)(_.ZP,{default:!0,children:["Use the following variables to interpolate sensitive or dynamic information into the configuration.",(0,S.jsx)("br",{}),"You can also access values from your environment variables by using the following syntax: ",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,children:"\"{{ env_var('MY_ENV_VARIABLE_NAME') }}\""}),(0,S.jsx)("br",{}),"For more information, check out the ",(0,S.jsx)(Z.Z,{href:e,openNewWindow:!0,primary:!0,children:"documentation"}),"."]}),(0,S.jsx)(O.Z,{mt:1,children:Me})]})}),[Me]),Be=(0,s.useMemo)((function(){return(null===ke||void 0===ke?void 0:ke.streams)||[]}),[ke]),Le=(0,Re.dd)((function(){return(0,S.jsx)(Io,{catalog:ee,isLoading:be,onActionCallback:function(e){var n=Object.entries(e).reduce((function(e,n){var t=(0,l.Z)(n,2),i=t[0];return t[1]?e.concat(i):e}),[]);if(n.length>0)ve({integration_source:{streams:n}}),He();else{var t=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(t)||h(q.type,q.uuid,(0,$r.Pz)(Mo(Mo({},Q),{},{catalog:{}}))),g({pipeline:Mo(Mo({},b),{},{data_integration:Mo(Mo({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:null})})}).then((function(){return a()})),He()}},streams:Be})}),{},[ee,q,Q,a,be,h,g,Be],{background:!0,uuid:"select_streams"}),Fe=(0,l.Z)(Le,2),Ue=Fe[0],He=Fe[1];return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{mb:1,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(T.Z,{iconOnly:!0,onClick:function(){return N((function(e){return!e}))},children:(0,S.jsxs)(S.Fragment,{children:[M&&(0,S.jsx)(ie.Kh,{size:1.5*C.iI}),!M&&(0,S.jsx)(ie._M,{size:1.5*C.iI})]})}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(lr.Z,{children:"Source"}),!M&&(0,S.jsxs)(lr.Z,{default:!0,inline:!0,children:["\xa0",null===(t=G[null===Q||void 0===Q?void 0:Q.source])||void 0===t?void 0:t.name]})]})]})}),M&&(0,S.jsxs)(O.Z,{mb:5,children:[(0,S.jsxs)(ho.dE,{children:[(0,S.jsxs)(O.Z,{mb:5,children:[(0,S.jsx)(lr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select source"}),(null===H||void 0===H?void 0:H.length)>0?(0,S.jsxs)(fr.Z,{onChange:function(e){var n,t,i=e.target.value;if(i){var o=null===(n=G[i])||void 0===n||null===(t=n.templates)||void 0===t?void 0:t.config;o&&Object.keys(o).forEach((function(e){o[e]=o[e]||null})),q?h(q.type,q.uuid,(0,$r.Pz)(Mo(Mo({},Q),{},{catalog:{},config:o,source:i}))):r({content:(0,$r.Pz)({config:o,source:i}),language:v.t6.YAML,type:v.tf.DATA_LOADER},0,P),Ze(null),g().then((function(){a()}))}},primary:!0,value:null===Q||void 0===Q?void 0:Q.source,children:[(0,S.jsx)("option",{value:""}),H.map((function(e){var n=e.name,t=e.uuid;return(0,S.jsx)("option",{value:t,children:n},t)}))]}):(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(zi.Z,{inverted:!0}),(0,S.jsx)(O.Z,{ml:1}),(0,S.jsx)(lr.Z,{level:5,primary:!0,children:"Loading sources..."})]})]}),q&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(O.Z,{mb:5,children:[(0,S.jsx)(lr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===Q||void 0===Q?void 0:Q.source)&&(0,S.jsxs)(O.Z,{mb:2,children:[(0,S.jsxs)(_.ZP,{default:!0,children:["For more information on how to configure this source, read the ",(0,S.jsxs)(Z.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"]})]}),Ne("https://docs.mage.ai/guides/data-integration-pipeline#configure-source")]}),K]}),(0,S.jsxs)("div",{children:[(0,S.jsx)(lr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select stream"}),(0,S.jsx)(T.Z,{loading:Se,onClick:function(){g().then((function(){Pe().then((function(){return Ue()})),a()}))},primary:!0,small:!0,children:"View and select streams"})]}),ce&&(0,S.jsx)(_.ZP,{warning:!0,children:ce})]})]}),be&&(0,S.jsx)(O.Z,{p:2,children:(0,S.jsx)(zi.Z,{})}),!be&&(0,S.jsx)(O.Z,{mt:3,children:(0,S.jsx)(Zo,{catalog:ee,destination:null===X||void 0===X?void 0:X.destination,isLoadingLoadSampleData:fe,loadSampleData:function(e){return de({integration_source:{action_type:"sample_data",pipeline_uuid:null===b||void 0===b?void 0:b.uuid,streams:[e]}})},pipeline:b,setErrors:x,setSelectedStream:w,source:null===Q||void 0===Q?void 0:Q.source,updateAllStreams:we,updateMetadataForColumns:Te,updateSchemaProperty:Ie,updateStream:Ee})})]}),(0,S.jsx)(O.Z,{mb:1,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(T.Z,{disabled:!q,iconOnly:!0,onClick:function(){return F((function(e){return!e}))},children:(0,S.jsxs)(S.Fragment,{children:[L&&q&&(0,S.jsx)(ie.Kh,{size:1.5*C.iI}),(!L||!q)&&(0,S.jsx)(ie._M,{disabled:!q,size:1.5*C.iI})]})}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(k.Z,{alignItems:"center",children:(0,S.jsx)(lr.Z,{children:"Transformers"})})]})}),L&&q&&(0,S.jsx)(O.Z,{mb:5,children:(0,S.jsxs)(ho.dE,{children:[c.length>0&&(0,S.jsx)(O.Z,{mb:1,children:c.map((function(e,n){return(0,S.jsx)(O.Z,{mb:1,children:e},n)}))}),(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsx)(ft,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=[];return q&&i.push(q.uuid),r(Mo(Mo({},e),{},{configuration:t,content:n,upstream_blocks:i}),o.length-1,(function(e){V&&(De({block:Mo(Mo({},V),{},{upstream_blocks:[e.uuid]})}),P(e))}))},compact:!0,hideCustom:!0,hideDataExporter:!0,hideDataLoader:!0,hideDbt:!0,hideMarkdown:!0,hideScratchpad:!0,hideSensor:!0,hideTransformer:!!$,hideTransformerDataSources:!0,pipeline:b})})]})}),(0,S.jsx)(O.Z,{mb:1,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(T.Z,{disabled:!q,iconOnly:!0,onClick:function(){return D((function(e){return!e}))},children:(0,S.jsxs)(S.Fragment,{children:[A&&q&&(0,S.jsx)(ie.Kh,{size:1.5*C.iI}),(!A||!q)&&(0,S.jsx)(ie._M,{disabled:!q,size:1.5*C.iI})]})}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(lr.Z,{children:"Destination"}),!A&&(0,S.jsxs)(lr.Z,{default:!0,inline:!0,children:["\xa0",null===(i=Y[null===X||void 0===X?void 0:X.destination])||void 0===i?void 0:i.name]})]})]})}),A&&q&&(0,S.jsxs)(ho.dE,{children:[(0,S.jsxs)(O.Z,{mb:5,children:[(0,S.jsx)(lr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select destination"}),(null===W||void 0===W?void 0:W.length)>0?(0,S.jsxs)(fr.Z,{onChange:function(e){var n=e.target.value;if(n){if(V)h(V.type,V.uuid,(0,$r.Pz)(Mo(Mo({},X),{},{destination:n})));else{var t,i,l=null===(t=Y[n])||void 0===t||null===(i=t.templates)||void 0===i?void 0:i.config;l&&(Object.keys(l).forEach((function(e){l[e]=l[e]||null})),l.hasOwnProperty("table")&&delete l.table);var c=[];if((null===o||void 0===o?void 0:o.length)>=2){var u=o.find((function(e){var n=e.uuid;return(null===q||void 0===q?void 0:q.uuid)!==n}));u&&c.push(u.uuid)}else q&&c.push(q.uuid);r({content:(0,$r.Pz)({config:l,destination:n}),language:v.t6.YAML,type:v.tf.DATA_EXPORTER,upstream_blocks:c},1,P)}g().then((function(){a()}))}},primary:!0,value:null===X||void 0===X?void 0:X.destination,children:[(0,S.jsx)("option",{value:""}),W.map((function(e){var n=e.name,t=e.uuid;return(0,S.jsx)("option",{value:t,children:n},t)}))]}):(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(zi.Z,{inverted:!0}),(0,S.jsx)(O.Z,{ml:1}),(0,S.jsx)(lr.Z,{level:5,primary:!0,children:"Loading destinations..."})]})]}),V&&(0,S.jsxs)(O.Z,{mb:5,children:[(0,S.jsx)(lr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===X||void 0===X?void 0:X.destination)&&(0,S.jsx)(S.Fragment,{children:(0,S.jsxs)(O.Z,{mb:2,children:[(0,S.jsxs)(_.ZP,{default:!0,children:["For more information on how to configure this destination, read the ",(0,S.jsxs)(Z.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/destinations/".concat(X.destination,"/README.md"),openNewWindow:!0,primary:!0,children:[X.destination," documentation"]}),".",(0,S.jsx)("br",{}),(0,S.jsx)("br",{}),"If your configuration contains a key named ",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,children:"table"}),", it\u2019s optional.",(0,S.jsx)("br",{}),"The table that\u2019s created in this destination will have a name corresponding to the stream\u2019s unique name (by default) or the value you entered under the input field labeled ",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,children:"Table name"})," in a previous section."]}),Ne("https://docs.mage.ai/guides/data-integration-pipeline#configure-destination")]})}),J,(0,S.jsx)(O.Z,{mt:3,children:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(O.Z,{mr:2,children:[(0,S.jsx)(_.ZP,{bold:!0,large:!0,children:"Automatically add new fields"}),(0,S.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,S.jsx)(po.Z,{checked:!!ne,disabled:!(null!==ee&&void 0!==ee&&ee.streams),onCheck:function(){return we((function(e){return Mo(Mo({},e),{},{auto_add_new_fields:!ne})}))}})]})}),(0,S.jsx)(O.Z,{mt:3,children:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(O.Z,{mr:2,children:[(0,S.jsx)(_.ZP,{bold:!0,large:!0,children:"Disable column type check"}),(0,S.jsxs)(_.ZP,{default:!0,children:["By default, the value for each column is validated according to the schema property for that column.",(0,S.jsx)("br",{}),"If a value in a column doesn\u2019t match its type, an error will be raised and the process will be stopped.",(0,S.jsx)("br",{}),"Turn this toggle on if you want to disable this strict type checking."]})]}),(0,S.jsx)(po.Z,{checked:!!te,disabled:!(null!==ee&&void 0!==ee&&ee.streams),onCheck:function(){return we((function(e){return Mo(Mo({},e),{},{disable_column_type_check:!te})}))}})]})})]})]})]})};function Bo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Lo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Bo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Bo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Fo=function(e){var n=e.addNewBlockAtIndex,t=e.addWidget,i=e.allBlocks,r=e.allowCodeBlockShortcuts,c=e.anyInputFocused,u=e.autocompleteItems,a=e.blockRefs,f=e.blocks,p=void 0===f?[]:f,h=e.dataProviders,m=e.deleteBlock,b=e.disableShortcuts,g=e.fetchFileTree,x=e.fetchPipeline,j=e.fetchSampleData,y=e.files,k=e.globalVariables,Z=e.hiddenBlocks,_=e.interruptKernel,P=e.mainContainerRef,E=e.mainContainerWidth,w=e.messages,I=e.onChangeCallbackBlock,T=e.onChangeCodeBlock,A=e.openSidekickView,D=e.pipeline,R=e.pipelineContentTouched,N=e.restartKernel,L=e.runBlock,F=e.runningBlocks,H=void 0===F?[]:F,G=e.savePipelineContent,W=e.selectedBlock,Y=e.setAnyInputFocused,q=e.setDisableShortcuts,Q=e.setEditingBlock,K=e.setErrors,V=e.setIntegrationStreams,X=e.setHiddenBlocks,J=e.setOutputBlocks,$=e.setPipelineContentTouched,ee=e.setSelectedBlock,ne=e.setSelectedOutputBlock,te=e.setSelectedStream,ie=e.setTextareaFocused,re=e.textareaFocused,oe=e.widgets,ue=(0,s.useState)(!1),ae=ue[0],se=ue[1],de=(0,s.useState)(!1),fe=de[0],he=de[1],me=(0,s.useState)(!0),ve=me[0],be=me[1],ye=(0,s.useState)(null),ke=ye[0],Ze=ye[1],Oe=(0,s.useState)(null),_e=Oe[0],Ce=Oe[1],Pe=(0,s.useState)(!1),Se=Pe[0],Ee=Pe[1],we=(0,s.useState)(""),Ie=we[0],Te=we[1],Ae=(0,s.useMemo)((function(){return H.reduce((function(e,n,t){return Lo(Lo({},e),{},(0,o.Z)({},n.uuid,Lo(Lo({},n),{},{priority:t})))}),{})}),[H]),De=(0,kn.Z)(W),Re=(0,s.useMemo)((function(){return p.length}),[p]),Me=(0,s.useMemo)((function(){return M.qL.INTEGRATION===(null===D||void 0===D?void 0:D.type)}),[D]),Ne=(0,s.useMemo)((function(){return M.qL.STREAMING===(null===D||void 0===D?void 0:D.type)}),[D]),Be=ge.ZP.block_templates.list({},{revalidateOnFocus:!1}).data,Le=(0,s.useMemo)((function(){return(null===Be||void 0===Be?void 0:Be.block_templates)||[]}),[Be]),Fe="PipelineDetail/index",Ue=(0,Qe.y)(),He=Ue.disableGlobalKeyboardShortcuts,Ge=Ue.registerOnKeyDown,ze=Ue.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){ze(Fe)}}),[ze,Fe]),Ge(Fe,(function(e,n,t){if(R&&(0,U.y)([B.zX,B.hS],n)){e.preventDefault();"undefined"!==typeof location&&window.confirm("You have changes that are unsaved. Click cancel and save your changes before reloading page.")&&location.reload()}if(!b&&!He)if((0,U.y)([B.zX,B.Um],n)||(0,U.y)([B.PQ,B.Um],n))e.preventDefault(),G();else if(re)n[B.vP]?ie(!1):R||B.Z1.find((function(e){return n[e]}))||$(!0);else if(!Me){if(W){var i=p.findIndex((function(e){var n=e.uuid;return W.uuid===n}));if(n[B.vP])ee(null);else if(t[0]===B.xD&&t[1]===B.xD)_();else if(t[0]===B.l1&&t[1]===B.l1&&-1!==i)m(W).then((function(e){null!==e&&void 0!==e&&e.error||setTimeout((function(){i===p.length-1?ee(p[i-1]):p.length>=0?ee(p[i+1]):ee(null)}),100)}));else if(n[B.Bu]&&i>=1){var r=p[i-1];if(r){var o,l;ee(r);var u="".concat(r.type,"s/").concat(r.uuid,".py");null===(o=a.current[u])||void 0===o||null===(l=o.current)||void 0===l||l.scrollIntoView()}}else if(n[B.kD]&&i<=Re-2){var s=p[i+1];if(s){var d,f;ee(s);var h="".concat(s.type,"s/").concat(s.uuid,".py");null===(d=a.current[h])||void 0===d||null===(f=d.current)||void 0===f||f.scrollIntoView()}}else(0,U.y)([B.Uq],n)&&ie(!0)}else De&&n[B.Uq]&&ee(De);c||t[0]!==B.OC||t[1]!==B.OC||N()}}),[n,c,a.current,p,_,Me,Re,R,N,G,W,De,$,ee,ie,re]),(0,s.useEffect)((function(){var e=setInterval((function(){R&&G()}),1e4);return function(){clearInterval(e)}}),[R,G]),(0,s.useEffect)((function(){setTimeout((function(){return he(!0)}),600)}),[D]);var We=(0,d.Db)((function(e){var n=e.block,t=e.upstreamBlocks;return ge.ZP.blocks.pipelines.useUpdate(null===D||void 0===D?void 0:D.uuid,null===n||void 0===n?void 0:n.uuid)({block:{upstream_blocks:t}})}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){x()},onErrorCallback:function(e,n){return null===K||void 0===K?void 0:K({errors:n,response:e})}})}}),Ye=(0,l.Z)(We,1)[0],qe=(0,s.useCallback)((function(e){se(!0),Ce(e),q(!0)}),[se,q,Ce]),Ke=(0,s.useCallback)((function(){se(!1),Ee(!1),Te(""),q(!1)}),[q]),Ve=(0,s.useCallback)((function(e,n){var t,i;p.forEach((function(r,o){var l=r.uuid;t>=0&&i>=0||(l===e.uuid?t=o:l===n.uuid&&(i=o))}));var r=(0,pe.oM)(p,i);return r=(0,pe.Hk)(n,Math.max(t,0),r),G({pipeline:{blocks:r,uuid:null===D||void 0===D?void 0:D.uuid}})}),[p,D,G]),Xe=(0,s.useMemo)((function(){var e=[];return p.filter((function(e){var n=e.type;return!Me||v.tf.TRANSFORMER===n})).forEach((function(l,c){var d,f=l.type,j=l.uuid,y=(null===W||void 0===W?void 0:W.uuid)===j,k=Ae[j],O=k?0===k.priority?_n.uF.BUSY:_n.uF.QUEUED:_n.uF.IDLE,C="".concat(f,"s/").concat(j,".py");a.current[C]=(0,s.createRef)();var R=f===v.tf.MARKDOWN,M=f===v.tf.TRANSFORMER,N=!(null===Z||void 0===Z||!Z[j]),B=c===Re-1||Me,F=a.current[C];d=N?(0,S.jsx)(Jr,{block:l,blocks:p,onClick:function(){return X((function(e){return Lo(Lo({},e),{},(0,o.Z)({},j,!N))}))},onDrop:Ve,ref:F},j):(0,S.jsx)(Tr,{addNewBlock:function(e,t){ie(!0);return n(e,c+1,(function(e){if(1===(null===t||void 0===t?void 0:t.length)){var n=t[0];Ye({block:{uuid:n},upstreamBlocks:[e.uuid]})}null===ee||void 0===ee||ee(e)}))},addNewBlockMenuOpenIdx:ke,addWidget:t,allBlocks:i,allowCodeBlockShortcuts:r,autocompleteItems:u,block:l,blockIdx:c,blockRefs:a,blockTemplates:Le,blocks:p,dataProviders:h,defaultValue:l.content,deleteBlock:function(e){m(e),Y(!1)},disableShortcuts:b,executionState:O,fetchFileTree:g,fetchPipeline:x,hideRunButton:Ne||R||Me&&M,interruptKernel:_,mainContainerRef:P,mainContainerWidth:E,messages:w[j],noDivider:B,onCallbackChange:function(e){return I(f,j,e)},onChange:function(e){return T(f,j,e)},onClickAddSingleDBTModel:qe,onDrop:Ve,openSidekickView:A,pipeline:D,ref:F,runBlock:L,runningBlocks:H,savePipelineContent:G,selected:y,setAddNewBlockMenuOpenIdx:Ze,setAnyInputFocused:Y,setCreatingNewDBTModel:Ee,setEditingBlock:Q,setErrors:K,setOutputBlocks:J,setSelected:function(e){return ee(!0===e?l:null)},setSelectedOutputBlock:ne,setTextareaFocused:ie,textareaFocused:y&&re,widgets:oe},j),e.push(d)})),e}),[n,ke,t,i,r,u,a,Le,p,h,m,b,g,x,Z,_,Me,Ne,P,E,w,Re,I,T,qe,Ve,A,D,L,H,Ae,G,W,Ze,Y,Q,K,X,J,ee,ne,ie,re,Ye,oe]),Je=(0,s.useMemo)((function(){return(0,S.jsx)(No,{addNewBlockAtIndex:n,blocks:p,codeBlocks:Xe,fetchFileTree:g,fetchPipeline:x,fetchSampleData:j,globalVariables:k,onChangeCodeBlock:T,openSidekickView:A,pipeline:D,savePipelineContent:G,setErrors:K,setIntegrationStreams:V,setOutputBlocks:J,setSelectedBlock:ee,setSelectedOutputBlock:ne,setSelectedStream:te})}),[n,p,Xe,g,x,j,k,T,A,D,G,K,V,J,ee,ne,te]),en=(0,s.useMemo)((function(){return(0,S.jsx)(ft,{addNewBlock:function(e){var t=p[p.length-1],i=null,r={},o=t?(0,Wi.eY)(t,e):[];t&&([v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(t.type)&&v.tf.SCRATCHPAD===e.type&&(i="from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(D.uuid,"', '").concat(t.uuid,"', 'output_0')\n")),v.t6.SQL===t.language&&(r=Lo(Lo({},(0,xe.GL)(t.configuration,[oi,li,ci,ui,fi])),r))),v.t6.SQL===e.language&&(i=ut(i)),i=at(e,i),n(Lo(Lo({},e),{},{configuration:r,content:i,upstream_blocks:o}),Re,ee),ie(!0)},blockTemplates:Le,hideCustom:Me||Ne,hideDataExporter:Me,hideDataLoader:Me,hideDbt:Me||Ne,hideScratchpad:Me,hideSensor:Me,onClickAddSingleDBTModel:qe,pipeline:D,setCreatingNewDBTModel:Ee})}),[n,Le,p,Me,Ne,Re,qe,D,ee,ie]);return(0,S.jsxs)(Pn.W,{backend:Sn.PD,children:[(0,S.jsx)(dn,{children:ve&&(0,S.jsx)(Cn.Z,{classNames:"pipeline-detail",in:fe,onEntered:function(){return setTimeout((function(){return be(!1)}),sn)},timeout:1,children:(0,S.jsx)(fn,{})})}),(0,S.jsxs)(O.Z,{mt:1,px:C.cd,children:[Me&&Je,!Me&&(0,S.jsxs)(S.Fragment,{children:[Xe,(0,S.jsx)(O.Z,{mt:C.cd,children:en})]}),ae&&(0,S.jsx)($e.Z,{onClickOutside:Ke,open:!0,children:(0,S.jsx)(zr,{blocks:p,creatingNewDBTModel:Se,dbtModelName:Ie,files:y,onClose:Ke,onOpenFile:function(e){var t=e;if(Se){var i=(0,ce.RA)(Ie||(0,ce.Y6)()),r=".".concat(z.SQL);i.endsWith(r)&&(i=i.slice(0,-4)),t="".concat(e).concat(le.sep).concat(i,".").concat(z.SQL)}var o={configuration:{file_path:t,limit:1e3},language:v.t6.SQL,name:(0,ce.wE)(t),type:v.tf.DBT};Se&&(o.content="--Docs: https://docs.mage.ai/dbt/sources\n");var l="undefined"===typeof _e||null===_e,c=p[l?p.length-1:_e],u=c?(0,Wi.eY)(c,o):[];n(Lo(Lo({},o),{},{upstream_blocks:u}),l?Re:_e+1,ee),Ke(),ie(!0)},setDbtModelName:Te})})]})]})},Uo=t(49894),Ho=t(41424),Go=t(32063),zo=t(70543),Wo=t(24141);function Yo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function qo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Yo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Yo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Qo=function(e){var n=e.after,t=e.afterHeader,i=e.afterHeightOffset,r=e.afterHidden,o=e.afterNavigationItems,c=e.afterOverflow,u=e.afterSubheader,a=e.before,d=e.beforeHeader,f=e.beforeHeightOffset,p=e.beforeNavigationItems,h=e.children,m=e.errors,v=e.headerOffset,b=e.mainContainerHeader,g=e.mainContainerRef,x=e.page,j=e.pipeline,y=e.setAfterHidden,k=e.setAfterWidthForChildren,Z=e.setErrors,O=e.setMainContainerWidth,_=(0,Wo.i)().width,C=(0,s.useState)((0,F.U2)(F.L8,un.Zt)),P=C[0],E=C[1],w=(0,s.useState)((0,F.U2)(F.J3,un.ve)),I=w[0],T=w[1],A=(0,s.useState)(!!(0,F.U2)(F.Uu)),D=A[0],R=A[1],M=(0,s.useState)(!1),N=M[0],B=M[1],L=(0,s.useState)(!1),U=L[0],H=L[1],G=r,z=y;if(!z){var W=(0,s.useState)(!!(0,F.U2)(F.zg)),Y=(0,l.Z)(W,2);G=Y[0],z=Y[1]}(0,s.useEffect)((function(){null===g||void 0===g||!g.current||N||U||null===O||void 0===O||O(g.current.getBoundingClientRect().width)}),[N,U,G,P,D,I,g,O,_]),(0,s.useEffect)((function(){N||(null===k||void 0===k||k(P),(0,F.t8)(F.L8,P))}),[N,P,k]),(0,s.useEffect)((function(){U||(0,F.t8)(F.J3,I)}),[U,I]);var q=ge.ZP.projects.list({},{revalidateOnFocus:!1}).data,Q=null===q||void 0===q?void 0:q.projects,K=(0,s.useMemo)((function(){var e,n=[{label:function(){return"Pipelines"},linkProps:{as:"/pipelines",href:"/pipelines"}}];return j&&(n.push.apply(n,[{bold:zo.b7!==x,label:function(){return null===j||void 0===j?void 0:j.uuid},linkProps:{as:"/pipelines/".concat(null===j||void 0===j?void 0:j.uuid),href:"/pipelines/[pipeline]"}}]),zo.b7===x&&n.push.apply(n,[{bold:!0,label:function(){return(0,ce.kC)(x)}}])),(0,S.jsx)(Ho.Z,{breadcrumbs:n,project:null===Q||void 0===Q?void 0:Q[0],version:null===Q||void 0===Q||null===(e=Q[0])||void 0===e?void 0:e.version})}),[x,j,Q]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(xn.Z,{title:null===j||void 0===j?void 0:j.name}),(0,S.jsx)(Go.Z,{after:n,afterHeader:t,afterHeightOffset:i,afterHidden:G,afterMousedownActive:N,afterNavigationItems:o,afterOverflow:c,afterSubheader:u,afterWidth:P,before:a,beforeHeader:d,beforeHeightOffset:f,beforeHidden:D,beforeMousedownActive:U,beforeNavigationItems:p,beforeWidth:I,header:K,headerOffset:v,mainContainerHeader:b,mainContainerRef:g,navigationShowMore:!0,setAfterHidden:z,setAfterMousedownActive:B,setAfterWidth:E,setBeforeHidden:R,setBeforeMousedownActive:H,setBeforeWidth:T,children:h}),m&&(0,S.jsx)($e.Z,{disableClickOutside:!0,isOpen:!0,onClickOutside:function(){return Z(null)},children:(0,S.jsx)(Uo.Z,qo(qo({},m),{},{onClose:function(){return Z(null)}}))})]})},Ko=t(41788),Vo=t(70001),Xo=t(26226),Jo=t(29989),$o=t(53655),el=t(84181),nl=t(31969);function tl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function il(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?tl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):tl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var rl=b.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 ol(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function ll(e,n){return Math.min.apply(Math,(0,r.Z)(e.map(n)))}var cl=function(e){return e.bins},ul=function(e){return e.count},al={top:0,left:0,right:0,bottom:0};function sl(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)(b.ThemeContext)),a=(u.monotone||nl.Z.monotone).grey300,d=(u.brand||nl.Z.brand).wind400,f=(u.content||nl.Z.content).default,p=(u.monotone||nl.Z.monotone).white,h=il(il({},al),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=ol(m,(function(e){return ol(cl(e),ul)})),g=ll(m,(function(e){return ll(cl(e),ul)})),x=ol(m,(function(e){return cl(e).length})),j="undefined"!==typeof n?n:0,y="undefined"!==typeof l?l:g,k=(0,el.Z)({domain:[0,m.length]}),Z=(0,el.Z)({domain:[0,x]}),O=(0,el.Z)({range:[a,d],domain:[j,v]}),_=(0,el.Z)({range:[.1,1],domain:[j,v]}),C=(0,el.Z)({range:[a,d],domain:[y,j]}),P=(0,el.Z)({range:[1,.1],domain:[y,j]}),E=c-(h.left+h.right),w=i-(h.bottom+h.top),I=E/m.length,T=w/x;return k.range([0,E]),Z.range([w,0]),c<10?null:(0,S.jsx)(S.Fragment,{children:(0,S.jsx)("svg",{width:c,height:i,children:(0,S.jsx)(Jo.Z,{left:h.left,top:h.top,children:(0,S.jsx)($o.Z,{data:m,xScale:k,yScale:Z,colorScale:O,opacityScale:_,binWidth:I,binHeight:I,gap:0,children:function(e){return e.map((function(e){return e.map((function(e){var t=e.opacity,i=e.color;return"undefined"!==typeof n&&e.count<n&&(t=P(e.count),i=C(e.count)),(0,S.jsxs)("svg",{height:T,width:I,x:e.x,y:e.y-T,children:[(0,S.jsx)("rect",{className:"visx-heatmap-rect",fill:i,fillOpacity:t,height:T,width:I}),(0,S.jsx)("text",{alignmentBaseline:"middle",fill:e.count>=.8*v?p:f,fontFamily:cr.ry,fontSize:14,textAnchor:"middle",x:"50%",y:"50%",children:e.count})]},"heatmap-rect-".concat(e.row,"-").concat(e.column))}))}))}})})})})}var dl=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*C.iI,f=8*C.iI,p=0;return u&&(p+=d+1*C.iI),a&&(p+=f+1*C.iI),(0,S.jsxs)(S.Fragment,{children:[(l||c)&&(0,S.jsx)("div",{style:{marginBottom:null===r||void 0===r?void 0:r.bottom,marginLeft:null===r||void 0===r?void 0:r.left,marginRight:null===r||void 0===r?void 0:r.right,marginTop:null===r||void 0===r?void 0:r.top,paddingLeft:p},children:(0,S.jsxs)(O.Z,{mb:{xs:1},children:[l&&(0,S.jsx)(O.Z,{mb:1,children:(0,S.jsx)(_.ZP,{center:!0,muted:!0,xsmall:!0,children:l})}),c&&(0,S.jsx)(k.Z,{children:c.map((function(e){var n=e.label,t=e.linkProps;return(0,S.jsx)(y.Z,{flex:"1",justifyContent:"center",children:t?(0,S.jsx)(Z.Z,{bold:!0,centerAlign:!0,minWidth:70,onClick:t.onClick,xsmall:!0,children:n}):(0,S.jsx)(_.ZP,{bold:!0,center:!0,minWidth:70,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})]})}),(0,S.jsxs)("div",{style:{height:i,display:"flex",width:"100%"},children:[u&&(0,S.jsx)("div",{style:{marginRight:1*C.iI,width:d},children:(0,S.jsx)(k.Z,{alignItems:"center",justifyContent:"center",children:(0,S.jsx)(rl,{children:(0,S.jsx)(_.ZP,{center:!0,muted:!0,xsmall:!0,children:u})})})}),a&&(0,S.jsx)("div",{style:{marginRight:1*C.iI},children:(0,S.jsx)(k.Z,{alignItems:"center",flexDirection:"column",fullHeight:!0,width:f,children:a.map((function(e){var n=e.label,t=e.linkProps;return(0,S.jsx)(y.Z,{alignItems:"center",flex:"1",children:t?(0,S.jsx)(Z.Z,{bold:!0,centerAlign:!0,onClick:t.onClick,xsmall:!0,children:n}):(0,S.jsx)(_.ZP,{bold:!0,center:!0,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})}),(0,S.jsx)("div",{style:{height:i,width:"100%"},children:(0,S.jsx)(Xo.Z,{children:function(e){var i=e.width,l=e.height;return(0,S.jsx)(sl,{countMidpoint:n,data:t,height:l,margin:r,minCount:o,width:i,yLabels:a})}})})]})]})},fl=t(11754);var pl=function(e){var n=e.afterWidth,t=e.features,i=e.insightsOverview,r=e.statistics,o=i.correlations,c=void 0===o?[]:o,u=n-(2*C.cd*C.iI+an.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,ce.QV)(n)}));return o.splice(t,0,1),o})),xyLabels:n}}(c),s=a.heatmapData,d=a.xyLabels,f=function(e,n){return(0,pe.YC)(null===e||void 0===e?void 0:e.map((function(e){return{feature:e,value:1-n["".concat(e.uuid,"/null_value_rate")]}})),"value")}(t,r),p=function(e,n){return(0,pe.YC)(null===e||void 0===e?void 0:e.map((function(e){return{feature:e,value:n["".concat(e.uuid,"/count_distinct")]}})),"value")}(t,r),h=function(e,n){return(0,pe.YC)(null===e||void 0===e?void 0:e.map((function(e){var t=Object.entries(n["".concat(e.uuid,"/value_counts")]||{})[0]||[],i=(0,l.Z)(t,2),r=i[0],o=i[1];return{feature:e,percentage:Number(o)/n.count,value:r}})),"percentage")}(t,r);return(0,S.jsxs)(k.Z,{flexDirection:"column",children:[(null===f||void 0===f?void 0:f.length)>=1&&(0,S.jsx)(fl.Z,{headerTitle:"Data completion",width:u,children:(0,S.jsx)(Vo.Z,{data:f.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*C.iI,50*C.iI),renderTooltipContent:function(e){var n=e.x;return"".concat((0,ce.T3)(n)," of rows have a value")},xNumTicks:2,ySerialize:function(e){return e.y}})}),(null===p||void 0===p?void 0:p.length)>=1&&(0,S.jsx)(fl.Z,{headerTitle:"Number of unique values",width:u,children:(0,S.jsx)(Vo.Z,{data:p.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*C.iI,50*C.iI),renderTooltipContent:function(e){var n=e.x;return"".concat(n," unique values")},xNumTicks:2,ySerialize:function(e){return e.y}})}),h.length>=1&&(0,S.jsx)(fl.Z,{headerTitle:"Distribution of values",width:u,children:(0,S.jsx)(Vo.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*C.iI,50*C.iI),renderTooltipContent:function(e){var n=e.value,t=e.x;return"".concat(n," is ").concat((0,ce.T3)(t)," of all rows")},xNumTicks:2,ySerialize:function(e){return e.y}})}),c&&(null===s||void 0===s?void 0:s.length)>=1&&(0,S.jsx)(fl.Z,{headerTitle:"Correlations",children:(0,S.jsx)(O.Z,{p:1,children:(0,S.jsx)(dl,{countMidpoint:0,data:s,height:8*C.iI*d.length,minCount:-1,xLabels:d,yLabels:d})})})]})};function hl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ml(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?hl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):hl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var vl=function(e){var n,t,i=e.block,r=e.blockActionDescription,o=e.blocks,l=e.inputPlaceholder,c=e.loading,u=e.onClickTag,a=e.runBlockAndTrack,d=e.supportedUpstreamBlockLanguages,f=e.supportedUpstreamBlockTypes,p=e.updateBlock,h=(0,s.useContext)(b.ThemeContext),m=(0,s.useState)(""),v=m[0],Z=m[1],E=(0,s.useState)(!1),w=E[0],I=E[1],A=(0,s.useState)(null),D=A[0],R=A[1],M=(0,s.useMemo)((function(){return(0,pe.HK)(o,(function(e){return e.uuid}))}),[o]);(0,s.useEffect)((function(){D||R((0,pe.HK)((null===i||void 0===i?void 0:i.upstream_blocks)||[],(function(e){return e})))}),[i,D]);var B=(0,s.useMemo)((function(){return(null===o||void 0===o?void 0:o.filter((function(e){var n=e.name,t=e.type,i=e.uuid;return((null===n||void 0===n?void 0:n.toLowerCase().includes(null===v||void 0===v?void 0:v.toLowerCase()))||(null===i||void 0===i?void 0:i.toLowerCase().includes(null===v||void 0===v?void 0:v.toLowerCase())))&&(null===f||void 0===f?void 0:f.includes(t))})))||[]}),[v,o,f]),L=(0,s.useMemo)((function(){var e=[];return null===B||void 0===B||B.forEach((function(n,t){var i=n.color,r=n.language,o=n.type,l=n.uuid,c=(0,P.qn)(o,{blockColor:i,theme:h}).accent;t>=1&&e.push((0,S.jsx)(j.Z,{light:!0},"divider-".concat(l)));var u=!(null===D||void 0===D||!D[l]),a=null!==d&&"undefined"!==typeof d&&!(null!==d&&void 0!==d&&d.includes(r));e.push((0,S.jsx)(O.Z,{px:2,py:1,children:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(x.Z,{color:c,size:1.5*C.iI,square:!0}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(_.ZP,{monospace:!0,muted:a,small:!0,children:l})]}),a&&(0,S.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:[r," support coming soon"]}),!a&&(0,S.jsx)(g.Z,{checked:!a&&u,disabled:a,onClick:function(){R((function(e){var n=ml({},e);return u?delete n[l]:n[l]=l,n}))}})]})},"option-".concat(l)))})),e}),[B,h,D]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)($e.Z,{onClickOutside:function(){return I(!1)},open:!0,children:[(0,S.jsx)(N.Z,{beforeIcon:(0,S.jsx)(ie.HN,{}),borderless:!0,compact:!0,onChange:function(e){return Z(e.target.value)},onClick:function(e){(0,pr.j)(e),I(!0)},onFocus:function(e){(0,pr.j)(e),I(!0)},placeholder:l,small:!0,value:v}),w&&(0,S.jsxs)(S.Fragment,{children:[L,(0,S.jsx)(O.Z,{mx:1,children:(0,S.jsx)(k.Z,{justifyContent:"flex-end",children:(0,S.jsx)(T.Z,{compact:!0,loading:c,onClick:function(){return p({block:i,upstream_blocks:Object.keys(D)}).then((function(){return I(!1)}))},small:!0,children:"Save selected blocks"})})})]})]}),!w&&(null===i||void 0===i||null===(n=i.upstream_blocks)||void 0===n?void 0:n.length)>=1&&(0,S.jsxs)(O.Z,{pb:1,pr:1,children:[r&&(0,S.jsx)(O.Z,{mt:1,pl:1,children:(0,S.jsx)(_.ZP,{muted:!0,small:!0,children:r})}),(0,S.jsx)(k.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===M||void 0===M?void 0:M[e];if(!n)return(0,S.jsx)("div",{},e);var t=n.color,r=n.type,o=(0,P.qn)(r,{blockColor:t,theme:h}).accentLight;return(0,S.jsx)(O.Z,{ml:1,mt:1,children:(0,S.jsx)(T.Z,{backgroundColor:o,compact:!0,disabled:!a,onClick:function(e){(0,pr.j)(e),u?u(n):null===a||void 0===a||a({block:ml(ml({},i),{},{upstream_blocks:[null===n||void 0===n?void 0:n.uuid]})})},small:!0,children:(0,S.jsx)(_.ZP,{monospace:!0,small:!0,children:e})})},e)}))})]})]})},bl=t(59e3);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 xl(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,o.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}var jl=function(e){var n=e.addNewBlockAtIndex,t=e.autocompleteItems,i=e.blockRefs,r=e.blocks,c=e.blocksInNotebook,u=e.deleteBlock,a=e.fetchFileTree,f=e.fetchPipeline,p=e.interruptKernel,h=e.messages,m=e.onChangeCallbackBlock,b=e.onChangeCodeBlock,g=e.onSelectBlockFile,x=e.pipeline,j=e.runBlock,y=e.runningBlocks,k=e.savePipelineContent,P=e.selectedBlock,E=e.setAnyInputFocused,w=e.setErrors,I=e.setHiddenBlocks,T=e.setSelectedBlock,A=e.setTextareaFocused,R=e.textareaFocused,M=(0,s.useRef)(null),N=(0,s.useState)(!1),L=N[0],F=N[1],H=(0,bl.iV)().block_uuid;(0,s.useEffect)((function(){var e=r.find((function(e){var n,t=e.uuid;return(null===H||void 0===H||null===(n=H.split(":"))||void 0===n?void 0:n[0])===t}));e&&(P&&(null===e||void 0===e?void 0:e.uuid)===(null===P||void 0===P?void 0:P.uuid)||(I((function(n){return xl(xl({},n),{},(0,o.Z)({},e.uuid,!1))})),g(e.uuid,e.type,null)))}),[H,r,g,P,I]);var G=(x||{}).type,z=(0,s.useMemo)((function(){return(null===x||void 0===x?void 0:x.callbacks)||[]}),[x]),W=(0,s.useMemo)((function(){return(0,pe.HK)(z,(function(e){return e.uuid}))}),[z]),Y=ge.ZP.block_templates.list({},{revalidateOnFocus:!1}).data,q=(0,s.useMemo)((function(){return(null===Y||void 0===Y?void 0:Y.block_templates)||[]}),[Y]),Q=(0,s.useCallback)((function(e){return n(e,(null===z||void 0===z?void 0:z.length)||0)}),[n,z]),K=(0,s.useMemo)((function(){return it(q,Q)}),[Q,q]),V=(0,s.useMemo)((function(){return rt(Q,v.tf.CALLBACK,G,{blockTemplatesByBlockType:K,languages:[v.t6.PYTHON]})}),[Q,K,G]),X=(0,s.useMemo)((function(){return W[null===P||void 0===P?void 0:P.uuid]}),[W,P]),J=(0,s.useMemo)((function(){return y.reduce((function(e,n,t){return xl(xl({},e),{},(0,o.Z)({},n.uuid,xl(xl({},n),{},{priority:t})))}),{})}),[y]),$=(0,d.Db)((function(e){var n=e.block,t=e.upstream_blocks;return ge.ZP.blocks.pipelines.useUpdate(null===x||void 0===x?void 0:x.uuid,encodeURIComponent(null===n||void 0===n?void 0:n.uuid),{query:{block_type:null===n||void 0===n?void 0:n.type}})({block:{upstream_blocks:t}})}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){f()},onErrorCallback:function(e,n){return null===w||void 0===w?void 0:w({errors:n,response:e})}})}}),ee=(0,l.Z)($,2),ne=ee[0],te=ee[1].isLoading,re=(0,s.useMemo)((function(){return z.map((function(e,n){var l=e.type,d=e.uuid,Z=(null===P||void 0===P?void 0:P.uuid)===d,_=J[d],D=_?0===_.priority?_n.uF.BUSY:_n.uF.QUEUED:_n.uF.IDLE,M="".concat(l,"s/").concat(d,".py");return i.current[M]=(0,s.createRef)(),(0,S.jsx)(O.Z,{mt:C.cd,children:(0,S.jsx)(Tr,{allBlocks:r,autocompleteItems:t,block:e,blockIdx:n,blockRefs:i,blocks:r,defaultValue:e.content,deleteBlock:function(e){u(xl({},e)),E(!1)},executionState:D,extraContent:(0,S.jsx)(vl,{block:e,blocks:c,inputPlaceholder:"Select blocks to add callbacks to",loading:te,onClickTag:function(e){I((function(n){return xl(xl({},n),{},(0,o.Z)({},e.uuid,!1))})),g(e.uuid,e.type,null)},supportedUpstreamBlockTypes:[v.tf.CUSTOM,v.tf.DATA_EXPORTER,v.tf.DATA_LOADER,v.tf.DBT,v.tf.SCRATCHPAD,v.tf.SENSOR,v.tf.TRANSFORMER],updateBlock:ne}),fetchFileTree:a,fetchPipeline:f,hideRunButton:!0,interruptKernel:p,messages:h[d],noDivider:!0,onCallbackChange:function(e){return m(l,d,e)},onChange:function(e){return b(l,d,e)},pipeline:x,ref:i.current[M],runBlock:j,runningBlocks:y,savePipelineContent:k,selected:Z,setAnyInputFocused:E,setErrors:w,setSelected:function(n){return T(!0===n?e:null)},setTextareaFocused:A,textareaFocused:Z&&R})},d)}))}),[t,i,r,c,z,u,a,f,p,te,h,m,b,g,x,j,y,J,k,P,E,w,I,T,A,R,ne]),oe="Callbacks/index",le=(0,Qe.y)(),ce=le.disableGlobalKeyboardShortcuts,ue=le.registerOnKeyDown,ae=le.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){ae(oe)}}),[ae,oe]),ue(oe,(function(e,n){!ce&&X&&((0,U.y)([B.zX,B.Um],n)||(0,U.y)([B.PQ,B.Um],n))&&(e.preventDefault(),k())}),[X,k]),(0,S.jsx)(Pn.W,{backend:Sn.PD,children:(0,S.jsxs)(O.Z,{p:C.cd,children:[(0,S.jsxs)(O.Z,{mb:C.cd,children:[(0,S.jsx)(_.ZP,{default:!0,children:"Run 1 or more callback block functions whenever another block succeeds or fails."}),(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsxs)(_.ZP,{default:!0,children:["Learn more about ",(0,S.jsx)(Z.Z,{href:"https://docs.mage.ai/development/blocks/callbacks/overview",openNewWindow:!0,children:"callbacks"}),"."]})})]}),re,(0,S.jsx)(O.Z,{mt:C.cd,children:(0,S.jsx)($e.Z,{onClickOutside:function(){return F(!1)},open:!0,children:(0,S.jsx)(Mn.Z,{disableKeyboardShortcuts:!0,items:V,onClickCallback:function(){return F(!1)},open:L,parentRef:M,uuid:"Callback",children:(0,S.jsx)(D.ZP,{beforeElement:(0,S.jsx)(Ln,{rose:!0,children:(0,S.jsx)(ie.mm,{size:Bn})}),inline:!0,onClick:function(e){e.preventDefault(),F(!0)},uuid:"AddNewBlocks/Callback",children:"Callback block"})})})})]})})},yl=t(92083),kl=t.n(yl),Zl=t(84969),Ol=t(90948),_l=t(65743),Cl=t(39048),Pl=t(79487),Sl=t(61655),El=t(16853),wl=t(65376),Il=t(52359),Tl=t(48072),Al=t(24903),Dl=t(98677),Rl=t(73899);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,o.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 Bl={bottom:C.iI*(3+C.cd),left:C.iI*C.cd,right:C.iI*C.cd,top:C.iI*C.cd};function Ll(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function Fl(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)(b.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?ur.iD:ur.J5,x=Nl(Nl({},Bl),c),j=n.slice(Math.max(0,n.length-50)),y=(0,s.useMemo)((function(){return Object.keys((null===j||void 0===j?void 0:j[0])||{}).filter((function(e){return e!==i}))}),[j,i]),k=(0,Al.Z)({domain:y,range:[Rl.a$,Rl.Ej,Rl.hM,Rl.ZA,Rl.$R,Rl.X_,Rl.er,Rl.hl,Rl.nQ]}),Z=(0,s.useMemo)((function(){return j.map(m)}),[j,m]),O=(0,Dl.Z)({domain:Z,padding:.1}),_=(0,Dl.Z)({domain:y,padding:.1}),C=(0,el.Z)({domain:[0,Ll(j,(function(e){return Ll(y,(function(n){return Number(e[n])}))}))]}),P={active:(null===h||void 0===h?void 0:h.content.default)||Ce.Z.content.default,backgroundPrimary:(null===h||void 0===h?void 0:h.chart.backgroundPrimary)||Ce.Z.chart.backgroundPrimary,backgroundSecondary:(null===h||void 0===h?void 0:h.chart.backgroundSecondary)||Ce.Z.chart.backgroundSecondary,muted:(null===h||void 0===h?void 0:h.content.muted)||Ce.Z.content.muted,primary:(null===h||void 0===h?void 0:h.chart.primary)||Ce.Z.chart.primary,tooltipBackground:(null===h||void 0===h?void 0:h.background.navigation)||Ce.Z.background.navigation},S=Z;a&&(S=j.reduce((function(e,n){return e.concat(y.map((function(e){var t=n[e];return(0,ce.HW)(t)?parseInt(String(t)):t})))}),[]));var E=Math.min(Math.max.apply(Math,(0,r.Z)(S.map((function(e){return String(e).length})))),20);x.left+=7*E;var w=f-(x.left+x.right),I=t-(x.top+x.bottom);a?(O.rangeRound([0,w]),C.rangeRound([I,0])):(O.rangeRound([I,0]),C.rangeRound([0,w])),_.rangeRound([0,O.bandwidth()]);var T=j.map(m).length,A=0;a||(A=O(S[T-1]));var D=(0,s.useCallback)((function(e){var n=(0,Tl.Z)(e)||{x:0,y:0},t=n.x,i=n.y,r=t-x.left,o=i-x.top,l=0;l=a?(r-A/2)/(w-A):1-(o-A/2)/(I-A);var c=Math.floor(l*T),u=j[c];"undefined"===typeof u&&(u=j[c-1]),a?r>A&&r<w+x.left-A&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i}):o>A&&o<I-A&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i})}),[j,T,x.left,x.top,a,d,A,w,I]);return{colorScale:k,colors:P,data:j,fontSize:g,handleTooltip:D,margin:x,tempScale:C,tickValues:S,xKeys:y,xMax:w,y1Scale:_,yLabelFormat:v,yMax:I,yScale:O,ySerialize:m}}var Ul=["height","width","xAxisLabel","yAxisLabel"];function Hl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Gl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Hl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Hl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var zl=3*C.iI,Wl=(C.iI,C.iI,C.iI,(0,Sl.Z)((function(e){var n=e.data,t=e.height,i=e.hideTooltip,r=e.keyForYData,o=void 0===r?"__y":r,c=e.large,u=e.margin,a=void 0===u?{}:u,s=e.renderNoDataText,d=e.renderTooltipContent,f=e.showTooltip,p=e.tooltipData,h=e.tooltipLeft,m=e.tooltipOpen,v=e.tooltipTop,b=e.width,g=e.xAxisLabel,x=e.xNumTicks,j=e.yLabelFormat,y=Fl({data:n,height:t,keyForYData:o,large:c,margin:a,showTooltip:f,width:b,yLabelFormat:j}),k=y.colorScale,Z=y.colors,O=y.data,C=y.fontSize,P=y.handleTooltip,E=y.margin,w=y.tempScale,I=y.tickValues,T=y.xKeys,A=y.xMax,D=y.y1Scale,R=y.yLabelFormat,M=y.yMax,N=y.yScale,B=y.ySerialize,L=[],F=Math.floor((null===I||void 0===I?void 0:I.length)/Math.floor(t/zl));return null===I||void 0===I||I.forEach((function(e,n){n%F===0&&L.push(e)})),b<10?null:(0,S.jsxs)("div",{children:[(0,S.jsxs)("svg",{height:t,width:b,children:[s&&!(null!==O&&void 0!==O&&O.length)&&(0,S.jsx)("text",{fill:Z.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:cr.ry,fontSize:C,x:"50%",y:"50%",children:s()}),(0,S.jsx)(_l.Z,{fill:"transparent",height:t-(E.top+E.bottom),onMouseLeave:function(){return i()},onMouseMove:P,onTouchMove:P,onTouchStart:P,rx:14,width:b-(E.left+E.right),x:E.left,y:E.top}),(null===O||void 0===O?void 0:O.length)&&(0,S.jsxs)(Jo.Z,{left:E.left,top:E.top,children:[(0,S.jsx)(Cl.Z,{color:k,data:O,keys:T,width:A,xScale:w,y0:B,y0Scale:N,y1Scale:D,children:function(e){return e.map((function(e){return(0,S.jsx)(Jo.Z,{top:e.y0,children:e.bars.map((function(n){return(0,S.jsx)("g",{children:(0,S.jsx)(S.Fragment,{children:(0,S.jsx)("rect",{fill:n.color,height:n.height,pointerEvents:"none",rx:4,width:n.width,x:n.x,y:n.y})})},"".concat(e.index,"-").concat(n.index,"-").concat(n.key))}))},"bar-group-horizontal-".concat(e.index,"-").concat(e.y0))}))}}),(0,S.jsx)(Zl.Z,{hideTicks:!0,scale:N,stroke:Z.muted,tickFormat:function(e){return R(e)},tickLabelProps:function(){return{fill:Z.active,fontFamily:cr.ry,fontSize:C,style:{width:"10px"},textAnchor:"end"}},tickStroke:Z.muted,tickValues:L,top:2}),(0,S.jsx)(Ol.Z,{label:g,labelProps:{fill:Z.muted,fontFamily:cr.ry,fontSize:C,textAnchor:"middle"},numTicks:x,scale:w,stroke:Z.muted,tickLabelProps:function(){return{fill:Z.active,fontFamily:cr.ry,fontSize:C,textAnchor:"middle"}},tickStroke:Z.muted,top:M})]}),p&&(0,S.jsx)("g",{children:(0,S.jsx)(Pl.Z,{from:{x:E.left,y:v},pointerEvents:"none",stroke:Z.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:A+E.left,y:v}})})]}),m&&p&&(0,S.jsxs)(El.Z,{left:h,style:Gl(Gl({},wl.j),{},{backgroundColor:Z.tooltipBackground}),top:v,children:[d&&d(p),!d&&Object.entries(p).map((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];if(o!==t){var r=i;return(0,ce.HW)(r)&&String(r).split(".").length>=2&&(r=r.toFixed(4)),(0,S.jsxs)(_.ZP,{inverted:!0,small:!0,children:[t,": ",r]},t)}}))]})]})})));var Yl=function(e){var n,t=e.height,i=e.width,r=e.xAxisLabel,o=e.yAxisLabel,l=(0,q.Z)(e,Ul);return n="undefined"===typeof i?"100%":o?0===i?i:i-28:i,(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{style:{display:"flex",height:t,marginBottom:r?C.iI:null,width:"100%"},children:[o&&(0,S.jsx)(k.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,S.jsx)(Il.Z,{children:(0,S.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:o})})}),(0,S.jsx)("div",{style:{height:t,width:n},children:(0,S.jsx)(Xo.Z,{children:function(e){var n=e.width,t=e.height;return(0,S.jsx)(Wl,Gl(Gl({},l),{},{height:t,width:n}))}})})]}),r&&(0,S.jsx)("div",{style:{paddingLeft:o?36:0,paddingTop:4},children:(0,S.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:r})})]})},ql=t(95422),Ql=["keyForYData"],Kl=["height","width","xAxisLabel","yAxisLabel"];function Vl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Xl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Vl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Vl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Jl=6*C.iI,$l=(0,Sl.Z)((function(e){var n=e.keyForYData,t=void 0===n?"__y":n,i=(0,q.Z)(e,Ql),r=i.height,o=i.hideTooltip,c=i.renderNoDataText,u=i.renderTooltipContent,a=i.tooltipData,s=i.tooltipLeft,d=i.tooltipOpen,f=i.tooltipTop,p=i.width,h=i.xLabelFormat,m=i.xNumTicks,v=i.yNumTicks,b=Fl(Xl(Xl({},i),{},{keyForYData:t,orientationVertical:!0})),g=b.colorScale,x=b.colors,j=b.data,y=b.fontSize,k=b.handleTooltip,Z=b.margin,O=b.tempScale,C=(b.tickValues,b.xKeys),P=(b.xMax,b.y1Scale),E=b.yLabelFormat,w=b.yMax,I=b.yScale,T=b.ySerialize,A=Math.min(m,p/Jl);return p<10?null:(0,S.jsxs)("div",{children:[(0,S.jsxs)("svg",{height:r,width:p,children:[c&&!(null!==j&&void 0!==j&&j.length)&&(0,S.jsx)("text",{fill:x.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:cr.ry,fontSize:y,x:"50%",y:"50%",children:c()}),(null===j||void 0===j?void 0:j.length)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_l.Z,{fill:"transparent",height:r-(Z.top+Z.bottom),onMouseLeave:function(){return o()},onMouseMove:k,onTouchMove:k,onTouchStart:k,rx:14,width:p-(Z.left+Z.right),x:Z.left,y:2*Z.top}),(0,S.jsxs)(Jo.Z,{top:Z.top,children:[(0,S.jsx)(ql.Z,{color:g,data:j,height:w,keys:C,x0:T,x0Scale:I,x1Scale:P,yScale:O,children:function(e){return e.map((function(e){return(0,S.jsx)(Jo.Z,{left:e.x0+Z.left,top:Z.top,children:e.bars.map((function(n){return(0,S.jsx)("g",{children:(0,S.jsx)("rect",{fill:n.color,height:n.height,pointerEvents:"none",rx:4,width:n.width,x:n.x,y:n.y})},"".concat(e.index,"-").concat(n.index,"-").concat(n.key))}))},"bar-group-horizontal-".concat(e.index,"-").concat(e.x0))}))}}),(0,S.jsx)(Zl.Z,{left:Z.left,numTicks:v,scale:O,stroke:x.muted,tickFormat:function(e){return E(e)},tickLabelProps:function(){return{fill:x.active,fontFamily:cr.ry,fontSize:y,textAnchor:"end",transform:"translate(-2,2.5)"}},tickStroke:x.muted,top:Z.top}),(0,S.jsx)(Ol.Z,{hideTicks:!0,left:Z.left,numTicks:A,scale:I,stroke:x.muted,tickFormat:h,tickLabelProps:function(){return{fill:x.active,fontFamily:cr.ry,fontSize:y,textAnchor:"middle"}},tickStroke:x.muted,top:w+Z.top})]})]}),a&&(0,S.jsx)("g",{children:(0,S.jsx)(Pl.Z,{from:{x:s,y:2*Z.top},pointerEvents:"none",stroke:x.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:s,y:w+2*Z.top}})})]}),d&&a&&(0,S.jsxs)(El.Z,{left:s,style:Xl(Xl({},wl.j),{},{backgroundColor:x.tooltipBackground}),top:f,children:[u&&u(a),!u&&Object.entries(a).map((function(e){var n=(0,l.Z)(e,2),i=n[0],r=n[1];if(t!==i){var o=r;return(0,ce.HW)(o)&&String(o).split(".").length>=2&&(o=o.toFixed(4)),(0,S.jsxs)(_.ZP,{inverted:!0,small:!0,children:[i,": ",o]},i)}})),(0,S.jsx)("br",{}),(0,S.jsxs)(_.ZP,{inverted:!0,small:!0,children:[h&&h(T(a)),!h&&T(a)]})]})]})}));var ec=function(e){var n=e.height,t=e.width,i=e.xAxisLabel,r=e.yAxisLabel,o=(0,q.Z)(e,Kl);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{style:{display:"flex",height:n,marginBottom:i?C.iI:null,width:"100%"},children:[r&&(0,S.jsx)(k.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,S.jsx)(Il.Z,{children:(0,S.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:r})})}),(0,S.jsx)("div",{style:{height:n,width:r?0===t?t:t-28:t},children:(0,S.jsx)(Xo.Z,{children:function(e){var n=e.height,t=e.width;return(0,S.jsx)($l,Xl(Xl({},o),{},{height:n,width:t}))}})})]}),i&&(0,S.jsx)("div",{style:{paddingLeft:r?36:0,paddingTop:4},children:(0,S.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:i})})]})},nc=t(66872),tc=t(68735),ic=t(320),rc=40*C.iI,oc=b.default.div.withConfig({displayName:"indexstyle__ChartBlockStyle",componentId:"sc-1c3ufnj-0"})(["border-radius:","px;margin-left:","px;margin-right:","px;margin-top:","px;",""],Pe.n_,.5*C.iI,.5*C.iI,1*C.iI,(function(e){return"\n background-color: ".concat((e.theme.background||Ce.Z.background).codeArea,";\n ")})),lc=b.default.div.withConfig({displayName:"indexstyle__ConfigurationOptionsStyle",componentId:"sc-1c3ufnj-1"})(["flex:4;padding-left:","px;padding-right:","px;"],1*C.iI,1*C.iI),cc=b.default.div.withConfig({displayName:"indexstyle__CodeStyle",componentId:"sc-1c3ufnj-2"})(["padding-top:","px;",""],C.iI/2,(function(e){return"\n background-color: ".concat((e.theme.background||Ce.Z.background).codeTextarea,";\n ")})),uc=b.default.div.withConfig({displayName:"indexstyle__CodeHelperStyle",componentId:"sc-1c3ufnj-3"})(["margin-bottom:","px;padding-bottom:","px;padding-left:","px;",""],C.cd*C.iI,C.iI,C.iI,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.borders||Ce.Z.borders).medium,";\n ")}));function ac(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 sc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ac(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ac(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var dc=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||rc,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=Zn.n1,v=u.time_interval;if([Zi.HOUR,Zi.MINUTE,Zi.SECOND].includes(v)&&(m=Zn.OC),zt.BAR_CHART===d||zt.TIME_SERIES_BAR_CHART===d){var b=i.x,g=i.y,x=zt.TIME_SERIES_BAR_CHART===d;if(b&&g&&Array.isArray(b)&&Array.isArray(g)){var j,y=null===(j=u.group_by)||void 0===j?void 0:j.join(", "),k=null===h||void 0===h?void 0:h.join(", ");h.length||h.push(ii);var Z=h[0],O=b.map((function(e,n){return sc({__y:e},h.reduce((function(e,t,i){var r,l=null===g||void 0===g||null===(r=g[i])||void 0===r?void 0:r[n];return"undefined"===typeof l?e:sc(sc({},e),{},(0,o.Z)({},t,l))}),{}))}));ki.ASCENDING===f?O=(0,pe.YC)(O,(function(e){return e[Z]}),{ascending:!1}):ki.DESCENDING===f&&(O=(0,pe.YC)(O,(function(e){return e[Z]}),{ascending:!0}));var P={data:O,height:p,renderNoDataText:function(){return"No data matching query"},width:r,xNumTicks:3};return xi.HORIZONTAL===s?(0,S.jsx)(Yl,sc(sc({},P),{},{xAxisLabel:k||u.y,yAxisLabel:y||u.x})):(0,S.jsx)(ec,sc(sc({},P),{},{xAxisLabel:y,xLabelFormat:function(e){return x?kl()(1e3*e).format(Zn.n1):e},xNumTicks:O.length,yAxisLabel:k,yNumTicks:5}))}}else if(zt.HISTOGRAM===d){var E,w=i.x,I=i.y,T=null===(E=u.group_by)||void 0===E?void 0:E.join(", ");if(w&&I&&Array.isArray(w))return(0,S.jsx)(nc.Z,{data:w.map((function(e,n){var t,i=e.max,r=e.min;return[i,null===I||void 0===I||null===(t=I[n])||void 0===t?void 0:t.value,r]})),height:p,width:r,large:!0,margin:{left:5*C.iI,right:1*C.iI,top:3*C.iI},noPadding:!0,renderTooltipContent:function(e){var n=(0,l.Z)(e,3),t=n[0],i=n[1],r=n[2];return(0,S.jsxs)(_.ZP,{inverted:!0,monospace:!0,small:!0,children:["Count : ",i,(0,S.jsx)("br",{}),"Bucket: ",r,"-",t]})},showAxisLabels:!0,showYAxisLabels:!0,showZeroes:!0,sortData:function(e){return(0,pe.YC)(e,"[0]")},xAxisLabel:T||u.x,yAxisLabel:T?"count(".concat(T,")"):u.y})}else if(zt.LINE_CHART===d||zt.TIME_SERIES_LINE_CHART===d){var A=i.x,D=i.y,R=zt.TIME_SERIES_LINE_CHART===d;if(A&&D&&Array.isArray(A)&&Array.isArray(D)&&Array.isArray(null===D||void 0===D?void 0:D[0])){var M,N=h;u.legend_labels&&(N=u.legend_labels.split(",").map((function(e){return e.trim()})));var B=A.map((function(e,n){return{x:e,y:(0,pe.w6)(D.length).map((function(e,t){var i=D[t][n];return"undefined"===typeof i||null===i?0:i}))}})),L=null===(M=u.group_by)||void 0===M?void 0:M.join(", "),F=h.join(", ");return(0,S.jsx)(tc.Z,{data:B,height:p,lineLegendNames:N,margin:{bottom:8*C.iI,left:5*C.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=kl()(1e3*n).format(m)),(0,S.jsxs)(_.ZP,{inverted:!0,small:!0,children:[t,": ",i]})},renderYTooltipContent:function(e,n){var t=e.y;return(0,S.jsxs)(_.ZP,{inverted:!0,small:!0,children:[N&&N[n]&&"".concat(N[n],": "),t&&(0,ce.x6)((0,ce.QV)(t[n],4))]})},width:r?r-3*C.iI:r,xAxisLabel:L||String(u.x),xLabelFormat:function(e){return R?kl()(1e3*e).format(Zn.n1):e},yAxisLabel:F||String(u.y),yLabelFormat:function(e){return e}})}}else if(zt.PIE_CHART===d){var U,H=i[String(u.x)],G=null===(U=u.group_by)||void 0===U?void 0:U.join(", ");if(H)return(0,S.jsx)(ic.Z,{data:Object.entries(H),getX:function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];return"".concat(t," (").concat((0,ce.x6)(i),")")},getY:function(e){return(0,l.Z)(e,2)[1]},height:p,width:r,xAxisLabel:G||String(u.x)})}else if(zt.TABLE===d){var z=i.index,W=i.x,Y=i.y;return Array.isArray(W)&&Array.isArray(Y)&&Array.isArray(Y[0])&&(0,S.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:Y,width:r})}return(0,S.jsx)("div",{})},fc=t(76096);var pc=function(e){var n=e.children,t=e.onChange,i=(0,s.useState)(s.Children.map(n,(function(){return null}))),r=i[0],o=i[1],l=(0,s.useState)(0),c=l[0],u=l[1];return(0,S.jsx)(k.Z,{children:s.Children.map(n,(function(e,n){return(0,S.jsx)(O.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 hc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function mc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?hc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):hc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function vc(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,x=e.fetchFileTree,j=e.messages,E=void 0===j?[]:j,w=e.onChangeContent,I=e.pipeline,T=e.runBlock,A=e.runningBlocks,R=e.savePipelineContent,M=e.selected,L=e.setAnyInputFocused,F=e.setErrors,U=e.setSelectedBlock,H=e.setTextareaFocused,G=e.textareaFocused,z=e.updateWidget,W=e.width,Y=(0,s.useRef)(null),q=(0,s.useContext)(b.ThemeContext),Q=ge.ZP.blocks.pipelines.detail(null===I||void 0===I?void 0:I.uuid,null===a||void 0===a?void 0:a.upstream_blocks[0]).data,K=(null===Q||void 0===Q||null===(t=Q.block)||void 0===t?void 0:t.outputs)||(null===a||void 0===a?void 0:a.outputs)||[],V=(0,s.useState)(null),X=V[0],J=V[1],$=(0,s.useState)(null===(i=a.configuration)||void 0===i?void 0:i.chart_type),ee=$[0],ne=$[1],te=(0,s.useState)(a.configuration),re=te[0],oe=te[1],le=(0,s.useState)(a.content),ue=le[0],ae=le[1],se=(0,s.useState)(!ee||0===K.length),de=se[0],fe=se[1],he=(0,s.useState)(!1),me=he[0],ve=he[1],be=(0,s.useState)(null),ye=be[0],ke=be[1],Ze=(0,s.useState)(null===a||void 0===a?void 0:a.upstream_blocks),Oe=Ze[0],_e=Ze[1],Pe=(0,s.useState)((null===K||void 0===K?void 0:K.length)||0),Se=Pe[0],Ee=Pe[1],we=(0,s.useState)(a.uuid),Ie=we[0],Te=we[1],Ae=Ai[ee],De=Di[ee],Re=(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]),Me=(0,s.useMemo)((function(){return(0,pe.HK)(Re,(function(e){return e.uuid}))}),[Re]),Ne=!!A.find((function(e){return e.uuid===a.uuid}))||(null===E||void 0===E?void 0:E.length)>=1&&m!==_n.uF.IDLE,Be=(0,s.useMemo)((function(){return null===E||void 0===E?void 0:E.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[E]),Le=!!Be.find((function(e){return e.error})),Fe=Be.length>=1,Ue=(0,s.useMemo)((function(){return{blockType:a.type,hasError:Le,selected:M}}),[a.type,Le,M]);if(null!==Be&&void 0!==Be&&Be.length){var He,Ge,ze=Be.length-1;c=null===Be||void 0===Be||null===(He=Be[ze])||void 0===He||null===(Ge=He.data)||void 0===Ge?void 0:Ge[0]}c?(c=(c=c.slice(1,c.length-1)).replaceAll('\\"','"').replaceAll("\\'","'"),(0,ce.Pb)(c)&&(r=JSON.parse(c))):(null===K||void 0===K?void 0:K.length)>=1&&(r={},K.forEach((function(e){var n=e||{},t=n.text_data,i=n.type,o=n.variable_uuid;_n.Gi.TEXT===i&&(0,ce.Pb)(t)&&(r[o]=JSON.parse(t))})));var We=(0,s.useCallback)((function(e){var n=mc(mc(mc({},a),e),{},{configuration:mc(mc({},a.configuration),e.configuration)});R().then((function(){T({block:n,code:ue,ignoreAlreadyRunning:!0,runUpstream:!!Oe.find((function(e){var n;return![v.DA.EXECUTED,v.DA.UPDATED].includes(null===(n=Me[e])||void 0===n?void 0:n.status)}))})})),Ee((function(e){return e+1}))}),[a,Me,ue,Ee,Oe]),qe=(0,s.useCallback)((function(e){ae(e),w(e)}),[w,ae]),Ke=(0,s.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.autoRun;oe((function(n){return mc(mc({},n),e)}));var i=mc(mc({},a),{},{configuration:mc(mc(mc({},re),e),{},{chart_type:ee})});z(i),Se&&t&&We(i)}),[a,ee,re,Se,We,oe,z]);(0,s.useEffect)((function(){J({python:Or({autocompleteItems:u,block:a,blocks:p,pipeline:I})})}),[u,a,p,I]);var Ve=(0,s.useMemo)((function(){return(0,S.jsx)(Ye.Z,{autoHeight:!0,autocompleteProviders:X,onChange:qe,selected:M,setSelected:function(e){return U(!0===e?a:null)},setTextareaFocused:H,showLineNumbers:!1,textareaFocused:G||zt.TABLE===ee&&!de,value:ue,width:"100%"})}),[X,a,ee,ue,de,M,U,H,G,qe]),Xe=(0,s.useMemo)((function(){return(Le||Fe)&&(0,S.jsx)(Wt,mc(mc({},Ue),{},{block:a,contained:!1,hideExtraInfo:!0,isInProgress:Ne,messages:Be,selected:M}))}),[a,Ue,Le,Fe,Ne,Be,M]),Je=(0,kn.Z)(de),$e=(0,kn.Z)(W);(0,s.useEffect)((function(){var e,n=null===Y||void 0===Y||null===(e=Y.current)||void 0===e?void 0:e.getBoundingClientRect();Je!==de||$e!==W?(ke(0),setTimeout((function(){var e,n,t=null===Y||void 0===Y||null===(e=Y.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.width;t&&ke(t)}),100)):n&&ke(n.width)}),[de,Je,Y,ke,W,$e]);var en=(0,s.useMemo)((function(){var e=[];return Oe.forEach((function(n,t){var i=Me[n],r=(0,P.qn)(null===i||void 0===i?void 0:i.type,{blockColor:null===i||void 0===i?void 0:i.color,theme:q}).accent;e.push((0,S.jsxs)(O.Z,{ml:2,children:[(0,S.jsxs)(_.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:["df_",t+1]})," ",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,S.jsx)(Z.Z,{color:r,inline:!0,onClick:function(){var e,n,t=null===f||void 0===f||null===(e=f.current)||void 0===e?void 0:e["".concat(null===i||void 0===i?void 0:i.type,"s/").concat(null===i||void 0===i?void 0:i.uuid,".py")];null===t||void 0===t||null===(n=t.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,S.jsx)(_.ZP,{color:r,monospace:!0,small:!0,children:n})})]},n))})),e}),[f,Me,q,Oe]),nn=(0,s.useMemo)((function(){var e,n=[],t=null===Ae||void 0===Ae||null===(e=Ae.code)||void 0===e?void 0:e.reduce((function(e,n){var t=n.uuid;return gi.includes(t)?e.concat(t):e}),[]);return null===t||void 0===t||t.forEach((function(e){var t=re[e];if(t){var i,r,o=null===(i=Ri[ee])||void 0===i||null===(r=i[e])||void 0===r?void 0:r.call(i);n.push((0,S.jsxs)(O.Z,{ml:2,children:[(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:t})," ",o&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,S.jsx)(_.ZP,{default:!0,inline:!0,small:!0,children:o})]})]},t))}})),n}),[ee,re,Ae]),tn=(0,kn.Z)(ee),rn=(0,kn.Z)(Oe);(0,s.useEffect)((function(){if((!tn&&ee&&null!==Oe&&void 0!==Oe&&Oe.length||(null===rn||void 0===rn||!rn.length)&&(null===Oe||void 0===Oe?void 0:Oe.length)>=1&&ee)&&!ue&&(0,xe.Qr)(re)&&De){var e=mc(mc({},a),{},{upstream_blocks:Oe});De.configuration&&Ke(De.configuration(e)),De.content&&qe(De.content(e))}}),[a,ee,tn,re,ue,De,Ke,qe,Oe,rn]);var on=(0,s.useMemo)((function(){return re.width_percentage||1}),[re]),ln=(0,s.useMemo)((function(){return Object.entries(Ae||{}).reduce((function(e,n){var t=(0,l.Z)(n,2),i=t[0],r=t[1];return mc(mc({},e),{},(0,o.Z)({},i,r.map((function(e){var n,t=e.autoRun,i=e.label,r=e.monospace,l=e.options,c=e.settings,u=void 0===c?{}:c,s=e.type,d=e.uuid,f={fullWidth:!0,key:d,label:(0,ce.kC)(i()),monospace:r,onBlur:function(){return U(a)},onChange:function(e){return Ke((0,o.Z)({},d,e.target.value),{autoRun:t})},onFocus:function(){return U(a)},value:(null===re||void 0===re?void 0:re[d])||""},p=(null!==Q&&void 0!==Q&&Q.block?[Q.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(wi.COLUMNS===s){var h=re[d]||[];n=(0,S.jsxs)(S.Fragment,{children:[(!u.maxValues||h.length<u.maxValues)&&(0,S.jsxs)(fr.Z,mc(mc({},f),{},{onChange:function(e){var n=re[d]||[],i=e.target.value;n.includes(i)?n=(0,pe.Od)(n,(function(e){return e===i})):n.push(i),Ke((0,o.Z)({},d,n),{autoRun:t})},value:null,children:[(0,S.jsx)("option",{value:""}),(0,pe.YC)(p.filter((function(e){return!h.includes(e)})),(function(e){return e})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))]})),h.map((function(e){return(0,S.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,S.jsx)(fo,{label:e,onClick:function(){Ke((0,o.Z)({},d,(0,pe.Od)(h,(function(n){return n===e}))),{autoRun:t})}})},e)}))]})}else if(wi.METRICS===s){var m=re[d]||[];n=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_.ZP,{bold:!0,children:"Metrics"}),(0,S.jsx)(_.ZP,{muted:!0,small:!0,children:"Select a column and an aggregation function."}),(0,S.jsxs)(pc,{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]}))||(Ke((0,o.Z)({},d,m.concat({aggregation:e[0],column:e[1]})),{autoRun:t}),r([null,null]),i()))},children:[(0,S.jsxs)(fr.Z,mc(mc({},f),{},{label:"aggregation",children:[(0,S.jsx)("option",{value:""}),(0,pe.YC)(Ii,(function(e){return e})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))]})),(0,S.jsxs)(fr.Z,mc(mc({},f),{},{label:"column",children:[(0,S.jsx)("option",{value:""}),(0,pe.YC)(p,(function(e){return e})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))]}))]}),m.map((function(e){var n=e.aggregation,i=e.column;return(0,S.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,S.jsx)(fo,{label:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(_.ZP,{inline:!0,monospace:!0,children:[n,"("]}),i,(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,children:")"})]}),onClick:function(){Ke((0,o.Z)({},d,(0,pe.Od)(m,(function(e){var t=e.aggregation,r=e.column;return n===t&&i===r}))),{autoRun:t})}})},"".concat(n,"(").concat(i,")"))}))]})}else n=l?(0,S.jsx)(fr.Z,mc(mc({},f),{},{children:l.map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))})):(0,S.jsx)(N.Z,mc(mc({},f),{},{type:s}));return(0,S.jsx)(O.Z,{mb:1,children:n},d)}))))}),{noCode:[]})}),[a,re,Ae,Q,U,Ke]),un=ln.code,an=ln.noCode,sn=(0,d.Db)(ge.ZP.widgets.pipelines.useUpdate(null===I||void 0===I?void 0:I.uuid,a.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){ve(!1),g(),x()},onErrorCallback:function(e,n){return null===F||void 0===F?void 0:F({errors:n,response:e})}})}}),dn=(0,l.Z)(sn,1)[0],fn="ChartBlock/".concat(a.uuid),pn=(0,Qe.y)(),hn=pn.registerOnKeyDown,mn=pn.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){mn(fn)}}),[mn,fn]),hn(fn,(function(e,n,t){me&&String(t[0])===String(B.Uq)&&String(t[1])!==String(B.zX)&&dn({widget:mc(mc({},a),{},{name:Ie})})}),[a,me,Ie,dn]),(0,S.jsx)(fc.Z,{sm:12,md:12*on,children:(0,S.jsxs)(oc,{ref:n,children:[(0,S.jsx)(O.Z,{mt:1,pt:1,px:1,children:(0,S.jsxs)(k.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,S.jsxs)(y.Z,{flex:1,style:{position:"relative"},children:[(0,S.jsx)(ir,{bold:!1,fullWidth:!0,inputValue:Ie,notRequired:!0,onBlur:function(){return setTimeout((function(){return ve(!1)}),300)},onChange:function(e){Te(e.target.value),e.preventDefault()},onClick:function(){L(!0),ve(!0)},onFocus:function(){L(!0),ve(!0)},small:!0,stacked:!0,value:!me&&a.uuid}),me&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{ml:1}),(0,S.jsx)(Z.Z,{noWrapping:!0,onClick:function(){return dn({widget:mc(mc({},a),{},{name:Ie})})},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update chart name"})]})]}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(fr.Z,{compact:!0,onChange:function(e){var n=[e.target.value],t=mc(mc({},a),{},{upstream_blocks:n});z(t),We(t),_e(n)},placeholder:"Source block",small:!0,value:(null===Oe||void 0===Oe?void 0:Oe[0])||"",children:null===Re||void 0===Re?void 0:Re.map((function(e){var n=e.uuid;return(0,S.jsx)("option",{value:n,children:n},n)}))}),(0,S.jsx)(O.Z,{mr:1}),!Ne&&(0,S.jsx)(cn.Z,{appearBefore:!0,default:!0,label:"Run chart block",size:null,widthFitContent:!0,children:(0,S.jsx)(D.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return We(a)},uuid:"ChartBlock/run/".concat(a.uuid),children:(0,S.jsx)(ie.Py,{size:2*C.iI})})}),_n.uF.QUEUED===m&&(0,S.jsx)(zi.Z,{color:(q||Ce.Z).content.active,small:!0,type:"cylon"}),_n.uF.BUSY===m&&(0,S.jsx)(zi.Z,{color:(q||Ce.Z).content.active,small:!0}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(cn.Z,{appearBefore:!0,default:!0,label:"Edit chart",size:null,widthFitContent:!0,children:(0,S.jsx)(D.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return fe((function(e){return!e}))},selected:de,uuid:"ChartBlock/edit/".concat(a.uuid),children:(0,S.jsx)(ie.I8,{size:2*C.iI})})}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(cn.Z,{appearBefore:!0,default:!0,label:"Delete chart",size:null,widthFitContent:!0,children:(0,S.jsx)(D.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return h(a)},uuid:"ChartBlock/delete/".concat(a.uuid),children:(0,S.jsx)(ie.rF,{size:2*C.iI})})})]})]})}),(0,S.jsx)(O.Z,{mt:1}),(0,S.jsxs)(k.Z,{fullWidth:!0,justifyContent:"space-between",children:[(0,S.jsx)(y.Z,{flex:6,ref:Y,children:r&&!(0,xe.Qr)(r)&&(0,S.jsx)(O.Z,{pb:3,children:(0,S.jsx)(dc,{block:mc(mc({},a),{},{configuration:mc(mc({},a.configuration),re)}),data:r,width:ye})})}),de&&(0,S.jsx)(lc,{children:(0,S.jsxs)(k.Z,{flexDirection:"column",fullWidth:!0,children:[(0,S.jsx)(O.Z,{mb:1,children:(0,S.jsx)(fr.Z,{onChange:function(e){var n=e.target.value,t=mc(mc({},a),{},{configuration:mc(mc({},re),{},{chart_type:n})});z(t),We(t),ne(n)},placeholder:"Select chart type",value:ee,children:yi.map((function(e){return(0,S.jsx)("option",{value:e,children:(0,ce.kC)(e)},e)}))})}),(0,S.jsx)(O.Z,{mb:1,children:(0,S.jsx)(fr.Z,{onChange:function(e){return Ke((0,o.Z)({},ni,e.target.value))},placeholder:"Chart width",value:(null===re||void 0===re?void 0:re.width_percentage)||1,children:[["1/2 width",.5],["full width",1]].map((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];return(0,S.jsx)("option",{value:i,children:t},t)}))})}),an]})})]}),de&&!(null===un||void 0===un||!un.length)&&v.t6.SQL!==a.language&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(O.Z,{my:1,px:1,children:[(0,S.jsx)(_.ZP,{bold:!0,children:"Custom chart code"}),(0,S.jsxs)(_.ZP,{muted:!0,children:["Write custom logic mapping data to input values for your chart.",(0,S.jsx)("br",{}),"This code is only executed if you don\u2019t have any columns or metrics selected."]})]}),(0,S.jsxs)(cc,{children:[Oe.length>=1&&(0,S.jsxs)(uc,{children:[(0,S.jsxs)(_.ZP,{muted:!0,small:!0,children:["Variables you can use in your code: ",en]}),(0,S.jsxs)(_.ZP,{muted:!0,small:!0,children:["Variables that you must define: ",nn]})]}),Ve]})]}),Xe&&(0,S.jsx)(O.Z,{px:1,children:Xe})]})})}var bc=s.forwardRef(vc),gc=t(97361),xc=["blockRefs","blocks","chartRefs","deleteWidget","messages","onChangeChartBlock","runBlock","runningBlocks","savePipelineContent","selectedBlock","setAnyInputFocused","setErrors","setSelectedBlock","setTextareaFocused","textareaFocused","updateWidget","widgets","width"];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,o.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.blockRefs,t=e.blocks,i=e.chartRefs,r=e.deleteWidget,l=e.messages,c=e.onChangeChartBlock,u=e.runBlock,a=e.runningBlocks,d=e.savePipelineContent,f=e.selectedBlock,p=e.setAnyInputFocused,h=e.setErrors,m=e.setSelectedBlock,v=e.setTextareaFocused,b=e.textareaFocused,g=e.updateWidget,x=e.widgets,j=e.width,y=(0,q.Z)(e,xc),Z=(0,s.useMemo)((function(){return a.reduce((function(e,n,t){return yc(yc({},e),{},(0,o.Z)({},n.uuid,yc(yc({},n),{},{priority:t})))}),{})}),[a]);return(0,S.jsxs)(k.Z,{flexDirection:"column",fullWidth:!0,children:[(0,S.jsx)(gc.Z,{fullHeight:!0,style:{marginLeft:.5*C.iI,marginRight:.5*C.iI},children:null===x||void 0===x?void 0:x.map((function(e){var o=e.uuid,x=Z[o],k=x?0===x.priority?_n.uF.BUSY:_n.uF.QUEUED:_n.uF.IDLE;return i.current[o]=(0,s.createRef)(),(0,s.createElement)(bc,yc(yc({},y),{},{block:e,blockRefs:n,blocks:t,chartRefs:i,deleteWidget:r,executionState:k,key:o,messages:l[o],onChangeContent:function(e){return c(o,e)},ref:i.current[o],runBlock:u,runningBlocks:a,savePipelineContent:d,selected:(null===f||void 0===f?void 0:f.uuid)===o,setAnyInputFocused:p,setErrors:h,setSelectedBlock:m,setTextareaFocused:v,textareaFocused:b,updateWidget:g,width:j}))}))}),(0,S.jsx)("div",{style:{height:"80vh"}})]})},Zc=b.default.svg.withConfig({displayName:"EmptyCharts__SVGStyle",componentId:"sc-ttsjrp-0"})([""]),Oc=function(e){var n=e.size,t=void 0===n?20:n,i=e.viewBox,r=void 0===i?"0 0 358 305":i;return(0,S.jsxs)(Zc,{height:t*(305/358),viewBox:r,width:t,children:[(0,S.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M290 47H66c-3.866 0-7 3.134-7 7v200c0 3.866 3.134 7 7 7h224c3.866 0 7-3.134 7-7V54c0-3.866-3.134-7-7-7zM66 46c-4.4183 0-8 3.5817-8 8v200c0 4.418 3.5817 8 8 8h224c4.418 0 8-3.582 8-8V54c0-4.4183-3.582-8-8-8H66z",fill:"#000"}),(0,S.jsx)("path",{fill:"#000",d:"M118 46h1v216h-1zM178 46h1v216h-1zM238 46h1v216h-1z"}),(0,S.jsx)("path",{fill:"#000",d:"M59 208.25v-1h239v1zM59 154.5v-1h239v1zM59 100.75v-1h239v1z"}),(0,S.jsx)("rect",{x:"209.651",y:"17.1125",width:"1.0163",height:"14.2284",rx:".5082",transform:"rotate(24.933 209.651 17.1125)",fill:"#2AB2FE"}),(0,S.jsx)("path",{fill:"#2AB2FE",d:"M207.788 23.5313l35.4813 16.4949-.4285.9215-35.4812-16.4948zM247.033 31.9316c.946-2.0359 3.364-2.9191 5.4-1.9726l31.795 14.7811-11.383 24.4836-31.794-14.7811c-2.036-.9465-2.92-3.3642-1.973-5.4002l7.955-17.1108z"}),(0,S.jsx)("path",{d:"M284.228 44.7401l31.795 14.7811c2.036.9465 2.919 3.3642 1.972 5.4001l-7.954 17.1109c-.947 2.0359-3.365 2.9191-5.401 1.9726l-31.795-14.7811 11.383-24.4836z",fill:"#0093E4"}),(0,S.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M352.959 83.7347a.5082.5082 0 00-.675.2466l-2.571 5.5296-35.481-16.4949-.428.9216 35.481 16.4949-2.571 5.5295a.5081.5081 0 00.247.675.5082.5082 0 00.675-.2466l5.57-11.9806a.5083.5083 0 00-.247-.6751z",fill:"#2AB2FE"}),(0,S.jsx)("circle",{cx:"55.2178",cy:"34.6274",r:"5.2954",fill:"#8ADE00"}),(0,S.jsx)("circle",{cx:"113.818",cy:"106.582",r:"5.2954",fill:"#8ADE00"}),(0,S.jsx)("circle",{cx:"84.2832",cy:"80.6953",r:"5.2954",fill:"#8ADE00"}),(0,S.jsx)("circle",{cx:"117.115",cy:"43.6274",r:"5.2954",fill:"#8ADE00"}),(0,S.jsx)("path",{d:"M337.354 256.065a38.3848 38.3848 0 01-10.816 21.271 38.3722 38.3722 0 01-21.293 10.768 38.3787 38.3787 0 01-23.542-3.895 38.3764 38.3764 0 01-16.691-17.054l17.208-8.494a19.1932 19.1932 0 0020.117 10.475 19.189 19.189 0 0010.647-5.385c2.886-2.88 4.78-6.605 5.407-10.635l18.963 2.949z",fill:"#FF3C3C"}),(0,S.jsx)("path",{d:"M294.876 288.277a38.3849 38.3849 0 01-21.64-10.056 38.3818 38.3818 0 01-11.516-20.899 38.3896 38.3896 0 013.06-23.666 38.386 38.386 0 0116.453-17.283l9.098 16.897a19.1904 19.1904 0 00-9.757 20.474 19.1937 19.1937 0 005.758 10.45 19.194 19.194 0 0010.82 5.028l-2.276 19.055z",fill:"#2ECDF7"}),(0,S.jsx)("path",{d:"M275.892 219.85a38.3804 38.3804 0 0145.342-1.268 38.3803 38.3803 0 0114.45 18.989 38.3873 38.3873 0 01.436 23.858l-18.346-5.631a19.1827 19.1827 0 00-.218-11.929 19.1907 19.1907 0 00-7.225-9.495 19.1875 19.1875 0 00-11.439-3.39 19.192 19.192 0 00-11.232 4.024l-11.768-15.158z",fill:"#885EFF"}),(0,S.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M259.206 102.57c.241.135.327.439.193.68l-39.314 70.576c-.613 1.1-1.962 1.565-3.124 1.093-3.766-1.53-13.762-5.285-26.356-7.597-12.6-2.314-27.762-3.177-41.881 1.037-16.112 4.81-27.78 14.07-35.424 22.135-3.822 4.032-6.635 7.763-8.491 10.483-.928 1.36-1.616 2.467-2.072 3.232-.228.383-.397.68-.509.881-.057.1-.098.177-.126.227l-.03.057-.008.014-.001.003a.5008.5008 0 01-.676.21.5005.5005 0 01-.209-.676l.442.233-.442-.233.001-.001.002-.005.009-.016.033-.062c.03-.055.073-.135.132-.239.116-.208.29-.513.523-.904.465-.782 1.165-1.906 2.105-3.285 1.881-2.756 4.727-6.53 8.591-10.607 7.727-8.153 19.539-17.532 35.864-22.405 14.331-4.278 29.668-3.391 42.347-1.063 12.685 2.329 22.748 6.109 26.552 7.654.699.284 1.51.002 1.875-.653l39.313-70.575a.5008.5008 0 01.681-.194z",fill:"#7D55EC"}),(0,S.jsx)("path",{d:"M221.651 176.111c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.873-1.734-3.873-3.873 0-2.139 1.734-3.873 3.873-3.873 2.139 0 3.873 1.734 3.873 3.873zM157.778 166.428c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.873-1.734-3.873-3.873 0-2.139 1.734-3.873 3.873-3.873 2.139 0 3.873 1.734 3.873 3.873zM106.428 204.191c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.8726-1.734-3.8726-3.873 0-2.139 1.7336-3.873 3.8726-3.873s3.873 1.734 3.873 3.873zM262.35 104.459c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.873-1.734-3.873-3.873 0-2.139 1.734-3.873 3.873-3.873 2.139 0 3.873 1.734 3.873 3.873z",fill:"#7D55EC"}),(0,S.jsx)("path",{d:"M8.5523 214.855c-.3562-1.045.2025-2.181 1.248-2.538l13.7251-4.677c1.0456-.356 2.1819.203 2.5382 1.248l29.6737 87.084-17.5112 5.967-29.6738-87.084z",fill:"#4776FF"}),(0,S.jsx)("path",{d:"M45.0935 264.735c-.3562-1.045.2025-2.182 1.2481-2.538l13.725-4.677c1.0455-.356 2.1819.203 2.5382 1.248l10.6438 31.237-17.5112 5.967-10.6439-31.237z",fill:"#FFCC19"}),(0,S.jsx)("path",{d:"M54.4607 234.868c-.3563-1.046.2025-2.182 1.248-2.538l13.7251-4.677c1.0455-.356 2.1819.202 2.5382 1.248l18.7879 55.137-17.5113 5.967-18.7879-55.137z",fill:"#4776FF"})]})};var _c,Cc=function(e){var n=e.blocksInNotebook;return e.extensionOption,(0,s.useMemo)((function(){return(null===n||void 0===n?void 0:n.filter((function(e){var n=e.type;return v.tf.DBT===n})))||[]}),[n]),(0,S.jsx)(S.Fragment,{})};function Pc(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 Sc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Pc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Pc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}!function(e){e.DBT="dbt",e.GREAT_EXPECTATIONS="great_expectations"}(_c||(_c={}));var Ec=function(e){var n=e.addNewBlockAtIndex,t=e.autocompleteItems,i=e.blockRefs,r=e.blocks,c=e.blocksInNotebook,u=e.deleteBlock,a=e.extensionOption,f=e.fetchFileTree,p=e.fetchPipeline,h=e.interruptKernel,m=e.messages,b=e.onChangeCallbackBlock,g=e.onChangeCodeBlock,x=e.pipeline,j=e.runBlock,y=e.runningBlocks,k=e.savePipelineContent,P=e.selectedBlock,E=e.setAnyInputFocused,w=e.setErrors,I=e.setSelectedBlock,T=e.setTextareaFocused,A=e.textareaFocused,R=(0,s.useRef)(null),M=(0,s.useState)(!1),N=M[0],L=M[1],F=(a||{}).uuid,H=(x||{}).extensions,G=(0,s.useMemo)((function(){return(null===a||void 0===a?void 0:a.templates)||[]}),[a]),z=(0,s.useMemo)((function(){return null===H||void 0===H?void 0:H[F]}),[F,H]),W=(0,s.useMemo)((function(){return(null===z||void 0===z?void 0:z.blocks)||[]}),[z]),Y=(0,s.useMemo)((function(){return(0,pe.HK)(W,(function(e){return e.uuid}))}),[W]),q=(0,s.useMemo)((function(){return F===(null===P||void 0===P?void 0:P.extension_uuid)&&Y[null===P||void 0===P?void 0:P.uuid]}),[Y,F,P]),Q=(0,s.useMemo)((function(){return y.reduce((function(e,n,t){return Sc(Sc({},e),{},(0,o.Z)({},n.uuid,Sc(Sc({},n),{},{priority:t})))}),{})}),[y]),K=(0,d.Db)((function(e){var n=e.block,t=e.upstream_blocks;return ge.ZP.blocks.pipelines.useUpdate(null===x||void 0===x?void 0:x.uuid,encodeURIComponent(null===n||void 0===n?void 0:n.uuid),{query:{extension_uuid:null===n||void 0===n?void 0:n.extension_uuid}})({block:{upstream_blocks:t}})}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){p()},onErrorCallback:function(e,n){return null===w||void 0===w?void 0:w({errors:n,response:e})}})}}),V=(0,l.Z)(K,2),X=V[0],J=V[1].isLoading,$=(0,s.useMemo)((function(){return W.map((function(e,n){var o=Sc(Sc({},e),{},{extension_uuid:F}),l=o.type,a=o.uuid,d=(null===P||void 0===P?void 0:P.uuid)===a,Z=Q[a],_=Z?0===Z.priority?_n.uF.BUSY:_n.uF.QUEUED:_n.uF.IDLE,D="".concat(l,"s/").concat(a,".py");return i.current[D]=(0,s.createRef)(),(0,S.jsx)(O.Z,{mt:C.cd,children:(0,S.jsx)(Tr,{allBlocks:r,autocompleteItems:t,block:o,blockIdx:n,blockRefs:i,blocks:r,defaultValue:o.content,deleteBlock:function(e){u(Sc(Sc({},e),{},{extension_uuid:F})),E(!1)},executionState:_,extraContent:(0,S.jsx)(vl,{block:o,blockActionDescription:"Click a block name to run expectations on it.",blocks:c,inputPlaceholder:"Select blocks to run expectations on",loading:J,supportedUpstreamBlockLanguages:[v.t6.PYTHON],supportedUpstreamBlockTypes:[v.tf.DATA_EXPORTER,v.tf.DATA_LOADER,v.tf.DBT,v.tf.TRANSFORMER],updateBlock:X}),fetchFileTree:f,fetchPipeline:p,hideRunButton:!0,interruptKernel:h,messages:m[a],noDivider:!0,onCallbackChange:function(e){return b(l,a,e)},onChange:function(e){return g(l,a,e)},pipeline:x,ref:i.current[D],runBlock:j,runningBlocks:y,savePipelineContent:k,selected:d,setAnyInputFocused:E,setErrors:w,setSelected:function(e){return I(!0===e?o:null)},setTextareaFocused:T,textareaFocused:d&&A})},a)}))}),[t,i,r,c,u,W,F,f,p,h,J,m,b,g,x,j,y,Q,k,P,E,w,I,T,A,X]),ee="Extensions/GreatExpectations/index",ne=(0,Qe.y)(),te=ne.disableGlobalKeyboardShortcuts,re=ne.registerOnKeyDown,oe=ne.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){oe(ee)}}),[oe,ee]),re(ee,(function(e,n){!te&&q&&((0,U.y)([B.zX,B.Um],n)||(0,U.y)([B.PQ,B.Um],n))&&(e.preventDefault(),k())}),[q,k]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(O.Z,{mb:C.cd,children:[(0,S.jsx)(_.ZP,{default:!0,children:"Add an extension block to start writing expectations for blocks in the current pipeline."}),(0,S.jsx)(O.Z,{mt:1,children:(0,S.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,S.jsx)(Z.Z,{href:"https://docs.mage.ai/development/testing/great-expectations",openNewWindow:!0,children:"Great Expectation power up"}),"."]})}),(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsxs)(_.ZP,{default:!0,children:["For all available expectations, read Great Expectation\u2019s ",(0,S.jsx)(Z.Z,{href:"https://greatexpectations.io/expectations/",openNewWindow:!0,children:"documentation"}),"."]})})]}),$,(0,S.jsx)(O.Z,{mt:C.cd,children:(0,S.jsx)($e.Z,{onClickOutside:function(){return L(!1)},open:!0,children:(0,S.jsx)(Mn.Z,{disableKeyboardShortcuts:!0,items:null===G||void 0===G?void 0:G.map((function(e){var t=e.description,i=e.name,r=e.path;return{label:function(){return i},onClick:function(){return n({config:{template_path:r},extension_uuid:F,type:v.tf.EXTENSION},(null===W||void 0===W?void 0:W.length)||0)},tooltip:function(){return t},uuid:e.uuid}})),onClickCallback:function(){return L(!1)},open:N,parentRef:R,uuid:"Extension",children:(0,S.jsx)(D.ZP,{beforeElement:(0,S.jsx)(Ln,{teal:!0,children:(0,S.jsx)(ie.mm,{size:Bn})}),inline:!0,onClick:function(e){e.preventDefault(),L(!0)},uuid:"AddNewBlocks/Extension",children:"Extension block"})})})})]})},wc=["pipeline"];function Ic(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 Tc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ic(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ic(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,q.Z)(e,wc),i=(0,f.useRouter)(),r=ge.ZP.extension_options.list().data,o=(0,s.useMemo)((function(){return(null===r||void 0===r?void 0:r.extension_options)||[]}),[r]),l=(0,s.useMemo)((function(){return(0,pe.HK)(o,(function(e){return e.uuid}))}),[o]),c=(0,s.useState)(null),u=c[0],a=c[1],d=(0,s.useMemo)((function(){return l[u]}),[l,u]),p=(0,s.useMemo)((function(){return Tc(Tc({},t),{},{pipeline:n})}),[n,t]);(0,s.useEffect)((function(){var e;a(null===(e=(0,bl.iV)())||void 0===e?void 0:e.extension)}),[i.asPath]);var h=(0,s.useMemo)((function(){return n?(_c.GREAT_EXPECTATIONS===u?e=Ec:_c.DBT===u&&(e=Cc),e?(0,S.jsx)(e,Tc(Tc({},p),{},{extensionOption:d})):void 0):null;var e}),[d,n,u,p]);return(0,S.jsx)(Pn.W,{backend:Sn.PD,children:(0,S.jsxs)(O.Z,{p:C.cd,children:[!u&&(0,S.jsxs)(O.Z,{mb:C.cd,children:[(0,S.jsxs)(_.ZP,{default:!0,children:["Power up your pipeline with extensions. Learn more about ",(0,S.jsx)(Z.Z,{href:"https://docs.mage.ai/design/blocks/extension",openNewWindow:!0,children:"extension blocks"}),"."]}),(0,S.jsx)(O.Z,{mt:1,children:(0,S.jsxs)(_.ZP,{default:!0,children:["Click on a power up below to add and configure it for the ",(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,children:null===n||void 0===n?void 0:n.uuid})," pipeline."]})})]}),!r&&!u&&(0,S.jsx)(zi.Z,{}),h,!u&&(null===o||void 0===o?void 0:o.map((function(e,n){var t=e.description,i=e.name,r=e.uuid;return(0,S.jsx)(O.Z,{mt:n>=1?C.cd:0,children:(0,S.jsx)(Z.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,mn.u7)({extension:r},{pushHistory:!0})},preventDefault:!0,children:(0,S.jsx)(R.Z,{dark:!0,children:(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(Co,{fullWidth:!1,children:(0,S.jsx)(O.Z,{p:C.cd,children:(0,S.jsx)(k.Z,{alignItems:"center",children:(0,S.jsx)("img",{alt:i,height:3*C.iI,src:"/images/extensions/".concat(r,"/logo.png"),width:3*C.iI})})})}),(0,S.jsx)(O.Z,{mr:C.cd}),(0,S.jsxs)(y.Z,{flexDirection:"column",children:[(0,S.jsx)(_.ZP,{bold:!0,children:i}),(0,S.jsx)(_.ZP,{default:!0,small:!0,children:t})]})]}),(0,S.jsx)(ie._Q,{})]})})})},r)})))]})})},Dc=t(88560),Rc=(b.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-43nc8t-0"})(["border-radius:","px;",""],Pe.TR,(function(e){return"\n border: 1px solid ".concat((e.theme.interactive||nl.Z.interactive).defaultBorder,";\n ")})),b.default.div.withConfig({displayName:"indexstyle__ColumnProfileStyle",componentId:"sc-43nc8t-1"})(["",""],(function(e){return"\n background: ".concat((e.theme.background||nl.Z.background).table,";\n border-bottom: 1px solid ").concat((e.theme.interactive||nl.Z.interactive).defaultBorder,";\n border-right: 1px solid ").concat((e.theme.interactive||nl.Z.interactive).defaultBorder,";\n ")}))),Mc=(b.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-43nc8t-2"})(["background:",";padding:","px ","px;"," border-top-left-radius:","px;border-top-right-radius:","px;"],Rl.Uq,1.75*C.iI,C.tr,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||nl.Z.interactive).defaultBorder,";\n ")}),Pe.TR,Pe.TR),b.default.div.withConfig({displayName:"indexstyle__FeatureProfileStyle",componentId:"sc-43nc8t-3"})(["",""],(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||nl.Z.interactive).defaultBorder,";\n ")}))),Nc=(b.default.div.withConfig({displayName:"indexstyle__BodyStyle",componentId:"sc-43nc8t-4"})(["border-bottom-left-radius:","px;border-bottom-right-radius:","px;overflow-y:scroll;"],Pe.TR,Pe.TR),b.default.div.withConfig({displayName:"indexstyle__CellStyle",componentId:"sc-43nc8t-5"})([""," padding:","px;"],(function(e){return e.backgroundColor&&"\n background-color: ".concat(e.backgroundColor,";\n ")}),C.iI)),Bc=b.default.div.withConfig({displayName:"indexstyle__ScrollOverflowStyle",componentId:"sc-43nc8t-6"})([""," overflow-x:auto;"],an.w5);function Lc(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 Fc=["Type","Missing","Unique","Min","Max","Mean","Median","Mode","Invalid","Outliers","Skewness","Std dev"],Uc={Missing:0,Invalid:0,Outliers:0,Unique:.9};function Hc(e){var n=e.columns,t=e.feature,i=e.shouldLink,r=e.statistics,o=(0,s.useContext)(b.ThemeContext),l=t.columnType,c=t.uuid,u=Lc(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,x=u.max_character_count,j=u.max_word_count,P=u.min,E=u.min_character_count,w=u.min_word_count,I=u.median,T=u.mode,A=u.null_value_count,D=u.null_value_rate,R=u.outlier_count,M=u.skew,N=u.std,B=u.unique_value_rate,L=[l,A,h,P,g,a,I,T,m,R,M,N],F={Min:w,Max:j,Mean:f},U={Min:"".concat((0,ce._6)("character",E)),Max:"".concat((0,ce._6)("character",x)),Mean:"".concat((0,ce._6)("character",(0,ce.QV)(d)))},H={Invalid:(0,ce.T3)(v),Missing:(0,ce.T3)(D),Unique:(0,ce.T3)(B)},G=Ie.T5[l],z=[o.background.row,o.background.row2],W=z[0],Y=z[1],q=i?Z.Z:_.ZP;return(0,S.jsxs)(y.Z,{flexDirection:"column",children:[(0,S.jsx)(Mc,{children:(0,S.jsx)(O.Z,{px:1,py:2,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[G&&(0,S.jsxs)(y.Z,{title:Dc.Rp[l],children:[(0,S.jsx)(G,{size:2*C.iI}),"\xa0"]}),(0,S.jsx)(q,{inline:!0,onClick:i?function(){return(0,mn.u7)({column:n.indexOf(c)},{pushHistory:!0})}:void 0,preventDefault:!0,secondary:!0,children:(0,S.jsx)(_.ZP,{bold:!0,default:!i,maxWidth:25*C.iI,monospace:!0,secondary:i,textOverflow:!0,title:c,children:c})})]})})}),L.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"-",n=arguments.length>1?arguments[1]:void 0,t=Fc[n],i=l===Dc.RL.TEXT&&t in F,r=i?F[t]:e,o=isNaN(r)?r:(0,ce.QV)(r),c=t in Uc&&o/p>Uc[t];return(0,S.jsx)(Nc,{backgroundColor:n%2===0?W:Y,children:(0,S.jsxs)(_.ZP,{bold:c,danger:c,default:!0,textOverflow:!0,title:i?U[t]:"",children:[i?"".concat((0,ce._6)("word",o)):o,t in H&&" (".concat(H[t],")")]})},n)}))]})}var Gc=function(e){var n=e.features,t=void 0===n?[]:n,i=e.shouldLink,r=e.statistics,o=(0,s.useContext)(b.ThemeContext),l=(0,s.useMemo)((function(){return t.map((function(e){return e.uuid}))}),[t]);return(0,S.jsx)(fl.Z,{headerTitle:"Feature profiles",children:(0,S.jsxs)(k.Z,{children:[(0,S.jsx)(Rc,{children:(0,S.jsxs)(y.Z,{flex:1,flexDirection:"column",style:{background:o.background.table},children:[(0,S.jsx)(O.Z,{mr:1.25*C.iI,mt:"".concat(53,"px")}),Fc.map((function(e,n){return(0,S.jsx)(Nc,{children:(0,S.jsx)(_.ZP,{default:!i,secondary:i,children:e})},"".concat(e,"-").concat(n))}))]})}),(0,S.jsx)(Bc,{children:(0,S.jsx)(k.Z,{children:t.map((function(e,n){return(0,S.jsx)(Mc,{children:(0,S.jsx)(Hc,{columns:l,feature:e,shouldLink:i,statistics:r})},"".concat(e,"-").concat(n))}))})})]})})};function zc(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 Wc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?zc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):zc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Yc=function(e){var n=e.onActionCallback,t=e.selectedBlock,i=e.selectedFilePath,r=e.setErrors,c=e.width,u=p("apiReloads"),a=(0,l.Z)(u,2)[1],f=ge.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),g=b[0],x=b[1],j=(0,s.useMemo)((function(){return null===v||void 0===v?void 0:v[g]}),[g,v]),Z=ge.ZP.file_contents.detail(j?encodeURIComponent(j.path):null).data,P=(0,s.useMemo)((function(){return null===Z||void 0===Z?void 0:Z.file_content}),[Z]),E=(0,s.useMemo)((function(){return Ae()}),[]),w=(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]),I=(0,d.Db)(ge.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,l="FileEditor/".concat(r);if(r){var c=r.split(le.sep);if("pipelines"===c[0]){var u=c.slice(1,c.length-1).join(le.sep);l="PipelineDetail/".concat(u)}}a((function(e){return Wc(Wc({},e),{},(0,o.Z)({},l,Number(new Date)))})),x((function(e){return e+1})),null===n||void 0===n||n(e)},onErrorCallback:function(e,n){return r({errors:n,response:e})}})}}),A=(0,l.Z)(I,2),D=A[0],R=A[1].isLoading,M=(0,s.useMemo)((function(){var e=v.map((function(e){var n=e.name,t=e.path;return[(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(y.Z,{flex:1,children:[(0,S.jsx)(_.ZP,{default:!0,monospace:!0,children:(0,Zn.JX)(n,{withSeconds:!0})}),(0,S.jsx)(O.Z,{px:2*C.cd,children:(0,S.jsx)(_.ZP,{monospace:!0,children:n})})]}),j&&(null===j||void 0===j?void 0:j.path)===t&&(0,S.jsx)(T.Z,{compact:!0,loading:R,onClick:function(e){(0,pr.j)(e),D({file_content:{version:n}})},small:!0,children:"Replace with this version"})]},n)]}));if(j){var n=(0,S.jsx)(O.Z,{p:C.cd,children:(0,S.jsx)(zi.Z,{},"spinner")});if(P&&(null===P||void 0===P?void 0:P.path)===(null===j||void 0===j?void 0:j.path)){var t=P.content,i=void 0===t?"":t;n=(0,S.jsx)(Ye.Z,{autoHeight:!0,language:ne[w],padding:!0,readOnly:!0,value:(0,ce.Pb)(i)?JSON.stringify(JSON.parse(i),null,2):i,width:c})}e=(0,pe.Hk)([n],g+1,e)}return e}),[P,w,v,R,j,g,D,c]);return(0,S.jsxs)("div",{style:{width:c},children:[(0,S.jsxs)(O.Z,{p:C.cd,children:[(0,S.jsx)(lr.Z,{level:5,children:"File versions"}),(0,S.jsx)(_.ZP,{inline:!0,monospace:!0,children:i?decodeURIComponent(i):null===t||void 0===t?void 0:t.uuid})]}),(0,S.jsx)(_e.Z,{buildRowProps:function(e){if(j&&g+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===j||void 0===j?void 0:j.name)},onClickRow:function(e){j?e===g?x(null):e<g?x(e):e>g+1&&x(e-1):x(e)},rows:M})]})},qc=t(21764),Qc=t(22673),Kc=t(52769),Vc=t(1286),Xc=(C.iI,Vc.O$,C.iI,ur.dN,b.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-cr39lf-0"})(["height:calc(100vh - ","px - ","px);width:fit-content;",""],un.Wi,an.nn,(function(e){return e.fullWidth&&"\n width: 100%;\n "})),b.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-cr39lf-1"})(["padding:","px;",""],2*C.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "})),b.default.table.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-cr39lf-2"})(["",""],(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}))),Jc=b.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*C.iI,"px;\n ")})),$c=t(19963);var eu=function(e){var n=e.copyText,t=e.deleteVariable,i=e.fetchVariables,r=e.hideEdit,o=e.obfuscate,c=e.pipelineUUID,u=e.variable,a=u.uuid,f=(u.type,u.value),p=(0,s.useRef)(null),h=(0,s.useState)(!1),m=h[0],v=h[1],b=(0,s.useState)(a),g=b[0],x=b[1],j=(0,s.useState)(f),k=j[0],Z=j[1],O=(0,s.useState)(!1),P=O[0],E=O[1],w=(0,d.Db)(ge.ZP.variables.pipelines.useUpdate(c,a),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){E(!1),i()}})}}),I=(0,l.Z)(w,1)[0],T=(0,s.useCallback)((function(e){if("Enter"===e.key){var n=k;try{n=JSON.parse(k)}catch(t){}I({variable:{name:g,value:n}})}else"Escape"===e.key&&E(!1)}),[g,k]);(0,s.useEffect)((function(){var e;P&&(null===p||void 0===p||null===(e=p.current)||void 0===e||e.focus())}),[P,p]);var A=n||"kwargs['".concat(a,"']");return(0,S.jsx)("div",{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},children:(0,S.jsxs)(gc.Z,{children:[(0,S.jsx)(fc.Z,{md:1,hiddenSmDown:!0,children:(0,S.jsx)(Jc,{noPadding:!0,children:(0,S.jsx)(D.ZP,{backgroundColor:$c.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(A),qc.Am.success("Successfully copied to clipboard.",{position:qc.Am.POSITION.BOTTOM_RIGHT,toastId:a})},small:!0,uuid:"Sidekick/GlobalVariables/".concat(a),withIcon:!0,children:(0,S.jsx)(ie.CK,{size:2.5*C.iI})})})}),(0,S.jsx)(fc.Z,{md:4,children:P?(0,S.jsx)(Jc,{children:(0,S.jsx)(N.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){x(e.target.value),e.preventDefault()},onKeyDown:T,paddingHorizontal:0,placeholder:"variable",small:!0,value:g})}):(0,S.jsx)(Jc,{children:(0,S.jsx)(_.ZP,{color:Rl.Or,monospace:!0,small:!0,textOverflow:!0,children:a})})}),(0,S.jsx)(fc.Z,{md:7,children:P?(0,S.jsx)(Jc,{children:(0,S.jsx)(N.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){Z(e.target.value),e.preventDefault()},onKeyDown:T,paddingHorizontal:0,placeholder:"enter value",ref:p,small:!0,value:k})}):(0,S.jsxs)(Jc,{children:[o?(0,S.jsx)(_.ZP,{monospace:!0,small:!0,children:"********"}):(0,S.jsx)(_.ZP,{monospace:!0,small:!0,children:f}),(0,S.jsxs)(y.Z,{children:[!r&&m&&(0,S.jsx)(D.ZP,{backgroundColor:$c.qJ,borderless:!0,inline:!0,muted:!0,onClick:function(){E(!0)},small:!0,uuid:"Sidekick/GlobalVariables/edit_".concat(a),withIcon:!0,children:(0,S.jsx)(ie.I8,{size:2.5*C.iI})}),t&&m&&(0,S.jsx)(D.ZP,{backgroundColor:$c.qJ,borderless:!0,inline:!0,muted:!0,onClick:t,small:!0,uuid:"Sidekick/GlobalVariables/delete_".concat(a),withIcon:!0,children:(0,S.jsx)(ie.rF,{size:2.5*C.iI})})]})]})})]})})},nu=t(93348),tu=t(58122);var iu=function(e){e.blocks;var n=e.fetchVariables,t=e.pipeline,i=e.selectedBlock,r=e.setErrorMessages,o=e.variables,c=e.width,u=(0,s.useState)(!1),a=u[0],f=u[1],p=(0,s.useState)(),h=p[0],m=p[1],b=(0,s.useState)(),g=b[0],x=b[1],j=null===t||void 0===t?void 0:t.uuid,y=(0,d.Db)(ge.ZP.variables.pipelines.useCreate(j),{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}))}})}}),P=(0,l.Z)(y,1)[0],E=(0,d.Db)((function(e){return ge.ZP.variables.pipelines.useDelete(j,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,l.Z)(E,1)[0],I=(0,s.useCallback)((function(e){if("Enter"===e.key){var t=g;try{t=JSON.parse(g)}catch(i){}P({variable:{name:h,value:t}}).then((function(){n(),m(null),x(null)})),f(!1)}else"Escape"===e.key&&f(!1)}),[P,n,h,g]),T=(0,s.useMemo)((function(){return c-4*C.iI}),[c]),A=(0,s.useMemo)((function(){return(0,tu.wx)(o,(function(e){return e.uuid===Kc.C}))}),[o]),R=(0,s.useMemo)((function(){return(0,tu.wx)(o,(function(e){return e.uuid===(null===i||void 0===i?void 0:i.uuid)}))}),[i,o]),M=(0,s.useMemo)((function(){return(0,S.jsxs)(Xc,{width:T,children:[a&&(0,S.jsxs)(gc.Z,{children:[(0,S.jsx)(fc.Z,{md:1,children:(0,S.jsx)(Jc,{noPadding:!0,children:(0,S.jsx)(D.ZP,{backgroundColor:$c.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(h),qc.Am.success("Successfully copied to clipboard.",{position:qc.Am.POSITION.BOTTOM_RIGHT,toastId:h})},uuid:"Sidekick/GlobalVariables/".concat(h),withIcon:!0,children:(0,S.jsx)(ie.CK,{size:2.5*C.iI})})})}),(0,S.jsx)(fc.Z,{md:4,children:(0,S.jsx)(Jc,{children:(0,S.jsx)(N.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,S.jsx)(fc.Z,{md:7,children:(0,S.jsx)(Jc,{children:(0,S.jsx)(N.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){x(e.target.value),e.preventDefault()},onKeyDown:I,paddingHorizontal:0,placeholder:"enter value",small:!0,value:g})})})]}),null===A||void 0===A?void 0:A.map((function(e){return(0,S.jsx)(eu,{deleteVariable:function(){return w(e.uuid)},fetchVariables:n,pipelineUUID:j,variable:e},e.uuid)}))]})}),[w,A,h,g,j,m,x,f,a,T]),B=(0,s.useMemo)((function(){return(0,S.jsx)(Xc,{width:T,children:null===R||void 0===R?void 0:R.map((function(e){return(0,S.jsx)(eu,{copyText:(n=e.uuid,"from mage_ai.data_preparation.variable_manager import (\n get_variable,\n)\n\n".concat(function(e,n,t){return"\n".concat(t," = get_variable('").concat(e,"', '").concat(n,"', '").concat(t,"')\n")}(j,null===i||void 0===i?void 0:i.uuid,n))),hideEdit:!0,pipelineUUID:j,variable:e},e.uuid);var n}))})}),[R,i,T]);return(0,S.jsxs)(O.Z,{p:C.cd,children:[(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(lr.Z,{level:4,monospace:!0,children:"Global Variables"}),(0,S.jsx)(O.Z,{ml:2}),(0,S.jsx)(D.ZP,{Icon:ie.mm,blackBorder:!0,inline:!0,onClick:function(){return f((function(e){return!e}))},uuid:"Sidekick/GlobalVariables/addNewVariable",children:"New"})]})}),(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsxs)(_.ZP,{muted:!0,children:["Press ",(0,S.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,S.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,S.jsx)(O.Z,{mb:C.cd,children:M}),(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.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,S.jsxs)(O.Z,{mb:C.cd,children:[(0,S.jsxs)(_.ZP,{bold:!0,large:!0,children:["For Python (",(0,S.jsx)(Z.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/runtime-variable",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,S.jsx)(Qc.Z,{language:"python",small:!0,source:"\n var = kwargs['variable_name']\n"})]}),(0,S.jsxs)(O.Z,{mb:C.cd,children:[(0,S.jsxs)(_.ZP,{bold:!0,large:!0,children:["For SQL (",(0,S.jsx)(Z.Z,{href:"https://docs.mage.ai/guides/sql-blocks#variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,S.jsx)(Qc.Z,{language:"sql",small:!0,source:"\n {{ variable_name }}\n"})]}),(0,S.jsxs)(O.Z,{mb:C.cd,children:[(0,S.jsxs)(_.ZP,{bold:!0,large:!0,children:["For R (",(0,S.jsx)(Z.Z,{href:"https://docs.mage.ai/guides/r-blocks#runtime-variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,S.jsx)(Qc.Z,{language:"r",small:!0,source:"\n var <- global_vars['variable_name']\n"})]}),(0,S.jsxs)(O.Z,{mb:C.cd,children:[(0,S.jsx)(lr.Z,{level:4,monospace:!0,children:"Trigger Runtime Variables"}),(0,S.jsx)(O.Z,{mb:C.cd}),(0,S.jsx)(_.ZP,{children:"Depending on what kind of trigger you use for this pipeline, some default runtime variables will be provided."})]}),Object.values(nu.Xm).map((function(e,n){var t;return(0,S.jsxs)(O.Z,{mb:C.cd,children:[(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsx)(_.ZP,{large:!0,monospace:!0,children:(0,ce.vg)(null===(t=nu.Z4[e])||void 0===t?void 0:t.call(nu.Z4))})}),(0,tu.JZ)([],e).map((function(n,t){return(0,S.jsx)(eu,{hideEdit:!0,pipelineUUID:j,variable:n},"var_".concat(e,"_").concat(t))}))]},"".concat(e,"_").concat(n))})),R&&R.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{my:2,children:(0,S.jsx)(lr.Z,{level:4,monospace:!0,children:"Block Output Variables"})}),(0,S.jsx)(O.Z,{mb:2,children:B}),(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsxs)(_.ZP,{children:["Output variables can be used in any ",(0,S.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,warning:!0,children:v.tf.SCRATCHPAD})," block. They are for scratchpad blocks, specifically. To get upstream block outputs inside of other blocks, use the positional arguments."]})}),(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsx)(_.ZP,{children:"To load the variable in a scratchpad block, use the following syntax:"})}),(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsx)(Qc.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"})})]})]})},ru=b.default.div.withConfig({displayName:"indexstyle__OutputContainerStyle",componentId:"sc-wkjnrg-0"})([""," overflow-y:scroll;"," ",""],an.w5,(function(e){return e.height&&"\n height: ".concat(e.height,"px;\n ")}),(function(e){return!e.height&&"\n max-height: ".concat(e.maxHeight||300,"px;\n ")}));function ou(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 lu(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ou(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ou(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var cu=function(e){var n=e.cancelPipeline,t=e.checkIfPipelineRunning,i=e.executePipeline,r=e.isPipelineExecuting,o=e.pipelineExecutionHidden,l=e.pipelineMessages,c=e.setPipelineExecutionHidden,u=(0,s.useMemo)((function(){return(null===l||void 0===l?void 0:l.length)||0}),[l]),a=(0,s.useMemo)((function(){return u>100?l.slice(-100):l}),[u,l]),d=(0,s.useCallback)((function(){var e=!o;c(e),(0,F.t8)(F.Q9,e)}),[o,c]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(y.Z,{children:[(0,S.jsx)(T.Z,{beforeIcon:(0,S.jsx)(ie.JM,{inverted:!0,size:2*C.iI}),compact:r,disabled:r,loading:r,onClick:i,success:!0,children:(0,S.jsx)(_.ZP,{bold:!0,inverted:!0,primary:!1,children:"Execute pipeline"})}),(0,S.jsx)(O.Z,{ml:1}),r&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(T.Z,{beforeIcon:(0,S.jsx)(ie.x8,{inverted:!0,size:2*C.iI}),onClick:n,success:!0,children:(0,S.jsx)(_.ZP,{bold:!0,inverted:!0,primary:!1,children:"Cancel pipeline"})}),(0,S.jsx)(O.Z,{ml:1})]}),(0,S.jsx)(T.Z,{onClick:t,secondary:!0,children:"Running status"})]}),(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(O.Z,{ml:1}),(0,S.jsx)(_.ZP,{children:"Hide"}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(po.Z,{checked:o,onCheck:d})]})]}),!o&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.Z,{mb:1}),(0,S.jsx)(ru,{noScrollbarTrackBackground:!0,children:(0,S.jsx)(yt,{executedAndIdle:!0,hasError:!1,selected:!0,children:a.map((function(e,n){var t=e.data,i=e.type,r=[],o=(r=(r=Array.isArray(t)?t:[t]).filter((function(e){return e}))).length;return r.map((function(e,t){var r,l={first:0===n&&0===t,last:n===u-1&&t===o-1};return _n.jU.includes(i)?r=(0,S.jsx)(kt,lu(lu({},l),{},{children:(0,S.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,S.jsx)(gt(),{children:e})})})):i===_n.Gi.IMAGE_PNG&&(r=(0,S.jsx)("div",{style:{backgroundColor:"white"},children:(0,S.jsx)("img",{alt:"Image ".concat(n," from code output"),src:"data:image/png;base64, ".concat(e)})})),(0,S.jsx)("div",{children:r},"code-output-".concat(n,"-").concat(t))}))}))})})]})]})};var uu=function(e){var n=e.fetchSecrets,t=e.pipelineUUID,i=e.secrets,r=e.setErrorMessages,o=e.width,c=(0,s.useState)(!1),u=c[0],a=c[1],f=(0,s.useState)(),p=f[0],h=f[1],m=(0,s.useState)(),v=m[0],b=m[1],g=(0,s.useMemo)((function(){return o-C.cd*C.iI*2}),[o]),x=(0,d.Db)(ge.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}))}})}}),j=(0,l.Z)(x,1)[0],y=(0,d.Db)((function(e){return ge.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)}))}})}}),Z=(0,l.Z)(y,1)[0],P=(0,s.useCallback)((function(e){"Enter"===e.key?(j({secret:{name:p,value:v}}).then((function(){n(),h(null),b(null)})),a(!1)):"Escape"===e.key&&a(!1)}),[j,n,p,v]);return(0,S.jsxs)(O.Z,{p:C.cd,children:[(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsxs)(k.Z,{alignItems:"center",children:[(0,S.jsx)(lr.Z,{level:4,monospace:!0,children:"Secrets"}),(0,S.jsx)(O.Z,{ml:2}),(0,S.jsx)(D.ZP,{Icon:ie.mm,blackBorder:!0,inline:!0,onClick:function(){return a((function(e){return!e}))},uuid:"Sidekick/Secrets/addNewSecret",children:"New"})]})}),(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsxs)(_.ZP,{children:[(0,S.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,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsxs)(_.ZP,{muted:!0,children:["Press ",(0,S.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,S.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsxs)(Xc,{width:g,children:[u&&(0,S.jsxs)(gc.Z,{children:[(0,S.jsx)(fc.Z,{md:1,children:(0,S.jsx)(Jc,{noPadding:!0,children:(0,S.jsx)(D.ZP,{backgroundColor:$c.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText("{{ mage_secret_var(".concat(p,") }}")),qc.Am.success("Successfully copied to clipboard.",{position:qc.Am.POSITION.BOTTOM_RIGHT,toastId:p})},uuid:"Sidekick/Secrets/".concat(p),withIcon:!0,children:(0,S.jsx)(ie.CK,{size:2.5*C.iI})})})}),(0,S.jsx)(fc.Z,{md:4,children:(0,S.jsx)(Jc,{children:(0,S.jsx)(N.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){h(e.target.value),e.preventDefault()},onKeyDown:P,paddingHorizontal:0,placeholder:"secret name",small:!0,value:p})})}),(0,S.jsx)(fc.Z,{md:7,children:(0,S.jsx)(Jc,{children:(0,S.jsx)(N.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){b(e.target.value),e.preventDefault()},onKeyDown:P,paddingHorizontal:0,placeholder:"secret value",small:!0,value:v})})})]}),null===i||void 0===i?void 0:i.map((function(e){return(0,S.jsx)(eu,{deleteVariable:function(){return Z(e.name)},fetchVariables:n,hideEdit:!0,obfuscate:!0,pipelineUUID:t,variable:{uuid:e.name,value:e.value}},e.name)}))]})}),(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.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,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsx)(Qc.Z,{language:"yaml",small:!0,source:"\n \"{{ mage_secret_var('<secret_name>') }}\"\n ",maxWidth:g})}),(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsx)(_.ZP,{children:"To reference a secret in code, you can import the `get_secret_value` helper method:"})}),(0,S.jsx)(O.Z,{mb:C.cd,children:(0,S.jsx)(Qc.Z,{language:"python",small:!0,source:"\n from mage_ai.data_preparation.shared.secrets import get_secret_value\n\n get_secret_value('<secret_name>')\n ",maxWidth:g})})]})},au=t(66607),su=t(33699),du=t(72454),fu=t(64155);function pu(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 hu(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?pu(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pu(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var mu=function(e){var n=e.activeView,t=e.addNewBlockAtIndex,i=e.afterWidth,r=e.autocompleteItems,l=e.blockRefs,c=e.blocks,u=e.blocksInNotebook,a=e.cancelPipeline,d=e.chartRefs,f=e.checkIfPipelineRunning,p=e.deleteBlock,m=e.deleteWidget,v=e.editingBlock,b=e.executePipeline,g=e.fetchFileTree,x=e.fetchPipeline,j=e.fetchSecrets,y=e.fetchVariables,Z=e.globalVariables,P=e.insights,E=e.interruptKernel,w=e.isPipelineExecuting,I=e.lastTerminalMessage,A=e.messages,D=e.metadata,R=e.onChangeCallbackBlock,N=e.onChangeChartBlock,B=e.onChangeCodeBlock,L=e.onSelectBlockFile,U=e.pipeline,H=e.pipelineMessages,G=e.runBlock,z=e.runningBlocks,W=e.sampleData,Y=e.savePipelineContent,q=e.secrets,Q=e.selectedBlock,K=e.selectedFilePath,V=e.sendTerminalMessage,X=e.setAllowCodeBlockShortcuts,J=e.setAnyInputFocused,$=e.setDepGraphZoom,ee=e.setDisableShortcuts,ne=e.setEditingBlock,te=e.setErrors,re=e.setHiddenBlocks,le=e.setSelectedBlock,ce=e.setTextareaFocused,ue=e.statistics,ae=e.textareaFocused,se=e.treeRef,de=e.updateWidget,fe=e.widgets,he=(0,Wo.i)().height,me=un.uX,ve=(0,s.useState)([]),be=ve[0],ge=ve[1],je=(0,s.useState)(!!(0,F.U2)(F.Q9)),ye=je[0],ke=je[1],Ze=(0,s.useMemo)((function(){return i-(du.k1+1)}),[i]),Oe=((null===v||void 0===v?void 0:v.upstreamBlocks)||{}).block,_e=((null===W||void 0===W?void 0:W.columns)||[]).slice(0,100),Ce=(null===W||void 0===W?void 0:W.rows)||[],Pe=(null===D||void 0===D?void 0:D.column_types)||{},Se=null===_e||void 0===_e?void 0:_e.map((function(e){return{columnType:Pe[e],uuid:e}})),Ee=(null===P||void 0===P?void 0:P[1])||{},we=(0,s.useMemo)((function(){return(0,pe.HK)((null===P||void 0===P?void 0:P[0])||[],(function(e){return e.feature.uuid}))}),[P]),Ie=(0,tu.v0)({statistics:ue}),Te=(0,tu.CL)({columnTypes:Pe,statistics:ue}),Ae=!!W,De=(0,s.useMemo)((function(){return M.qL.INTEGRATION===(null===U||void 0===U?void 0:U.type)}),[U]),Re=M.qL.STREAMING!==(null===U||void 0===U?void 0:U.type)?-70:ye?-16:300,Me=(0,s.useCallback)((0,Vc.Fk)({columnTypes:Pe,columns:_e,insightsByFeatureUUID:we,insightsOverview:Ee,noColumnLinks:!0,statistics:ue}),[Pe,_e,we,Ee,ue]),Ne=(0,s.useMemo)((function(){return(0,S.jsx)(iu,{blocks:c,fetchVariables:y,pipeline:U,selectedBlock:Q,setErrorMessages:ge,variables:Z,width:Ze})}),[Ze,c,y,Z,U,Q]),Be=(0,s.useMemo)((function(){return(0,S.jsx)(Yc,{selectedBlock:Q,selectedFilePath:K,setErrors:te,width:Ze>an.nn?Ze-an.nn:Ze})}),[Ze,Q,K,te]),Le=(0,s.useMemo)((function(){return(0,S.jsx)(uu,{fetchSecrets:j,pipelineUUID:null===U||void 0===U?void 0:U.uuid,secrets:q,setErrorMessages:ge,width:Ze})}),[Ze,j,U,q]),Fe={addNewBlockAtIndex:t,autocompleteItems:r,blockRefs:l,blocks:c,blocksInNotebook:u,deleteBlock:p,fetchFileTree:g,fetchPipeline:x,interruptKernel:E,messages:A,onChangeCallbackBlock:R,onChangeCodeBlock:B,onSelectBlockFile:L,pipeline:U,runBlock:G,runningBlocks:z,savePipelineContent:Y,selectedBlock:Q,setAnyInputFocused:J,setErrors:te,setHiddenBlocks:re,setSelectedBlock:le,setTextareaFocused:ce,textareaFocused:ae};return(0,S.jsxs)(S.Fragment,{children:[(null===be||void 0===be?void 0:be.length)>=1&&(0,S.jsxs)(O.Z,{mb:3,mt:2,mx:2,children:[(0,S.jsxs)(k.Z,{justifyContent:"space-between",children:[(0,S.jsx)(_.ZP,{bold:!0,danger:!0,children:"Errors"}),(0,S.jsx)(T.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return ge([])},transparent:!0,children:(0,S.jsx)(ie.x8,{muted:!0})})]}),null===be||void 0===be?void 0:be.map((function(e){return(0,S.jsx)(O.Z,{pb:1,children:(0,S.jsx)(_.ZP,{monospace:!0,xsmall:!0,children:e})},e)}))]}),(0,S.jsxs)(fu.t0,{fullWidth:!0,heightOffset:oe.cH.TERMINAL===n?0:an.nn,onBlur:function(){K||ee(!1),null===X||void 0===X||X(!1)},onFocus:function(){ee(!0),n===oe.cH.TREE&&(null===X||void 0===X||X(!0))},children:[n===oe.cH.TREE&&(0,S.jsx)(h,{uuid:"PipelineDetail/".concat(null===U||void 0===U?void 0:U.uuid),children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(jt.Z,{blockRefs:l,editingBlock:v,enablePorts:!De,fetchPipeline:x,height:he-me-Re,onClickNode:function(e){var n=e.block.uuid;return re((function(e){var t=!(null===e||void 0===e||!e[n]);return t?hu(hu({},e),{},(0,o.Z)({},n,!t)):e}))},pipeline:U,runningBlocks:z,selectedBlock:Q,setEditingBlock:ne,setErrors:te,setSelectedBlock:le,setZoom:$,treeRef:se}),!Oe&&M.qL.STREAMING===(null===U||void 0===U?void 0:U.type)&&(0,S.jsx)(O.Z,{p:1,children:(0,S.jsx)(cu,{cancelPipeline:a,checkIfPipelineRunning:f,executePipeline:b,isPipelineExecuting:w,pipelineExecutionHidden:ye,pipelineMessages:H,setPipelineExecutionHidden:ke})})]})}),n===oe.cH.DATA&&_e.length>0&&(0,S.jsx)(xt.Z,{columnHeaderHeight:(0,xe.Qr)(Pe)&&(0,xe.Qr)(we)&&(0,xe.Qr)(Ee)?0:fu.Eh,columns:_e,height:he-me-un.OM,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,renderColumnHeader:Me,rows:Ce,width:Ze}),n===oe.cH.REPORTS&&(0,S.jsx)(fu.ht,{noPadding:!Q||!Ae,children:(0,S.jsxs)(k.Z,{flexDirection:"column",fullWidth:!0,children:[Ie&&(0,S.jsx)(au.Z,{stats:Ie,title:"Quality metrics"}),Te&&(0,S.jsx)(O.Z,{mt:C.cd,children:(0,S.jsx)(au.Z,{stats:Te,title:"Statistics"})}),Se.length>0&&(0,S.jsx)(O.Z,{mt:C.cd,children:(0,S.jsx)(Gc,{features:Se,statistics:ue})})]})}),n===oe.cH.GRAPHS&&(0,S.jsx)(fu.ht,{noPadding:!Q||!Ae,children:(0,S.jsx)(pl,{afterWidth:Ze,features:Se,insightsOverview:Ee,statistics:ue})}),oe.cH.SECRETS===n&&Le,oe.cH.VARIABLES===n&&Ne,oe.cH.FILE_VERSIONS===n&&(0,S.jsx)(h,{uuid:"FileVersions/".concat(K?decodeURIComponent(K):""),children:Be}),De||Q&&Ae||!Q&&Ae&&n===oe.cH.DATA?null:oe.du.includes(n)&&(0,S.jsx)(k.Z,{alignItems:"center",justifyContent:"center",verticalHeight:oe.fp,verticalHeightOffset:me,width:Ze,children:(0,S.jsx)(_.ZP,{center:!0,default:!0,disableWordBreak:!0,large:!0,monospace:!0,children:Q?!Ae&&"No data or insights available":"Select a block for insights"})}),oe.cH.CHARTS===n&&(fe.length>0?(0,S.jsx)(kc,{autocompleteItems:r,blockRefs:l,blocks:c,chartRefs:d,deleteWidget:m,fetchFileTree:g,fetchPipeline:x,messages:A,onChangeChartBlock:N,pipeline:U,runBlock:G,runningBlocks:z,savePipelineContent:Y,selectedBlock:Q,setAnyInputFocused:J,setErrors:te,setSelectedBlock:le,setTextareaFocused:ce,textareaFocused:ae,updateWidget:de,widgets:fe,width:Ze}):(0,S.jsxs)(k.Z,{alignItems:"center",flexDirection:"column",justifyContent:"center",verticalHeight:oe.fp,verticalHeightOffset:me,width:Ze,children:[(0,S.jsx)(O.Z,{px:1,children:(0,S.jsx)(k.Z,{flexDirection:"row",children:(0,S.jsxs)(_.ZP,{center:!0,default:!0,children:["Add a chart by clicking the chart icon \xa0",(0,S.jsx)(ie.GQ,{size:1.5*C.iI}),"\xa0in",(0,S.jsx)("br",{}),"the top right corner of a block (if applicable)."]})})}),(0,S.jsx)(O.Z,{mt:C.cd,px:1,children:(0,S.jsx)(Oc,{size:40*C.iI})})]})),oe.cH.TERMINAL===n&&(0,S.jsx)("div",{style:{height:"100%",position:"relative",width:Ze},children:(0,S.jsx)(su.Z,{lastMessage:I,onFocus:function(){return le(null)},sendMessage:V,width:Ze})}),oe.cH.EXTENSIONS===n&&(0,S.jsx)(Ac,hu({},Fe)),oe.cH.CALLBACKS===n&&(0,S.jsx)(jl,hu({},Fe))]})]})},vu=t(12691),bu=t.n(vu),gu=t(35438);function xu(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 ju(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?xu(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):xu(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var yu=function(e){var n,t=e.activeView,i=e.depGraphZoom,r=e.pipeline,o=e.secrets,l=e.treeRef,c=e.variables,u=null===r||void 0===r?void 0:r.uuid,a=(0,bl.iV)(),d=(0,tu.wx)(c,(function(e){return e.uuid===Kc.C})),f=oe.Qq[t],p=(null===f||void 0===f||null===(n=f.buildLabel)||void 0===n?void 0:n.call(f,{pipeline:r,secrets:o,variables:d}))||(null===f||void 0===f?void 0:f.label),h=(0,S.jsx)(_.ZP,{bold:!0,children:p}),m=oe.cH.EXTENSIONS===t&&(null===a||void 0===a?void 0:a.extension),v=ge.ZP.extension_options.list({},{},{pauseFetch:!m}).data,b=(0,s.useMemo)((function(){return(null===v||void 0===v?void 0:v.extension_options)||[]}),[v]),g=(0,s.useMemo)((function(){return(0,pe.HK)(b,(function(e){return e.uuid}))}),[b]);if(!t)return(0,S.jsx)("div",{});if(l&&oe.cH.TREE===t)h=(0,S.jsxs)(k.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[h,(0,S.jsx)(O.Z,{mr:1}),(0,S.jsxs)(y.Z,{alignItems:"center",children:[(0,S.jsx)(T.Z,ju(ju({},gu.Ai),{},{onClick:function(){var e,n;null===l||void 0===l||null===(e=l.current)||void 0===e||null===(n=e.zoomIn)||void 0===n||n.call(e)},children:(0,S.jsx)(_.ZP,{noWrapping:!0,children:"Zoom in"})})),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(T.Z,ju(ju({},gu.Ai),{},{onClick:function(){var e,n;null===l||void 0===l||null===(e=l.current)||void 0===e||null===(n=e.zoomOut)||void 0===n||n.call(e)},children:(0,S.jsx)(_.ZP,{noWrapping:!0,children:"Zoom out"})})),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsx)(cn.Z,{appearAbove:!0,appearBefore:!0,default:!0,label:"Shortcut: Double-click canvas",lightBackground:!0,size:null,widthFitContent:!0,children:(0,S.jsx)(T.Z,ju(ju({},gu.Ai),{},{onClick:function(){var e,n;null===l||void 0===l||null===(e=l.current)||void 0===e||null===(n=e.fitCanvas)||void 0===n||n.call(e)},children:(0,S.jsx)(_.ZP,{noWrapping:!0,children:"Reset"})}))}),(0,S.jsx)(O.Z,{mr:1}),(0,S.jsxs)(_.ZP,{bold:!0,children:[null===i||void 0===i?void 0:i.toFixed(2),"x"]})]})]});else if(m){var x=g[null===a||void 0===a?void 0:a.extension];h=(0,S.jsxs)(k.Z,{children:[(0,S.jsx)(bu(),{as:"/pipelines/".concat(u,"/edit?").concat(oe.uM,"=").concat(oe.cH.EXTENSIONS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,S.jsx)(Z.Z,{default:!0,children:p})}),(0,S.jsx)(_.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,S.jsx)(_.ZP,{bold:!0,children:null===x||void 0===x?void 0:x.name})]})}return(0,S.jsx)(un.ym,{children:h})},ku=t(3055),Zu=t(59920),Ou=t(36405);function _u(e){var n=e.activeView,t=e.pipeline,i=e.secrets,r=e.setActiveSidekickView,o=e.variables,l=(0,tu.wx)(o,(function(e){return e.uuid===Kc.C}));return oe.j5.map((function(e){var o=e.buildLabel,c=e.key,u=e.label;return{Icon:oe.Z7[c],id:c,isSelected:function(){return n===c},label:function(){return(null===o||void 0===o?void 0:o({pipeline:t,secrets:i,variables:l}))||u},onClick:function(){return r(c,!0)}}}))}var Cu=t(28799);function Pu(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 Su(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Pu(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Pu(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Eu(e){var n,t,i=e.page,c=e.pipeline,u=(0,f.useRouter)(),p=(0,Wo.i)().height,b=u.query.pipeline,g=c.uuid||b,x=(0,s.useState)(!!(0,F.U2)(F.zg)),j=x[0],y=x[1],Z=(0,s.useState)(null),_=Z[0],P=Z[1],E=(0,s.useState)(null),w=E[0],R=E[1],N=(0,s.useState)(null),B=N[0],U=N[1],H=(0,s.useState)(null),G=H[0],z=H[1],q=(0,s.useState)([]),Q=q[0],K=q[1],V=(0,s.useState)({}),X=V[0],J=V[1],$=(0,s.useState)(!1),ee=$[0],ne=$[1],re=(0,s.useState)(!1),le=re[0],ue=re[1],ae=(0,s.useState)(!1),se=ae[0],de=ae[1],fe=(0,s.useState)(!1),he=fe[0],me=fe[1],ve=(0,s.useState)(1),be=ve[0],ye=ve[1],Ze="".concat(L.H8,"_").concat(g),Oe=(0,F.U2)(Ze),_e=(0,s.useState)((0,pe.sE)(zo.NR,(function(e){return e.uuid===Oe}))||zo.NR[0]),Ce=_e[0],Pe=_e[1],Se=(0,s.useCallback)((function(e){Pe(e),(0,F.t8)(Ze,null===e||void 0===e?void 0:e.uuid)}),[Ze,Pe]),Ee="".concat(L.g6,"_").concat(g),we=(0,s.useState)({}),Ie=we[0],Te=we[1],Ae=(0,s.useCallback)((function(e){Te((function(n){var t=e(n);return(0,F.t8)(Ee,JSON.stringify(t)),t}))}),[Ee,Te]);(0,s.useEffect)((function(){var e=(0,F.U2)(Ee);e&&(0,ce.Pb)(e)&&Te(JSON.parse(e))}),[Ee,Te]);var De=(0,s.useRef)(null),Me=ge.ZP.statuses.list({},{revalidateOnFocus:!1}).data,Ne=(0,s.useMemo)((function(){var e,n;return null===Me||void 0===Me||null===(e=Me.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.disable_pipeline_edit_access}),[Me]),Be=(0,s.useMemo)((function(){var e,n;return null===Me||void 0===Me||null===(e=Me.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.max_print_output_lines}),[Me]),Le=(0,s.useState)({}),Fe=Le[0],Ue=Le[1],Ge=(0,s.useState)([]),ze=Ge[0],We=Ge[1],Ye=ge.ZP.kernels.list({},{refreshInterval:5e3,revalidateOnFocus:!0}),Qe=Ye.data,Ke=Ye.mutate,Ve=null===Qe||void 0===Qe?void 0:Qe.kernels,Xe=(null===Ve||void 0===Ve?void 0:Ve.find((function(e){return e.name===M.a_[null===an||void 0===an?void 0:an.type]})))||(null===Ve||void 0===Ve?void 0:Ve[0]),$e=(0,kn.Z)(g),en=ge.ZP.pipelines.detail(g,{includes_outputs:(0,xe.Qr)(Fe)},{refreshInterval:6e4}),nn=en.data,tn=en.mutate,rn=ge.ZP.files.list(),on=rn.data,cn=rn.mutate,un=(0,s.useMemo)((function(){return(null===on||void 0===on?void 0:on.files)||[]}),[on]),an=null===nn||void 0===nn?void 0:nn.pipeline,sn=(0,s.useMemo)((function(){return M.qL.INTEGRATION===(null===an||void 0===an?void 0:an.type)}),[an]),dn=(0,s.useState)(null),fn=dn[0],pn=dn[1],hn=(0,s.useState)((0,Zn.Tz)({dateObj:!0})),vn=hn[0],bn=hn[1],jn=(0,s.useState)(!1),yn=jn[0],Cn=jn[1],Pn=(0,Re.dd)((function(){return(0,S.jsx)(ke.Z,{centerOnScreen:!0,neutral:!0,onClick:wn,subtitle:"Please refresh your page to have the most up-to-date data before making any changes.",title:"Your pipeline may be stale.",width:34*C.iI})}),{},[],{background:!0,uuid:"stale_pipeline_message"}),Sn=(0,l.Z)(Pn,2),En=Sn[0],wn=Sn[1];(0,s.useEffect)((function(){var e,n;null!==nn&&void 0!==nn&&null!==(e=nn.pipeline)&&void 0!==e&&e.updated_at&&(null===fn||void 0===fn?void 0:fn.toISOString())!==new Date(null===nn||void 0===nn||null===(n=nn.pipeline)||void 0===n?void 0:n.updated_at).toISOString()&&pn(new Date(nn.pipeline.updated_at)),fn&&Number(fn)>Number(vn)&&En()}),[null===nn||void 0===nn||null===(n=nn.pipeline)||void 0===n?void 0:n.updated_at,fn,vn,En]),(0,s.useEffect)((function(){(0,je.bB)(nn,R)}),[nn]);var In=(0,bl.iV)(),Tn=In[oe.uM],An=In.block_uuid,Dn=In.file_path,Rn=(0,s.useMemo)((function(){var e=In["file_paths[]"]||[];return Array.isArray(e)||(e=[e]),e}),[In]),Mn=(0,s.useCallback)((function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=arguments.length>2?arguments[2]:void 0,i=(0,o.Z)({},oe.uM,e);null!==t&&void 0!==t&&t.blockUUID&&(i.block_uuid=null===t||void 0===t?void 0:t.blockUUID),(0,mn.u7)(i,{preserveParams:["block_uuid","file_path","file_paths[]"],pushHistory:n,replaceParams:!0})}),[]);(0,s.useEffect)((function(){Tn||Mn(oe.cH.TREE,!1)}),[Tn,Mn]);var Nn=(0,s.useCallback)((function(e,n,t){y(!1),setTimeout((function(){return Mn(e,n,t)}),1)}),[Mn]),Bn=(0,s.useRef)({}),Ln=(0,s.useRef)({}),Fn=(0,s.useRef)(null),Un=(0,s.useRef)({}),Hn=(0,s.useRef)({}),Gn=(0,s.useRef)({}),zn=(0,s.useCallback)((function(e,n,t){var i=Un.current||{};Un.current=Su(Su({},i),{},(0,o.Z)({},e,Su(Su({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[Un]),Wn=(0,s.useCallback)((function(e,n,t){var i=Hn.current||{};Hn.current=Su(Su({},i),{},(0,o.Z)({},e,Su(Su({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[Hn]),Yn=(0,s.useCallback)((function(e,n,t){zn(e,n,t),Cn(!0)}),[zn,Cn]),qn=(0,s.useCallback)((function(e,n,t){Wn(e,n,t),Cn(!0)}),[Wn,Cn]),Qn=(0,s.useCallback)((function(e){Gn.current=Su(Su({},Gn.current),e)}),[Gn]),Kn=(0,s.useCallback)((function(e,n){Qn((0,o.Z)({},e,n)),Cn(!0)}),[Qn,Cn]),Vn=(0,s.useState)(null),Xn=Vn[0],Jn=Vn[1],$n=ge.ZP.data_providers.list({},{revalidateOnFocus:!1}).data,et=null===$n||void 0===$n?void 0:$n.data_providers,nt=ge.ZP.variables.pipelines.list(g,{},{revalidateOnFocus:!1}),tt=nt.data,it=nt.mutate,rt=null===tt||void 0===tt?void 0:tt.variables,ot=ge.ZP.secrets.list({},{revalidateOnFocus:!1}),lt=ot.data,ct=ot.mutate,ut=null===lt||void 0===lt?void 0:lt.secrets,at=(0,s.useState)([]),st=at[0],dt=at[1],ft=(0,s.useState)([]),pt=ft[0],ht=ft[1],mt=(0,s.useRef)({}),vt=(0,s.useCallback)((function(e){var n;Cn(!0);var t=mt.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),mt.current[e.uuid]=Su(Su(Su({},t),e),{},{configuration:Su(Su({},t.configuration),e.configuration),upstream_blocks:i})}),[Cn,mt]),bt=(0,s.useState)(!1),gt=bt[0],xt=bt[1],jt=(0,s.useState)({upstreamBlocks:null}),yt=jt[0],kt=jt[1],Zt=(0,s.useState)([]),Ot=Zt[0],_t=Zt[1],Ct=(0,s.useState)(null),St=Ct[0],Et=Ct[1],wt=function(e,n){var t=(0,pe.HK)(n,(function(e){return e.uuid}));return e.map((function(e){return t[e]})).filter((function(e){return!!e}))}(Ut(g),st),It=(0,s.useState)(wt),Tt=It[0],At=It[1],Dt=(0,s.useState)(),Rt=Dt[0],Mt=Dt[1],Nt=(0,s.useState)(),Ht=Nt[0],Gt=Nt[1],zt=(0,s.useState)(null),Wt=zt[0],Yt=zt[1],qt=(0,kn.Z)(Tt),Qt=(0,s.useCallback)((function(){kt({upstreamBlocks:{block:null,values:[]}}),Ue({}),Cn(!1),_t([]),Et(null)}),[]);(0,s.useEffect)((function(){g!==$e&&(Un.current={},Hn.current={})}),[g,$e]);var Kt=ge.ZP.block_outputs.detail((null===Wt||void 0===Wt?void 0:Wt.type)!==v.tf.SCRATCHPAD&&(null===Wt||void 0===Wt?void 0:Wt.type)!==v.tf.CHART&&(null===Wt||void 0===Wt?void 0:Wt.uuid)&&encodeURIComponent(null===Wt||void 0===Wt?void 0:Wt.uuid),{pipeline_uuid:!j&&g}),Vt=Kt.data,Xt=Kt.mutate,Jt=(0,s.useMemo)((function(){return null===Vt||void 0===Vt?void 0:Vt.block_output}),[Vt]),$t=(0,s.useMemo)((function(){var e,n,t;return sn?null===(e=(0,pe.sE)(null===Jt||void 0===Jt?void 0:Jt.outputs,(function(e){return e.variable_uuid==="output_sample_data_".concat((0,ce.kE)(Ht))})))||void 0===e?void 0:e.sample_data:null===Jt||void 0===Jt||null===(n=Jt.outputs)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.sample_data}),[Jt,sn,Ht]),ei=ge.ZP.blocks.pipelines.analyses.detail(!j&&g,(null===Wt||void 0===Wt?void 0:Wt.type)!==v.tf.SCRATCHPAD&&(null===Wt||void 0===Wt?void 0:Wt.type)!==v.tf.CHART&&(null===Wt||void 0===Wt?void 0:Wt.uuid)&&encodeURIComponent(null===Wt||void 0===Wt?void 0:Wt.uuid)),ni=ei.data,ti=ei.mutate,ii=(null===ni||void 0===ni||null===(t=ni.analyses)||void 0===t?void 0:t[0])||{},ri=ii.insights,oi=void 0===ri?{}:ri,li=ii.metadata,ci=void 0===li?{}:li,ui=ii.statistics,ai=void 0===ui?{}:ui;(0,s.useEffect)((function(){0===Ot.length&&(ti(),Xt(),it())}),[ti,Xt,it,Ot]),(0,s.useEffect)((function(){if(0===Tt.length)Yt(null);else if((null===qt||void 0===qt?void 0:qt.length)!==(null===Tt||void 0===Tt?void 0:Tt.length)&&(null===Tt||void 0===Tt?void 0:Tt.length)<(null===qt||void 0===qt?void 0:qt.length)){var e=qt.findIndex((function(e){return e.uuid===(null===Wt||void 0===Wt?void 0:Wt.uuid)})),n=qt.length-1===e?e-1:e+1;Yt(qt[Math.max(0,n)])}}),[Tt,qt,null===Wt||void 0===Wt?void 0:Wt.uuid]),(0,s.useEffect)((function(){var e;null!==(e=yt.upstreamBlocks)&&void 0!==e&&e.block&&(y(!1),Mn(oe.cH.TREE))}),[yt.upstreamBlocks,Mn]);var si=ge.ZP.autocomplete_items.list({},{refreshInterval:!1,revalidateOnFocus:!1}),di=si.data,fi=si.mutate,pi=null===di||void 0===di?void 0:di.autocomplete_items;(0,s.useEffect)((function(){Dn||de(!1),z(Dn)}),[Dn]),(0,s.useEffect)((function(){(0,pe.fS)(Rn,Q)||K(Rn)}),[Rn,Q]);var hi=(0,d.Db)(ge.ZP.pipelines.useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.pipeline.uuid;u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(n,"/edit")),cn()},onErrorCallback:function(e,n){return R({errors:n,response:e})}})}}),mi=(0,l.Z)(hi,1)[0],vi=(0,d.Db)(ge.ZP.pipelines.useUpdate(g,{update_content:!0}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){Cn(!1),tn()},onErrorCallback:function(e,n){return R({errors:n,response:e})}})}}),bi=(0,l.Z)(vi,2),gi=bi[0],xi=bi[1].isLoading,ji=(0,s.useCallback)((function(e,n){var t=e||{},i=t.block,r=t.pipeline,o=void 0===r?{extensions:{}}:r,c=(n||{}).contentOnly;if(!(fn&&Number(fn)>Number(vn))){var u=(0,Zn.Tz)({dateObj:!0}),a=(0,Zn.Tz)();bn(u);var s={},d={},f={};st.forEach((function(e){var n,t,r,o=e.extension_uuid,u=e.type,a=e.uuid,p=null===(n=Hn.current[u])||void 0===n?void 0:n[a];"undefined"===typeof p&&(p=e.content);var h,m=null===(t=Un.current[u])||void 0===t?void 0:t[a];"undefined"===typeof m&&(m=e.callback_content);var b=null===(r=Fe[a])||void 0===r?void 0:r.filter((function(e){return!!e})),g=null===b||void 0===b?void 0:b.find((function(e){return e.error}));if(b){var x=[],j=0;b.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(Pt)?e:e.concat(n)}),[]),i===_n.Gi.TEXT_PLAIN&&(j+=(null===t||void 0===t?void 0:t.length)||0)),(!Be||j<Be+5)&&x.push(n))})),h=x.map((function(e,n){return{text_data:JSON.stringify(e),variable_uuid:"".concat(a,"_").concat(n)}}))}var y=Su(Su({},e),{},{callback_content:m,content:p,outputs:h});(null===i||void 0===i?void 0:i.uuid)===a&&Object.entries(i).forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];"object"===typeof i&&!Array.isArray(i)&&i?Object.entries(i).forEach((function(e){var n=(0,l.Z)(e,2),i=n[0],r=n[1];y[t]||(y[t]={}),y[t][i]=r})):y[t]=i})),c?d[y.uuid]={callback_content:y.callback_content,content:y.content,outputs:y.outputs,uuid:y.uuid}:[v.tf.EXTENSION].includes(u)?(s[o]||(s[o]=[]),s[o].push(y)):v.tf.CALLBACK===u?f[y.uuid]=y:d[y.uuid]=y}));var p=Su(Su({},null===an||void 0===an?void 0:an.extensions),null===o||void 0===o?void 0:o.extensions);Object.entries(s).forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];p[t]||(p[t]={}),p[t].blocks=i}));var h=[],m=[];return((null===o||void 0===o?void 0:o.blocks)||st).forEach((function(e){var n=e.uuid,t=d[n],i=f[n];"undefined"!==typeof t?h.push(t):"undefined"!==typeof i&&m.push(i)})),gi({pipeline:Su(Su(Su({},an),o),{},{blocks:h,callbacks:m,extensions:p,updated_at:a,widgets:pt.map((function(e){var n,t,i=Gn.current[e.uuid],r=mt.current[e.uuid]||{};"undefined"===typeof i&&(i=e.content);var o=null===(n=Fe[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(Pt)?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 Su(Su(Su({},e),r),{},{configuration:Su(Su({},e.configuration),r.configuration),content:i,outputs:t})}))})})}En()}),[st,Fe,an,fn,vn,En,gi,pt]),yi=(0,s.useCallback)((function(e){ji();var n=encodeURIComponent(e),t=(0,bl.iV)()["file_paths[]"]||[];Array.isArray(t)||(t=[t]),t.includes(n)||t.push(n),(0,mn.u7)({file_path:n,"file_paths[]":t})}),[ji]),ki=(0,s.useMemo)((function(){var e=[],n=[];return st.forEach((function(t){v.tf.EXTENSION===t.type||v.tf.CALLBACK===t.type?n.push(t):e.push(t)})),{blocksInNotebook:e,blocksInSidekick:n}}),[st]),Zi=ki.blocksInNotebook,Oi=ki.blocksInSidekick,_i=(0,s.useCallback)((function(e,n){return ji({pipeline:{name:e,type:n}}).then((function(e){var t,i;if(null!==e&&void 0!==e&&null!==(t=e.data)&&void 0!==t&&t.pipeline){var r=e.data.pipeline.uuid;g!==r?window.location.href="/pipelines/".concat(r,"/edit"):(cn(),n!==(null===an||void 0===an?void 0:an.type)&&tn(),Lt(Zi,g,r),Lt(Oi,g,r))}else null!==e&&void 0!==e&&null!==(i=e.data)&&void 0!==i&&i.error&&R((function(e){return Su(Su({},e),{},{links:[{label:"Check pipeline configuration",onClick:function(){yi("pipelines/".concat(g,"/").concat(W.METADATA_YAML)),R(null)}}]})}))}))}),[Zi,Oi,cn,tn,yi,null===an||void 0===an?void 0:an.type,g,ji]),Ci=(0,d.Db)((function(e){var n=e.type,t=e.extension_uuid,i=e.uuid,r={};return n&&(r.block_type=n),t&&(r.extension_uuid=t),ge.ZP.blocks.pipelines.useDelete(g,encodeURIComponent(i),r)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.block,t=n.type,i=n.uuid;dt((function(e){return(0,pe.oM)(e,e.findIndex((function(e){var n=e.type,r=e.uuid;return t===n&&i===r})))})),tn(),Et(null),t===v.tf.SCRATCHPAD&&cn()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;R({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&Ue((function(e){return Su(Su({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:_n.Gi.TEXT_PLAIN}}))))}))}})}}),Pi=(0,l.Z)(Ci,1)[0],Si=(0,d.Db)((function(e){var n=e.uuid;return ge.ZP.widgets.pipelines.useDelete(g,n)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.widget.uuid;ht((function(e){return(0,pe.oM)(e,e.findIndex((function(e){var t=e.uuid;return n===t})))})),tn(),cn()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;R({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&Ue((function(e){return Su(Su({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:_n.Gi.TEXT_PLAIN}}))))}))}})}}),Ei=(0,l.Z)(Si,1)[0],wi=(0,Re.dd)((function(e){return(0,S.jsx)(ke.Z,{centerOnScreen:!0,neutral:!0,onCancel:Ai,onClick:function(){return Ri(e)},subtitle:"Deleting this block is dangerous. Your block may have downstream dependencies that depend on this block. You can delete this block anyway and remove it as a dependency from downstream blocks.",title:"Your block has dependencies",width:34*C.iI})})),Ii=(0,l.Z)(wi,2),Ti=Ii[0],Ai=Ii[1],Di=(0,d.Db)((function(e){var n=e.language,t=e.type,i=e.uuid,r="".concat(t,"/").concat(i);return n&&te[n]&&(r="".concat(r,".").concat(te[n].toLowerCase())),ge.ZP.blocks.useDelete(encodeURIComponent(r))()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){fi(),tn(),cn()},onErrorCallback:function(e,n){Ti(),R({displayMessage:e.exception,errors:n,response:e})}})}}),Ri=(0,l.Z)(Di,1)[0],Mi=(0,d.Db)(ge.ZP.kernels.useUpdate(null===Xe||void 0===Xe?void 0:Xe.id),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){return Ke()},onErrorCallback:function(e,n){return R({errors:n,response:e})}})}}),Ni=(0,l.Z)(Mi,1)[0],Bi=(0,s.useCallback)((function(){return Ni({kernel:{action_type:"restart"}})}),[Ni]),Li=(0,s.useCallback)((function(){Ni({kernel:{action_type:"interrupt"}}),_t([])}),[Ni]),Fi=(0,d.Db)(ge.ZP.blocks.pipelines.useCreate(g)),Ui=(0,l.Z)(Fi,1)[0],Hi=(0,s.useCallback)((function(e,n,t){var i,o,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,ce.Y6)();e.converted_from_type&&e.converted_from_uuid&&(i=null===(o=Hn.current[e.converted_from_type])||void 0===o?void 0:o[e.converted_from_uuid]);var u=e.language,a=e.type;if(sn){var s=(0,pe.HK)((null===an||void 0===an?void 0:an.blocks)||[],(function(e){return e.type})),d=s[v.tf.DATA_EXPORTER],f=s[v.tf.DATA_LOADER],p=s[v.tf.TRANSFORMER];if(v.tf.DATA_LOADER===a){if(v.t6.YAML!==u)return void R({displayMessage:"The source you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(f)return void R({displayMessage:"Pipeline ".concat(null===an||void 0===an?void 0:an.uuid," already has a source: ").concat(null===f||void 0===f?void 0:f.uuid,".")})}else if(v.tf.TRANSFORMER===a){if(p)return void R({displayMessage:"Pipeline ".concat(null===an||void 0===an?void 0:an.uuid," already has a transformer: ").concat(null===p||void 0===p?void 0:p.uuid,".")})}else if(v.tf.DATA_EXPORTER===a){if(v.t6.YAML!==u)return void R({displayMessage:"The destination you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(d)return void R({displayMessage:"Pipeline ".concat(null===an||void 0===an?void 0:an.uuid," already has a destination: ").concat(null===d||void 0===d?void 0:d.uuid,".")})}}return Ui({block:Su({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),cn(),tn().then((function(e){var n=e.pipeline,t=n.blocks,i=n.extensions;return dt((function(e){var n=(0,r.Z)(t);Object.entries(i||{}).forEach((function(e){var t=(0,l.Z)(e,2),i=t[0],o=t[1].blocks;o&&n.push.apply(n,(0,r.Z)(o.map((function(e){return Su(Su({},e),{},{extension_uuid:i})}))))}));var o=(0,pe.HK)(e,(function(e){return e.uuid})),c=[];return n.forEach((function(e){var n=o[e.uuid];n?c.push(n):c.push(e)})),c}))}))},onErrorCallback:function(e,n){return R({errors:n,response:e})}})}))}),[Ui,cn,tn,sn,dt,R,an]),Gi=(0,s.useState)(!1),zi=Gi[0],Wi=Gi[1];(0,s.useEffect)((function(){Wi(!!(0,F.U2)(L.kY))}),[]);var Yi=(0,Re.dd)((function(e){var n=e.block,t=e.idx,i=e.name,r=void 0===i?(0,ce.Y6)():i,o=e.onCreateCallback;return(0,S.jsx)(Y,{block:n,defaultName:r,onClose:Ki,onSave:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Hi(n,t,o,null===e||void 0===e?void 0:e.name).then((function(){return Ki()}))},pipeline:an})}),{},[Hi,an],{background:!0,uuid:"configure_block_name_and_create"}),qi=(0,l.Z)(Yi,2),Qi=qi[0],Ki=qi[1],Vi=(0,d.Db)(ge.ZP.widgets.pipelines.useCreate(g)),Xi=(0,l.Z)(Vi,1)[0],Ji=(0,s.useCallback)((function(e,n,t){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,ce.Y6)();return Xi({widget:Su({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),cn(),tn(),Mn(oe.cH.CHARTS),U(n)},onErrorCallback:function(e,n){return R({errors:n,response:e})}})}))}),[cn,tn,Xi,Mn]);(0,s.useEffect)((function(){if(B){var e,n=null===(e=Ln.current[B.uuid])||void 0===e?void 0:e.current;n&&(n.scrollIntoView(),U(null))}}),[B,U]),(0,s.useEffect)((function(){$e!==g&&(dt([]),ht([]),At([]),We([]))}),[g,$e]),(0,s.useEffect)((function(){if("undefined"!==typeof(null===an||void 0===an?void 0:an.blocks)||"undefined"!==typeof(null===an||void 0===an?void 0:an.extensions)){var e=[];"undefined"!==typeof(null===an||void 0===an?void 0:an.blocks)&&e.push.apply(e,(0,r.Z)(null===an||void 0===an?void 0:an.blocks)),"undefined"!==typeof(null===an||void 0===an?void 0:an.callbacks)&&e.push.apply(e,(0,r.Z)(null===an||void 0===an?void 0:an.callbacks)),"undefined"!==typeof(null===an||void 0===an?void 0:an.extensions)&&Object.entries((null===an||void 0===an?void 0:an.extensions)||{}).forEach((function(n){var t=(0,l.Z)(n,2),i=t[0],o=t[1].blocks;o&&e.push.apply(e,(0,r.Z)(o.map((function(e){return Su(Su({},e),{},{extension_uuid:i})}))))})),dt(e)}}),[null===an||void 0===an?void 0:an.blocks,null===an||void 0===an?void 0:an.callbacks,null===an||void 0===an?void 0:an.extensions]),(0,s.useEffect)((function(){"undefined"!==typeof(null===an||void 0===an?void 0:an.widgets)&&ht(an.widgets)}),[null===an||void 0===an?void 0:an.widgets]),(0,s.useEffect)((function(){(null===wt||void 0===wt?void 0:wt.length)>0&&0===(null===Tt||void 0===Tt?void 0:Tt.length)&&(At(wt),Yt(wt[0]))}),[Tt,wt]);var $i=(0,kn.Z)(st);(0,s.useEffect)((function(){if("undefined"!==typeof(null===an||void 0===an?void 0:an.blocks)&&(!st.length||!(0,pe.fS)(null===$i||void 0===$i?void 0:$i.map((function(e){return e.uuid})).sort(),null===st||void 0===st?void 0:st.map((function(e){return e.uuid})).sort()))){var e=Bt(an.blocks),n=e.content,t=e.messages;Hn.current=n,Ue((function(e){return Su(Su({},t),e)}))}}),[st,$i,null===an||void 0===an?void 0:an.blocks,Ue]),(0,s.useEffect)((function(){if(!pt.length&&"undefined"!==typeof(null===an||void 0===an?void 0:an.widgets)){var e=Bt(an.widgets),n=e.content,t=e.messages;Gn.current=n,Ue((function(e){return Su(Su({},t),e)}))}}),[null===an||void 0===an?void 0:an.widgets,Ue,pt]);var er=(0,s.useCallback)((function(e,n,t){var i=st.find((function(t){var i=t.type,r=t.uuid;return i===n&&r===e}));if(i){if(Et(i),null!==Bn&&void 0!==Bn&&Bn.current){var r,o=Bn.current["".concat(i.type,"s/").concat(i.uuid,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}(0,mn.u7)({block_uuid:null,file_path:null,"file_paths[]":[]})}else if(n===v.tf.CHART){var l=pt.find((function(n){return n.uuid===e}));if(l&&(Et(l),null!==Ln&&void 0!==Ln&&Ln.current)){var c,u=Ln.current[l.uuid];null===u||void 0===u||null===(c=u.current)||void 0===c||c.scrollIntoView()}}else t&&yi(t)}),[st,yi,pt]);(0,s.useEffect)((function(){if(An&&!St){var e=st.find((function(e){var n,t=e.uuid;return(null===An||void 0===An||null===(n=An.split(":"))||void 0===n?void 0:n[0])===t}));e&&(Ae((function(n){return Su(Su({},n),{},(0,o.Z)({},e.uuid,!1))})),er(e.uuid,e.type,null))}else(null===$i||void 0===$i?void 0:$i.length)!==(null===st||void 0===st?void 0:st.length)&&St&&(Ae((function(e){return Su(Su({},e),{},(0,o.Z)({},St.uuid,!1))})),er(St.uuid,St.type,null))}),[An,st,null===$i||void 0===$i?void 0:$i.length,er,St,Ae]);var nr=(0,s.useMemo)((function(){return new m.Z}),[]),tr=(0,s.useMemo)((function(){return{api_key:qe.l,token:nr.decodedToken.token}}),[nr]),ir=(0,a.ZP)((0,Cu.Ib)(),{onClose:function(){return console.log("socketUrlPublish closed")},onMessage:function(e){if(e){var n=JSON.parse(e.data),t=n.block_type,i=n.execution_state,l=n.msg_type,c=n.pipeline_uuid,u=n.uuid;if(!u&&!c)return;var a=st.find((function(e){var n=e.type,i=e.uuid;return t===n&&u===i}));"stream_pipeline"!==l?Ue((function(e){var t=e[u]||[];return Su(Su({},e),{},(0,o.Z)({},u,t.concat(n)))})):(We((function(e){return[].concat((0,r.Z)(e),[n])})),_n.uF.IDLE===i&&(_t([]),tn(),u||xt(!1))),_n.uF.BUSY===i?_t((function(e){return e.find((function(e){var n=e.uuid;return u===n}))||!a?e:e.concat(a)})):_n.uF.IDLE===i&&_t((function(e){return e.filter((function(e){var n=e.uuid;return u!==n}))})),Ne||Cn(!0)}},onOpen:function(){return console.log("socketUrlPublish opened")},reconnectAttempts:10,reconnectInterval:3e3,shouldReconnect:function(){return console.log("Attempting to reconnect..."),!0}}).sendMessage,rr=(0,s.useCallback)((function(){ji().then((function(){xt(!0),We([]),ir(JSON.stringify(Su(Su({},tr),{},{execute_pipeline:!0,pipeline_uuid:g})))}))}),[g,ji,ir,tr]),or=(0,s.useCallback)((function(){ir(JSON.stringify(Su(Su({},tr),{},{cancel_pipeline:!0,pipeline_uuid:g})))}),[g,ir,tr]),lr=(0,s.useCallback)((function(){ir(JSON.stringify(Su(Su({},tr),{},{cancel_pipeline:!0,pipeline_uuid:g,skip_publish_message:!0})))}),[g,ir,tr]),cr=(0,s.useCallback)((function(){ir(JSON.stringify(Su(Su({},tr),{},{check_if_pipeline_running:!0,pipeline_uuid:g})))}),[g,ir,tr]);(0,s.useEffect)((function(){var e;return window.addEventListener("pagehide",lr),null===u||void 0===u||null===(e=u.events)||void 0===e||e.on("routeChangeStart",lr),function(){var e;null===u||void 0===u||null===(e=u.events)||void 0===e||e.off("routeChangeStart",lr),window.removeEventListener("pagehide",lr)}}),[lr,null===u||void 0===u?void 0:u.events]);var ur=(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;Ot.find((function(e){var n=e.uuid;return h===n}))&&!i||(ir(JSON.stringify(Su(Su({},tr),{},{code:t,extension_uuid:f,pipeline_uuid:null===an||void 0===an?void 0:an.uuid,run_downstream:o,run_settings:c,run_tests:d,run_upstream:a,type:n.type,upstream_blocks:p,uuid:h}))),Ue((function(e){return delete e[h],e})),ne(!1),_t((function(e){return e.find((function(e){var n=e.uuid;return h===n}))?e:e.concat(n)}))),tn()}),[tn,an,Ot,ir,Ue,_t,ne,tr]),ar=(0,s.useCallback)((function(e){var n=e.block;return Ne?ur(e):ji({block:{outputs:[],uuid:n.uuid}},{contentOnly:!0}).then((function(){return ur(e)}))}),[Ne,ur,ji]),sr=(0,a.ZP)((0,Cu.Ib)("terminal"),{queryParams:tr,shouldReconnect:function(){return!0}}),dr=sr.lastMessage,fr=sr.sendMessage,pr=(0,s.useMemo)((function(){return(0,S.jsx)(mu,{activeView:Tn,addNewBlockAtIndex:function(e,n,t,i){return new Promise((function(){return Qi({block:e,idx:n,name:i,onCreateCallback:t})}))},afterWidth:_,autocompleteItems:pi,blockRefs:Bn,blocks:st,blocksInNotebook:Zi,cancelPipeline:or,chartRefs:Ln,checkIfPipelineRunning:cr,deleteBlock:Pi,deleteWidget:Ei,editingBlock:yt,executePipeline:rr,fetchFileTree:cn,fetchPipeline:tn,fetchSecrets:ct,fetchVariables:it,globalVariables:rt,insights:oi,interruptKernel:Li,isPipelineExecuting:gt,isPipelineUpdating:xi,lastTerminalMessage:dr,messages:Fe,metadata:ci,onChangeCallbackBlock:Yn,onChangeChartBlock:Kn,onChangeCodeBlock:qn,onSelectBlockFile:er,pipeline:an,pipelineMessages:ze,runBlock:ar,runningBlocks:Ot,sampleData:$t,savePipelineContent:ji,secrets:ut,selectedBlock:St,selectedFilePath:G,sendTerminalMessage:fr,setActiveSidekickView:Mn,setAllowCodeBlockShortcuts:me,setAnyInputFocused:ue,setDepGraphZoom:ye,setDisableShortcuts:de,setEditingBlock:kt,setErrors:R,setHiddenBlocks:Ae,setSelectedBlock:Et,setTextareaFocused:ne,statistics:ai,textareaFocused:ee,treeRef:Fn,updatePipelineMetadata:_i,updateWidget:vt,widgets:pt})}),[Tn,_,pi,Bn,st,Zi,or,cr,Pi,Ei,yt,rr,cn,tn,ct,it,rt,oi,Li,gt,xi,dr,Fe,ci,Yn,Kn,qn,er,an,ze,ar,Ot,$t,ji,ut,St,G,fr,Mn,ue,kt,R,Ae,ne,Qi,ai,ee,_i,vt,pt]),hr=(0,s.useMemo)((function(){return(0,S.jsx)(Fo,{addNewBlockAtIndex:zi?Hi: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)?Hi(e,n,t,i):Qi({block:e,idx:n,name:i,onCreateCallback:t})}))},addWidget:function(e,n){var t=n.onCreateCallback;return Ji(e,pt.length,t)},allBlocks:st,allowCodeBlockShortcuts:he,anyInputFocused:le,autocompleteItems:pi,blockRefs:Bn,blocks:Zi,dataProviders:et,deleteBlock:Pi,disableShortcuts:se,fetchFileTree:cn,fetchPipeline:tn,fetchSampleData:Xt,files:un,globalVariables:rt,hiddenBlocks:Ie,interruptKernel:Li,mainContainerRef:De,mainContainerWidth:Xn,messages:Fe,onChangeCallbackBlock:Yn,onChangeCodeBlock:qn,openSidekickView:Nn,pipeline:an,pipelineContentTouched:yn,restartKernel:Bi,runBlock:ar,runningBlocks:Ot,savePipelineContent:ji,selectedBlock:St,setAnyInputFocused:ue,setDisableShortcuts:de,setEditingBlock:kt,setErrors:R,setHiddenBlocks:Ae,setIntegrationStreams:Mt,setOutputBlocks:At,setPipelineContentTouched:Cn,setSelectedBlock:Et,setSelectedOutputBlock:Yt,setSelectedStream:Gt,setTextareaFocused:ne,textareaFocused:ee,widgets:pt})}),[Hi,Ji,he,le,pi,zi,Bn,st,Zi,et,Pi,se,cn,tn,Xt,un,rt,Ie,Li,De,Xn,Fe,Yn,qn,Nn,an,yn,Bi,ar,Ot,ji,St,ue,kt,R,Ae,Cn,Et,ne,Qi,ee,pt]),mr=(0,s.useMemo)((function(){if(i===zo.b7)return(0,S.jsx)(ln,{cancelPipeline:or,createPipeline:mi,executePipeline:rr,interruptKernel:Li,isPipelineExecuting:gt,pipeline:an,restartKernel:Bi,savePipelineContent:ji,setActiveSidekickView:Mn,setMessages:Ue,children:G&&(0,S.jsx)(O.Z,{ml:1,children:(0,S.jsx)(k.Z,{alignItems:"center",fullHeight:!0,children:(0,S.jsx)(T.Z,{compact:!0,onClick:function(){return z(null)},small:!0,children:"View pipeline"})})})})}),[or,mi,rr,Li,gt,i,an,Bi,ji,G,Mn,Ue,z]),vr=(0,s.useMemo)((function(){if(i===zo.b7)return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(On,{filePaths:Q,filesTouched:X,isBusy:Ot.length>=1,isPipelineUpdating:xi,kernel:Xe,pipeline:an,pipelineContentTouched:yn,pipelineLastSaved:fn,restartKernel:Bi,savePipelineContent:ji,selectedFilePath:G,setErrors:R,setRunningBlocks:_t,updatePipelineMetadata:_i,children:mr}),(null===Q||void 0===Q?void 0:Q.length)>0&&(0,S.jsx)(gn,{filePaths:Q,filesTouched:X,savePipelineContent:ji,selectedFilePath:G})]})}),[mr,X,xi,Xe,i,an,yn,fn,Bi,Ot,ji,G,Q,R,_i]),br=(0,s.useMemo)((function(){var e;return null===Rt||void 0===Rt||null===(e=Rt.filter((function(e){return(0,pe.sE)(null===Jt||void 0===Jt?void 0:Jt.outputs,(function(n){return n.variable_uuid==="output_sample_data_".concat((0,ce.kE)(e))}))})))||void 0===e?void 0:e.map((function(e){return(0,S.jsx)(O.Z,{pl:1,children:(0,S.jsx)(D.ZP,{blackBorder:!0,compact:!0,muted:!0,onClick:function(){return Gt(e)},selected:Ht===e,uuid:e,children:e})},e)}))}),[Jt,Rt,Ht]),gr=(0,s.useRef)(null),xr=(0,s.useMemo)((function(){return(0,S.jsx)(He,{addNewBlock:function(e,n){Hi(e,st.length,n,e.name),(null===Rn||void 0===Rn?void 0:Rn.length)>=1&&u.push("/pipelines/".concat(g,"/edit"))},blocks:st,deleteWidget:Ei,fetchAutocompleteItems:fi,fetchFileTree:cn,fetchPipeline:tn,files:un,onSelectBlockFile:er,openFile:yi,openPipeline:function(e){Qt(),u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(e,"/edit"))},openSidekickView:Nn,pipeline:an,ref:gr,setErrors:R,setSelectedBlock:Et,widgets:pt})}),[Hi,st,Ei,fi,cn,tn,null===Rn||void 0===Rn?void 0:Rn.length,un,er,yi,Nn,an,g,Qt,u,R,Et,pt]),jr=(0,s.useMemo)((function(){return(0,S.jsx)(I,{blockRefs:Bn,hiddenBlocks:Ie,pipeline:an,setHiddenBlocks:Ae})}),[Bn,Ie,an,Ae]),yr=(0,s.useMemo)((function(){return zo.Jf.uuid===(null===Ce||void 0===Ce?void 0:Ce.uuid)?xr:zo.IY.uuid===(null===Ce||void 0===Ce?void 0:Ce.uuid)?jr:null}),[xr,jr,Ce]),kr=(0,s.useMemo)((function(){return(0,S.jsx)(O.Z,{px:1,children:(0,S.jsx)(A.Z,{noPadding:!0,onClickTab:function(e){Se(e)},selectedTabUUID:null===Ce||void 0===Ce?void 0:Ce.uuid,small:!0,tabs:zo.NR})})}),[Se,Ce]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(xn.Z,{title:null===an||void 0===an?void 0:an.name}),(0,S.jsxs)(Qo,{after:pr,afterHeader:(0,S.jsx)(yu,{activeView:Tn,depGraphZoom:be,pipeline:an,secrets:ut,treeRef:Fn,variables:rt}),afterHeightOffset:ku.Mz,afterHidden:j,afterNavigationItems:_u({activeView:Tn,pipeline:an,secrets:ut,setActiveSidekickView:Mn,variables:rt}),afterOverflow:oe.cH.DATA===Tn?"hidden":null,afterSubheader:(null===Tt||void 0===Tt?void 0:Tt.length)>0&&Tn===oe.cH.DATA&&(0,S.jsxs)(k.Z,{alignItems:"center",fullHeight:!0,fullWidth:!0,children:[!sn&&Tt.map((function(e){var n=e.uuid,t=(null===Wt||void 0===Wt?void 0:Wt.uuid)===n;return(0,S.jsx)(O.Z,{pl:1,children:(0,S.jsx)(D.ZP,{afterElement:t?(0,S.jsx)(T.Z,{basic:!0,highlightOnHover:!0,onClick:function(){!function(e,n){var t=Ut(e).filter((function(e){return e!==n}));(0,F.t8)(Ft(e),t)}(g,e.uuid),At((function(e){return e.filter((function(e){return e.uuid!==n}))}))},padding:"2px",transparent:!0,children:(0,S.jsx)(ie.x8,{muted:!0,size:1.25*C.iI})}):null,blackBorder:!0,compact:!0,muted:!0,onClick:function(){return Yt(e)},selected:t,uuid:n,children:n})},n)})),sn&&br]}),before:yr,beforeHeader:kr,beforeHeightOffset:ku.Mz,beforeNavigationItems:(0,Ou.H)(Zu.M.EDIT,an),errors:w,headerOffset:(null===Q||void 0===Q?void 0:Q.length)>0?36:0,mainContainerHeader:vr,mainContainerRef:De,page:i,pipeline:an,setAfterHidden:y,setAfterWidthForChildren:P,setErrors:R,setMainContainerWidth:Jn,children:[(0,S.jsx)("div",{style:{height:G?0:null,opacity:G?0:null,visibility:G?"hidden":null},children:(0,S.jsx)(h,{uuid:"PipelineDetail/".concat(g),children:hr})}),null===Rn||void 0===Rn?void 0:Rn.map((function(e){return(0,S.jsx)("div",{style:{display:G===e?null:"none"},children:(0,S.jsx)(h,{uuid:"FileEditor/".concat(decodeURIComponent(e)),children:(0,S.jsx)(Je,{active:G===e,addNewBlock:function(e,n){Hi(e,st.length,n,e.name),u.push("/pipelines/".concat(g,"/edit"))},fetchPipeline:tn,fetchVariables:it,filePath:e,openSidekickView:Nn,pipeline:an,selectedFilePath:G,sendTerminalMessage:fr,setDisableShortcuts:de,setErrors:R,setFilesTouched:J,setSelectedBlock:Et})})},e)})),(0,S.jsx)(O.Z,{pb:Dn?0:Math.max(Math.floor(p*(2/3)/C.iI),0)})]})]})}Eu.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=zo.b7,r={page:i,pipeline:{uuid:t}},e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();var wu=(0,Ko.Z)(Eu)},11366:function(e,n,t){"use strict";t.d(n,{H8:function(){return r},g6:function(){return o},kY:function(){return i}});var i="automatically_name_blocks",r="pipeline_edit_before_tab_selected",o="pipeline_edit_hidden_blocks"},42305:function(e,n,t){"use strict";t.d(n,{A5:function(){return f},AY:function(){return p},BP:function(){return d},JX:function(){return s},OC:function(){return o},Pc:function(){return h},Tz:function(){return a},d$:function(){return u},lJ:function(){return m},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.dayAgo,i=n.includeSeconds,c=n.utcFormat,u=r()(e),a=l;return c&&(u=u.utc()),t&&(u=u.subtract(1,"days")),i&&(a=o),u.format(a)}function a(e){var n=u((new Date).toISOString(),{includeSeconds:!0,utcFormat:!0});return null!==e&&void 0!==e&&e.dateObj?new Date(n):n}function s(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 d(e,n,t){return r()(e).utc().hours(+n).minutes(+t).format()}function f(e){return r()(e).unix()}function p(e,n,t,i){var r="".concat(e.toISOString().split("T")[0]," ").concat(n,":").concat(t);return i?"".concat(r,":").concat(i):r}function h(e){var n=r().unix(+e).utc();return{date:n.toDate(),hour:String(n.hour()),minute:String(n.minute())}}function m(e){return e.padStart(2,"0")}},76419:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/pipelines/[pipeline]/edit",function(){return t(59455)}])}},function(e){e.O(0,[3662,844,7607,5896,4804,1774,9350,5872,2714,2125,7011,8789,7107,1424,1005,8180,8957,1286,5540,5682,6567,9774,2888,179],(function(){return n=76419,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
|