mage-ai 0.9.68__py3-none-any.whl → 0.9.70__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mage-ai might be problematic. Click here for more details.
- mage_ai/api/policies/BackfillPolicy.py +1 -0
- mage_ai/api/policies/PipelinePolicy.py +1 -0
- mage_ai/api/policies/WorkspacePolicy.py +1 -0
- mage_ai/api/presenters/BackfillPresenter.py +1 -0
- mage_ai/api/resources/GitBranchResource.py +56 -23
- mage_ai/api/resources/GitCustomBranchResource.py +29 -1
- mage_ai/api/resources/OauthResource.py +1 -1
- mage_ai/api/resources/PipelineResource.py +11 -5
- mage_ai/api/resources/PipelineRunResource.py +41 -4
- mage_ai/api/resources/PipelineScheduleResource.py +4 -0
- mage_ai/api/resources/PullRequestResource.py +6 -4
- mage_ai/api/resources/SeedResource.py +2 -1
- mage_ai/api/resources/SessionResource.py +13 -1
- mage_ai/api/resources/WorkspaceResource.py +5 -4
- mage_ai/authentication/permissions/constants.py +2 -0
- mage_ai/authentication/permissions/seed.py +32 -21
- mage_ai/authentication/providers/active_directory.py +4 -3
- mage_ai/authentication/providers/okta.py +22 -83
- mage_ai/cache/block_action_object/__init__.py +1 -1
- mage_ai/cluster_manager/kubernetes/workload_manager.py +52 -1
- mage_ai/cluster_manager/workspace/base.py +6 -0
- mage_ai/cluster_manager/workspace/kubernetes.py +22 -1
- mage_ai/command_center/applications/utils.py +2 -2
- mage_ai/command_center/presenters/text.py +1 -1
- mage_ai/data_preparation/executors/k8s_block_executor.py +30 -7
- mage_ai/data_preparation/executors/k8s_pipeline_executor.py +30 -7
- mage_ai/data_preparation/executors/streaming_pipeline_executor.py +78 -8
- mage_ai/data_preparation/git/__init__.py +50 -22
- mage_ai/data_preparation/git/api.py +62 -7
- mage_ai/data_preparation/git/utils.py +45 -21
- mage_ai/data_preparation/models/block/__init__.py +31 -8
- mage_ai/data_preparation/models/block/data_integration/mixins.py +16 -5
- mage_ai/data_preparation/models/block/dynamic/child.py +3 -0
- mage_ai/data_preparation/models/block/dynamic/utils.py +9 -4
- mage_ai/data_preparation/models/block/dynamic/variables.py +2 -2
- mage_ai/data_preparation/models/block/extension/utils.py +1 -0
- mage_ai/data_preparation/models/block/global_data_product/__init__.py +25 -2
- mage_ai/data_preparation/models/block/integration/__init__.py +1 -1
- mage_ai/data_preparation/models/block/remote/__init__.py +0 -0
- mage_ai/data_preparation/models/block/remote/models.py +58 -0
- mage_ai/data_preparation/models/block/sql/__init__.py +1 -1
- mage_ai/data_preparation/models/block/utils.py +38 -0
- mage_ai/data_preparation/models/constants.py +2 -0
- mage_ai/data_preparation/models/global_data_product/__init__.py +12 -0
- mage_ai/data_preparation/models/pipeline.py +31 -11
- mage_ai/data_preparation/models/triggers/__init__.py +4 -2
- mage_ai/data_preparation/models/utils.py +6 -0
- mage_ai/data_preparation/models/variable.py +18 -4
- mage_ai/data_preparation/repo_manager.py +3 -2
- mage_ai/data_preparation/shared/utils.py +1 -1
- mage_ai/data_preparation/storage/local_storage.py +12 -6
- mage_ai/data_preparation/templates/data_exporters/mysql.py +2 -2
- mage_ai/data_preparation/templates/data_exporters/oracledb.py +27 -0
- mage_ai/data_preparation/templates/repo/metadata.yaml +1 -0
- mage_ai/io/bigquery.py +131 -58
- mage_ai/io/mysql.py +38 -6
- mage_ai/io/snowflake.py +152 -29
- mage_ai/orchestration/db/migrations/versions/42a14d6143f1_update_token_column_type.py +54 -0
- mage_ai/orchestration/db/models/oauth.py +14 -13
- mage_ai/orchestration/db/models/schedules.py +30 -2
- mage_ai/orchestration/job_manager.py +6 -0
- mage_ai/orchestration/notification/sender.py +37 -15
- mage_ai/orchestration/pipeline_scheduler_original.py +48 -31
- mage_ai/orchestration/queue/celery_queue.py +8 -1
- mage_ai/orchestration/queue/process_queue.py +67 -4
- mage_ai/orchestration/queue/queue.py +8 -0
- mage_ai/orchestration/triggers/api.py +29 -1
- mage_ai/orchestration/triggers/global_data_product.py +9 -4
- mage_ai/orchestration/triggers/utils.py +10 -1
- mage_ai/orchestration/utils/resources.py +3 -0
- mage_ai/server/api/downloads.py +4 -1
- mage_ai/server/api/runs.py +151 -0
- mage_ai/server/constants.py +1 -1
- mage_ai/server/frontend_dist/404.html +6 -6
- mage_ai/server/frontend_dist/_next/static/{i8pymuJDTVHdWjUP1QSh1 → RhDiJSkcjCsh4xxX4BFBk}/_buildManifest.js +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1557-b3502f3f1aa92ac7.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/2717-d9200be634dd6766.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/3548-9d26185b3fb663b1.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/5699-6d708c6b2153ea08.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/7361-8a23dd8360593e7a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/7966-b9b85ba10667e654.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/9624-8b8e100079ab69e1.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/_app-2a69553d8c6eeb53.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/index-4e12783b064c1cfe.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-4bfc84ff07d7656f.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/pipeline-runs-a66b4c7641ae03eb.js → frontend_dist/_next/static/chunks/pages/pipeline-runs-6d183f91a2ff6668.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-7181b086c93784d2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills-38e1fbcfbfc1014e.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-b645a6d13ab9fe3a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-59aca25a5b1d3998.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-eb11c5390c982b49.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{triggers-cb88fd075a357fcf.js → triggers-4612d15a65c35912.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-3591d035bb3bb2b8.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/platform/preferences-32985f3f7c7dd3ab.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/platform/settings-c2e9ef989c8bfa73.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-349af617d05f001b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/sync-data-60d01d3887e31136.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{users-86814e581acaf5db.js → users-a4db8710f703c729.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/sign-in-09414a8b66fb6f06.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/triggers-9cba3211434a8966.js → frontend_dist/_next/static/chunks/pages/triggers-a599c6ac89be8c8d.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-3433c8b22e8342aa.js +1 -0
- mage_ai/server/frontend_dist/block-layout.html +2 -2
- mage_ai/server/frontend_dist/compute.html +2 -2
- mage_ai/server/frontend_dist/files.html +2 -2
- mage_ai/server/frontend_dist/global-data-products/[...slug].html +2 -2
- mage_ai/server/frontend_dist/global-data-products.html +2 -2
- mage_ai/server/frontend_dist/global-hooks/[...slug].html +2 -2
- mage_ai/server/frontend_dist/global-hooks.html +2 -2
- mage_ai/server/frontend_dist/index.html +2 -2
- mage_ai/server/frontend_dist/manage/files.html +2 -2
- mage_ai/server/frontend_dist/manage/settings.html +2 -2
- mage_ai/server/frontend_dist/manage/users/[user].html +2 -2
- mage_ai/server/frontend_dist/manage/users/new.html +2 -2
- mage_ai/server/frontend_dist/manage/users.html +2 -2
- mage_ai/server/frontend_dist/manage.html +2 -2
- mage_ai/server/frontend_dist/oauth.html +2 -2
- mage_ai/server/frontend_dist/overview.html +2 -2
- mage_ai/server/frontend_dist/pipeline-runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills/[...slug].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/dashboard.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/platform/global-hooks/[...slug].html +2 -2
- mage_ai/server/frontend_dist/platform/global-hooks.html +2 -2
- mage_ai/server/frontend_dist/settings/account/profile.html +2 -2
- mage_ai/server/frontend_dist/settings/platform/preferences.html +2 -2
- mage_ai/server/frontend_dist/settings/platform/settings.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/permissions/[...slug].html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/permissions.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/preferences.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/roles/[...slug].html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/roles.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/sync-data.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/users/[...slug].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 +6 -6
- mage_ai/server/frontend_dist/templates/[...slug].html +2 -2
- mage_ai/server/frontend_dist/templates.html +2 -2
- mage_ai/server/frontend_dist/terminal.html +2 -2
- mage_ai/server/frontend_dist/test.html +2 -2
- mage_ai/server/frontend_dist/triggers.html +2 -2
- mage_ai/server/frontend_dist/version-control.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/404.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/_next/static/{CKCvjsYCf2imD2X8zAOBf → TdpLLFome13qvM0gXvpHs}/_buildManifest.js +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/1557-b3502f3f1aa92ac7.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/2717-d9200be634dd6766.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3548-9d26185b3fb663b1.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5699-6d708c6b2153ea08.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/7361-8a23dd8360593e7a.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/7966-b9b85ba10667e654.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9624-8b8e100079ab69e1.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/_app-2a69553d8c6eeb53.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/index-4e12783b064c1cfe.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage-4bfc84ff07d7656f.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/pipeline-runs-a66b4c7641ae03eb.js → frontend_dist_base_path_template/_next/static/chunks/pages/pipeline-runs-6d183f91a2ff6668.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-7181b086c93784d2.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills-38e1fbcfbfc1014e.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/edit-b645a6d13ab9fe3a.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/settings-59aca25a5b1d3998.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-eb11c5390c982b49.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/{triggers-cb88fd075a357fcf.js → triggers-4612d15a65c35912.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines-3591d035bb3bb2b8.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/platform/preferences-32985f3f7c7dd3ab.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/platform/settings-c2e9ef989c8bfa73.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/preferences-349af617d05f001b.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/sync-data-60d01d3887e31136.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/{users-86814e581acaf5db.js → users-a4db8710f703c729.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/sign-in-09414a8b66fb6f06.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/triggers-9cba3211434a8966.js → frontend_dist_base_path_template/_next/static/chunks/pages/triggers-a599c6ac89be8c8d.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/version-control-3433c8b22e8342aa.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/block-layout.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/compute.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/files.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/global-data-products/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/global-data-products.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/global-hooks/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/global-hooks.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/index.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/files.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/settings.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/users/[user].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/users/new.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/users.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/oauth.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/overview.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipeline-runs.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/backfills/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/backfills.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/dashboard.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/edit.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/logs.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors/block-runs.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors/block-runtime.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/runs/[run].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/runs.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/settings.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/syncs.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/triggers/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/triggers.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/platform/global-hooks/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/platform/global-hooks.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/account/profile.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/platform/preferences.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/platform/settings.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/permissions/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/permissions.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/preferences.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/roles/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/roles.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/sync-data.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/users/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/users.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/sign-in.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/templates/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/templates.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/terminal.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/test.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/triggers.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/version-control.html +2 -2
- mage_ai/server/scheduler_manager.py +9 -0
- mage_ai/server/server.py +47 -17
- mage_ai/server/utils/output_display.py +2 -2
- mage_ai/server/websocket_server.py +1 -0
- mage_ai/services/aws/ecs/ecs.py +1 -0
- mage_ai/services/k8s/config.py +4 -4
- mage_ai/services/k8s/utils.py +97 -0
- mage_ai/settings/keys/auth.py +2 -0
- mage_ai/settings/server.py +1 -1
- mage_ai/shared/parsers.py +6 -1
- mage_ai/streaming/sources/influxdb.py +2 -0
- mage_ai/streaming/sources/kafka.py +1 -1
- mage_ai/tests/api/endpoints/mixins.py +10 -9
- mage_ai/tests/api/endpoints/test_seeds.py +24 -0
- mage_ai/tests/api/operations/base/mixins.py +1 -1
- mage_ai/tests/api/operations/test_sessions.py +53 -2
- mage_ai/tests/api/resources/test_pipeline_resource.py +2 -2
- mage_ai/tests/authentication/oauth/test_utils.py +1 -1
- mage_ai/tests/authentication/providers/test_okta.py +43 -0
- mage_ai/tests/data_preparation/models/block/test_global_data_product.py +2 -0
- mage_ai/tests/orchestration/db/models/test_oauth.py +3 -3
- mage_ai/tests/orchestration/queue/test_process_queue.py +1 -0
- mage_ai/tests/orchestration/triggers/test_global_data_product.py +138 -136
- mage_ai/tests/server/test_server.py +27 -4
- mage_ai/tests/services/k8s/test_job_manager.py +9 -6
- mage_ai/version_control/branch/utils.py +2 -1
- mage_ai/version_control/models.py +3 -2
- {mage_ai-0.9.68.dist-info → mage_ai-0.9.70.dist-info}/METADATA +5 -5
- {mage_ai-0.9.68.dist-info → mage_ai-0.9.70.dist-info}/RECORD +272 -264
- mage_ai/server/frontend_dist/_next/static/chunks/1557-01f0843dc6ac4971.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2717-b5f9575799b594d5.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3548-961ff79ca70038c7.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/5699-6efc749f2f8ddd20.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/7361-18d9d8be96e1ce97.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/7966-f07b2913f7326b50.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9624-59b2f803f9c88cd6.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/_app-08790743315de36a.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/index-13760bb72d823b69.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-852d403c7bda21b3.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-ff4bd7a8ec3bab40.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills-a8b61d8d239fd16f.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-bd0aff5a5ed8888c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-d1ee961387c58b7f.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-f028ef3880ed856c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-ceb06e1616ee9610.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/platform/preferences-8ff16ef9566e911a.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/platform/settings-74d76300942dcee8.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-d7a8bc51bb7a1082.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/sync-data-79a4cf66a623e667.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/sign-in-f59d34429fe022ee.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-5753fac7c1bfdc88.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/1557-01f0843dc6ac4971.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/2717-b5f9575799b594d5.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3548-961ff79ca70038c7.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5699-6efc749f2f8ddd20.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/7361-18d9d8be96e1ce97.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/7966-f07b2913f7326b50.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9624-59b2f803f9c88cd6.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/_app-08790743315de36a.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/index-13760bb72d823b69.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage-852d403c7bda21b3.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-ff4bd7a8ec3bab40.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills-a8b61d8d239fd16f.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/edit-bd0aff5a5ed8888c.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/settings-d1ee961387c58b7f.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-f028ef3880ed856c.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines-ceb06e1616ee9610.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/platform/preferences-8ff16ef9566e911a.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/platform/settings-74d76300942dcee8.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/preferences-d7a8bc51bb7a1082.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/sync-data-79a4cf66a623e667.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/sign-in-f59d34429fe022ee.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/version-control-5753fac7c1bfdc88.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{i8pymuJDTVHdWjUP1QSh1 → RhDiJSkcjCsh4xxX4BFBk}/_ssgManifest.js +0 -0
- /mage_ai/server/frontend_dist_base_path_template/_next/static/{CKCvjsYCf2imD2X8zAOBf → TdpLLFome13qvM0gXvpHs}/_ssgManifest.js +0 -0
- {mage_ai-0.9.68.dist-info → mage_ai-0.9.70.dist-info}/LICENSE +0 -0
- {mage_ai-0.9.68.dist-info → mage_ai-0.9.70.dist-info}/WHEEL +0 -0
- {mage_ai-0.9.68.dist-info → mage_ai-0.9.70.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.9.68.dist-info → mage_ai-0.9.70.dist-info}/top_level.txt +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2551],{53779:function(e,n,t){"use strict";t.d(n,{C:function(){return f},X$:function(){return p},eD:function(){return d}});var i=t(25976),o=t(44897),r=t(42631),l=t(70515),u=t(47041),c=t(91437),s=6.25*l.iI,a=100*l.iI,d=i.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%);",""],r.n_,a,(function(e){return"\n box-shadow: ".concat((e.theme||o.Z).shadow.window,";\n background-color: ").concat((e.theme||o.Z).background.panel,";\n ")})),v=(0,i.css)(["display:flex;align-items:center;justify-content:space-between;height:","px;padding:","px ","px;",""],s,l.iI,l.cd*l.iI,(function(e){return"\n background-color: ".concat((e.theme||o.Z).background.output,";\n ")})),p=i.default.div.withConfig({displayName:"indexstyle__WindowHeaderStyle",componentId:"sc-g0cszf-1"})([""," border-top-left-radius:","px;border-top-right-radius:","px;",""],v,r.n_,r.n_,(function(e){return"\n border-bottom: ".concat(r.YF,"px ").concat(r.M8," ").concat((e.theme||o.Z).borders.medium,";\n ")})),f=i.default.div.withConfig({displayName:"indexstyle__WindowContentStyle",componentId:"sc-g0cszf-2"})(["overflow:auto;padding:","px 0;"," "," "," ",""],l.iI,u.w5,(0,c.eR)(),(function(e){return e.minMaxHeight&&"\n max-height: ".concat(7*l.iI,"px;\n ")}),(function(e){return!e.minMaxHeight&&"\n max-height: calc(100vh - ".concat(6.5*s,"px);\n ")}))},72226:function(e,n,t){"use strict";var i=t(82394),o=t(38276),r=t(75499),l=t(30160),u=t(17488),c=t(70515),s=t(28598);function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function d(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.objectAttributes,t=e.originalAttributes,a=e.setObjectAttributes;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o.Z,{mb:1,px:c.cd,children:[(0,s.jsx)(l.ZP,{bold:!0,children:"Outdated after"}),(0,s.jsx)(l.ZP,{muted:!0,small:!0,children:"After the global data product successfully completes running, how long after that will the global data product be outdated?"})]}),(0,s.jsx)(r.Z,{columnFlex:[null,1],columns:[{uuid:"Unit"},{uuid:"Value"}],rows:[{uuid:"seconds"},{uuid:"weeks"},{uuid:"months"},{uuid:"years"}].map((function(e){var o,r,c=e.uuid,v=null===n||void 0===n||null===(o=n.outdated_after)||void 0===o?void 0:o[c],p=null===t||void 0===t||null===(r=t.outdated_after)||void 0===r?void 0:r[c];return[(0,s.jsxs)(l.ZP,{default:!0,monospace:!0,children:[c," ",p&&(0,s.jsxs)(l.ZP,{inline:!0,monospace:!0,muted:!0,children:["(default: ",p,")"]})]},"label-".concat(c)),(0,s.jsx)(u.Z,{compact:!0,monospace:!0,onChange:function(e){return a((function(n){var t;return d(d({},n),{},{outdated_after:d(d({},null===n||void 0===n?void 0:n.outdated_after),{},(0,i.Z)({},c,0===(null===(t=e.target.value)||void 0===t?void 0:t.length)?null:Number(e.target.value)))})}))},placeholder:"Enter a number",primary:!0,setContentOnMount:!0,small:!0,type:"number",value:"undefined"===typeof v||null===v?"":v},"input-".concat(c))]}))})]})}},29644:function(e,n,t){"use strict";var i=t(82394),o=t(44085),r=t(38276),l=t(75499),u=t(30160),c=t(17488),s=t(70515),a=t(81728),d=t(86735),v=t(28598);function p(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function f(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?p(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.objectAttributes,t=e.originalAttributes,p=e.setObjectAttributes;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(r.Z,{mb:1,px:s.cd,children:[(0,v.jsxs)(u.ZP,{bold:!0,children:["Outdated starting at ",(0,v.jsx)(u.ZP,{inline:!0,muted:!0,children:"(optional)"})]}),(0,v.jsx)(u.ZP,{muted:!0,small:!0,children:"If enough time has passed since the last global data product has ran successfully and the global data product is determined to be outdated, then you can configure it to be outdated at a specific date or time."}),(0,v.jsx)("div",{style:{marginTop:4},children:(0,v.jsxs)(u.ZP,{muted:!0,small:!0,children:["For example, let\u2019s say the global data product is outdated after 12 hours. The last successful run was yesterday at 18:00. The global data product will be outdated today at 06:00. However, if the ",(0,v.jsx)(u.ZP,{bold:!0,inline:!0,muted:!0,small:!0,children:"Outdated starting at"})," has a value of 17 for ",(0,v.jsx)(u.ZP,{bold:!0,inline:!0,muted:!0,small:!0,children:"Hour of day"}),", then the global data product won\u2019t run again until today at 17:00."]})})]}),(0,v.jsx)(l.Z,{columnFlex:[null,1],columns:[{uuid:"Unit"},{uuid:"Value"}],rows:[{uuid:"second_of_minute",values:(0,d.w6)(60).map((function(e,n){return{uuid:n,value:n}}))},{uuid:"minute_of_hour",values:(0,d.w6)(60).map((function(e,n){return{uuid:n,value:n}}))},{uuid:"hour_of_day",values:(0,d.w6)(24).map((function(e,n){return{uuid:n,value:n}}))},{uuid:"day_of_week",values:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"].map((function(e,n){return{uuid:e,value:n}}))},{uuid:"day_of_month",values:(0,d.w6)(31).map((function(e,n){return{uuid:n+1,value:n+1}}))},{uuid:"day_of_year",values:(0,d.w6)(365).map((function(e,n){return{uuid:n+1,value:n+1}}))},{uuid:"week_of_month",values:(0,d.w6)(5).map((function(e,n){return{uuid:n+1,value:n+1}}))},{uuid:"week_of_year",values:(0,d.w6)(52).map((function(e,n){return{uuid:n+1,value:n+1}}))},{uuid:"month_of_year",values:["January","February","March","April","May","June","July","August","September","October","November","December"].map((function(e,n){return{uuid:e,value:n+1}}))}].map((function(e){var r,l,s,d=e.uuid,h=e.values,m=null===n||void 0===n||null===(r=n.outdated_starting_at)||void 0===r?void 0:r[d],g=null===t||void 0===t||null===(l=t.outdated_starting_at)||void 0===l?void 0:l[d],b={compact:!0,key:"outdated-starting-at-input-".concat(d),monospace:!0,onChange:function(e){return p((function(n){var t;return f(f({},n),{},{outdated_starting_at:f(f({},null===n||void 0===n?void 0:n.outdated_starting_at),{},(0,i.Z)({},d,0===(null===(t=e.target.value)||void 0===t?void 0:t.length)?null:Number(e.target.value)))})}))},primary:!0,small:!0,value:"undefined"===typeof m||null===m?"":m};return s=h?(0,v.jsx)(o.Z,f(f({},b),{},{placeholder:"Select a value",children:h.map((function(e){var n=e.uuid,t=e.value;return(0,v.jsx)("option",{value:t,children:n},t)}))})):(0,v.jsx)(c.Z,f(f({},b),{},{placeholder:"Enter a number",setContentOnMount:!0,type:"number"})),[(0,v.jsxs)(u.ZP,{default:!0,monospace:!0,children:[(0,a.vg)(d)," ",g&&(0,v.jsxs)(u.ZP,{inline:!0,monospace:!0,muted:!0,children:["(default: ",g,")"]})]},"outdated-starting-at-label-".concat(d)),s]}))})]})}},46209:function(e,n,t){"use strict";var i=t(82394),o=t(12691),r=t.n(o),l=t(70652),u=t(48670),c=t(38276),s=t(75499),a=t(30160),d=t(17488),v=t(70515),p=t(28598);function f(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function h(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?f(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.blocks,t=e.objectAttributes,o=e.originalAttributes,f=e.setObjectAttributes;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(c.Z,{mb:1,px:v.cd,children:[(0,p.jsx)(a.ZP,{bold:!0,children:"Block data to output"}),(0,p.jsx)(a.ZP,{muted:!0,small:!0,children:"The data output from the block(s) you select below will be the data product that is returned when a downstream entity is requesting data from this global data product."}),(0,p.jsx)("div",{style:{marginTop:4},children:(0,p.jsx)(a.ZP,{muted:!0,small:!0,children:"When requesting data from this global data product, the selected block(s) will return data from its most recent partition. You can override this by adding a value in the partitions setting. For example, if you set the partitions value to 5, then the selected block will return data from its 5 most recent partitions. If you set the partitions value to 0, then all the partitions will be returned."})})]}),(0,p.jsx)(s.Z,{columnFlex:[null,1,null],columns:[{label:function(){return""},uuid:"selected"},{uuid:"Block UUID"},{uuid:"Partitions"}],rows:null===n||void 0===n?void 0:n.map((function(e){var n,c=e.uuid,s=null===t||void 0===t?void 0:t.settings,v=null===s||void 0===s?void 0:s[c],m=null===v||void 0===v?void 0:v.partitions,g=null===o||void 0===o||null===(n=o.settings)||void 0===n?void 0:n[c],b=null===g||void 0===g?void 0:g.partitions,x=!!v||!!g;return[(0,p.jsx)(l.Z,{checked:x,onClick:function(){return function(e){f((function(n){var t=(null===n||void 0===n?void 0:n.settings)||{};return e?t[c]={}:null===t||void 0===t||delete t[c],h(h({},n),{},{settings:t})}))}(!x)}},"selected--".concat(c)),(0,p.jsxs)("div",{children:[(0,p.jsx)(r(),{as:"/pipelines/".concat(null===t||void 0===t?void 0:t.object_uuid,"/edit?block_uuid=").concat(c),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,p.jsx)(u.Z,{monospace:!0,openNewWindow:!0,sameColorAsText:!0,children:c})})," ",b&&(0,p.jsxs)(a.ZP,{inline:!0,monospace:!0,muted:!0,children:["(default: ",b,")"]})]},"block-uuid-".concat(c)),(0,p.jsx)(d.Z,{compact:!0,monospace:!0,onChange:function(e){return f((function(n){var t,o;return h(h({},n),{},{settings:h(h({},null===n||void 0===n?void 0:n.settings),{},(0,i.Z)({},c,h(h({},null===n||void 0===n||null===(t=n.settings)||void 0===t?void 0:t[c]),{},{partitions:0===(null===(o=e.target.value)||void 0===o?void 0:o.length)?null:Number(e.target.value)})))})}))},placeholder:"1",primary:!0,setContentOnMount:!0,small:!0,type:"number",value:"undefined"===typeof m||null===m?"":m},"input-".concat(c))]}))})]})}},67355:function(e,n,t){"use strict";var i=t(12691),o=t.n(i),r=t(82684),l=t(34376),u=t(8666),c=t(48670),s=t(38276),a=t(4190),d=t(75499),v=t(30160),p=t(35686),f=t(70515),h=t(95924),m=t(28598);n.Z=function(e){var n=e.globalDataProducts,t=e.onClickRow,i=(0,l.useRouter)(),g=p.ZP.global_data_products.list({},{},{pauseFetch:!!n}).data,b=(0,r.useMemo)((function(){return n||(null===g||void 0===g?void 0:g.global_data_products)||[]}),[g,n]);return g||n?g&&0===(null===b||void 0===b?void 0:b.length)?(0,m.jsx)(s.Z,{p:f.cd,children:(0,m.jsx)(v.ZP,{children:"There are currently no global data products registered."})}):(0,m.jsx)(d.Z,{columnFlex:[1,null,null],columns:[{uuid:"UUID"},{uuid:"Object type"},{uuid:"Object UUID"}],onClickRow:function(e){var n=null===b||void 0===b?void 0:b[e];n&&(t?null===t||void 0===t||t(n):i.push("/global-data-products/[...slug]","/global-data-products/".concat(null===n||void 0===n?void 0:n.uuid)))},rows:null===b||void 0===b?void 0:b.map((function(e){var n=e.object_type,t=e.object_uuid,r=e.uuid,l={as:null,href:null};return u.b.PIPELINE===n&&(l.as="/pipelines/".concat(t,"/edit"),l.href="/pipelines/[pipeline]/edit"),[(0,m.jsx)(v.ZP,{monospace:!0,children:r},"uuid"),(0,m.jsx)(v.ZP,{default:!0,monospace:!0,children:n},"objectType"),(0,m.jsx)(o(),{as:null===l||void 0===l?void 0:l.as,href:(null===l||void 0===l?void 0:l.href)||"",passHref:!0,children:(0,m.jsx)(c.Z,{default:!0,monospace:!0,onClick:function(e){(0,h.j)(e),i.push(l.href,l.as)},preventDefault:!0,children:t})},"objectUUID")]})),uuid:"global-data-products"}):(0,m.jsx)(s.Z,{p:f.cd,children:(0,m.jsx)(a.Z,{})})}},29480:function(e,n,t){"use strict";t.d(n,{$W:function(){return a},cl:function(){return d},cv:function(){return v},dE:function(){return c},zG:function(){return s}});var i=t(25976),o=t(44897),r=t(42631),l=t(70515),u=t(47041),c=i.default.div.withConfig({displayName:"indexstyle__SectionStyle",componentId:"sc-7a1uhf-0"})(["border-radius:","px;padding:","px;",""],r.n_,l.cd*l.iI,(function(e){return"\n background-color: ".concat((e.theme.background||o.Z.background).popup,";\n ")})),s=i.default.div.withConfig({displayName:"indexstyle__DocsStyle",componentId:"sc-7a1uhf-1"})(["> div{overflow:initial;}> div img{max-width:80%;background:white;padding:1rem;max-height:20vh;}"]),a=i.default.div.withConfig({displayName:"indexstyle__CodeEditorStyle",componentId:"sc-7a1uhf-2"})(["padding-top:","px;",""],l.cd*l.iI,(function(e){return"\n background-color: ".concat((e.theme.background||o.Z.background).codeTextarea,";\n ")})),d=i.default.div.withConfig({displayName:"indexstyle__TableContainerStyle",componentId:"sc-7a1uhf-3"})(["overflow:auto;max-height:90vh;width:100%;"," "," "," "," ",""],u.w5,(function(e){return e.hideHorizontalScrollbar&&"\n overflow-x: hidden;\n "}),(function(e){return e.width&&"\n width: ".concat(e.width,";\n ")}),(function(e){return e.height&&"\n height: ".concat(e.height,";\n ")}),(function(e){return e.maxHeight&&"\n max-height: ".concat(e.maxHeight,";\n ")})),v=i.default.div.withConfig({displayName:"indexstyle__HeaderRowStyle",componentId:"sc-7a1uhf-4"})(["padding:","px;"," "," ",""],2*l.iI,(function(e){return"\n background-color: ".concat((e.theme||o.Z).interactive.defaultBackground,";\n border-bottom: ").concat(r.YF,"px ").concat(r.M8," ").concat((e.theme||o.Z).borders.medium,";\n ")}),(function(e){return e.padding&&"\n padding: ".concat(e.padding,"px;\n ")}),(function(e){return e.rounded&&"\n border-top-left-radius: ".concat(r.n_,"px;\n border-top-right-radius: ").concat(r.n_,"px;\n ")}))},28795:function(e,n,t){"use strict";var i;t.d(n,{B:function(){return o},M:function(){return i}}),function(e){e.BACKFILLS="backfills",e.BLOCK_RUNS="block_runs",e.DASHBOARD="dashboard",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={}));var o="cancel_all_running_pipeline_runs"},85010:function(e,n,t){"use strict";t.d(n,{H:function(){return u}});var i=t(57653),o=t(72473),r=t(28795),l=t(50178);function u(e,n,t){var u=(n||{}).uuid||t,c=[{Icon:o.Lightning,id:r.M.TRIGGERS,isSelected:function(){return r.M.TRIGGERS===e},label:function(){return"Triggers"},linkProps:{as:"/pipelines/".concat(u,"/triggers"),href:"/pipelines/[pipeline]/triggers"}},{Icon:o.Schedule,id:r.M.RUNS,isSelected:function(){return r.M.RUNS===e},label:function(){return"Runs"},linkProps:{as:"/pipelines/".concat(u,"/runs"),href:"/pipelines/[pipeline]/runs"}},{Icon:o.Logs,id:r.M.PIPELINE_LOGS,isSelected:function(){return r.M.PIPELINE_LOGS===e},label:function(){return"Logs"},linkProps:{as:"/pipelines/".concat(u,"/logs"),href:"/pipelines/[pipeline]/logs"}},{Icon:o.Monitor,id:r.M.MONITOR,isSelected:function(){return r.M.MONITOR===e},label:function(){return"Monitor"},linkProps:{as:"/pipelines/".concat(u,"/monitors"),href:"/pipelines/[pipeline]/monitors"}}];return i.qL.PYTHON===(null===n||void 0===n?void 0:n.type)&&c.splice(2,0,{Icon:o.BackfillV2,id:r.M.BACKFILLS,isSelected:function(){return r.M.BACKFILLS===e},label:function(){return"Backfills"},linkProps:{as:"/pipelines/".concat(u,"/backfills"),href:"/pipelines/[pipeline]/backfills"}}),i.qL.INTEGRATION===(null===n||void 0===n?void 0:n.type)&&c.unshift({Icon:o.PipeIcon,id:r.M.SYNCS,isSelected:function(){return r.M.SYNCS===e},label:function(){return"Syncs"},linkProps:{as:"/pipelines/".concat(u,"/syncs"),href:"/pipelines/[pipeline]/syncs"}}),c.unshift({Icon:o.Code,disabled:!u,id:r.M.EDIT,isSelected:function(){return r.M.EDIT===e},label:function(){return(0,l.Ct)()?"View pipeline":"Edit pipeline"},linkProps:{as:"/pipelines/".concat(u,"/edit"),href:"/pipelines/[pipeline]/edit"}}),c.push({Icon:o.SettingsWithKnobs,id:r.M.SETTINGS,isSelected:function(){return r.M.SETTINGS===e},label:function(){return"Pipeline settings"},linkProps:{as:"/pipelines/".concat(u,"/settings"),href:"/pipelines/[pipeline]/settings"}}),c.unshift({Icon:o.NavDashboard,id:r.M.DASHBOARD,isSelected:function(){return r.M.DASHBOARD===e},label:function(){return"Dashboard"},linkProps:{as:"/pipelines/".concat(u,"/dashboard"),href:"/pipelines/[pipeline]/dashboard"}}),c}},8916:function(e,n,t){"use strict";t.d(n,{FS:function(){return s},JZ:function(){return v},Tt:function(){return d},e7:function(){return p},wx:function(){return a}});var i=t(75582),o=t(82394),r=t(83784),l=t(30229);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 c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?u(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e){return"string"===typeof e?e:JSON.stringify(e)}function a(e,n){var t,i;return null===e||void 0===e||null===(t=e.find((function(e){var t=e.block;return n(t)})))||void 0===t||null===(i=t.variables)||void 0===i?void 0:i.map((function(e){var n=e.value;return c(c({},e),{},{value:s(n)})}))}function d(e){var n;return null===(n=a(e,(function(e){return e.uuid===r.C})))||void 0===n?void 0:n.reduce((function(e,n){var t=n.uuid,i=n.value;return c(c({},e),{},(0,o.Z)({},t,i))}),{})}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 p(e){return e?Object.entries(e).reduce((function(e,n){var t=(0,i.Z)(n,2),r=t[0],l=t[1],u=l;try{u=JSON.parse(l)}catch(s){}return c(c({},e),{},(0,o.Z)({},r,u))}),{}):e}},46568:function(e,n,t){"use strict";var i=t(82394),o=t(26304),r=(t(82684),t(33591)),l=t(28598),u=["children","fullHeight","gutter","style"];function c(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?c(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):c(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,c=e.style,a=void 0===c?{}:c,d=(0,o.Z)(e,u),v=s({},a);return i&&(v.paddingLeft=i,v.paddingRight=v.paddingLeft),t&&(v.height="100%"),(0,l.jsx)(r.Col,s(s({},d),{},{style:v,children:n}))}},82682:function(e,n,t){"use strict";var i=t(82394),o=t(26304),r=t(82684),l=t(33591),u=t(28598),c=["children","fullHeight","gutter","justifyContent","style"];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 a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.fullHeight,i=e.gutter,s=e.justifyContent,d=e.style,v=void 0===d?{}:d,p=(0,o.Z)(e,c),f=a({},v);return i&&(f.marginLeft=-1*i,f.marginRight=f.marginLeft),t&&(f.height="100%"),(0,u.jsx)(l.Row,a(a({},p),{},{justifyContent:s,style:f,children:r.Children.map(n,(function(e,n){return e&&r.cloneElement(e,{gutter:i,key:n})}))}))}},68781:function(e,n,t){"use strict";var i;t.d(n,{R:function(){return o}}),function(e){e.AZURE_CONTAINER_INSTANCE="azure_container_instance",e.ECS="ecs",e.GCP_CLOUD_RUN="gcp_cloud_run",e.K8S="k8s",e.LOCAL_PYTHON="local_python",e.PYSPARK="pyspark"}(i||(i={}));var o=[i.AZURE_CONTAINER_INSTANCE,i.ECS,i.GCP_CLOUD_RUN,i.K8S,i.LOCAL_PYTHON,i.PYSPARK]},8666:function(e,n,t){"use strict";var i;t.d(n,{b:function(){return i}}),function(e){e.BLOCK="block",e.PIPELINE="pipeline"}(i||(i={}))},14466:function(e,n,t){"use strict";t.d(n,{Ij:function(){return r},N_:function(){return h},SQ:function(){return l},TT:function(){return u},W6:function(){return v},XG:function(){return a},YB:function(){return s},i9:function(){return f},sw:function(){return c},t4:function(){return d}});var i,o,r,l,u,c,s,a,d,v,p=t(82394);!function(e){e.CREATE="create",e.DELETE="delete",e.DETAIL="detail",e.EXECUTE="execute",e.LIST="list",e.UPDATE="update",e.UPDATE_ANYWHERE="update_anywhere"}(o||(o={})),function(e){e.BREAK="break",e.CONTINUE="continue",e.RAISE="raise"}(r||(r={})),function(e){e.AFTER="after",e.BEFORE="before"}(l||(l={})),function(e){e.ERROR="error",e.META="meta",e.METADATA="metadata",e.PAYLOAD="payload",e.QUERY="query",e.RESOURCE="resource",e.RESOURCES="resources"}(u||(u={})),function(e){e.FAILURE="failure",e.SUCCESS="success"}(c||(c={})),function(e){e.AND="and",e.OR="or"}(s||(s={})),function(e){e.ERROR="error",e.HOOK="hook",e.META="meta",e.METADATA="metadata",e.OPERATION_RESOURCE="operation_resource",e.PAYLOAD="payload",e.QUERY="query",e.RESOURCE="resource",e.RESOURCES="resources",e.RESOURCE_ID="resource_id",e.RESOURCE_PARENT="resource_parent",e.RESOURCE_PARENT_ID="resource_parent_id",e.RESOURCE_PARENT_TYPE="resource_parent_type",e.USER="user"}(a||(a={})),function(e){e.BOOLEAN="BOOLEAN",e.DICTIONARY="DICTIONARY",e.FLOAT="FLOAT",e.INTEGER="INTEGER",e.LIST="LIST",e.STRING="STRING"}(d||(d={})),function(e){e.EQUALS="EQUALS",e.GREATER_THAN="GREATER_THAN",e.GREATER_THAN_OR_EQUALS="GREATER_THAN_OR_EQUALS",e.INCLUDES="INCLUDES",e.LESS_THAN="LESS_THAN",e.LESS_THAN_OR_EQUALS="LESS_THAN_OR_EQUALS",e.NOT_EQUALS="NOT_EQUALS",e.NOT_INCLUDES="NOT_INCLUDES",e.NOT_PRESENT="NOT_PRESENT",e.PRESENT="PRESENT"}(v||(v={}));var f=[v.NOT_PRESENT,v.PRESENT],h=(i={},(0,p.Z)(i,v.EQUALS,"=="),(0,p.Z)(i,v.GREATER_THAN,">"),(0,p.Z)(i,v.GREATER_THAN_OR_EQUALS,">="),(0,p.Z)(i,v.INCLUDES,"includes"),(0,p.Z)(i,v.LESS_THAN,"<"),(0,p.Z)(i,v.LESS_THAN_OR_EQUALS,"<="),(0,p.Z)(i,v.NOT_EQUALS,"!="),(0,p.Z)(i,v.NOT_INCLUDES,"not includes"),(0,p.Z)(i,v.NOT_PRESENT,"is not present"),(0,p.Z)(i,v.PRESENT,"is present"),i)},83784:function(e,n,t){"use strict";t.d(n,{C:function(){return i}});var i="global"},11074:function(e,n,t){"use strict";t.d(n,{Z:function(){return c}});var i=t(25976),o=t(44897),r=t(42631),l=i.default.div.withConfig({displayName:"indexstyle__PanelStyle",componentId:"sc-1rfr5wd-0"})(["border-radius:","px;"," ",""],r.n_,(function(e){return"\n background-color: ".concat((e.theme.background||o.Z.background).panel,";\n ")}),(function(e){return e.fullWidth&&"\n width: 100%;\n "})),u=t(28598);var c=function(e){var n=e.children,t=e.fullWidth,i=void 0===t||t;return(0,u.jsx)(l,{fullWidth:i,children:n})}},96348:function(e,n,t){"use strict";t.d(n,{g:function(){return g},Z:function(){return b}});var i=t(82684),o=t(25976),r=t(44897),l=t(42631),u=t(47041),c=t(70515),s=1.5*c.iI,a=1.5*c.iI,d=o.default.div.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-13p7y8j-0"})(["border-radius:","px;overflow:hidden;width:100%;"," "," "," ",""],l.n_,(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}),(function(e){return"\n background-color: ".concat((e.theme||r.Z).background.page,";\n border: ").concat(l.YF,"px ").concat(l.M8," ").concat((e.theme||r.Z).interactive.defaultBorder,";\n box-shadow: ").concat((e.theme||r.Z).shadow.frame,";\n ")}),(function(e){return e.noBackground&&"\n background-color: transparent;\n "}),(function(e){return e.noBoxShadow&&"\n box-shadow: none;\n "})),v=o.default.div.withConfig({displayName:"indexstyle__RowContainerStyle",componentId:"sc-13p7y8j-1"})(["overflow:auto;border-bottom-left-radius:","px;border-bottom-right-radius:","px;"," "," "," ",""],l.n_,l.n_,u.w5,(function(e){return e.maxHeight>0&&"\n max-height: ".concat(e.maxHeight,"px;\n ")}),(function(e){return e.minHeight>0&&"\n min-height: ".concat(e.minHeight,"px;\n ")}),(function(e){return e.scrollable&&"\n margin-bottom: ".concat(c.iI,"px;\n overflow-y: auto;\n padding-top: ").concat(3,"px;\n padding-left: ").concat(3,"px;\n padding-right: ").concat(3,"px;\n ")})),p=o.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-13p7y8j-2"})(["border-top-left-radius:","px;border-top-right-radius:","px;padding:","px ","px;",""],l.n_,l.n_,s,2*c.iI,(function(e){return"\n border-bottom: ".concat(l.YF,"px ").concat(l.M8," ").concat((e.theme.interactive||r.Z.interactive).defaultBorder,";\n ")})),f=o.default.div.withConfig({displayName:"indexstyle__RowStyle",componentId:"sc-13p7y8j-3"})(["padding:","px ","px;"," "," "," "," "," ",""],a,2*c.iI,(function(e){return"\n border-bottom: ".concat(l.YF,"px ").concat(l.M8," ").concat((e.theme||r.Z).borders.medium2,";\n ")}),(function(e){return e.sameColorBorders&&"\n border-bottom-color: ".concat((e.theme||r.Z).interactive.defaultBorder,";\n ")}),(function(e){return e.noHorizontalPadding&&"\n padding-left: 0;\n padding-right: 0;\n "}),(function(e){return e.condensed&&"\n padding-top: ".concat(9,"px;\n padding-bottom: ").concat(9,"px;\n ")}),(function(e){return e.secondary&&"\n background-color: ".concat((e.theme.background||r.Z.background).row2,";\n ")}),(function(e){return e.last&&e.noBorder&&"\n border-bottom-left-radius: ".concat(l.n_,"px;\n border-bottom-right-radius: ").concat(l.n_,"px;\n border-bottom: none;\n ")})),h=o.default.div.withConfig({displayName:"indexstyle__FooterStyle",componentId:"sc-13p7y8j-4"})(["border-bottom-left-radius:","px;border-bottom-right-radius:","px;padding:","px ","px;",""],l.n_,l.n_,s,2*c.iI,(function(e){return"\n border-top: ".concat(l.YF,"px ").concat(l.M8," ").concat((e.theme||r.Z).borders.medium2,";\n ")})),m=t(28598),g=f;var b=function(e){var n=e.alternating,t=e.children,o=e.footer,r=e.header,l=e.maxHeight,u=e.minHeight,c=e.noBackground,s=e.noBoxShadow,a=e.sameColorBorders,f=e.scrollable,g=e.width,b=[].concat(t).filter((function(e){return null!==e}));return(0,m.jsxs)(d,{noBackground:c,noBoxShadow:s,width:g,children:[r&&(0,m.jsx)(p,{children:r}),(0,m.jsx)(v,{maxHeight:l,minHeight:u,scrollable:f,children:i.Children.map(b,(function(e,t){return e&&i.cloneElement(e,{last:t===b.length-1,sameColorBorders:a,secondary:n&&t%2===1})}))}),o&&(0,m.jsx)(h,{children:o})]})}},58268:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return yl}});var i=t(77837),o=t(21831),r=t(75582),l=t(82394),u=t(38860),c=t.n(u),s=t(92083),a=t.n(s),d=t(56085),v=t(25976),p=t(82684),f=t(69864),h=t(34376),m=t(65557),g=t(40761),b=t(44425),x=t(70652),j=t(39867),k=t(15338),Z=t(97618),y=t(55485),P=t(48670),C=t(38276),O=t(30160),w=t(70515),_=t(55283),S=t(28598);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 E(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,l.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 T=function(e){var n=e.blockRefs,t=e.hiddenBlocks,i=e.pipeline,o=e.setHiddenBlocks,r=(0,p.useContext)(v.ThemeContext),u=(0,p.useMemo)((function(){return(null===i||void 0===i?void 0:i.blocks)||[]}),[i]),c=(0,p.useMemo)((function(){var e=[],n=[];return u.forEach((function(i){var o=i.uuid;null!==t&&void 0!==t&&t[o]?e.push(i):n.push(i)})),{blocksHidden:e,blocksVisible:n}}),[u,t]),s=c.blocksHidden,a=c.blocksVisible,d=(0,p.useMemo)((function(){return(null===u||void 0===u?void 0:u.length)>=1&&0===a.length}),[u,a]),f=(0,p.useMemo)((function(){return(null===u||void 0===u?void 0:u.length)>=1&&0===s.length}),[u,s]),h=(0,p.useCallback)((function(e){var t=e.type,i=e.uuid;if(null!==n&&void 0!==n&&n.current){var o,r=n.current["".concat(t,"s/").concat(i,".py")];null===r||void 0===r||null===(o=r.current)||void 0===o||o.scrollIntoView()}}),[n]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(C.Z,{p:1,children:[(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(x.Z,{checked:f,onClick:function(){return o((function(){return{}}))}}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{noWrapping:!0,children:"Show all"})]}),(0,S.jsx)(C.Z,{mb:1}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(x.Z,{checked:d,onClick:function(){return o((function(){return u.reduce((function(e,n){var t=n.uuid;return E(E({},e),{},(0,l.Z)({},t,!0))}),{})}))}}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{noWrapping:!0,children:"Hide all"})]})]}),(0,S.jsx)(k.Z,{medium:!0}),null===u||void 0===u?void 0:u.map((function(e){var n=e.uuid,i=(0,_.qn)(e.type,{blockColor:e.color,theme:r}).accent,u=!(null!==t&&void 0!==t&&t[n]);return(0,S.jsx)(P.Z,{block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){o((function(e){return E(E({},e),{},(0,l.Z)({},n,u))})),u||setTimeout((function(){return h(e)}),1)},preventDefault:!0,children:(0,S.jsx)(C.Z,{mt:1,px:1,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(C.Z,{pr:1,children:(0,S.jsx)(x.Z,{checked:u})}),(0,S.jsxs)(Z.Z,{alignItems:"center",children:[(0,S.jsx)(j.Z,{color:i,size:1.5*w.iI,square:!0}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{default:!0,monospace:!0,noWrapping:!0,small:!0,children:n})]})]})})},n)}))]})},M=t(60523),B=t(27277),D=t(17717),A=t(85854),R=t(75499),N=t(72473),L=t(86735);var F=function(e){var n=e.cacheItems,t=e.selectedLinks,i=(0,p.useMemo)((function(){var e;return null===t||void 0===t||null===(e=t.find((function(e){return e.uuid in b.GJ})))||void 0===e?void 0:e.uuid}),[t]),o=(0,p.useMemo)((function(){var e,i=null===t||void 0===t||null===(e=t.slice(0,2))||void 0===e?void 0:e.map((function(e){return e.uuid}));return null===n||void 0===n?void 0:n.find((function(e){var n,t=e.item;return null===i||void 0===i?void 0:i.includes(null===t||void 0===t||null===(n=t.project)||void 0===n?void 0:n.uuid)}))}),[n,t]);if(b.tf.DBT===i&&o){var l,u,c,s,a=null===o||void 0===o?void 0:o.item,d=a.models,v=a.profiles,f=a.project,h=(0,L.YC)(Object.entries((null===v||void 0===v||null===(l=v[null===f||void 0===f?void 0:f.profile])||void 0===l?void 0:l.outputs)||{}),(function(e){return e[0]})),m=(null===f||void 0===f?void 0:f["model-paths"])||[],g=(null===f||void 0===f||null===(u=f.file_path)||void 0===u?void 0:u.split(D.sep))||[],x=(null===g||void 0===g?void 0:g.length)||0;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(A.Z,{level:5,children:"Project"})}),(0,S.jsx)(k.Z,{light:!0,short:!0}),(0,S.jsx)(C.Z,{p:w.cd,children:null===g||void 0===g?void 0:g.map((function(e,n){var t=n===x-1,i=t?N.List:N.FolderOutline;return(0,S.jsx)(C.Z,{ml:2*n,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(i,{default:t,muted:!t}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{default:t,monospace:!0,muted:!t,small:!0,children:e})]})},e)}))}),(0,S.jsx)(k.Z,{light:!0}),(0,S.jsx)(R.Z,{columnFlex:[null,null],columns:[{label:function(){return"Detail"},uuid:"details"},{label:function(){return""},rightAligned:!0,uuid:"value"}],noHeader:!0,rows:[[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:"Name"}),(0,S.jsx)(O.ZP,{monospace:!0,rightAligned:!0,small:!0,children:null===f||void 0===f?void 0:f.name})],[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:"Models paths"}),(0,S.jsx)(O.ZP,{monospace:!0,rightAligned:!0,small:!0,children:null===m||void 0===m?void 0:m.join(", ")})],[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:"Models"}),(0,S.jsx)(O.ZP,{monospace:!0,rightAligned:!0,small:!0,children:(null===d||void 0===d?void 0:d.length)||0})]]}),(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(A.Z,{level:5,children:"Profiles"})}),(0,S.jsx)(k.Z,{light:!0,short:!0}),(0,S.jsx)(C.Z,{p:w.cd,children:null===v||void 0===v||null===(c=v.file_path)||void 0===c||null===(s=c.split(D.sep))||void 0===s?void 0:s.map((function(e,n){var t=n===x-1,i=t?N.List:N.FolderOutline;return(0,S.jsx)(C.Z,{ml:2*n,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(i,{default:t,muted:!t}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{default:t,monospace:!0,muted:!t,small:!0,children:e})]})},e)}))}),(0,S.jsx)(k.Z,{light:!0}),(0,S.jsx)(R.Z,{columnFlex:[null,null],columns:[{uuid:"Targets"},{rightAligned:!0,uuid:"Type"}],rows:null===h||void 0===h?void 0:h.map((function(e){var n=(0,r.Z)(e,2),t=n[0],i=n[1];return[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:t},"target-".concat(t)),(0,S.jsx)(O.ZP,{monospace:!0,rightAligned:!0,small:!0,children:null===i||void 0===i?void 0:i.type},"type-".concat(null===i||void 0===i?void 0:i.type))]}))})]})}return(0,S.jsx)(S.Fragment,{})},U=t(44897),H=t(46684),W=v.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-183il08-0"})(["height:","px;",""],H.Mz,(function(e){return"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n border-bottom: 1px solid ").concat((e.theme.borders||U.Z.borders).medium,";\n ")})),G=t(81728);var K=function(e){var n,t=e.children,i=e.navigateBack,r=e.selectedLinks,l=e.selectedTab,u=(0,p.useMemo)((function(){var e=(0,o.Z)(r||[]);return e.reverse(),e}),[r]),c=(0,p.useMemo)((function(){return(null===u||void 0===u?void 0:u.length)||0}),[u]);return(0,S.jsx)(W,{children:(0,S.jsxs)(y.ZP,{alignItems:"center",fullHeight:!0,children:[(0,S.jsx)(C.Z,{pl:w.cd}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[l&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(P.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return null===i||void 0===i?void 0:i()},preventDefault:!0,children:(0,S.jsx)(y.ZP,{alignItems:"center",children:(0,S.jsx)(N.ArrowLeft,{muted:!0})})}),(0,S.jsx)(C.Z,{pr:1}),(0,S.jsx)(P.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return null===i||void 0===i?void 0:i(c||1)},preventDefault:!0,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(null===l||void 0===l?void 0:l.Icon)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(l.Icon,{}),(0,S.jsx)(C.Z,{mr:1})]}),(0,S.jsx)(O.ZP,{bold:!0,muted:!0,children:null!==l&&void 0!==l&&l.label?null===l||void 0===l||null===(n=l.label)||void 0===n?void 0:n.call(l):(0,G.vg)(null===l||void 0===l?void 0:l.uuid)})]})})]}),null===u||void 0===u?void 0:u.map((function(e,n){var t=e||{Icon:null,label:null,uuid:null},o=t.Icon,s=t.label,a=t.uuid;return(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(l||n>=1)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(N.ChevronRight,{muted:!0}),(0,S.jsx)(C.Z,{mr:1})]}),(0,S.jsx)(P.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return null===i||void 0===i?void 0:i(c-1-n)},preventDefault:!0,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[o&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o,{default:n>=1&&(null===u||void 0===u?void 0:u.length)>=3}),(0,S.jsx)(C.Z,{mr:1})]}),(0,S.jsx)(O.ZP,{bold:!0,muted:n!==c-1,noWrapping:!0,children:b.V4[a]||s?null===s||void 0===s?void 0:s({selectedLinks:r}):a})]})})]},a)}))]}),(l||(null===r||void 0===r?void 0:r.length)>=1)&&t&&(0,S.jsx)(C.Z,{mr:w.cd}),t,(0,S.jsx)(C.Z,{pr:w.cd})]})})},z=t(83905),q=t(80029),V=t(78650),Y=t(35686);var X,Q,J,$=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(e.excludeDirPattern,e.excludePattern,e.pattern,Y.ZP.files.list()),t=n.data,i=n.mutate,o=(0,p.useMemo)((function(){return(null===t||void 0===t?void 0:t.files)||[]}),[t]);return{fetch:i,files:o}},ee=t(32929);!function(e){e.BLOCKS="blocks",e.FILES="files"}(Q||(Q={})),function(e){e.ALL_BLOCKS="all_blocks",e.ALL_BLOCKS_IN_TYPE="all_blocks_in_type"}(J||(J={}));var ne=[{Icon:N.TemplateShapes,label:function(){return"All blocks"},uuid:J.ALL_BLOCKS}].concat(null===ee.qy||void 0===ee.qy?void 0:ee.qy.filter((function(e){return e.uuid in b.GJ}))),te=(X={},(0,l.Z)(X,Q.FILES,{Icon:N.FolderOutline,uuid:Q.FILES}),(0,l.Z)(X,Q.BLOCKS,{Icon:N.BatchSquaresStacked,uuid:Q.BLOCKS}),X);function ie(e){var n,t,i=e.models,o=e.project,r=(null===o||void 0===o?void 0:o["model-paths"])||[],l=new RegExp(null===r||void 0===r||null===(n=r.map((function(e){return[null===o||void 0===o?void 0:o.uuid,e,""].join(D.sep)})))||void 0===n?void 0:n.join("|"));return(0,L.YC)(null===(t=i||[])||void 0===t?void 0:t.map((function(e){var n,t,i,r,u,c=e.replace(l,""),s=null===c||void 0===c?void 0:c.split(D.sep);(null===s||void 0===s?void 0:s.length)>=2?(i=null===s||void 0===s?void 0:s[(null===s||void 0===s?void 0:s.length)-1],r=null===s||void 0===s||null===(u=s.slice(0,(null===s||void 0===s?void 0:s.length)-1))||void 0===u?void 0:u.join(D.sep)):i=null===s||void 0===s?void 0:s[0];var a=null===(n=i)||void 0===n?void 0:n.split(".");return{directory:r,fileExtension:null===a||void 0===a?void 0:a[(null===a||void 0===a?void 0:a.length)-1],filePath:c,fullPath:e,name:null===a||void 0===a||null===(t=a.slice(0,(null===a||void 0===a?void 0:a.length)-1))||void 0===t?void 0:t.join("."),project:o}})),(function(e){return e.name}))}var oe=t(71953);function re(e){return null===e||void 0===e?void 0:e.map((function(e){var n=e.directory,t=e.fileExtension,i=e.filePath,o=e.name;return{Icon:oe.T[t],label:function(){return(0,S.jsx)(O.ZP,{monospace:!0,noWrapping:!0,children:o})},description:function(){return(0,S.jsx)(y.ZP,{flexDirection:"column",children:(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,noWrapping:!0,small:!0,children:n})})},uuid:i}}))}function le(e){var n;return[{Icon:N.FolderOutline,label:function(){return(0,G._6)("project",(null===e||void 0===e?void 0:e.length)||0)},uuid:J.ALL_BLOCKS_IN_TYPE}].concat(null===(n=(0,L.YC)(e||[],(function(e){var n,t=e.item;return null===t||void 0===t||null===(n=t.project)||void 0===n?void 0:n.name})))||void 0===n?void 0:n.map((function(e){var n=e.item,t=null===n||void 0===n?void 0:n.project;return{Icon:N.FolderOutline,label:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{selectedLinks:null},n=e.selectedLinks;return(0,S.jsx)(O.ZP,{default:(null===n||void 0===n?void 0:n.length)>=3,monospace:!0,noWrapping:!0,children:null===t||void 0===t?void 0:t.name})},description:function(){var e;return(0,S.jsxs)(y.ZP,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,noWrapping:!0,small:!0,children:(0,G._6)("model",(null===n||void 0===n||null===(e=n.models)||void 0===e?void 0:e.length)||0)}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,noWrapping:!0,small:!0,children:null===t||void 0===t?void 0:t.uuid})]})},uuid:null===t||void 0===t?void 0:t.uuid}})))}function ue(e,n){var t,i,o,r,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,u=(null===n||void 0===n?void 0:n.length)||0,c=null===n||void 0===n||null===(t=n[0])||void 0===t?void 0:t.uuid,s=e;Array.isArray(e)||(s=[e]);var a=null===(i=s)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.uuid,d=J.ALL_BLOCKS===a,v=a in b.GJ,p=J.ALL_BLOCKS_IN_TYPE===a,f=l&&(null===l||void 0===l?void 0:l.find((function(e){return e.uuid===c}))),h=l&&(null===l||void 0===l?void 0:l.find((function(e){return e.uuid===a}))),m=null===n||void 0===n||null===(r=n.find((function(e){return e.uuid in b.GJ})))||void 0===r?void 0:r.uuid;if(0===u)return d?[]:s;if(1<=u){if(d)return[];if(v)return s}if(2<=u){var g;if(v)return s;if(p)return null===n||void 0===n?void 0:n.slice(u-1);if(f&&h)return s.concat(null===n||void 0===n?void 0:n.slice(u-1));if((null===(g=s)||void 0===g?void 0:g.length)>=2)return s.concat(null===n||void 0===n?void 0:n.slice(1))}return 3<=u&&b.tf.DBT===m?s.concat(null===n||void 0===n?void 0:n.slice(1)):s.concat(n||[])}function ce(e,n){var t=null===n||void 0===n?void 0:n.slice(null===e?1:e);null===t||void 0===t||t.length;return(null===t||void 0===t?void 0:t.length)>=1?t:null}function se(e,n){var t;return b.tf.DBT===(null===e||void 0===e||null===(t=e[0])||void 0===t?void 0:t.uuid)?null===n||void 0===n?void 0:n[0]:(null===e||void 0===e?void 0:e[0])||(null===n||void 0===n?void 0:n[0])}var ae=t(23780);var de=function(e){var n=e.cacheItems,t=e.selectedLinks,i=e.selectedTab,o=e.setSelectedLinks,l=(0,ae.VI)(null,{},[],{uuid:"FileBrowserNavigation"}),u=(0,r.Z)(l,1)[0],c=(0,p.useRef)(null),s=$(),a=s.fetch,d=s.files,v=(0,p.useMemo)((function(){var e,i=null===t||void 0===t||null===(e=t.slice(0,2))||void 0===e?void 0:e.map((function(e){return e.uuid}));return null===n||void 0===n?void 0:n.find((function(e){var n,t=e.item;return null===i||void 0===i?void 0:i.includes(null===t||void 0===t||null===(n=t.project)||void 0===n?void 0:n.uuid)}))}),[n,t]),f=(0,p.useMemo)((function(){var e,i;return null!==t&&void 0!==t&&t.find((function(e){var n=e.uuid;return b.tf.DBT===n}))?v&&(null===t||void 0===t?void 0:t.length)>=3?re(ie({models:null===v||void 0===v||null===(e=v.item)||void 0===e?void 0:e.models,project:null===v||void 0===v||null===(i=v.item)||void 0===i?void 0:i.project})):le(n):ne}),[n,v,t]);return(0,p.useMemo)((function(){var e;return null===t||void 0===t||null===(e=t.find((function(e){return e.uuid in b.GJ})))||void 0===e?void 0:e.uuid}),[t]),(0,S.jsxs)(S.Fragment,{children:[Q.FILES===(null===i||void 0===i?void 0:i.uuid)&&(0,S.jsx)(V.Z,{fetchFiles:a,files:d,onClickFile:function(e,n){return console.log(e)},onClickFolder:function(e,n){return console.log(e,!0)},ref:c,showError:u,uuid:"FileBrowserNavigation"}),Q.BLOCKS===(null===i||void 0===i?void 0:i.uuid)&&(0,S.jsx)(q.Z,{navLinks:f||[],selectedLink:se(t,f),setSelectedLink:function(e){return o((function(t){return ue(e,t,n)}))}})]})},ve=t(90299);function pe(e,n){var t=e.selectedTab,i=e.setSelectedTab,o=[te[Q.FILES],te[Q.BLOCKS]];return(0,p.useEffect)((function(){i((function(e){return e||(null===o||void 0===o?void 0:o[0])}))}),[]),(0,S.jsx)(W,{ref:n,children:(0,S.jsx)(y.ZP,{alignItems:"flex-end",fullHeight:!0,children:(0,S.jsx)(ve.Z,{onClickTab:function(e){return null===i||void 0===i?void 0:i(e)},selectedTabUUID:null===t||void 0===t?void 0:t.uuid,tabs:o,underlineStyle:!0})})})}var fe,he=p.forwardRef(pe),me=t(32013),ge=t(98777),be=t(71180),xe=t(89083),je=t(24138),ke=t(4190),Ze=t(89706);!function(e){e.CODE="Compiled code",e.DATA="Sample data",e.LINEAGE="Lineage",e.OVERVIEW="Overview",e.PIPELINES="Pipelines and runs"}(fe||(fe={}));var ye=[{uuid:fe.OVERVIEW},{uuid:fe.DATA},{uuid:fe.LINEAGE},{uuid:fe.PIPELINES},{uuid:fe.CODE}],Pe=t(72619);var Ce=function(e){var n=e.cacheItem,t=e.cacheItems,i=e.mainContainerHeight,o=e.onClickAction,l=e.selectedLinks,u=e.setSelectedLinks,c=(0,p.useContext)(v.ThemeContext),s=(0,ae.VI)(null,{},[],{uuid:"BlockBrowser/BlockDetail"}),a=(0,r.Z)(s,1)[0],d=(0,p.useRef)(null),h=(0,p.useState)(null),m=h[0],g=h[1],x=(0,p.useState)(null),j=x[0],P=x[1],I=(0,p.useState)(null),E=I[0],T=I[1],M=(0,p.useMemo)((function(){var e,n;return null===E||void 0===E||null===(e=E.item)||void 0===e||null===(n=e.data)||void 0===n?void 0:n.sample_data}),[E]),B=null===l||void 0===l?void 0:l[0],D=(0,p.useMemo)((function(){return null===n||void 0===n?void 0:n.item}),[n]),L=(0,p.useMemo)((function(){return ie({models:null===D||void 0===D?void 0:D.models,project:null===D||void 0===D?void 0:D.project})}),[D]),F=(0,p.useMemo)((function(){return null===L||void 0===L?void 0:L.find((function(e){return e.filePath===(null===B||void 0===B?void 0:B.uuid)}))}),[L,B]),U=Y.ZP.file_contents.detail(encodeURIComponent(null===F||void 0===F?void 0:F.fullPath)).data,H=(0,p.useMemo)((function(){return null===U||void 0===U?void 0:U.file_content}),[U]),W=(0,p.useMemo)((function(){var e;return{item_type:z.N.DBT,project_path:null===D||void 0===D||null===(e=D.project)||void 0===e?void 0:e.uuid}}),[D]),G=Y.ZP.cache_items.detail(encodeURIComponent(null===F||void 0===F?void 0:F.fullPath),W).data,K=(0,p.useMemo)((function(){return null===G||void 0===G?void 0:G.cache_item}),[G]),q=(0,p.useMemo)((function(){var e;return(null===K||void 0===K||null===(e=K.item)||void 0===e?void 0:e.upstream_blocks)||[]}),[K]),V=(0,p.useMemo)((function(){return null===q||void 0===q?void 0:q.filter((function(e){var n,t=e.configuration;return(null===t||void 0===t?void 0:t.file_path)!==(null===F||void 0===F?void 0:F.fullPath)&&(null===t||void 0===t||null===(n=t.file_source)||void 0===n?void 0:n.path)!==(null===F||void 0===F?void 0:F.fullPath)}))}),[F,q]);(0,p.useEffect)((function(){P((function(e){return e||(null===ye||void 0===ye?void 0:ye[0])}))}),[]);var X,Q,J,$,ee,ne,te,oe,le,ce,se,de,pe,he,me,ge,Ce,Oe,we,_e,Se,Ie,Ee,Te,Me,Be,De,Ae=(0,p.useMemo)((function(){var e,n;return{schema:null===D||void 0===D||null===(e=D.schema)||void 0===e?void 0:e.find((function(e){var t=e.models;return null===t||void 0===t?void 0:t.find((function(e){if((null===e||void 0===e?void 0:e.name)===(null===F||void 0===F?void 0:F.name))return n=e}))})),schemaDetails:n}}),[D,F]),Re=(0,f.Db)(Y.ZP.cache_items.useUpdate(encodeURIComponent(null===F||void 0===F?void 0:F.fullPath),W),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var n=e.cache_item;T(n)},onErrorCallback:function(e,n){return T(null),a({errors:n,response:e})}})}}),Ne=(0,r.Z)(Re,2),Le=Ne[0],Fe=Ne[1].isLoading;return(0,p.useEffect)((function(){setTimeout((function(){var e,n;return g(null===d||void 0===d||null===(e=d.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.height)}),1)}),[]),(0,p.useEffect)((function(){fe.DATA===(null===j||void 0===j?void 0:j.uuid)&&Le({cache_item:{}})}),[F,j,Le]),z.N.DBT===(null===n||void 0===n?void 0:n.item_type)?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{ref:d,children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{alignItems:"center",flex:1,children:[(0,S.jsx)(N.DBT,{size:2.5*w.iI}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsxs)(y.ZP,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{large:!0,monospace:!0,children:null===F||void 0===F?void 0:F.name}),(null===Ae||void 0===Ae||null===(X=Ae.schemaDetails)||void 0===X?void 0:X.description)&&(0,S.jsx)("div",{style:{marginTop:2},children:(0,S.jsx)(O.ZP,{muted:!0,children:null===Ae||void 0===Ae||null===(Q=Ae.schemaDetails)||void 0===Q?void 0:Q.description})})]})]}),o&&(0,S.jsx)(be.ZP,{backgroundColor:(0,_.qn)(b.tf.DBT,{theme:c}).accent,beforeIcon:(0,S.jsx)(N.AddBlock,{}),onClick:function(){return o({cacheItem:n,row:F})},children:"Add to pipeline as a block"})]})}),(0,S.jsx)(ve.Z,{large:!0,onClickTab:function(e){return null===P||void 0===P?void 0:P(e)},selectedTabUUID:null===j||void 0===j?void 0:j.uuid,tabs:ye,underlineStyle:!0}),(0,S.jsx)(k.Z,{light:!0})]}),fe.OVERVIEW===(null===j||void 0===j?void 0:j.uuid)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(A.Z,{level:5,children:"Info"})}),(0,S.jsx)(k.Z,{light:!0,short:!0}),(0,S.jsx)(R.Z,{columnFlex:[null,1],columns:[{label:function(){return"Info"},uuid:"details"},{label:function(){return""},uuid:"value"}],noHeader:!0,rows:[[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:"Model file"}),(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:null===F||void 0===F?void 0:F.filePath})],[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:"Directory"}),(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:null===F||void 0===F?void 0:F.directory})]].concat(null!==Ae&&void 0!==Ae&&null!==(J=Ae.schema)&&void 0!==J&&J.file_path?[[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:"Schema file"}),(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:null===Ae||void 0===Ae||null===($=Ae.schema)||void 0===$?void 0:$.file_path})]]:[])}),(null===Ae||void 0===Ae||null===(ee=Ae.schemaDetails)||void 0===ee||null===(ne=ee.columns)||void 0===ne?void 0:ne.length)>=1&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(A.Z,{level:5,children:"Schema"})}),(0,S.jsx)(k.Z,{light:!0,short:!0}),(0,S.jsx)(R.Z,{columnFlex:[null,1],columns:[{uuid:"Column"},{uuid:"Description"}],rows:null===Ae||void 0===Ae||null===(te=Ae.schemaDetails)||void 0===te||null===(oe=te.columns)||void 0===oe?void 0:oe.map((function(e){var n=e.description,t=e.name;return[(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:t},"name-".concat(t)),(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:n},"description-".concat(n))]}))})]}),(null===V||void 0===V?void 0:V.length)>=1&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(A.Z,{level:5,children:"Upstream model dependencies"})}),(0,S.jsx)(k.Z,{light:!0,short:!0}),(0,S.jsx)(R.Z,{columnFlex:[1,1,1,null],columns:[{uuid:"Name"},{uuid:"Model file"},{uuid:"Directory"},{rightAligned:!0,uuid:"Project"}],onClickRow:function(e){var n,i,o,r=null===V||void 0===V?void 0:V[e],l=null===r||void 0===r?void 0:r.configuration,c=null===t||void 0===t?void 0:t.find((function(e){var n;return e.uuid===(null===l||void 0===l||null===(n=l.file_source)||void 0===n?void 0:n.project_path)})),s=ie({models:[(null===l||void 0===l?void 0:l.file_path)||(null===l||void 0===l||null===(n=l.file_source)||void 0===n?void 0:n.path)],project:null===c||void 0===c||null===(i=c.item)||void 0===i?void 0:i.project}),a=null===(o=re([null===s||void 0===s?void 0:s[0]]))||void 0===o?void 0:o[0];return u((function(e){return ue(a,e,t)}))},rows:null===V||void 0===V?void 0:V.map((function(e){var n,t,i,o,r=e.configuration,l=e.uuid,u=null===(n=ie({models:[(null===r||void 0===r?void 0:r.file_path)||(null===r||void 0===r||null===(t=r.file_source)||void 0===t?void 0:t.path)],project:null===D||void 0===D?void 0:D.project}))||void 0===n?void 0:n[0];return[(0,S.jsx)(O.ZP,{monospace:!0,dbt:!0,small:!0,children:(null===u||void 0===u?void 0:u.name)||l},"model-".concat(l)),(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:(null===u||void 0===u?void 0:u.filePath)||(null===r||void 0===r?void 0:r.file_path)||(null===r||void 0===r||null===(i=r.file_source)||void 0===i?void 0:i.path)},"model-file-".concat(l)),(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:null===u||void 0===u?void 0:u.directory},"model-directory-".concat(l)),(0,S.jsx)(O.ZP,{default:!0,monospace:!0,rightAligned:!0,small:!0,children:null===r||void 0===r||null===(o=r.file_source)||void 0===o?void 0:o.project_path},"project-".concat(l))]}))})]}),(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(A.Z,{level:5,children:"Code"})}),(0,S.jsx)(k.Z,{light:!0,short:!0}),(0,S.jsx)(R.Z,{columnFlex:[null,1],columns:[{label:function(){return"Info"},uuid:"details"},{label:function(){return""},uuid:"value"}],noHeader:!0,rows:[[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:"File"}),(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:null===F||void 0===F?void 0:F.fullPath})]]}),(0,S.jsx)(xe.Z,{autoHeight:!0,language:Ze.nB[null===F||void 0===F?void 0:F.fileExtension],padding:2*w.iI,readOnly:!0,value:null===H||void 0===H?void 0:H.content})]}),fe.LINEAGE===(null===j||void 0===j?void 0:j.uuid)&&(0,S.jsx)(S.Fragment,{children:(null===q||void 0===q?void 0:q.length)>=1&&(0,S.jsx)(je.ZP,{disabled:!0,enablePorts:!1,height:Math.max(i,50*w.iI),heightOffset:m,pannable:!0,pipeline:{blocks:q,uuid:null},zoomable:!0})}),fe.DATA===(null===j||void 0===j?void 0:j.uuid)&&(0,S.jsxs)(S.Fragment,{children:[Fe&&(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(ke.Z,{inverted:!0})}),!Fe&&!(null!==M&&void 0!==M&&null!==(le=M.rows)&&void 0!==le&&le.length)&&(0,S.jsxs)(C.Z,{p:w.cd,children:[!(null!==E&&void 0!==E&&null!==(ce=E.item)&&void 0!==ce&&null!==(se=ce.exception)&&void 0!==se&&se.length)&&(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsx)(O.ZP,{default:!0,children:"No sample data exists. Try running the model first."})}),(null===E||void 0===E||null===(de=E.item)||void 0===de||null===(pe=de.logs)||void 0===pe?void 0:pe.length)>=1&&(0,S.jsx)(C.Z,{mb:w.cd,children:null===E||void 0===E||null===(he=E.item)||void 0===he||null===(me=he.logs)||void 0===me||null===(ge=me.split("\n"))||void 0===ge?void 0:ge.map((function(e){return(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,pre:!0,children:e},e)}))}),(null===E||void 0===E||null===(Ce=E.item)||void 0===Ce||null===(Oe=Ce.exception)||void 0===Oe?void 0:Oe.length)>=1&&(0,S.jsx)(C.Z,{mb:w.cd,children:null===E||void 0===E||null===(we=E.item)||void 0===we||null===(_e=we.exception)||void 0===_e||null===(Se=_e.split("\n"))||void 0===Se?void 0:Se.map((function(e){return(0,S.jsx)(O.ZP,{monospace:!0,pre:!0,warning:!0,children:e},e)}))})]}),!Fe&&M&&(null===M||void 0===M||null===(Ie=M.rows)||void 0===Ie?void 0:Ie.length)>=1&&(0,S.jsx)(R.Z,{columnFlex:null===M||void 0===M||null===(Ee=M.columns)||void 0===Ee?void 0:Ee.map((function(){return null})),columns:null===M||void 0===M||null===(Te=M.columns)||void 0===Te?void 0:Te.map((function(e){return{uuid:e}})),rows:null===M||void 0===M||null===(Me=M.rows)||void 0===Me?void 0:Me.map((function(e){return null===e||void 0===e?void 0:e.map((function(e,n){return(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:String(e)===String(!1)?"false":String(e)===String(!0)?"true":e},"value-".concat(e,"-").concat(n))}))}))})]}),fe.PIPELINES===(null===j||void 0===j?void 0:j.uuid)&&(0,S.jsx)(S.Fragment,{}),fe.CODE===(null===j||void 0===j?void 0:j.uuid)&&(0,S.jsx)(S.Fragment,{children:(null===K||void 0===K||null===(Be=K.item)||void 0===Be?void 0:Be.content_compiled)&&(0,S.jsx)(xe.Z,{autoHeight:!0,language:Ze.nB[null===F||void 0===F?void 0:F.fileExtension],padding:2*w.iI,readOnly:!0,value:null===K||void 0===K||null===(De=K.item)||void 0===De?void 0:De.content_compiled})})]}):(0,S.jsx)("div",{})},Oe=t(95924);function we(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function _e(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?we(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):we(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Se=function(e){var n=e.cacheItems,t=e.mainContainerHeight,i=e.onClickAction,o=e.refCacheItems,r=e.selectedItem,u=e.selectedLinks,c=e.setSelectedLinks,s=(0,p.useMemo)((function(){var e;return null===u||void 0===u||null===(e=u.find((function(e){return e.uuid in b.GJ})))||void 0===e?void 0:e.uuid}),[u]),a=(0,p.useMemo)((function(){return(0,L.YC)(n||[],(function(e){var n,t=e.item;return null===t||void 0===t||null===(n=t.project)||void 0===n?void 0:n.name})).filter((function(e){var n,t,i=e.item;return 1===(null===u||void 0===u?void 0:u.length)||(null===u||void 0===u||null===(n=u[0])||void 0===n?void 0:n.uuid)===(null===i||void 0===i||null===(t=i.project)||void 0===t?void 0:t.uuid)}))}),[n,u]),d=(0,p.useCallback)((function(e){var t=(null===e||void 0===e?void 0:e.item)||{models:[],project:null},r=ie({models:t.models,project:t.project});return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Models"}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(N.PaginateArrowRight,{muted:!0}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{default:!0,large:!0,monospace:!0,children:(null===r||void 0===r?void 0:r.length)||0})]})}),(0,S.jsx)(k.Z,{light:!0}),(0,S.jsx)(R.Z,{buildRowProps:function(n){var t=null===r||void 0===r?void 0:r[n],i=(0,p.createRef)();return(null===e||void 0===e?void 0:e.uuid)in(null===o||void 0===o?void 0:o.current)||(o.current[null===e||void 0===e?void 0:e.uuid]={}),o.current[null===e||void 0===e?void 0:e.uuid][t.fullPath]=i,{rowProps:{id:t.fullPath,ref:i}}},columnFlex:[1,1,1,1],columns:[{uuid:"Name"},{uuid:"Directory"},{uuid:"File"},{label:function(){return""},rightAligned:!0,uuid:"Action"}],onClickRow:function(e){var t,i,o=null===r||void 0===r?void 0:r[e],l=null===(t=re([o]))||void 0===t?void 0:t[0],u=null===(i=le(n))||void 0===i?void 0:i.find((function(e){var n;return e.uuid===(null===o||void 0===o||null===(n=o.project)||void 0===n?void 0:n.uuid)}));return c((function(e){return ue([l,u],e,n)}))},rows:null===r||void 0===r?void 0:r.map((function(n){var t=n.directory,o=n.filePath,r=n.name;return[(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:r},"model-".concat(r)),(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:t},"model-".concat(t)),(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:o},"model-".concat(o)),(0,S.jsx)(y.ZP,{justifyContent:"flex-end",children:(0,S.jsx)(be.ZP,{compact:!0,onClick:function(t){return(0,Oe.j)(t),i({cacheItem:e,row:n})},secondary:!0,small:!0,children:"Add to pipeline"})})]}))})]})}),[n,i,c]),v=(0,p.useMemo)((function(){return(0,S.jsx)(me.Z,{noBorder:!0,noBoxShadow:!0,visibleMappingForced:null===n||void 0===n?void 0:n.reduce((function(e,n,t){return _e(_e({},e),{},(0,l.Z)({},String(t),!0))}),{}),children:null===n||void 0===n?void 0:n.map((function(e){var n,t=(null===e||void 0===e||null===(n=e.item)||void 0===n?void 0:n.project)||{name:null,uuid:null},i=t.name,r=t.uuid,l=(0,p.createRef)();return o.current[null===e||void 0===e?void 0:e.uuid]={cacheItem:l},(0,S.jsx)(ge.Z,{id:null===e||void 0===e?void 0:e.uuid,noBorderRadius:!0,noPaddingContent:!0,refContainer:l,title:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(N.FolderOutline,{size:2*w.iI}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsxs)(y.ZP,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{monospace:!0,children:i}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,small:!0,children:r})]})]}),titleXPadding:w.cd*w.iI,titleYPadding:w.cd*w.iI,children:d(e)},r)}))})}),[d,n]),f=(0,p.useMemo)((function(){return d(null===a||void 0===a?void 0:a[0])}),[a,d]),h=(0,p.useMemo)((function(){return(0,S.jsx)(Ce,{cacheItem:r,cacheItems:n,mainContainerHeight:t,onClickAction:i,selectedLinks:u,setSelectedLinks:c})}),[n,t,i,r,u,c]);return(0,S.jsx)(S.Fragment,{children:b.tf.DBT===s&&(0,S.jsx)(S.Fragment,{children:1===(null===u||void 0===u?void 0:u.length)?v:2===(null===u||void 0===u?void 0:u.length)?f:h})})},Ie=t(49130),Ee=t(17488),Te=t(62547),Me=t(42631),Be=t(47041),De=t(91437),Ae=8*w.iI,Re=v.default.div.withConfig({displayName:"indexstyle__AfterContentStyle",componentId:"sc-119v89s-0"})(["",""],(function(e){return"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n ")})),Ne=v.default.div.withConfig({displayName:"indexstyle__AfterFooterStyle",componentId:"sc-119v89s-1"})(["",""],(function(e){return"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n ")})),Le=v.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-119v89s-2"})(["border-radius:","px;position:relative;"," ",""],Me.n_,(function(e){return"\n border: 1px solid ".concat((e.theme.borders||U.Z.borders).light,";\n background-color: ").concat((e.theme.background||U.Z.background).panel,";\n ")}),(function(e){return e.maxWidth&&"\n width: ".concat(e.maxWidth,"px;\n ")})),Fe=v.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-119v89s-3"})(["padding:","px;",""],w.cd*w.iI,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.borders||U.Z.borders).light,";\n ")})),Ue=v.default.div.withConfig({displayName:"indexstyle__NavigationStyle",componentId:"sc-119v89s-4"})([""," "," ",""],(0,De.eR)(),(function(e){return!e.selected&&"\n &:hover {\n background-color: ".concat((e.theme.interactive||U.Z.interactive).rowHoverBackground,";\n }\n ")}),(function(e){return e.selected&&"\n background-color: ".concat((e.theme.background||U.Z.background).codeTextarea,";\n ")})),He=v.default.div.withConfig({displayName:"indexstyle__StreamGridGroupStyle",componentId:"sc-119v89s-5"})(["position:absolute;"]),We=v.default.div.withConfig({displayName:"indexstyle__StreamGridGroupInnerStyle",componentId:"sc-119v89s-6"})([""," overflow:auto;position:fixed;",""],Be.w5,(function(e){return e.borderRight&&"\n border-right: 1px solid ".concat((e.theme.borders||U.Z.borders).light,";\n ")})),Ge=v.default.div.withConfig({displayName:"indexstyle__StreamGridStyle",componentId:"sc-119v89s-7"})(["border-radius:","px;padding:","px;margin:","px;"," "," "," "," ",""],Me.n_,w.cd*w.iI,1*w.iI,(function(e){return!e.warning&&"\n &:hover {\n cursor: pointer;\n }\n "}),(function(e){return!e.selected&&!e.warning&&"\n border: 1px solid ".concat((e.theme.borders||U.Z.borders).light,";\n ")}),(function(e){return e.warning&&!e.selected&&"\n border: 1px solid ".concat((e.theme.accent||U.Z.accent).warningTransparent,";\n ")}),(function(e){return e.warning&&e.selected&&"\n border: 1px solid ".concat((e.theme.accent||U.Z.accent).warning,";\n ")}),(function(e){return e.selected&&!e.warning&&"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n border: 1px solid ").concat((e.theme.borders||U.Z.borders).contrast,";\n ")})),Ke=v.default.div.withConfig({displayName:"indexstyle__BackgroundStyle",componentId:"sc-119v89s-8"})(["",""],(function(e){return"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n ")})),ze=t(38118),qe=t(39643),Ve=v.default.div.withConfig({displayName:"indexstyle__MainStyle",componentId:"sc-aj0zrh-0"})([".show{display:block;}tr.show{display:table-row;}.hide{display:none;}"]),Ye=t(53808),Xe=t(42041),Qe=t(44688),Je=t(19183);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 en(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,l.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 nn=function(e){var n,t=e.contained,i=e.defaultBlockType,o=e.focused,l=e.onClickAction,u=e.setFocused,c=(0,p.useRef)(null),s=(0,p.useRef)(null),a=(0,p.useRef)(null),d=(0,p.useRef)({}),v=(0,p.useRef)({}),f=(0,p.useRef)(null),h=(0,p.useMemo)((function(){return"dbt/Browser"}),[]),m=(0,p.useMemo)((function(){return"".concat(h,"width_after")}),[h]),g=(0,p.useMemo)((function(){return"".concat(h,"width_before")}),[h]),x=(0,Je.i)(),j=x.height,P=x.width,_=(0,p.useState)({height:null,width:null}),I=_[0],E=_[1];(0,p.useEffect)((function(){E({height:j-2*Ae,width:P-2*Ae})}),[j,P]);var T=(0,ae.VI)(null,{},[],{uuid:h}),M=((0,r.Z)(T,1)[0],(0,p.useState)(!1)),D=M[0],A=M[1],R=(0,p.useCallback)((function(e){u&&void 0!==typeof o?null===u||void 0===u||u(e):A(e)}),[o,u]),L=(0,p.useMemo)((function(){return"undefined"===typeof o?D:o}),[o,D]),U=(0,p.useState)(!0),W=U[0],G=U[1],q=(0,p.useState)((0,Ye.U2)(m,60*w.iI)),V=q[0],X=q[1],J=(0,p.useState)(!1),$=J[0],ee=J[1],oe=(0,p.useState)(Math.max((0,Ye.U2)(g),40*w.iI)),ue=oe[0],se=oe[1],ve=(0,p.useState)(null),pe=ve[0],fe=ve[1],me=(0,p.useState)(!1),ge=me[0],be=me[1],xe=(0,p.useState)(null),je=xe[0],ke=xe[1],Ze=Y.ZP.cache_items.list({item_type:z.N.DBT}).data,ye=(0,p.useMemo)((function(){return(null===Ze||void 0===Ze?void 0:Ze.cache_items)||[]}),[Ze]),Pe=(0,p.useState)(null),Ce=Pe[0],we=Pe[1],_e=(0,p.useCallback)((function(e){we(e),f.current=e,v.current={},null===ye||void 0===ye||ye.forEach((function(e){if(z.N.DBT===(null===e||void 0===e?void 0:e.item_type)){var n,t,i,o,r,l=null===d||void 0===d||null===(n=d.current)||void 0===n?void 0:n[null===e||void 0===e?void 0:e.uuid],u=null===e||void 0===e||null===(t=e.item)||void 0===t||null===(i=t.models)||void 0===i?void 0:i.filter((function(e){var n,t,i,o,r=!(null!==(n=f.current)&&void 0!==n&&n.length)||(null===e||void 0===e||null===(t=e.toLowerCase())||void 0===t||null===(i=t.replaceAll("_"," "))||void 0===i||null===(o=i.replaceAll("-"," "))||void 0===o?void 0:o.includes(f.current));if(l){var u=null===l||void 0===l?void 0:l[e];if(null!==u&&void 0!==u&&u.current)if(r){var c,s,a,d=(null===(c=(null===u||void 0===u||null===(s=u.current)||void 0===s?void 0:s.className)||"")||void 0===c?void 0:c.split(" "))||[];u.current.className=null===d||void 0===d||null===(a=d.filter((function(e){return!["hide","show"].includes(e)})).concat("show"))||void 0===a?void 0:a.join(" ")}else{var v,p,h,m=(null===(v=(null===u||void 0===u||null===(p=u.current)||void 0===p?void 0:p.className)||"")||void 0===v?void 0:v.split(" "))||[];u.current.className=null===m||void 0===m||null===(h=m.filter((function(e){return!["hide","show"].includes(e)})).concat("hide"))||void 0===h?void 0:h.join(" ")}}return r}));if((null===u||void 0===u?void 0:u.length)>=1){if(v.current[e.uuid]=en(en({},e||{}),{},{item:en(en({},e.item||{}),{},{models:u})}),null!==l&&void 0!==l&&null!==(o=l.cacheItem)&&void 0!==o&&o.current){var c,s,a,p,h=(null===(c=(null===l||void 0===l||null===(s=l.cacheItem)||void 0===s||null===(a=s.current)||void 0===a?void 0:a.className)||"")||void 0===c?void 0:c.split(" "))||[];l.cacheItem.current.className=null===h||void 0===h||null===(p=h.filter((function(e){return!["hide","show"].includes(e)})).concat("show"))||void 0===p?void 0:p.join(" ")}}else if(null!==l&&void 0!==l&&null!==(r=l.cacheItem)&&void 0!==r&&r.current){var m,g,b,x,j=(null===(m=(null===l||void 0===l||null===(g=l.cacheItem)||void 0===g||null===(b=g.current)||void 0===b?void 0:b.className)||"")||void 0===m?void 0:m.split(" "))||[];l.cacheItem.current.className=null===j||void 0===j||null===(x=j.filter((function(e){return!["hide","show"].includes(e)})).concat("hide"))||void 0===x?void 0:x.join(" ")}}}))}),[ye]),Me=(0,p.useState)(null),Be=Me[0],De=Me[1],Re=(0,p.useState)(null),Ne=Re[0],Fe=Re[1],Ue=(0,p.useCallback)((function(e){De(e),_e(null),null!==a&&void 0!==a&&a.current&&(a.current.value="")}),[_e]),He=(0,p.useCallback)((function(e){Fe(e),_e(null),null!==a&&void 0!==a&&a.current&&(a.current.value="")}),[_e]),We=(0,p.useMemo)((function(){var e,n=null===Be||void 0===Be||null===(e=Be.slice(0,2))||void 0===e?void 0:e.map((function(e){return e.uuid}));return null===ye||void 0===ye?void 0:ye.find((function(e){var t,i=e.item;return null===n||void 0===n?void 0:n.includes(null===i||void 0===i||null===(t=i.project)||void 0===t?void 0:t.uuid)}))}),[ye,Be]);(0,p.useEffect)((function(){i&&(Fe(te[Q.BLOCKS]),Ue([null===ne||void 0===ne?void 0:ne.find((function(e){return e.uuid===i}))]))}),[]),(0,p.useEffect)((function(){G(!We)}),[We]);var Ge=(0,p.useMemo)((function(){return(0,S.jsx)(F,{cacheItems:ye,selectedLinks:Be})}),[ye,Be]),Ke=(0,p.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;Ue((function(n){return ce(e,n)}))}),[Be,Ue,He]),$e=(0,p.useMemo)((function(){return(0,S.jsx)(Ve,{children:(0,S.jsx)(Se,{cacheItems:ye,mainContainerHeight:je,onClickAction:l,refCacheItems:d,selectedItem:We,selectedLinks:Be,setSelectedLinks:Ue})})}),[ye,je,l,We,Be,Ue]);(0,p.useEffect)((function(){setTimeout((function(){var e,n,t,i;fe(null===s||void 0===s||null===(e=s.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.height),ke(null===c||void 0===c||null===(t=c.current)||void 0===t||null===(i=t.getBoundingClientRect())||void 0===i?void 0:i.height)}),1)}),[]);var nn=(0,Qe.y)(),tn=nn.registerOnKeyDown,on=nn.unregisterOnKeyDown;(0,p.useEffect)((function(){return function(){return on(h)}}),[on,h]),null===tn||void 0===tn||tn(h,(function(e,n){var t,i;L&&(n[qe.vP]&&(R(!1),null===a||void 0===a||null===(t=a.current)||void 0===t||t.blur()));((0,Xe.y)([qe.zX,qe.A1],n)||(0,Xe.y)([qe.PQ,qe.A1],n))&&(e.preventDefault(),null===a||void 0===a||null===(i=a.current)||void 0===i||i.focus())}),[L,R]);var rn=(0,p.useMemo)((function(){var e=[];return null===ye||void 0===ye||ye.forEach((function(n){var t,i,o;null===(t=ie({models:(null===n||void 0===n||null===(i=n.item)||void 0===i?void 0:i.models)||[],project:null===n||void 0===n||null===(o=n.item)||void 0===o?void 0:o.project}))||void 0===t||t.forEach((function(t){var i,o,r,l,u,c,s={cacheItem:n,model:t};e.push({itemObject:s,searchQueries:[null===t||void 0===t?void 0:t.fullPath,null===t||void 0===t||null===(i=t.fullPath)||void 0===i||null===(o=i.toLowerCase())||void 0===o||null===(r=o.replaceAll("_"," "))||void 0===r?void 0:r.replaceAll("-"," "),null===t||void 0===t?void 0:t.name,null===t||void 0===t||null===(l=t.name)||void 0===l||null===(u=l.toLowerCase())||void 0===u||null===(c=u.replaceAll("_"," "))||void 0===c?void 0:c.replaceAll("-"," ")],value:null===t||void 0===t?void 0:t.fullPath})}))})),e}),[ye]);return(0,S.jsx)(Le,{maxWidth:t?null===I||void 0===I?void 0:I.width:null,children:(0,S.jsx)(Te.Z,{after:Ge,afterDividerContrast:!0,afterHeightOffset:0,afterHidden:W,afterInnerHeightMinus:pe,afterMousedownActive:$,afterWidth:V,before:(0,S.jsx)(de,{cacheItems:ye,selectedLinks:Be,selectedTab:Ne,setSelectedLinks:Ue}),beforeDividerContrast:!0,beforeHeader:(0,S.jsx)("div",{ref:s,children:(null===Be||void 0===Be?void 0:Be.length)>=1?(0,S.jsx)(K,{navigateBack:Ke,selectedLinks:Be,selectedTab:Ne}):(0,S.jsx)(he,{selectedTab:Ne,setSelectedTab:He})}),beforeHeightOffset:0,beforeContentHeightOffset:pe,beforeMousedownActive:ge,beforeWidth:ue,contained:!0,headerOffset:H.Mz,height:t?null===I||void 0===I?void 0:I.height:j,hideAfterCompletely:!We,inline:!0,mainContainerHeader:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(K,{navigateBack:Ke,selectedTab:(null===Be||void 0===Be?void 0:Be.length)>=2?null===Be||void 0===Be?void 0:Be[1]:null,children:(0,S.jsxs)(ze.eS,{children:[(0,S.jsx)(Ee.Z,{afterIcon:(0,S.jsx)(Ie.Z,{addPlusSignBetweenKeys:!0,disabled:!0,keyTextGroups:[[qe.RJ,qe.ZS]]}),afterIconClick:function(){var e;null===a||void 0===a||null===(e=a.current)||void 0===e||e.focus()},beforeIcon:(0,S.jsx)(N.Search,{}),compact:!0,fullWidth:!0,onBlur:function(){return setTimeout((function(){return R(!1)}),150)},onChange:function(e){return _e(e.target.value)},onFocus:function(){return R(!0)},placeholder:"Search a file...",primary:!0,small:!0,ref:a}),(0,S.jsx)(ze.rS,{maxHeight:100*w.iI,topOffset:null===a||void 0===a||null===(n=a.current)||void 0===n?void 0:n.getBoundingClientRect().height,children:(0,S.jsx)(B.Z,{itemGroups:[{items:L?rn:[],renderItem:function(e,n){var t=e.itemObject,i=(t.cacheItem,t.model),o=i.filePath,r=i.project,l=N.Database;return(0,S.jsx)(ze.gI,en(en({},n),{},{onClick:function(e){var t;(0,Oe.j)(e),null===n||void 0===n||null===(t=n.onClick)||void 0===t||t.call(n,e)},children:(0,S.jsxs)(Z.Z,{alignItems:"center",flex:1,justifyContent:"space-between",children:[(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(l,{default:!0}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{default:!0,monospace:!0,overflowWrap:!0,small:!0,textOverflow:!0,children:o})]}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,overflowWrap:!0,small:!0,textOverflow:!0,children:null===r||void 0===r?void 0:r.name})]})]})}))}}],maxResults:12,onSelectItem:function(e){var n,t,i,o=e.itemObject,r=[],l=null===o||void 0===o?void 0:o.cacheItem;z.N.DBT===(null===l||void 0===l?void 0:l.item_type)&&(r.push(null===(t=re([null===o||void 0===o?void 0:o.model]))||void 0===t?void 0:t[0]),r.push(null===(i=le(ye))||void 0===i?void 0:i.find((function(e){var n,t;return e.uuid===(null===l||void 0===l||null===(n=l.item)||void 0===n||null===(t=n.project)||void 0===t?void 0:t.uuid)}))),r.push(null===ne||void 0===ne?void 0:ne.find((function(e){return e.uuid===b.tf.DBT}))));Ue(r),_e(null),R(!1),null===a||void 0===a||null===(n=a.current)||void 0===n||n.blur()},searchQuery:Ce,uuid:"".concat(h,"/AutocompleteDropdown")})})]})}),(0,S.jsx)(k.Z,{light:!0})]}),mainContainerRef:c,setAfterHidden:G,setAfterMousedownActive:ee,setAfterWidth:X,setBeforeMousedownActive:be,setBeforeWidth:se,uuid:h,children:$e})})},tn=t(65701),on=t(1254);var rn=function(e){var n=e.size;return(0,S.jsxs)("svg",{width:n,height:n,viewBox:"0 0 121 121",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,S.jsx)("path",{d:"M67.7193 2.36691C69.8656 1.52184 72.3078 2.0081 73.9667 3.61084L116.977 45.1646C119.018 47.1366 119.362 50.2841 117.794 52.65L92.5787 90.7113C92.1293 91.3897 91.5441 91.9675 90.8601 92.4083L51.1076 118.029C48.6859 119.589 45.4904 119.168 43.5558 117.033L3.02296 72.3013C1.48382 70.6027 1.07052 68.1652 1.96372 66.0542L20.1894 22.9792C20.8058 21.5224 21.9825 20.3749 23.4544 19.7954L67.7193 2.36691Z",fill:"url(#paint0_radial_11972_15232)"}),(0,S.jsx)("path",{d:"M71.2431 0.979492L23.6155 19.9931C22.1646 20.5723 21.0034 21.7045 20.3877 23.1402L0.499023 69.5159L20.1894 22.9792C20.8058 21.5224 21.9825 20.3749 23.4544 19.7954L71.2431 0.979492Z",fill:"url(#paint1_radial_11972_15232)"}),(0,S.jsx)("path",{d:"M66.8804 2.66681C69.0294 1.81866 71.4758 2.30583 73.1359 3.9125L116.693 46.0674C117.169 46.5283 117.061 47.3191 116.478 47.635L75.3823 69.9165C74.5929 70.3446 73.6135 70.1821 73.0046 69.522L27.1285 19.7915C26.661 19.2848 26.8482 18.4667 27.4895 18.2136L66.8804 2.66681Z",fill:"url(#paint3_radial_11972_15232)"}),(0,S.jsx)("path",{d:"M66.8804 2.66681C69.0294 1.81866 71.4758 2.30583 73.1359 3.9125L116.693 46.0674C117.169 46.5283 117.061 47.3191 116.478 47.635L75.3823 69.9165C74.5929 70.3446 73.6135 70.1821 73.0046 69.522L27.1285 19.7915C26.661 19.2848 26.8482 18.4667 27.4895 18.2136L66.8804 2.66681Z",fill:"url(#paint4_linear_11972_15232)"}),(0,S.jsx)("path",{d:"M23.3591 24.6945L58.2913 58.6736L25.3897 22.7247C24.8455 22.13 23.9152 22.1095 23.3452 22.6795C22.7871 23.2375 22.7934 24.1442 23.3591 24.6945Z",fill:"url(#paint5_radial_11972_15232)"}),(0,S.jsx)("path",{d:"M51.6694 46.395L73.0043 69.5215C73.6132 70.1816 74.5925 70.3441 75.382 69.9161L117.654 46.9975L75.6257 67.8209C74.8809 68.1899 73.9844 68.0497 73.3879 67.4708L51.6694 46.395Z",fill:"url(#paint6_radial_11972_15232)"}),(0,S.jsxs)("defs",{children:[(0,S.jsxs)("radialGradient",{id:"paint0_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(16.9412 88.4412) rotate(18.02) scale(82.0367 81.4644)",children:[(0,S.jsx)("stop",{stopColor:"#FFDA19"}),(0,S.jsx)("stop",{offset:"0.473958",stopColor:"#33CDF2"}),(0,S.jsx)("stop",{offset:"0.786458",stopColor:"#3266FF"}),(0,S.jsx)("stop",{offset:"1",stopColor:"#5429FF"})]}),(0,S.jsxs)("radialGradient",{id:"paint1_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(35.8711 10.2518) rotate(87.6364) scale(26.1711 27.0141)",children:[(0,S.jsx)("stop",{stopColor:"white"}),(0,S.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),(0,S.jsxs)("radialGradient",{id:"paint2_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(150.671 44.2502) rotate(128.639) scale(125.554 128.436)",children:[(0,S.jsx)("stop",{stopColor:"white"}),(0,S.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),(0,S.jsxs)("radialGradient",{id:"paint3_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(133.353 52.8357) rotate(144.647) scale(86.7385 72.7129)",children:[(0,S.jsx)("stop",{offset:"0.081278",stopColor:"white"}),(0,S.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),(0,S.jsxs)("linearGradient",{id:"paint4_linear_11972_15232",x1:"76.5876",y1:"66.532",x2:"79.1358",y2:"50.4429",gradientUnits:"userSpaceOnUse",children:[(0,S.jsx)("stop",{stopColor:"white"}),(0,S.jsx)("stop",{offset:"0.416667",stopColor:"white",stopOpacity:"0.1"}),(0,S.jsx)("stop",{offset:"0.682292",stopColor:"white",stopOpacity:"0"})]}),(0,S.jsxs)("radialGradient",{id:"paint5_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(25.2251 23.4978) rotate(48.3599) scale(35.5147 43.1672)",children:[(0,S.jsx)("stop",{stopColor:"white"}),(0,S.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),(0,S.jsxs)("radialGradient",{id:"paint6_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(76.5908 67.6516) rotate(104.629) scale(14.9575 79.0374)",children:[(0,S.jsx)("stop",{stopColor:"white"}),(0,S.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]})]})]})},ln=t(30352),un=t(68562),cn=t(7267),sn=t(57653),an=t(44085),dn=t(4015),vn=t(13803),pn=t(72191),fn=t(2548);function hn(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 mn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?hn(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):hn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var gn=function(e){var n,t,i,o=e.block,l=e.defaultName,u=e.isReplacingBlock,c=e.isUpdatingBlock,s=e.onClose,a=e.onSave,d=e.pipeline,v=(0,ae.VI)(null,{},[],{uuid:"ConfigureBlock"}),h=(0,r.Z)(v,1)[0],m=null===(n=(null===o||void 0===o?void 0:o.pipelines)||[])||void 0===n?void 0:n.length,g=(0,p.useRef)(null),x=(0,p.useState)({color:(null===o||void 0===o?void 0:o.color)||null,language:(null===o||void 0===o||null===(t=o.defaults)||void 0===t?void 0:t.language)||(null===o||void 0===o?void 0:o.language),name:l,type:null===o||void 0===o?void 0:o.type}),j=x[0],k=x[1],P=(0,p.useCallback)((function(){a(mn(mn({},j),{},{name:(null===j||void 0===j?void 0:j.name)||l})),s()}),[j,l,s,a]);(0,p.useEffect)((function(){var e,n=function(e){if(e.stopPropagation(),e.key===qe.KW)s();else if(e.key===qe.tt){var n=e.target.innerText;n.startsWith("Save and")||"Cancel"===n||P()}};return null===(e=document)||void 0===e||e.addEventListener("keydown",n),function(){var e;null===(e=document)||void 0===e||e.removeEventListener("keydown",n)}}),[P,s]),(0,p.useEffect)((function(){var e;null===g||void 0===g||null===(e=g.current)||void 0===e||e.focus()}),[]);var _=(0,p.useMemo)((function(){return sn.qL.INTEGRATION===(null===d||void 0===d?void 0:d.type)}),[d]),I=(0,p.useMemo)((function(){return b.tf.CUSTOM===(null===o||void 0===o?void 0:o.type)}),[o]),E=(0,p.useMemo)((function(){return b.tf.MARKDOWN===(null===o||void 0===o?void 0:o.type)}),[o]),T=(0,p.useMemo)((function(){return null===o||void 0===o?void 0:o.block_action_object}),[o]),M=(0,p.useMemo)((function(){return fn.L.GENERATE_BLOCK===(null===T||void 0===T?void 0:T.object_type)}),[T]),B=(0,p.useMemo)((function(){return M&&(null===T||void 0===T?void 0:T.description)}),[T,M]),D=(0,p.useMemo)((function(){var e;return vn.I.DATA_INTEGRATION===(null===o||void 0===o||null===(e=o.config)||void 0===e?void 0:e.template_type)||!![vn.O.DESTINATIONS,vn.O.SOURCES].includes(null===T||void 0===T?void 0:T.language)}),[o,T]),A=(0,p.useState)(null),R=A[0],L=A[1],F=(0,f.Db)(Y.ZP.llms.useCreate(),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var n=e.llm,t=(null===n||void 0===n?void 0:n.response)||{},i=t.block_type,o=(t.code,t.configuration),r=t.content,l=t.language;k((function(e){return mn(mn({},e),{},{block_action_object:null,configuration:o,content:r,language:l,type:i})})),L(n)},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),U=(0,r.Z)(F,2),H=U[0],W=U[1].isLoading;(0,p.useEffect)((function(){M&&B&&!R&&H({llm:{request:{block_description:B,block_type:b.tf.TRANSFORMER,code_language:b.t6.PYTHON},use_case:cn.z.GENERATE_CODE}})}),[H,B,M,R]);var K=(0,p.useMemo)((function(){var e,n;return null!==o&&void 0!==o&&null!==(e=o.config)&&void 0!==e&&e.custom_template?null===o||void 0===o||null===(n=o.config)||void 0===n?void 0:n.custom_template:[fn.L.CUSTOM_BLOCK_TEMPLATE,fn.L.MAGE_TEMPLATE].includes(null===T||void 0===T?void 0:T.object_type)?mn(mn({},T),{},{name:null===T||void 0===T?void 0:T.title}):void 0}),[o,T]),z=(0,p.useMemo)((function(){var e=(null===j||void 0===j?void 0:j.type)||(null===o||void 0===o?void 0:o.type);K&&(e=null===K||void 0===K?void 0:K.block_type);var n=b.V4[e];return _&&(b.tf.DATA_LOADER===e?n="Source":b.tf.DATA_EXPORTER===e&&(n="Destination")),n}),[o,j,K,_]);return(0,S.jsxs)(dn.Nk,{width:M&&(null===j||void 0===j?void 0:j.content)&&80*w.iI,children:[(0,S.jsxs)(dn.I5,{children:[M&&W&&(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(O.ZP,{children:"Generating block using AI..."}),(0,S.jsx)(ke.Z,{inverted:!0})]}),M&&!W&&(0,S.jsx)(y.ZP,{alignItems:"center",justifyContent:"center",children:(0,S.jsx)(N.AISparkle,{size:5*w.iI,warning:!0})}),!M&&(0,S.jsx)(y.ZP,{alignItems:"center",justifyContent:"center",children:(0,S.jsx)(rn,{size:15*w.iI})})]}),M&&!W&&(0,S.jsx)(dn.gI,{children:(0,S.jsxs)(C.Z,{py:1,children:[(0,S.jsx)(C.Z,{mb:1,children:(0,S.jsx)(O.ZP,{default:!0,children:"Block generated using AI"})}),(0,S.jsx)(O.ZP,{textOverflow:!0,children:B})]})}),K&&(0,S.jsx)(dn.gI,{children:(0,S.jsxs)(C.Z,{py:1,children:[(0,S.jsx)(C.Z,{mb:1,children:(0,S.jsx)(O.ZP,{default:!0,children:"Template"})}),(0,S.jsx)(O.ZP,{textOverflow:!0,children:null===(i=(null===K||void 0===K?void 0:K.name)||(null===K||void 0===K?void 0:K.template_uuid))||void 0===i?void 0:i.slice(0,40)})]})}),b.tf.GLOBAL_DATA_PRODUCT!==(null===o||void 0===o?void 0:o.type)&&m>1&&(0,S.jsxs)(dn.gI,{children:[(0,S.jsx)(Z.Z,{flex:"1",children:(0,S.jsx)(N.AlertTriangle,{size:pn.l2,warning:!0})}),(0,S.jsx)(Z.Z,{flex:"6",children:(0,S.jsxs)(O.ZP,{bold:!0,warning:!0,children:[c&&"Renaming this block will affect ".concat(m," pipelines.")+" The renamed block may need to be re-added to the shared pipeline(s).",u&&"This will create a copy of the selected block and replace the existing one so it is no longer shared with any other pipelines."]})})]}),(0,S.jsxs)(dn.gI,{children:[(0,S.jsx)(O.ZP,{default:!0,children:"Name"}),(0,S.jsx)(Ee.Z,{alignRight:!0,fullWidth:!0,noBackground:!0,noBorder:!0,onChange:function(e){return k((function(n){return mn(mn({},n),{},{name:e.target.value})}))},paddingVertical:w.iI,placeholder:"Block name...",ref:g,value:(null===j||void 0===j?void 0:j.name)||""})]}),(0,S.jsxs)(dn.gI,{children:[(0,S.jsx)(O.ZP,{default:!0,children:"Type"}),(0,S.jsx)(C.Z,{mr:w.cd,py:1,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{muted:!0,children:z}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(N.Locked,{muted:!0})]})})]}),!E&&(I||K||(null===j||void 0===j?void 0:j.language))&&(0,S.jsxs)(dn.gI,{paddingVerticalAddition:3,children:[(0,S.jsx)(O.ZP,{default:!0,children:"Language"}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[[b.t6.PYTHON,b.t6.SQL,b.t6.R,b.t6.YAML].reduce((function(e,n){var t=(K?null===K||void 0===K?void 0:K.language:null===j||void 0===j?void 0:j.language)===n;return!(I&&!c&&!u||t||D&&b.t6.R!==n&&D&&b.t6.SQL!==n)||I&&b.t6.YAML===n||e.push((0,S.jsx)(C.Z,{ml:1,children:(0,S.jsx)(be.ZP,{borderColor:t?null:"transparent",compact:!0,default:!I&&!t&&!D,disabled:!I&&!t&&!D,noBackground:!0,notClickable:(!I||c||!D)&&t,onClick:K&&!D?null:function(){return k((function(e){return mn(mn({},e),{},{language:n})}))},selected:t,children:b.LE[n]})},n)),e}),[]),!I&&!D&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(N.Locked,{muted:!0})]}),(0,S.jsx)(C.Z,{mr:I||D?1:2})]})]}),(I||(null===K||void 0===K?void 0:K.color)||(null===j||void 0===j?void 0:j.color))&&(0,S.jsxs)(dn.gI,{children:[(0,S.jsx)(O.ZP,{default:!0,children:"Color"}),I&&(0,S.jsxs)(an.Z,{alignRight:!0,disabled:u,noBackground:!0,noBorder:!0,onChange:function(e){return k((function(n){return mn(mn({},n),{},{color:e.target.value})}))},value:K?(null===K||void 0===K?void 0:K.color)||"":(null===j||void 0===j?void 0:j.color)||"",children:[(0,S.jsx)("option",{value:""}),Object.values(b.Lq).map((function(e){return(0,S.jsx)("option",{value:e,children:(0,G.kC)(e)},e)}))]}),!I&&(0,S.jsx)(C.Z,{mr:w.cd,py:1,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{muted:!0,children:(0,G.kC)((null===K||void 0===K?void 0:K.color)||(null===j||void 0===j?void 0:j.color)||"")}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(N.Locked,{muted:!0})]})})]}),M&&(null===j||void 0===j?void 0:j.content)&&(0,S.jsx)(dn.gI,{display:"block",children:(0,S.jsx)(C.Z,{pr:w.cd,py:1,children:(0,S.jsx)(tn.W,{backend:on.PD,children:(0,S.jsx)(ln.Z,{block:mn(mn({},j),{},{uuid:B}),defaultValue:null===j||void 0===j?void 0:j.content,disableDrag:!0,hideExtraCommandButtons:!0,hideExtraConfiguration:!0,hideHeaderInteractiveInformation:!0,noDivider:!0,onChange:function(e){return k((function(n){return mn(mn({},n),{},{content:e})}))},selected:!0,textareaFocused:!0},B)})})}),(0,S.jsx)(dn.$b,{children:(0,S.jsxs)(y.ZP,{fullWidth:!0,children:[(0,S.jsxs)(un.ZP,{bold:!0,centerText:!0,disabled:W,onClick:P,primary:!0,tabIndex:0,uuid:"ConfigureBlock/SaveAndAddBlock",children:["Save and\xa0",c?"update":u?"replace":"add"]}),(0,S.jsx)(C.Z,{ml:1,children:(0,S.jsx)(be.ZP,{onClick:s,tabIndex:0,children:"Cancel"})})]})})]})},bn=t(54750),xn=t(4804),jn=t(99236),kn=t(98464),Zn=t(29480),yn=t(37443),Pn=t(53405);function Cn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function On(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Cn(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Cn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var wn=function(e){var n=e.block,t=e.blockConfigString,i=e.blockContent,o=e.blockUpstreamBlocks,l=e.dataIntegrationConfiguration,u=e.onChangeCodeBlock,c=e.pipeline,s=e.savePipelineContent,a=e.setBlockConfigString,d=e.setBlockContent,v=e.setContent,h=e.setSelectedSubTab,m=e.showError,g=n||{},x=g.language,Z=g.type,_=g.uuid,I=(c||{}).uuid,E=(0,p.useState)(!1),T=E[0],M=E[1],B=(0,p.useMemo)((function(){return b.t6.YAML===x&&i?(0,xn.Qc)(i):{}}),[i,x]),D=(0,kn.Z)(t);(0,p.useEffect)((function(){!B||t||D||a((0,xn.Pz)(null===B||void 0===B?void 0:B.config))}),[t,D,B,a]);var R=(0,p.useState)(!1),L=R[0],F=R[1],U=(0,f.Db)(Y.ZP.integration_sources.useCreate(),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var n=e.integration_source;null!==n&&void 0!==n&&n.error_message?m({response:{error:{exception:null===n||void 0===n?void 0:n.error_message}}}):null!==n&&void 0!==n&&n.success&&F(!0)},onErrorCallback:function(e,n){return m({errors:n,response:e})}})}}),H=(0,r.Z)(U,2),W=H[0],G=H[1].isLoading,K=(0,p.useCallback)((function(){return s().then((function(){return W({integration_source:{action_type:"test_connection",block_uuid:_,pipeline_uuid:I}})}))}),[_,W,I,s]),z=(0,p.useMemo)((function(){if(b.t6.YAML===x)return(0,S.jsx)(Zn.$W,{children:(0,S.jsx)(xe.Z,{autoHeight:!0,language:x,onChange:function(e){a(e);try{var n=(0,xn.Qc)(e),t=(0,xn.Pz)(On(On({},B),{},{config:n}));u(Z,_,t),v(t),M(!1)}catch(i){M(!0)}},tabSize:2,value:t||void 0,width:"100%"})});b.t6.PYTHON}),[t,i,B,x,Z,_,d,v]),q=(0,p.useMemo)((function(){return(0,Pn.Wi)(o,l)}),[o,l]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.PlugAPI,{success:!0}),loading:G,onClick:function(){F(!1),K()},secondary:!0,compact:!0,children:"Test connection"}),L&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(j.Z,{size:1*w.iI,success:!0}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{success:!0,children:"Connection successful"})]})]})]})}),(0,S.jsx)(k.Z,{light:!0}),(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsx)(O.ZP,{bold:!0,default:!0,large:!0,children:"Inputs from upstream blocks"}),0===(null===q||void 0===q?void 0:q.length)&&(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{muted:!0,children:["No inputs are selected. Toggle the upstream blocks in the ",(0,S.jsx)(P.Z,{bold:!0,onClick:function(){return h(yn.tw.UPSTREAM_BLOCK_SETTINGS)},preventDefault:!0,children:"Upstream block settings"})," to enable its output data as an input."]})})]}),(null===q||void 0===q?void 0:q.length)>=1&&(0,S.jsx)(jn.Z,{inputsBlocks:q}),T&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(k.Z,{light:!0}),(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsx)(C.Z,{mb:1,children:(0,S.jsx)(A.Z,{danger:!0,level:5,children:"ERROR"})}),(0,S.jsxs)(O.ZP,{muted:!0,children:["The credentials configuration is formatted incorrectly for the language ",b.LE[x],". The formatting must be fixed before the credentials configuration can be saved."]})]})]}),z]})},_n=t(13126),Sn=t(96348),In=t(26304),En=t(93859),Tn=t(66909),Mn=t(42122);var Bn=function(e){var n=e.block,t=e.height,i=e.pipeline,o=e.setSelectedSubTab,l=e.showError,u=e.stream,c=(0,p.useRef)(null),s=(0,p.useState)(null),a=s[0],d=s[1],v=(0,p.useState)(100),h=v[0],m=(v[1],(0,p.useState)(0)),g=m[0],b=m[1];(0,p.useEffect)((function(){var e,n;null!==c&&void 0!==c&&null!==(e=c.current)&&void 0!==e&&e.getBoundingClientRect().height&&b(null===c||void 0===c||null===(n=c.current)||void 0===n?void 0:n.getBoundingClientRect().height)}),[c]);var x=null===i||void 0===i?void 0:i.uuid,j=null===n||void 0===n?void 0:n.uuid,k=(0,p.useMemo)((function(){return{parentStreamID:(0,Pn.Qu)(u),streamID:(0,Pn.M$)(u)}}),[u]),Z=k.parentStreamID,y=k.streamID,_=(0,p.useMemo)((function(){return(0,Mn.Qr)((0,Pn.WE)(u||{})||{},{idIsInObject:!0})}),[u]),I=Y.ZP.outputs.pipelines.detail(!a&&x,!a&&j,{parent_stream:Z,sample_count:h,stream:y},{revalidateOnFocus:!1}).data,E=(0,f.Db)(Y.ZP.outputs.useCreate(),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var n=e.output;d(n)},onErrorCallback:function(e,n){return l({errors:n,response:e})}})}}),T=(0,r.Z)(E,2),M=T[0],B=T[1].isLoading,D=(0,p.useCallback)((function(){return M({output:{block_uuid:j,persist:1,pipeline_uuid:x,refresh:1,sample_count:h,streams:[{parent_stream:Z,stream:y}]}})}),[j,M,Z,x,h,y]),A=(0,p.useMemo)((function(){return a||(null===I||void 0===I?void 0:I.output)}),[I,a]),R=(0,p.useMemo)((function(){var e,n=(A||{}).outputs,t=void 0===n?[]:n;return null===t||void 0===t||null===(e=t.find((function(e){return e.uuid===y})))||void 0===e?void 0:e.data}),[A,y]),N=(0,p.useMemo)((function(){var e=R||{},n=e.sample_data,i=(e.type,n||{}),o=i.columns,r=i.rows;if(null!==o&&void 0!==o&&o.length&&null!==r&&void 0!==r&&r.length)return(0,S.jsx)(En.Z,{columnHeaderHeight:Tn.Eh,columns:o,height:t-g,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,rows:r})}),[R,t,g]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{p:w.cd,ref:c,children:_?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.ZP,{default:!0,children:"Please select at least 1 column in the stream in order to fetch sample data."}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(P.Z,{bold:!0,onClick:function(){return o(yn.tw.SETTINGS)},preventDefault:!0,children:"Go to Schema properties to select a column"})})]}):(0,S.jsx)(be.ZP,{compact:!0,loading:B,onClick:function(){return D()},primary:!0,children:R?"Refresh sample data":"Fetch sample data"})}),N]})},Dn=t(31882),An=t(69650),Rn=t(12468),Nn=t(61599),Ln=t(14466),Fn=v.default.div.withConfig({displayName:"indexstyle__SectionStyle",componentId:"sc-wjbb3f-0"})(["border-radius:","px;"," ",""],Me.n_,(function(e){return"\n border: 1px solid ".concat((e.theme.borders||U.Z.borders).light,";\n ")}),(function(e){return!e.noPadding&&"\n padding: ".concat(w.cd*w.iI,"px;\n ")}));function Un(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Hn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Un(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Un(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Wn=function(e){var n,t=e.block,i=(e.blocksMapping,e.onChangeBlock),u=e.setBlockAttributes,c=e.stream,s=(e.streamMapping,e.updateStreamsInCatalog),a=(0,p.useRef)(null),d=(0,p.useState)({}),v=d[0],f=d[1],h=c||{},m=h.auto_add_new_fields,g=h.bookmark_properties,x=h.bookmark_property_operators,j=h.destination_table,k=h.disable_column_type_check,P=h.key_properties,_=h.partition_keys,I=h.replication_method,E=h.run_in_parallel,T=h.unique_conflict_method,M=h.unique_constraints,B=(0,Pn.M$)(c),D=(0,Pn.WD)(c),A=(0,Pn.Z5)(c),N=null===t||void 0===t||null===(n=t.metadata)||void 0===n?void 0:n.data_integration,F=(null===N||void 0===N?void 0:N.source)||(null===N||void 0===N?void 0:N.destination),U=(0,p.useCallback)((function(e){return s(e,(function(e){return null===i||void 0===i?void 0:i(e)}))}),[i,s]),H=(0,p.useCallback)((function(e,n){U([Hn(Hn({},c),{},(0,l.Z)({},e,n))])}),[c,U]),W=(0,p.useMemo)((function(){var e,n=[],t={},i=[],l=(0,Pn.RP)(c)||{};return null===(e=Object.entries(l||{}))||void 0===e||e.forEach((function(e){var o,l=(0,r.Z)(e,2),u=l[0],c=l[1],s=c.metadata,a=c.type;n.push(u),(!s||null===s||void 0===s||!s.metadata||null!==s&&void 0!==s&&null!==(o=s.metadata)&&void 0!==o&&o.selected)&&i.push(u);var d=Array.isArray(a)?a:[a];if((null===d||void 0===d?void 0:d.length)>=1){var v=d[(null===d||void 0===d?void 0:d.length)-1];null!==t&&void 0!==t&&t[v]||(t[v]=[]),t[v].push(u)}})),(0,S.jsx)(R.Z,{columnFlex:[1,1],rows:[[(0,S.jsx)(O.ZP,{children:"Number of columns selected"},"columns"),(0,S.jsxs)(O.ZP,{monospace:!0,rightAligned:!0,children:[null===i||void 0===i?void 0:i.length," ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,children:"/"})," ",null===n||void 0===n?void 0:n.length]},"columns-value")]].concat((0,o.Z)((0,L.YC)(Object.entries(t),(function(e){return(0,r.Z)(e,1)[0]})).map((function(e){var n=(0,r.Z)(e,2),t=n[0],i=n[1];return[(0,S.jsxs)(O.ZP,{children:[(0,G.vg)(t)," columns"]},"columns-".concat(t)),(0,S.jsx)(O.ZP,{monospace:!0,rightAligned:!0,children:null===i||void 0===i?void 0:i.length},"columns-value-".concat(t))]}))),(0,o.Z)([["Bookmarks",g,"bookmark_properties"],["Unique constraints",M,"unique_constraints"],["Key properties",P,"key_properties"],["Partition keys",_,"partition_keys"]].map((function(e){var n,t=(0,r.Z)(e,3),i=t[0],o=t[1],l=t[2];return[(0,S.jsx)(O.ZP,{children:i},i),(0,S.jsxs)(y.ZP,{alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end",children:[!(null!==o&&void 0!==o&&o.length)&&(0,S.jsx)(O.ZP,{muted:!0,monospace:!0,children:"-"}),null===(n=(0,L.YC)(o||[],(function(e){return e})))||void 0===n?void 0:n.map((function(e){return(0,S.jsx)("div",{style:{marginLeft:w.iI/2},children:(0,S.jsx)(Dn.Z,{label:e,onClick:function(){return H(l,(0,L.Od)(o,(function(n){return n===e})))},xsmall:!0})},"".concat(i,"-value-").concat(e))}))]},"".concat(i,"-value"))]}))))})}),[g,P,_,c,M,H]),K=(0,p.useMemo)((function(){return D in v?null===v||void 0===v?void 0:v[D]:j}),[j,v,D]);return(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(Fn,{children:[(0,S.jsx)(O.ZP,{default:!0,uppercase:!0,children:"Output"}),(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{large:!0,children:"Destination table"}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(Rn.Z,{label:(0,S.jsxs)(O.ZP,{children:["By default, this stream will be saved to your destination under the table named ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:B}),". To change the table name, enter in a different value."]}),lightBackground:!0}),(0,S.jsx)(C.Z,{mr:w.cd})]}),(0,S.jsx)(Z.Z,{flex:1,children:(0,S.jsx)(Ee.Z,{fullWidth:!0,monospace:!0,onChange:function(e){var n,t=null===e||void 0===e||null===(n=e.target)||void 0===n?void 0:n.value;f((function(e){return Hn(Hn({},e),{},(0,l.Z)({},D,t))})),clearTimeout(a.current),a.current=setTimeout((function(){return H("destination_table",t)}),300)},value:K||""})})]})})]})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(Fn,{children:[(0,S.jsx)(O.ZP,{default:!0,uppercase:!0,children:"Settings"}),(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{large:!0,children:"Replication method"}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(Rn.Z,{label:(0,S.jsxs)(O.ZP,{children:["Do you want to synchronize the entire stream (",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Nn._B.FULL_TABLE}),") on each pipeline run or only new records (",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Nn._B.INCREMENTAL}),")?",Nn.th.POSTGRESQL===F&&(0,S.jsxs)(O.ZP,{children:["Log-based incremental replication (",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Nn._B.LOG_BASED}),") is also available for PostgreSQL sources."]})]}),lightBackground:!0}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(an.Z,{defaultColor:!0,onChange:function(e){return H("replication_method",e.target.value)},placeholder:"Select an option",value:I,children:Nn.jL.map((function(e){return(0,S.jsx)("option",{value:e,children:(0,G.vg)(e)},e)}))})]})}),(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{large:!0,children:"Unique conflict method"}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(Rn.Z,{label:(0,S.jsxs)(O.ZP,{children:["If a new record has the same value as an existing record in the ",(0,G._6)("unique 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)(O.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)(O.ZP,{inline:!0,children:" and "},e):n>=1&&(0,S.jsx)(S.Fragment,{children:",\xa0"}),e]},e)})),", how do you want to resolve the conflict? The conflict method ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Nn.MU.IGNORE})," will skip the new record if it\u2019s a duplicate of an existing record. The conflict method ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Nn.MU.UPDATE})," will not save the new record and instead update the existing record with the new record\u2019s properties."]}),lightBackground:!0}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(an.Z,{defaultColor:!0,onChange:function(e){return H("unique_conflict_method",e.target.value)},placeholder:"Select an option",value:T,children:Object.values(Nn.MU).map((function(e){return(0,S.jsx)("option",{value:e,children:(0,G.vg)(e)},e)}))})]})})]})}),(null===N||void 0===N?void 0:N.sql)&&Nn._B.INCREMENTAL===I&&(null===g||void 0===g?void 0:g.length)>=1&&(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(Fn,{children:[(0,S.jsx)(O.ZP,{default:!0,uppercase:!0,children:"Bookmark property operators"}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{muted:!0,small:!0,children:["By default, new records are compared to the bookmark property value using the operator greater than or equals (",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:">="}),").",(0,S.jsx)("br",{}),"If the bookmark property is also a unique constraint, then the default operator is greater than (",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:">"}),").",(0,S.jsx)("br",{}),"Change the operator that is used when determining which records to sync based on the bookmark value from the most recently completed sync."]})}),null===g||void 0===g?void 0:g.map((function(e){var n;return n=null!==x&&void 0!==x&&x[e]?null===x||void 0===x?void 0:x[e]:M&&null!==M&&void 0!==M&&M.includes(e)?Ln.W6.GREATER_THAN:Ln.W6.GREATER_THAN_OR_EQUALS,(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsxs)(O.ZP,{default:!0,monospace:!0,children:[(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,muted:!0,children:["{new_record}","."]}),e]}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(an.Z,{compact:!0,defaultColor:!0,monospace:!0,onChange:function(n){return H("bookmark_property_operators",Hn(Hn({},x),{},(0,l.Z)({},e,n.target.value)))},value:n,children:[Ln.W6.EQUALS,Ln.W6.GREATER_THAN,Ln.W6.GREATER_THAN_OR_EQUALS,Ln.W6.LESS_THAN,Ln.W6.LESS_THAN_OR_EQUALS,Ln.W6.NOT_EQUALS].map((function(e){return(0,S.jsx)("option",{value:e,children:Ln.N_[e]},e)}))}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsxs)(O.ZP,{default:!0,monospace:!0,children:[(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,muted:!0,children:["{bookmark}","."]}),e]})]})},e)}))]})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(Fn,{children:[(0,S.jsx)(O.ZP,{default:!0,uppercase:!0,children:"Options"}),(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Run streams in parallel"}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(O.ZP,{default:!0,children:"Parallel streams will be run at the same time, so make sure there are no dependencies between them."})})]}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(An.Z,{checked:!!E,onCheck:function(e){return H("run_in_parallel",e(E))}})]})}),b.tf.DATA_EXPORTER===(null===t||void 0===t?void 0:t.type)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Automatically add new fields"}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(O.ZP,{default:!0,children:"Turn the toggle on if you want new table columns in each data source stream to be automatically added and synced with the data destination."})})]}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(An.Z,{checked:!!m,onCheck:function(e){return H("auto_add_new_fields",e(m))}})]})}),(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Disable column type check"}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(O.ZP,{default:!0,children:"By default, the value for each column is validated according to the schema property for that column. If a value in a column doesn\u2019t match its type, an error will be raised and the process will be stopped. Turn this toggle on if you want to disable this strict type checking."})})]}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(An.Z,{checked:!!k,onCheck:function(e){return H("disable_column_type_check",e(k))}})]})})]})]})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(Fn,{noPadding:!0,children:[(0,S.jsx)(C.Z,{pt:w.cd,px:w.cd,children:(0,S.jsx)(O.ZP,{default:!0,uppercase:!0,children:"Summary"})}),(0,S.jsx)(C.Z,{mt:w.cd,pb:w.cd,children:W})]})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(Fn,{children:[(0,S.jsx)(O.ZP,{default:!0,uppercase:!0,children:"Other"}),(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{large:!0,children:"Select stream"}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(An.Z,{checked:!!A,onCheck:function(e){return U([(0,Pn.XE)(c,{selected:e(A)})])}})]})}),(0,S.jsx)(C.Z,{mt:w.HN,children:(0,S.jsx)(y.ZP,{alignItems:"center",children:(0,S.jsx)(be.ZP,{danger:!0,onClick:function(){window.confirm("Are you sure you want to remove stream ".concat(B," from block ").concat(null===t||void 0===t?void 0:t.uuid,"?"))&&u((function(e){var n,t=Hn(Hn({},e),{},{catalog:Hn(Hn({},null===e||void 0===e?void 0:e.catalog),{},{streams:(0,L.Od)(null===e||void 0===e||null===(n=e.catalog)||void 0===n?void 0:n.streams,(function(e){return(0,Pn.WD)(e)===D}))})});return null===i||void 0===i||i(t),t}))},children:"Delete stream from block"})})})]})})]})},Gn=t(11074),Kn=t(69632);function zn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function qn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?zn(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):zn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Vn=function(e){var n,t,i=e.block,o=(e.blocksMapping,e.highlightedColumnsMapping),u=e.onChangeBlock,c=e.setBlockAttributes,s=e.setHighlightedColumnsMapping,a=e.setSelectedSubTab,d=e.setStreamsMappingConflicts,v=e.showStreamConflicts,f=e.stream,h=e.streamMapping,m=e.streamsMappingConflicts,g=(0,p.useCallback)((function(e){c((function(n){var t=e(n);return null===u||void 0===u||u(t),t}))}),[u,c]),b=(0,p.useMemo)((function(){return(0,Pn.RP)(f)||{}}),[f]),P=(0,p.useState)(null),_=P[0],I=P[1],E=(0,p.useState)(null),T=E[0],M=E[1],B=(0,p.useRef)(null),D=(0,p.useState)(null),F=D[0],U=D[1],H=(0,p.useCallback)((function(){U(null),I(null)}),[U,I]);(0,p.useEffect)((function(){var e;return null===(e=document)||void 0===e||e.addEventListener("click",H),function(){var e;null===(e=document)||void 0===e||e.removeEventListener("click",H)}}),[H]);var W=(0,p.useMemo)((function(){var e=f.bookmark_properties,n=f.key_properties,t=f.partition_keys,i=(f.replication_method,f.unique_constraints);return{bookmarkPropertiesMapping:(0,L.HK)(e||[],(function(e){return e})),keyPropertiesMapping:(0,L.HK)(n||[],(function(e){return e})),partitionKeysMapping:(0,L.HK)(t||[],(function(e){return e})),uniqueConstraintsMapping:(0,L.HK)(i||[],(function(e){return e}))}}),[f]),G=W.bookmarkPropertiesMapping,K=W.keyPropertiesMapping,z=W.partitionKeysMapping,q=W.uniqueConstraintsMapping,V=(0,p.useMemo)((function(){var e,n;return null===(e=(0,L.YC)(Object.entries(b||{}),(function(e){return(0,r.Z)(e,1)[0]})))||void 0===e||null===(n=e.map)||void 0===n?void 0:n.call(e,(function(e){var n=(0,r.Z)(e,2);return{column:n[0],property:n[1]}}))}),[b]),Y=((0,p.useMemo)((function(){return(0,Pn.MB)(f)}),[f]),(0,p.useMemo)((function(){return(0,Pn.Nf)(f)}),[f])),X=null===i||void 0===i||null===(n=i.metadata)||void 0===n||null===(t=n.data_integration)||void 0===t?void 0:t.destination,Q=(0,p.useMemo)((function(){return!Nn.kB.includes(X)}),[X]),J=(0,p.useMemo)((function(){var e=[null,1,1],n=null===V||void 0===V?void 0:V.every((function(e){var n,t,i,o=e.property;return!(null!==o&&void 0!==o&&o.metadata)||!(null!==o&&void 0!==o&&null!==(n=o.metadata)&&void 0!==n&&n.metadata)||(null===o||void 0===o||null===(t=o.metadata)||void 0===t||null===(i=t.metadata)||void 0===i?void 0:i.selected)})),t=[{label:function(){return(0,S.jsx)(An.Z,{checked:n,compact:!0,onCheck:function(e){return function(e){var n=null===V||void 0===V?void 0:V.reduce((function(n,t){var i=t.column,o=(null===Y||void 0===Y?void 0:Y[i])||(0,Pn.jC)(i);return n[i]=qn(qn({},o),{},{metadata:qn(qn({},null===o||void 0===o?void 0:o.metadata),e)}),n}),{});g((function(e){return(0,Pn.$C)((0,Pn.AP)(f,n),e)}))}({selected:e(n)})}})},uuid:"action"},{uuid:"Property"},{uuid:"Types"}];Q&&(e.push.apply(e,[null,null]),t.push.apply(t,[{center:!0,uuid:"Unique"},{center:!0,uuid:"Key"}]));var i=f.replication_method;return Nn._B.INCREMENTAL===i&&(e.push(null),t.push({center:!0,uuid:"Bookmark"})),e.push(null),t.push({center:!0,uuid:"Partition"}),{columnFlex:e,columns:t}}),[V,g,f,Y,Q]),$=J.columnFlex,ee=J.columns,ne=(0,p.useCallback)((function(e,n,t){var i,o=t||{},r=o.disableEdit,u=o.key,c=(0,Pn.wx)(e,n),s=(null===c||void 0===c?void 0:c.typesDerived)||[];return(0,S.jsxs)(y.ZP,{alignItems:"center",flexWrap:"wrap",children:[null===(i=s||[])||void 0===i?void 0:i.map((function(n){return(0,S.jsx)("div",{style:{paddingBottom:1,marginRight:2,paddingTop:1},children:(0,S.jsx)(Dn.Z,{label:n,onClick:r?null:function(t){(0,Oe.j)(t);var i=!(null===s||void 0===s||!s.includes(n))?(0,Pn.VZ)([n],c):(0,Pn.qx)([n],c),o={anyOf:null===i||void 0===i?void 0:i.anyOf,format:null===i||void 0===i?void 0:i.format,type:null===i||void 0===i?void 0:i.type};g((function(n){return(0,Pn.$C)((0,Pn.KN)(f,(0,l.Z)({},e,o)),n)}))},xsmall:!0})},"".concat(e,"-").concat(u||"types","-").concat(n))})),!r&&(0,S.jsx)(be.ZP,{iconOnly:!0,noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(e){(0,Oe.j)(e),U({x:e.pageX,y:e.pageY}),I(c)},children:(0,S.jsx)(N.Edit,{default:!0})})]},"".concat(e,"-").concat(u||"types"))}),[g,U,I,f]),te=(0,p.useMemo)((function(){return null===V||void 0===V?void 0:V.map((function(e){var n,t=e.column,i=e.property,o=f.bookmark_properties,u=f.key_properties,c=f.partition_keys,s=f.replication_method,a=f.unique_constraints,d=(i.anyOf,i.format,i.metadata),v=(i.type,(0,Pn.wx)(t,i)),p=(null===v||void 0===v||v.typesDerived,!d||!(null!==d&&void 0!==d&&d.metadata)||(null===d||void 0===d||null===(n=d.metadata)||void 0===n?void 0:n.selected)),h=null===q||void 0===q?void 0:q[t],m=null===G||void 0===G?void 0:G[t],b=null===K||void 0===K?void 0:K[t],j=null===z||void 0===z?void 0:z[t],k=[(0,S.jsx)("div",{style:{minHeight:22},children:(0,S.jsx)(An.Z,{checked:p,compact:!0,onCheck:function(e){g((function(n){return(0,Pn.$C)((0,Pn.AP)(f,(0,l.Z)({},t,qn(qn({},d),{},{metadata:qn(qn({},null===d||void 0===d?void 0:d.metadata),{},{selected:e(p)})}))),n)}))}})},"".concat(t,"-selected")),(0,S.jsx)(O.ZP,{monospace:!0,children:t},"".concat(t,"-column")),ne(t,v)];Q&&k.push((0,S.jsx)(y.ZP,{alignItems:"center",justifyContent:"center",children:(0,S.jsx)(x.Z,{checked:h,onClick:function(e){(0,Oe.j)(e),g((function(e){return(0,Pn.$C)(qn(qn({},f),{},{unique_constraints:h?(0,L.Od)(a||[],(function(e){return e===t})):(0,L.Hl)(t,a||[])}),e)}))}})},"".concat(t,"-unique")));var Z=[];return Q&&Z.push([b,"key_properties",u]),Nn._B.INCREMENTAL===s&&Z.push([m,"bookmark_properties",o]),Z.push([j,"partition_keys",c]),Z.forEach((function(e){var n=(0,r.Z)(e,3),i=n[0],o=n[1],u=n[2];k.push((0,S.jsx)(y.ZP,{alignItems:"center",justifyContent:"center",children:(0,S.jsx)(x.Z,{checked:i,onClick:function(e){(0,Oe.j)(e),g((function(e){return(0,Pn.$C)(qn(qn({},f),{},(0,l.Z)({},o,i?(0,L.Od)(u||[],(function(e){return e===t})):(0,L.Hl)(t,u||[]))),e)}))}})},"".concat(t,"-").concat(o)))})),k}))}),[G,K,z,ne,V,g,f,Q,q]),ie=(0,p.useCallback)((function(e){var n=null===V||void 0===V?void 0:V[e];return qn(qn({},n),{},{highlighted:!(null===o||void 0===o||!o[null===n||void 0===n?void 0:n.column])})}),[o,V]),oe=(0,p.useMemo)((function(){var e;if(F&&_){var n=21*w.iI,t=(null===B||void 0===B||null===(e=B.current)||void 0===e?void 0:e.getBoundingClientRect())||{},i=t.x,o=t.width,r=F||{},u=r.x,c=void 0===u?0:u,s=r.y,a=void 0===s?0:s,d=c;c+n>=i+o&&(d=i+o-(n+w.iI)),d<0&&(d=0);var v=(null===b||void 0===b?void 0:b[null===_||void 0===_?void 0:_.uuid])||{},p=(0,Pn.wx)(null===_||void 0===_?void 0:_.uuid,v||{}),h=p||{},m=h.typesDerived,k=void 0===m?[]:m,Z=h.uuid;return(0,S.jsx)("div",{onClick:Oe.j,style:{left:d,position:"fixed",top:a+w.iI/2,width:n,zIndex:100},children:(0,S.jsxs)(Gn.Z,{children:[(0,S.jsx)("div",{style:{position:"relative"},children:(0,S.jsx)(be.ZP,{iconOnly:!0,noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(e){(0,Oe.j)(e),U(null),I(null)},style:{position:"absolute",right:-.5*w.iI,top:-.5*w.iI,zIndex:1},children:(0,S.jsx)(j.Z,{default:!0,size:2.5*w.iI,children:(0,S.jsx)(N.Close,{size:1.5*w.iI})})})}),(0,S.jsx)(C.Z,{p:w.cd,children:Nn.D5.map((function(e,n){var t=!(null===k||void 0===k||!k.includes(e));return(0,S.jsx)("div",{style:{marginTop:0===n?0:4},children:(0,S.jsx)(y.ZP,{alignItems:"center",children:(0,S.jsx)(x.Z,{checked:t,label:e,onClick:function(n){(0,Oe.j)(n);var i=t?(0,Pn.VZ)([e],p):(0,Pn.qx)([e],p),o={anyOf:null===i||void 0===i?void 0:i.anyOf,format:null===i||void 0===i?void 0:i.format,type:null===i||void 0===i?void 0:i.type};g((function(e){return(0,Pn.$C)((0,Pn.KN)(f,(0,l.Z)({},Z,o)),e)}))}})})},e)}))})]})})}}),[F,_,B,b,g,U,I,f]),re=(0,p.useMemo)((function(){return(0,Pn.p$)(f,m,h)}),[f,h,m]),le=(0,p.useCallback)((function(e,n){var t,i=null===re||void 0===re?void 0:re.stream,o=null===i||void 0===i||null===(t=i.schema)||void 0===t?void 0:t.properties;M((function(t){var i=qn({},t);return null===e||void 0===e||e.forEach((function(e){n?i[e]=null===o||void 0===o?void 0:o[e]:e in i&&(null===i||void 0===i||delete i[e])})),i}))}),[re,M]),ue=(0,p.useCallback)((function(e){var n=e||{},t=n.column,i=n.property,o=n.currentProperty,r=!(null===T||void 0===T||!T[t]),l=[(0,S.jsx)(x.Z,{checked:r,onClick:function(e){(0,Oe.j)(e),le([t],!r)}},"".concat(t,"-accept")),(0,S.jsx)(O.ZP,{monospace:!0,children:t},"".concat(t,"-property")),ne(t,i,{disableEdit:!0})];return o?l.push(ne(t,o,{disableEdit:!0,key:"types-current"})):l.push((0,S.jsx)("div",{},"".concat(t,"-empty"))),l}),[ne,T,le]),ce=(0,p.useCallback)((function(e,n){var t=n||{},i=t.columnFlex,o=t.columns,r=(null===e||void 0===e?void 0:e.map((function(e){return e.column})))||[],l=null===r||void 0===r?void 0:r.every((function(e){return!(null===T||void 0===T||!T[e])}));return(0,S.jsx)(R.Z,{columnFlex:[null,1].concat(i||[]),columns:[{label:function(){return(0,S.jsx)(x.Z,{checked:l,onClick:function(e){(0,Oe.j)(e),le(r,!l)}})},uuid:"Accept change"},{uuid:"Property"}].concat(o||[]),highlightRowOnHover:!0,onClickRow:function(n){var t=null===e||void 0===e?void 0:e[n],i=null===t||void 0===t?void 0:t.column,o=!(null===T||void 0===T||!T[i]);le([i],!o)},rows:null===e||void 0===e?void 0:e.map(ue)})}),[ue,T,le]),se=(0,p.useMemo)((function(){var e,n;if(!re)return null;var t=re.newColumnSettings,i=re.newColumns,o=re.stream,l=null===o||void 0===o||null===(e=o.schema)||void 0===e?void 0:e.properties,u=null===(n=(0,L.YC)(i,(function(e){return e})))||void 0===n?void 0:n.map((function(e){return{column:e,property:null===l||void 0===l?void 0:l[e]}})),c=(0,L.YC)(Object.entries(t),(function(e){return(0,r.Z)(e,1)[0]})).map((function(e){var n=(0,r.Z)(e,2),t=n[0];n[1];return{column:t,property:null===l||void 0===l?void 0:l[t],currentProperty:null===b||void 0===b?void 0:b[t]}}));return(0,S.jsxs)(S.Fragment,{children:[(null===u||void 0===u?void 0:u.length)>=1&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(A.Z,{level:5,warning:!0,children:"New properties"})}),(0,S.jsx)(k.Z,{light:!0}),ce(u,{columnFlex:[1,1],columns:[{uuid:"Types (new)"},{label:function(){return""},uuid:"empty"}]})]}),(null===c||void 0===c?void 0:c.length)>=1&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(A.Z,{level:5,warning:!0,children:"Properties with new types"})}),(0,S.jsx)(k.Z,{light:!0}),ce(c,{columnFlex:[1,1],columns:[{uuid:"Types (new)"},{uuid:"Types (current)"}]})]})]})}),[re,ce,b]),ae=(0,p.useMemo)((function(){return(0,S.jsx)(R.Z,{columnFlex:$,columns:ee,highlightRowOnHover:!0,isSelectedRow:function(e){var n;return null===(n=ie(e))||void 0===n?void 0:n.highlighted},menu:oe,onClickRow:function(e){var n=ie(e),t=n.column,i=n.highlighted;s((function(e){return i?(0,Mn.gR)(e,[t]):qn(qn({},e),{},(0,l.Z)({},t,!0))}))},ref:B,rows:te,stickyHeader:!0})}),[$,ee,ie,B,oe,te,s]);return(0,S.jsxs)(S.Fragment,{children:[v&&se&&(0,S.jsxs)(C.Z,{my:w.cd,children:[(0,S.jsx)(C.Z,{px:w.cd,children:(0,S.jsx)(Kn.NJ,{children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(Z.Z,{children:(0,S.jsx)(N.AlertTriangle,{size:2*w.iI,warning:!0})}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsxs)(O.ZP,{muted:!0,children:["The following properties are either new or have different types. Please review and either merge the changes or discard them.",(0,S.jsx)("br",{}),"Click the checkbox to include the updated property when merging changes."]})]})})}),se,(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)(y.ZP,{children:[(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.BranchAlt,{}),onClick:function(){g((function(e){var n;return(0,Pn.$C)(qn(qn({},f),{},{schema:qn(qn({},null===f||void 0===f?void 0:f.schema),{},{properties:qn(qn({},null===f||void 0===f||null===(n=f.schema)||void 0===n?void 0:n.properties),T)})}),e)})),d({noParents:{},parents:{}}),a(yn.tw.SETTINGS)},primary:!0,children:"Merge changes"}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(be.ZP,{onClick:function(){d({noParents:{},parents:{}}),a(yn.tw.SETTINGS)},secondary:!0,children:"Discard changes"})]})})]}),!v&&ae,(0,S.jsx)(C.Z,{pb:w.HN})]})},Yn=["block","height","pipeline","selectedSubTab","showError","stream"];function Xn(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 Qn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Xn(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Xn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Jn=function(e){var n=e.block,t=e.height,i=e.pipeline,o=e.selectedSubTab,r=e.showError,l=e.stream,u=(0,In.Z)(e,Yn);return yn.tw.OVERVIEW!==o&&o?yn.tw.SETTINGS===o||yn.tw.STREAM_CONFLICTS===o?(0,S.jsx)(Vn,Qn(Qn({},u),{},{block:n,showStreamConflicts:yn.tw.STREAM_CONFLICTS===o,stream:l})):yn.tw.SAMPLE_DATA===o?(0,S.jsx)(Bn,{block:n,height:t,pipeline:i,showError:r,stream:l}):(0,S.jsx)(S.Fragment,{}):(0,S.jsx)(Wn,Qn(Qn({},u),{},{block:n,stream:l}))},$n={label:function(e){return"".concat((0,G._6)("stream",e,!0)," fetched")},uuid:"Recently fetched"},et={label:function(e){return"".concat((0,G._6)("stream",e,!0)," from settings")},uuid:"From stream settings"},nt=[$n,et];function tt(e,n){return null===n||void 0===n?void 0:n.filter((function(n){var t=new RegExp(e||"","i"),i=(0,Pn.M$)(n);return!e||(null===i||void 0===i?void 0:i.match(t))||(null===i||void 0===i?void 0:i.replace("-"," ").match(t))||(null===i||void 0===i?void 0:i.replace("-","").match(t))||(null===i||void 0===i?void 0:i.replace("_"," ").match(t))||(null===i||void 0===i?void 0:i.replace("_","").match(t))||(null===i||void 0===i?void 0:i.replaceAll("-"," ").match(t))||(null===i||void 0===i?void 0:i.replaceAll("-","").match(t))||(null===i||void 0===i?void 0:i.replaceAll("_"," ").match(t))||(null===i||void 0===i?void 0:i.replaceAll("_","").match(t))}))}var it=function(e){var n=e.block,t=e.blocksMapping,i=e.height,o=e.onChangeBlock,u=e.searchText,c=e.setSelectedMainNavigationTab,s=(e.setSelectedSubTab,e.setStreamsMappingConflicts),a=e.streamsFetched,d=e.updateStreamsInCatalog,v=e.width,f=(0,p.useMemo)((function(){return(0,Pn.Uc)(n,{getAll:!0})}),[n]),h=(0,p.useMemo)((function(){return(0,Pn.UA)(f)}),[f]),m=(0,p.useMemo)((function(){return(0,Pn.UA)(a||[])}),[a]),g=(0,p.useCallback)((function(e){return(0,Pn.ig)(e,m,h)}),[m,h]),b=(0,p.useCallback)((function(e){return(0,Pn.p$)(e,m,h)}),[m,h]),x=(0,p.useCallback)((function(e){var n;return(n={},(0,l.Z)(n,$n.uuid,m),(0,l.Z)(n,et.uuid,h),n)[e]}),[h,m]),j=(0,p.useMemo)((function(){var e=[];return nt.forEach((function(n,i){var o,l=n.label,c=n.uuid,s=x(c),a=[],d=Object.values((null===s||void 0===s?void 0:s.noParents)||{})||[],v=tt(u,d);(null===v||void 0===v?void 0:v.length)>=1&&a.push({streams:(0,L.YC)(v||[],Pn.M$)}),null===(o=Object.entries((null===s||void 0===s?void 0:s.parents)||{}))||void 0===o||o.forEach((function(e){var n=(0,r.Z)(e,2),i=n[0],o=n[1],l=tt(u,Object.values(o||{})||[]);(null===l||void 0===l?void 0:l.length)>=1&&a.push({block:null===t||void 0===t?void 0:t[i],streams:(0,L.YC)(l||[],Pn.M$)})})),(null===a||void 0===a?void 0:a.length)>=1&&e.push({count:(0,L.Sm)((null===a||void 0===a?void 0:a.map((function(e){var n=e.streams;return(null===n||void 0===n?void 0:n.length)||0})))||[]),label:l,subgroups:a,uuid:c})})),e}),[x,u]),P=(0,p.useMemo)((function(){return(null===j||void 0===j?void 0:j.length)||0}),[j]);return(0,S.jsx)(S.Fragment,{children:null===j||void 0===j?void 0:j.map((function(e,n){var t=e.count,r=e.label,l=e.subgroups,u=e.uuid,a=$n.uuid===u;return(0,S.jsx)(He,{style:{height:i,right:et.uuid===u?null:0,width:v/P},children:(0,S.jsx)(We,{borderRight:P>=2&&!a,style:{height:i,width:v/P},children:(0,S.jsxs)(C.Z,{pt:w.cd,children:[(0,S.jsx)(C.Z,{px:w.Mq,children:(0,S.jsx)(A.Z,{level:4,children:r(t)})}),null===l||void 0===l?void 0:l.map((function(e,n){var t,i=e.block,r=e.streams;return(0,S.jsxs)(C.Z,{mt:i&&0===n?w.cd:1,children:[(0,S.jsx)(C.Z,{mb:i?w.cd:0,mt:i?0:w.cd,children:(0,S.jsx)(k.Z,{light:!0})}),i&&(0,S.jsx)(C.Z,{px:w.cd,children:(0,S.jsx)(O.ZP,{bold:!0,color:null===(t=(0,_.qn)(null===i||void 0===i?void 0:i.type,{blockColor:null===i||void 0===i?void 0:i.color}))||void 0===t?void 0:t.accent,default:!0,large:!0,monospace:!0,children:null===i||void 0===i?void 0:i.uuid})}),(0,S.jsx)(C.Z,{p:1,children:(0,S.jsx)(y.ZP,{alignItems:"center",flexWrap:"wrap",children:null===r||void 0===r?void 0:r.map((function(e){var n=g(e),t=!!b(e),i=(0,Pn.M$)(e),r=(0,Pn.Qu)(e),l=!1;if(a){var u=(0,Pn.zB)(e,x(et.uuid));u&&(l=(0,Pn.Z5)(u))}else l=(0,Pn.Z5)(e);var v=n&&t;return(0,S.jsx)(Ge,{onClick:a&&v?function(){return!1}:function(n){n.preventDefault(),d([(0,Pn.XE)(e,{selected:!l})],(function(e){return null===o||void 0===o?void 0:o(e)}))},selected:l,warning:v&&a,children:(0,S.jsxs)(y.ZP,{alignItems:"center",fullHeight:!0,justifyContent:"space-between",children:[(0,S.jsx)(Z.Z,{flex:1,children:(0,S.jsx)(O.ZP,{monospace:!0,muted:!l,children:i})}),v&&a&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{monospace:!0,warning:!0,children:"exists"})]}),v&&a&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(Z.Z,{alignItems:"center",style:{minHeight:3*w.iI},children:(0,S.jsx)(be.ZP,{compact:!0,onClick:function(){s((function(n){return(0,Pn.UA)([e],n)})),c((function(e){return{selectedMainNavigationTab:i,selectedMainNavigationTabSub:r,selectedSubTab:yn.tw.STREAM_CONFLICTS}}))},small:!0,warning:!0,children:"View differences"})})]}),(!v||!a)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mr:w.HN}),l&&(0,S.jsx)(N.Settings,{size:2*w.iI}),(0,S.jsx)(C.Z,{mr:l?1:3}),(0,S.jsx)(Z.Z,{alignItems:"center",style:{height:3*w.iI},children:(0,S.jsx)(An.Z,{checked:l,compact:!0,onCheck:function(n){return d([(0,Pn.XE)(e,{selected:n(l)})],(function(e){return null===o||void 0===o?void 0:o(e)}))}})})]})]})},i)}))})})]},i?null===i||void 0===i?void 0:i.uuid:"no-subtitle-".concat(n))}))]})})},u)}))})};function ot(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 rt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ot(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ot(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var lt=function(e){var n=e.attributes,t=e.attributesMapping,i=e.columnFlex,o=e.rightAlignColumnForRowIndexes,r=e.rowGroupHeaders,u=e.rowsGroupedByIndex,c=e.setAttributesMapping,s=(0,p.useCallback)((function(e,n){var i,r=e.inputType,u=e.label,s=e.options,a=e.uuid,d=null===t||void 0===t?void 0:t[a],v=!(null===d||void 0===d||!d.selected),p=null===d||void 0===d?void 0:d.value;return yn.oI.CHECKBOX===r?i=(0,S.jsx)(x.Z,{checked:!!p,onClick:function(e){v&&(0,Oe.j)(e),c((function(e){return rt(rt({},e),{},(0,l.Z)({},a,rt(rt({},null===e||void 0===e?void 0:e[a]),{},{value:!p})))}))}}):yn.oI.SELECT===r?i=(0,S.jsxs)(an.Z,{compact:!0,fullWidth:!0,onChange:function(e){(0,Oe.j)(e),c((function(n){var t;return rt(rt({},n),{},(0,l.Z)({},a,rt(rt({},null===n||void 0===n?void 0:n[a]),{},{value:null===e||void 0===e||null===(t=e.target)||void 0===t?void 0:t.value})))}))},onClick:function(e){v&&(0,Oe.j)(e)},value:p,children:[(0,S.jsx)("option",{value:""}),null===s||void 0===s?void 0:s.map((function(e){var n=e.disabled,t=e.label,i=e.value;return(0,S.jsx)("option",{disabled:n,value:i,children:t?t():i},i)}))]}):yn.oI.TOGGLE===r&&(i=(0,S.jsx)(An.Z,{checked:p,compact:!0,onCheck:function(e){c((function(n){return rt(rt({},n),{},(0,l.Z)({},a,rt(rt({},null===n||void 0===n?void 0:n[a]),{},{value:e(p)})))}))},pauseEvent:v})),[(0,S.jsx)(x.Z,{checked:v,onClick:function(e){(0,Oe.j)(e),c((function(e){return rt(rt({},e),{},(0,l.Z)({},a,rt(rt({},null===e||void 0===e?void 0:e[a]),{},{selected:!v})))}))}},"".concat(a,"-checkbox")),(0,S.jsx)(O.ZP,{muted:!v,children:u()},"".concat(a,"-name")),(0,S.jsx)(y.ZP,{alignItems:"center",justifyContent:null!==o&&void 0!==o&&o.includes(n)?"flex-end":"center",children:i},"".concat(a,"-value"))]}),[t,o,c]);return(0,p.useMemo)((function(){return(0,S.jsx)(R.Z,{columnFlex:i||[null,1,null],columns:[{uuid:"Use"},{uuid:"Attribute"},{uuid:"Value"}],groupsInline:!0,onClickRow:function(e){var i=null===n||void 0===n?void 0:n[e],o=null===i||void 0===i?void 0:i.uuid,r=null===t||void 0===t?void 0:t[o],u=!(null===r||void 0===r||!r.selected);c((function(e){return rt(rt({},e),{},(0,l.Z)({},o,rt(rt({},null===e||void 0===e?void 0:e[o]),{},{selected:!u})))}))},rowGroupHeaders:r,rowsGroupedByIndex:u,rows:n.map((function(e,n){return s(e,n)}))})}),[n,t,i,s])};var ut=function(e){var n=e.selectedStreamMapping,t=e.setSelectedStreamMapping,i=e.streamMapping,o=(0,p.useMemo)((function(){return(0,Pn.th)(i)}),[i]),r=(0,p.useMemo)((function(){var e=[],t=[],i=[],r=[],l=0;return null===o||void 0===o||o.forEach((function(o){var u=o.groupHeader,c=o.streams;e.push(u);var s=[];null===c||void 0===c||c.forEach((function(e){r.push(e),s.push(l),l+=1;var i=(0,Pn.WD)(e),o=(0,Pn.M$)(e),u=!!(0,Pn.zB)(e,n),c=[(0,S.jsx)(x.Z,{checked:u},"".concat(i,"-").concat(o,"-use")),(0,S.jsx)(O.ZP,{muted:!u,children:o},"".concat(i,"-").concat(o,"-stream"))];t.push(c)})),i.push(s)})),{rowGroupHeaders:e,rows:t,rowsGroupedByIndex:i,streamsArray:r}}),[n,o]),l=r.rowGroupHeaders,u=r.rows,c=r.rowsGroupedByIndex,s=r.streamsArray,a=(0,p.useMemo)((function(){var e,t;return(null===(e=Object.values((null===n||void 0===n?void 0:n.noParents)||{}))||void 0===e?void 0:e.length)+(0,L.Sm)(null===(t=Object.values((null===n||void 0===n?void 0:n.parents)||{}))||void 0===t?void 0:t.map((function(e){var n;return null===(n=Object.values(e||{}))||void 0===n?void 0:n.length})))}),[n]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)("div",{children:[(0,S.jsxs)(A.Z,{children:[(0,G._6)("stream",a||0)," chosen"]}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(O.ZP,{default:!0,children:"Clicking the Apply button below will use the values from the selected properties below and change the values of those properties in all the selected columns for all the selected streams."})})]})}),(0,S.jsx)(R.Z,{columnFlex:[null,1],columns:[{uuid:"Use"},{uuid:"Stream"}],groupsInline:!0,onClickRow:function(e){var i=null===s||void 0===s?void 0:s[e],o=!!(0,Pn.zB)(i,n);t((function(e){return(0,Pn.iN)(i,e,{remove:o})}))},rowGroupHeaders:l,rows:u,rowsGroupedByIndex:c,stickyHeader:!0})]})};var ct=function(e){var n=e.attributesMapping,t=e.selectedStreamMapping,i=e.setAttributesMapping,o=e.setSelectedStreamMapping,r=e.streamMapping,l=(0,p.useMemo)((function(){return(0,S.jsx)(lt,{attributes:[{label:function(){return"Replication method"},inputType:yn.oI.SELECT,options:Nn.jL.map((function(e){return{label:function(){return(0,G.vg)(e)},value:e}})),uuid:Pn.I1.REPLICATION_METHOD},{label:function(){return"Unique conflict method"},inputType:yn.oI.SELECT,options:Object.values(Nn.MU).map((function(e){return{label:function(){return(0,G.vg)(e)},value:e}})),uuid:Pn.I1.UNIQUE_CONFLICT_METHOD},{label:function(){return"Run stream in parallel"},inputType:yn.oI.TOGGLE,uuid:Pn.I1.RUN_IN_PARALLEL},{label:function(){return"Automatically add new columns"},inputType:yn.oI.TOGGLE,uuid:Pn.I1.AUTO_ADD_NEW_FIELDS},{label:function(){return"Disable strict column type checks"},inputType:yn.oI.TOGGLE,uuid:Pn.I1.DISABLE_COLUMN_TYPE_CHECK}],attributesMapping:n,columnFlex:[null,1,1],rightAlignColumnForRowIndexes:[2,3,4],setAttributesMapping:i})}),[n,i]),u=(0,p.useMemo)((function(){return(0,S.jsx)(ut,{selectedStreamMapping:t,setSelectedStreamMapping:o,streamMapping:r})}),[t,o,r]);return(0,S.jsxs)(Ke,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)("div",{children:[(0,S.jsx)(A.Z,{children:"Make changes to multiple streams"}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(O.ZP,{default:!0,children:"Clicking the Apply button below will use the values from the attributes below and change the values of those attributes for all the selected streams."})})]})}),l,u]})};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 at(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,l.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 dt=function(e){var n,t,i=e.attributesMapping,u=e.block,c=e.highlightedColumnsMapping,s=e.selectedStreamMapping,a=e.setAttributesMapping,d=e.setHighlightedColumnsMapping,v=e.setSelectedStreamMapping,f=e.stream,h=e.streamMapping,m=(e.updateStreamsInCatalog,null===u||void 0===u||null===(n=u.metadata)||void 0===n||null===(t=n.data_integration)||void 0===t?void 0:t.destination),g=(0,p.useMemo)((function(){return!Nn.kB.includes(m)}),[m]);(0,p.useEffect)((function(){if(f&&!s){var e=(0,Pn.M$)(f||{}),n=(0,Pn.Qu)(f||{});n?v({noParents:{},parents:(0,l.Z)({},n,(0,l.Z)({},e,f))}):e&&v({noParents:(0,l.Z)({},e,f),parents:{}})}}),[s,v,f]);var b=(0,p.useMemo)((function(){return(null===f||void 0===f?void 0:f.replication_method)===Nn._B.INCREMENTAL}),[null===f||void 0===f?void 0:f.replication_method]),x=(0,p.useMemo)((function(){var e=[{label:function(){return"Include property when syncing"},inputType:yn.oI.CHECKBOX,uuid:Pn.I1.PROPERTY_SELECTED},{label:function(){return"Partition key"},inputType:yn.oI.CHECKBOX,uuid:Pn.I1.PARTITION_KEYS}].concat((0,o.Z)(Nn.D5.map((function(e){return{label:function(){return(0,G.vg)(e)},inputType:yn.oI.CHECKBOX,uuid:e}}))));b&&e.splice(1,0,{label:function(){return"Bookmark property"},inputType:yn.oI.CHECKBOX,uuid:Pn.I1.BOOKMARK_PROPERTIES}),g&&e.splice(1,0,{label:function(){return"Unique constraint"},inputType:yn.oI.CHECKBOX,uuid:Pn.I1.UNIQUE_CONSTRAINTS},{label:function(){return"Key property"},inputType:yn.oI.CHECKBOX,uuid:Pn.I1.KEY_PROPERTIES});var n=2;b&&(n+=1),g&&(n+=2);var t=(0,L.m5)(n);return(0,S.jsx)(lt,{attributes:e,attributesMapping:i,rowGroupHeaders:["Options","Column types"],rowsGroupedByIndex:[t,null===Nn.D5||void 0===Nn.D5?void 0:Nn.D5.map((function(e,t){return t+n}))],setAttributesMapping:a})}),[i,a,g,b]),j=(0,p.useMemo)((function(){return(0,S.jsx)(ut,{selectedStreamMapping:s,setSelectedStreamMapping:v,streamMapping:h})}),[s,v,h]),k=(0,p.useMemo)((function(){var e,n=null===(e=Object.entries(c||{}))||void 0===e?void 0:e.reduce((function(e,n){var t=(0,r.Z)(n,2),i=t[0];return t[1]?e.concat(i):e}),[]);return(0,L.YC)(n,(function(e){return e}))}),[c]);return(0,S.jsxs)(Ke,{children:[(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)(A.Z,{children:[!(null!==k&&void 0!==k&&k.length)&&"Choose at least 1 property",(null===k||void 0===k?void 0:k.length)>=1&&"".concat((0,G._6)("property",(null===k||void 0===k?void 0:k.length)||0)," chosen")]}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:[!(null!==k&&void 0!==k&&k.length)&&"Click 1 or more rows in the table to select which schema properties to apply bulk changes to.",(null===k||void 0===k?void 0:k.length)>=1&&(0,S.jsx)(S.Fragment,{children:"Clicking the Apply button below will use the values from the selected properties below and change the values of those properties in all the selected columns for all the selected streams."})]})})]}),(null===k||void 0===k?void 0:k.length)>=1&&(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsx)(y.ZP,{alignItems:"center",flexWrap:"wrap",children:null===k||void 0===k?void 0:k.map((function(e){return(0,S.jsx)("div",{style:{marginBottom:w.iI/2,marginRight:w.iI/2},children:(0,S.jsx)(Dn.Z,{label:e,onClick:function(){d((function(n){return!(null===n||void 0===n||!n[e])?(0,Mn.gR)(n,[e]):at(at({},n),{},(0,l.Z)({},e,!0))}))}})},"".concat(e,"-chip"))}))})})]}),x,j]})};function vt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function pt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?vt(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):vt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ft={compact:!0,small:!0};var ht=function(e){var n=e.block,t=e.blocksMapping,i=e.onChangeBlock,o=e.selectedStreamMapping,r=e.setSelectedMainNavigationTab,u=e.setSelectedStreamMapping,c=e.streamMapping,s=e.updateStreamsInCatalog,a=(0,p.useRef)(null),d=(0,p.useState)({}),v=d[0],f=d[1],h=(0,p.useCallback)((function(e){return s(e,(function(e){return null===i||void 0===i?void 0:i(e)}))}),[i,s]),m=(n||{}).type,g=c||{},x=g.noParents,j=g.parents,k=(0,p.useMemo)((function(){return(0,Mn.Qr)(x||{})&&(0,Mn.Qr)(j||{})}),[x,j]),I=(0,p.useMemo)((function(){return(0,Pn.th)(c)}),[c]),E=(0,p.useMemo)((function(){var e=[null,1,3,2,2,null],n=[{label:function(e){var n=e.groupIndex,t=((null===I||void 0===I?void 0:I[n])||{}).streams,i=t&&(null===t||void 0===t?void 0:t.every((function(e){return(0,Pn.Z5)(e)})));return(0,S.jsx)(An.Z,{checked:i,compact:!0,disabled:!(null!==t&&void 0!==t&&t.length),onCheck:function(e){t&&h(null===t||void 0===t?void 0:t.map((function(n){return(0,Pn.XE)(n,{selected:e(i)})})))}})},uuid:"action"},{uuid:"Stream"},{uuid:"Table"},{uuid:"Sync"},{uuid:"Unique conflict"},{center:b.tf.DATA_EXPORTER===m,rightAligned:b.tf.DATA_EXPORTER!==m,uuid:"Parallel"}];return b.tf.DATA_EXPORTER===m&&(e.push.apply(e,[null,null]),n.push.apply(n,[{center:!0,uuid:"Add columns"},{center:!0,uuid:"No strict check"}])),{columnFlex:e,columns:n}}),[m,I,h]),T=E.columnFlex,M=E.columns,B=(0,p.useMemo)((function(){var e=[],n=[],i=[],o=[],u=0;return null===I||void 0===I||I.forEach((function(c){var s=c.groupHeader,d=c.streams,g=s?null===t||void 0===t?void 0:t[s]:null;g?n.push((0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(O.ZP,{bold:!0,color:(0,_.qn)(null===g||void 0===g?void 0:g.type,{blockColor:null===g||void 0===g?void 0:g.color}).accent,monospace:!0,children:s})})):n.push(s);var x=[];null===d||void 0===d||d.forEach((function(n){e.push(n),x.push(u),u+=1;var t=(0,Pn.WD)(n),o=(0,Pn.Qu)(n),c=(0,Pn.M$)(n),s=n.auto_add_new_fields,d=n.bookmark_properties,g=n.destination_table,j=n.disable_column_type_check,k=n.replication_method,w=n.run_in_parallel,_=n.unique_conflict_method,I=(0,Pn.Z5)(n),E=t in v?null===v||void 0===v?void 0:v[t]:g,T=[(0,S.jsx)(An.Z,{checked:I,compact:!0,onCheck:function(e){h([(0,Pn.XE)(n,{selected:e(I)})])}},"".concat(t,"-action")),(0,S.jsx)(P.Z,{bold:!0,monospace:!0,onClick:function(){r(c,o)},preventDefault:!0,sameColorAsText:!0,children:c},"".concat(t,"-name")),(0,S.jsx)(Ee.Z,{compact:!0,defaultColor:!E,monospace:!0,onChange:function(e){var i,o=null===e||void 0===e||null===(i=e.target)||void 0===i?void 0:i.value;f((function(e){return pt(pt({},e),{},(0,l.Z)({},t,o))})),clearTimeout(a.current),a.current=setTimeout((function(){return h([pt(pt({},n),{},{destination_table:o})])}),300)},onClick:Oe.j,placeholder:c,value:E||""},"".concat(t,"-destinationTable")),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(Z.Z,{flex:1,children:(0,S.jsx)(an.Z,pt(pt({},ft),{},{fullWidth:!0,onChange:function(e){var t;return h([pt(pt({},n),{},{replication_method:null===e||void 0===e||null===(t=e.target)||void 0===t?void 0:t.value})])},onClick:Oe.j,placeholder:"Replication method",value:k,children:Nn.jL.map((function(e){return(0,S.jsx)("option",{value:e,children:(0,G.vg)(e)},e)}))}))}),Nn._B.INCREMENTAL===k&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mr:1}),!(null!==d&&void 0!==d&&d.length)&&(0,S.jsx)(O.ZP,{danger:!0,xsmall:!0,children:"No bookmark properties set"}),(null===d||void 0===d?void 0:d.length)>=1&&(null===d||void 0===d?void 0:d.map((function(e,n){return(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,muted:!0,xsmall:!0,children:[n>=1&&", ",e]},e)})))]})]},"".concat(t,"-replicationMethod")),(0,p.createElement)(an.Z,pt(pt({},ft),{},{key:"".concat(t,"-uniqueConflictMethod"),onChange:function(e){var t;return h([pt(pt({},n),{},{unique_conflict_method:null===e||void 0===e||null===(t=e.target)||void 0===t?void 0:t.value})])},onClick:Oe.j,placeholder:"Unique conflict method",value:_}),Object.values(Nn.MU).map((function(e){return(0,S.jsx)("option",{value:e,children:(0,G.vg)(e)},e)}))),(0,S.jsx)(y.ZP,{alignItems:"center",justifyContent:b.tf.DATA_EXPORTER===m?"center":"flex-end",children:(0,S.jsx)(An.Z,{checked:!!w,compact:!0,onCheck:function(e){h([pt(pt({},n),{},{run_in_parallel:e(w)})])}})},"".concat(t,"-runInParallel"))];b.tf.DATA_EXPORTER===m&&T.push.apply(T,[(0,S.jsx)(y.ZP,{alignItems:"center",justifyContent:"center",children:(0,S.jsx)(An.Z,{checked:!!s,compact:!0,onCheck:function(e){h([pt(pt({},n),{},{auto_add_new_fields:e(s)})])}})},"".concat(t,"-autoAddNewFields")),(0,S.jsx)(y.ZP,{alignItems:"center",justifyContent:"center",children:(0,S.jsx)(An.Z,{checked:!!j,compact:!0,onCheck:function(e){h([pt(pt({},n),{},{disable_column_type_check:e(j)})])}})},"".concat(t,"-disableColumnTypeCheck"))]),i.push(T)})),o.push(x)})),{rowGroupHeaders:n,rows:i,rowsGroupedByIndex:o,streamsInRows:e}}),[m,t,v,f,r,I,a,h]),D=B.rowGroupHeaders,N=B.rows,L=B.rowsGroupedByIndex,F=B.streamsInRows;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsx)(A.Z,{children:"Overview of streams"}),k&&(0,S.jsxs)(C.Z,{mt:1,children:[(0,S.jsx)(O.ZP,{default:!0,children:"Fetch and add at least 1 stream to the catalog in order to see an overview of all the configured stream."}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(P.Z,{bold:!0,onClick:function(){return r(yn.uK.STREAMS)},preventDefault:!0,children:"Go and fetch Streams"})})]})]}),!k&&(0,S.jsx)(R.Z,{columnFlex:T,columns:M,isSelectedRow:function(e){var n=null===F||void 0===F?void 0:F[e];return!!(0,Pn.zB)(n,o)},groupsInline:!0,onClickRow:function(e){var n=null===F||void 0===F?void 0:F[e],t=!!(0,Pn.zB)(n,o);u((function(e){return(0,Pn.iN)(n,e,{remove:t})}))},rowGroupHeaders:D,rows:N,rowsGroupedByIndex:L,stickyHeader:!0})]})};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 gt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?mt(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):mt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var bt=3*w.iI*2;var xt=function(e){var n=e.block,t=void 0===n?null:n,i=e.defaultMainNavigationTab,u=void 0===i?null:i,c=e.defaultMainNavigationTabSub,s=void 0===c?null:c,a=e.defaultSubTab,d=void 0===a?null:a,v=e.onChangeBlock,h=e.onChangeCodeBlock,m=e.onClose,g=e.onSaveBlock,I=e.pipeline,E=e.savePipelineContent,T=e.setContent,M=(0,p.useRef)(null),B=(0,p.useRef)(null),D=(0,p.useRef)(null),R=(0,p.useRef)(null),F=(0,p.useState)({}),U=F[0],H=F[1],W=(0,p.useState)(null),G=W[0],K=W[1],z=(0,p.useState)(!1),q=z[0],V=z[1],X=(0,Je.i)(),Q=X.height,J=X.width,$=I||{},ee=$.blocks,ne=$.uuid,te=t||{},ie=(te.catalog,te.content),oe=(te.language,te.type),re=te.uuid,le=(0,p.useMemo)((function(){return b.tf.DATA_LOADER===oe?vn.O.SOURCES:vn.O.DESTINATIONS}),[oe]),ue=(0,p.useState)(t||null),ce=ue[0],se=ue[1],de=ce||{},pe=(de.configuration,de.content),fe=de.metadata,he=(0,p.useMemo)((function(){return(null===fe||void 0===fe?void 0:fe.data_integration)||{}}),[fe]),me=he.destination,ge=he.name,xe=he.source,je=(0,p.useMemo)((function(){return me||xe||null}),[me,xe]),Ze=(0,p.useMemo)((function(){var e={include_block_catalog:!0,include_block_metadata:!0,include_documentation:!0};return je&&(e.data_integration_uuid=je),e}),[je]),ye=Y.ZP.blocks.pipelines.detail(ne,re,Ze,{},{key:"pipelines/".concat(ne,"/blocks/").concat(re,"/documentation")}).data,Ce=(0,p.useMemo)((function(){var e;return(null===ce||void 0===ce||null===(e=ce.configuration)||void 0===e?void 0:e.data_integration)||{}}),[ce]),Oe=(0,p.useCallback)((function(e){return se((function(n){var t,i=gt(gt({},n),{},{configuration:gt(gt({},null===n||void 0===n?void 0:n.configuration),{},{data_integration:e((null===n||void 0===n||null===(t=n.configuration)||void 0===t?void 0:t.data_integration)||{})})});return null===v||void 0===v||v(i),i}))}),[v,se]),we=(0,p.useCallback)((function(e){return Oe((function(n){return gt(gt({},n),{},{inputs:e((null===n||void 0===n?void 0:n.inputs)||{})})}))}),[Oe]),_e=(0,p.useCallback)((function(e,n){return se((function(t){var i=(null===t||void 0===t?void 0:t.catalog)||{streams:[]},r=(0,o.Z)((null===i||void 0===i?void 0:i.streams)||[]);null===e||void 0===e||e.forEach((function(e){var n=(0,Pn.M$)(e),t=null===e||void 0===e?void 0:e.parent_stream,i=null===r||void 0===r?void 0:r.findIndex((function(e){var i=(0,Pn.M$)(e),o=null===e||void 0===e?void 0:e.parent_stream;return n===i&&t===o})),o={};i>=0&&(o=null===r||void 0===r?void 0:r[i]);var l=gt(gt({},o),e);i>=0?r[i]=l:r.push(l)}));var l=gt(gt({},t),{},{catalog:gt(gt({},i),{},{streams:r})});return null===n||void 0===n||n(l),l}))}),[se]),Se=(0,p.useMemo)((function(){return null===ye||void 0===ye?void 0:ye.block}),[ye]);(0,p.useEffect)((function(){Se&&(ce&&(null===Se||void 0===Se?void 0:Se.uuid)===(null===ce||void 0===ce?void 0:ce.uuid)||se(Se))}),[ce,Se]);var Ie=(0,p.useMemo)((function(){return(0,L.HK)(ee||[],(function(e){return e.uuid}))}),[ee]),Me=(0,p.useMemo)((function(){var e;return null===ce||void 0===ce||null===(e=ce.upstream_blocks)||void 0===e?void 0:e.map((function(e){return null===Ie||void 0===Ie?void 0:Ie[e]}))}),[ce,Ie]),Be=(0,p.useMemo)((function(){return null===Se||void 0===Se?void 0:Se.documentation}),[Se]),De=(0,p.useMemo)((function(){return(0,Pn.Uc)(ce,{getAll:!0})}),[ce]),He=(0,p.useMemo)((function(){return(0,Pn.UA)(De)}),[De]),We=(0,p.useMemo)((function(){return"DataIntegrationModal/".concat(re)}),[re]),Ge=(0,p.useMemo)((function(){return"block_layout_after_width_".concat(We)}),[We]),Ke=(0,p.useMemo)((function(){return"block_layout_before_width_".concat(We)}),[We]),ze=(0,ae.VI)(null,{},[],{uuid:We}),qe=(0,r.Z)(ze,1)[0],Ve=(0,p.useState)((0,Ye.U2)(Ge,60*w.iI)),Xe=Ve[0],Qe=Ve[1],$e=(0,p.useState)(!1),en=$e[0],nn=$e[1],tn=(0,p.useState)(Math.max((0,Ye.U2)(Ke),40*w.iI)),on=tn[0],rn=tn[1],ln=(0,p.useState)(!1),un=ln[0],cn=ln[1],sn=(0,p.useState)({}),an=sn[0],dn=sn[1],pn=(0,p.useState)({selectedMainNavigationTab:null,selectedMainNavigationTabSub:s,selectedSubTab:null}),fn=pn[0],hn=fn.selectedMainNavigationTab,mn=fn.selectedMainNavigationTabSub,gn=fn.selectedSubTab,xn=pn[1],jn=(0,p.useState)((0,Pn.UA)([])),kn=jn[0],Zn=jn[1],Cn=(0,p.useMemo)((function(){if(!(0,Mn.Qr)(null===kn||void 0===kn?void 0:kn.noParents)||!(0,Mn.Qr)(null===kn||void 0===kn?void 0:kn.parents)){var e,n,t,i;if(hn)if(mn)e=null===kn||void 0===kn||null===(n=kn.parents)||void 0===n||null===(t=n[hn])||void 0===t?void 0:t[mn];else e=null===kn||void 0===kn||null===(i=kn.noParents)||void 0===i?void 0:i[hn];return(0,yn.C0)({addStreamConflicts:!!e})}return(0,yn.C0)()}),[hn,mn,kn]),On=(0,p.useCallback)((function(e){return e in yn.Pf?yn.Pf[e]:Cn}),[Cn]),In=(0,p.useCallback)((function(e){xn((function(n){return function(e,n){var t=e||{},i=t.selectedMainNavigationTab,o=t.selectedMainNavigationTabSub,r=t.selectedSubTab,l=n||{},u=l.selectedMainNavigationTab,c=l.selectedMainNavigationTabSub,s=i in yn.Pf?yn.Pf[i]:Cn,a=r;if(yn.mU[i]||yn.mU[u]){var d,v,p;if(a){if(yn.mU[u]&&!yn.mU[i]){var f;!a||null!==Cn&&void 0!==Cn&&Cn.includes(a)||yn.tw.STREAM_CONFLICTS===a||(a=null===Cn||void 0===Cn||null===(f=Cn[0])||void 0===f?void 0:f.uuid)}}else a=null===s||void 0===s||null===(p=s[0])||void 0===p?void 0:p.uuid;i!==u&&dn({});var h=(0,Pn.zB)({parent_stream:c,stream:u,tap_stream_id:u},He),m=(0,Pn.zB)({parent_stream:o,stream:i,tap_stream_id:i},He),g=(0,L.jV)(Object.keys((null===h||void 0===h||null===(d=h.schema)||void 0===d?void 0:d.properties)||{}),Object.keys((null===m||void 0===m||null===(v=m.schema)||void 0===v?void 0:v.properties)||{}));dn((function(e){return gt({},(0,Mn.GL)(e,g||[]))}))}return{selectedMainNavigationTab:i,selectedMainNavigationTabSub:o,selectedSubTab:a}}(e(n),n)}))}),[dn,He,Cn]);(0,p.useEffect)((function(){hn||In((function(e){var n,t,i=e.selectedSubTab;return{selectedMainNavigationTab:u||yn.uK.CONFIGURATION,selectedMainNavigationTabSub:s,selectedSubTab:u?d||(null===(n=On(u))||void 0===n||null===(t=n[0])||void 0===t?void 0:t.uuid):i}}))}),[u,s,d,On,hn,In]);var En=(0,p.useMemo)((function(){return On(hn)}),[On,hn]),Tn=(0,p.useMemo)((function(){var e=[{Icon:N.SettingsWithKnobs,uuid:yn.uK.CONFIGURATION},{Icon:N.Sun,uuid:yn.uK.STREAMS},{Icon:N.Table,uuid:yn.uK.OVERVIEW}].map((function(e){var n=e.Icon,t=e.uuid;return(0,S.jsx)(Ue,{selected:hn===t,children:(0,S.jsx)(P.Z,{block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){return In((function(){return{selectedMainNavigationTab:t}}))},preventDefault:!0,children:(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(j.Z,{primaryLight:!0,size:4*w.iI,square:!0,children:(0,S.jsx)(n,{size:2*w.iI})}),(0,S.jsx)(C.Z,{mr:2}),(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:yn.TD[t]})]})})})},t)})),n=(null===De||void 0===De?void 0:De.length)||0,t=[],i={};return null===De||void 0===De||De.forEach((function(e){var n=e.parent_stream;n?(null!==i&&void 0!==i&&i[n]||(i[n]=[]),i[n].push(e)):t.push(e)})),[{block:null,streams:t}].concat((0,o.Z)((0,L.YC)(Object.entries(i),(function(e){var n=(0,r.Z)(e,2),t=n[0];n[1];return t})).map((function(e){var n=(0,r.Z)(e,2),t=n[0],i=n[1];return{block:null===Ie||void 0===Ie?void 0:Ie[t],streams:i}})))).forEach((function(t){var i=t.block,o=t.streams;if(i){var r=null===i||void 0===i?void 0:i.uuid;e.push((0,S.jsx)(k.Z,{light:!0},"block-".concat(r,"-divider-top"))),e.push((0,S.jsx)(C.Z,{px:w.cd,py:1,children:(0,S.jsx)(O.ZP,{bold:!0,color:(0,_.qn)(null===i||void 0===i?void 0:i.type,{blockColor:null===i||void 0===i?void 0:i.color}).accent,monospace:!0,small:!0,children:r})},"block-".concat(r)))}null===o||void 0===o||o.forEach((function(t,i){var o=(0,Pn.M$)(t),r=(0,Pn.Qu)(t),l=(0,Pn.WD)(t),u=(0,Pn.Z5)(t),c=hn===o&&(!r||mn===r);e.push((0,S.jsx)(k.Z,{light:!0},"".concat(l,"-divider-top"))),e.push((0,S.jsx)(Ue,{selected:c,children:(0,S.jsx)(P.Z,{block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){In((function(e){var n=e.selectedSubTab;return{selectedMainNavigationTab:o,selectedMainNavigationTabSub:r,selectedSubTab:n}}))},preventDefault:!0,children:(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(j.Z,{size:1*w.iI,success:u}),(0,S.jsx)(C.Z,{mr:2}),(0,S.jsx)(Z.Z,{flex:1,children:(0,S.jsx)(O.ZP,{default:!u,monospace:!0,children:o})})]})})})},l)),i===n-1&&e.push((0,S.jsx)(k.Z,{light:!0},"".concat(l,"-divider-last")))}))})),e}),[Ie,hn,mn,In,De]),Bn=(0,p.useState)(null),Dn=Bn[0],Rn=Bn[1],Nn=(0,p.useMemo)((function(){return(0,Pn.qf)(He,(0,Pn.UA)(Dn||[]))}),[He,Dn]),Ln=(0,f.Db)(Y.ZP.integration_sources.useUpdate(ne),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var n=e.integration_source.streams;Rn(n)},onErrorCallback:function(e,n){return qe({errors:n,response:e})}})}}),Fn=(0,r.Z)(Ln,2),Un=Fn[0],Hn=Fn[1].isLoading,Wn=(0,p.useCallback)((function(){return Un({integration_source:{block_uuid:re}})}),[re,Un]),Gn=(0,p.useState)(null),Kn=Gn[0],zn=Gn[1],qn=(0,p.useMemo)((function(){return(0,S.jsxs)("div",{ref:R,children:[(null===En||void 0===En?void 0:En.length)>=1&&(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(ve.Z,{noPadding:!0,onClickTab:function(e){var n=e.uuid;return In((function(e){return gt(gt({},e),{},{selectedSubTab:n})}))},regularSizeText:!0,selectedTabUUID:gn,tabs:En})}),!(null!==En&&void 0!==En&&En.length)&&yn.uK.STREAMS===hn&&(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(Z.Z,{flex:1,children:(0,S.jsx)(Ee.Z,{beforeIcon:(0,S.jsx)(N.Search,{muted:!(null!==Kn&&void 0!==Kn&&Kn.length),size:2*w.iI}),fullWidth:!0,noBackground:!0,noBorder:!0,noBorderRadiusBottom:!0,noBorderRadiusTop:!0,onChange:function(e){var n;return zn(null===e||void 0===e||null===(n=e.target)||void 0===n?void 0:n.value)},paddingHorizontal:w.iI*w.cd,paddingVertical:w.iI*w.cd,placeholder:"Type the name of the stream to filter...",value:Kn||""})}),(null===Kn||void 0===Kn?void 0:Kn.length)>=1&&(0,S.jsx)(be.ZP,{iconOnly:!0,noPadding:!0,noBackground:!0,noBorder:!0,onClick:function(){return zn(null)},children:(0,S.jsx)(N.Close,{default:!0,size:2*w.iI})}),!Nn&&(0,S.jsx)(C.Z,{px:w.cd,children:(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.CubeWithArrowDown,{size:2*w.iI}),compact:!0,loading:Hn,onClick:function(){return Wn()},primary:!0,children:"Fetch streams"})})]}),(0,S.jsx)(k.Z,{light:!0})]})}),[Wn,Hn,Nn,R,Kn,hn,gn,zn,In,En]),Vn=(0,p.useMemo)((function(){return Q-2*Ae}),[Q]),Yn=(0,p.useMemo)((function(){return J-2*Ae}),[J]),Xn=(0,p.useState)(null),Qn=Xn[0],$n=Xn[1],et=(0,p.useState)(null),nt=et[0],tt=et[1],ot=(0,p.useState)(null),rt=(ot[0],ot[1]),lt=(0,p.useState)(!1),ut=lt[0],st=lt[1];(0,p.useEffect)((function(){var e,n,t,i,o,r;(hn||gn)&&($n(null===R||void 0===R||null===(e=R.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.height),rt(null===B||void 0===B||null===(t=B.current)||void 0===t||null===(i=t.getBoundingClientRect())||void 0===i?void 0:i.height),tt(null===D||void 0===D||null===(o=D.current)||void 0===o||null===(r=o.getBoundingClientRect())||void 0===r?void 0:r.height))}),[D,B,R,hn,gn]);var at=(0,f.Db)(Y.ZP.blocks.pipelines.useUpdate(encodeURIComponent(ne),encodeURIComponent(re)),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){null===g||void 0===g||g(null===e||void 0===e?void 0:e.block)},onErrorCallback:function(e,n){return qe({errors:n,response:e})}})}}),vt=(0,r.Z)(at,2),pt=(vt[0],vt[1].isLoading,(0,p.useMemo)((function(){return hn&&![yn.uK.CONFIGURATION,yn.uK.OVERVIEW,yn.uK.STREAMS,yn.uK.SYNC].includes(hn)}),[hn])),ft=(0,p.useMemo)((function(){return pt&&yn.tw.SETTINGS===gn}),[pt,gn]),mt=(0,p.useMemo)((function(){return yn.uK.CONFIGURATION===hn&&yn.tw.CREDENTIALS===gn}),[hn,gn]),xt=(0,p.useMemo)((function(){return yn.uK.OVERVIEW===hn}),[hn]),jt=(0,p.useMemo)((function(){return!(mt||ft||xt&&(null===De||void 0===De?void 0:De.length)>=1)||ut}),[ut,mt,ft,xt,De]),kt=(0,p.useMemo)((function(){var e=(0,Pn.zB)({parent_stream:mn,stream:hn,tap_stream_id:hn},He);if(e)return(0,S.jsx)(Jn,{block:ce,blocksMapping:Ie,height:Vn-Qn-2*w.iI,highlightedColumnsMapping:an,onChangeBlock:v,pipeline:I,selectedSubTab:gn,setBlockAttributes:se,setHighlightedColumnsMapping:dn,setSelectedSubTab:function(e){return In((function(n){return gt(gt({},n),{},{selectedSubTab:e})}))},setStreamsMappingConflicts:Zn,showError:qe,stream:e,streamMapping:He,streamsMappingConflicts:kn,updateStreamsInCatalog:_e})}),[ce,Ie,Qn,Vn,an,v,I,hn,mn,gn,se,dn,In,Zn,qe,He,kn,_e]),Zt=(0,p.useState)(null),yt=Zt[0],Pt=Zt[1];(0,p.useEffect)((function(){"undefined"!==typeof yt&&null!==yt||Pt("undefined"!==typeof ie&&null!==ie?ie:pe)}),[pe,ie,yt,Pt]);var Ct=(0,p.useState)(null),Ot=Ct[0],wt=Ct[1],_t=(0,p.useMemo)((function(){return(0,S.jsx)(wn,{block:ce,blockConfigString:Ot,blockContent:yt,blockUpstreamBlocks:Me,dataIntegrationConfiguration:Ce,onChangeCodeBlock:h,pipeline:I,savePipelineContent:E,setBlockConfigString:wt,setBlockContent:Pt,setContent:T,setSelectedSubTab:function(e){return In((function(n){return gt(gt({},n),{},{selectedSubTab:e})}))},showError:qe})}),[ce,Ot,yt,Me,Ce,h,I,E,wt,Pt,T,In,qe]),St=(0,p.useMemo)((function(){if(yn.uK.CONFIGURATION===hn){if(yn.tw.UPSTREAM_BLOCK_SETTINGS===gn){var e=null===Me||void 0===Me?void 0:Me.map((function(e){var n,t,i=e.uuid,o=null===Ce||void 0===Ce||null===(n=Ce.inputs)||void 0===n?void 0:n[i],r=(null===o||void 0===o?void 0:o.streams)||[],u=!!o,c=null===Ie||void 0===Ie?void 0:Ie[i],s=(null===c||void 0===c?void 0:c.catalog)?null===(t=(0,Pn.Uc)(c))||void 0===t?void 0:t.map((function(e){var n=e.stream,t=e.tap_stream_id;return n||t})):[i],a=1===(null===s||void 0===s?void 0:s.length)&&(null===s||void 0===s?void 0:s.includes(i));return(0,S.jsxs)("div",{children:[(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(Z.Z,{children:(0,S.jsx)(O.ZP,{bold:!0,large:!0,monospace:!0,muted:!u,children:i})}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(An.Z,{checked:u,compact:!0,onCheck:function(e){we((function(n){return e(u)?gt(gt({},n),{},(0,l.Z)({},i,{})):(0,Mn.gR)(n,[i])}))}})]}),u&&(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsxs)(Sn.Z,{noBackground:!0,noBoxShadow:!0,sameColorBorders:!0,children:[(0,S.jsx)(Sn.g,{noBorder:!0,children:(0,S.jsxs)(y.ZP,gt(gt({},y.A0),{},{children:[(0,S.jsxs)(Z.Z,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{bold:!0,default:!0,children:"Use catalog as an input"}),(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:"If checked, then this block\u2019s catalog will be included as part of the input argument(s) for the current block."})]}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(x.Z,{checked:null===o||void 0===o?void 0:o.catalog,onClick:function(){return we((function(e){var n;return gt(gt({},e),{},(0,l.Z)({},i,gt(gt({},null===e||void 0===e?void 0:e[i]),{},{catalog:!(null!==e&&void 0!==e&&null!==(n=e[i])&&void 0!==n&&n.catalog)})))}))}})]}))}),a&&(0,S.jsx)(Sn.g,{noBorder:!0,children:(0,S.jsxs)(y.ZP,gt(gt({},y.A0),{},{children:[(0,S.jsxs)(Z.Z,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{bold:!0,default:!0,children:"Use the block\u2019s output data as an input"}),(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:"Include this block\u2019s output data as an input."})]}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(x.Z,{checked:null===r||void 0===r?void 0:r.includes(i),monospace:!0,onClick:function(){return we((function(e){return gt(gt({},e),{},(0,l.Z)({},i,gt(gt({},null===e||void 0===e?void 0:e[i]),{},{streams:null!==r&&void 0!==r&&r.includes(i)?(0,L.Od)(r,(function(e){return e===i})):r.concat(i)})))}))},small:!0})]}))}),!a&&(0,S.jsxs)(Sn.g,{noBorder:!0,children:[(0,S.jsxs)(y.ZP,gt(gt({},y.A0),{},{children:[(0,S.jsxs)(Z.Z,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{bold:!0,default:!0,children:"Select which stream\u2019s data to use as an input"}),(0,S.jsxs)(O.ZP,{muted:!0,small:!0,children:["Only the output data from the selected streams will be used as an input.",(0,S.jsx)("br",{}),"If none are selected, then no output data from any stream from this block will be used as in input.",(0,S.jsx)("br",{}),"If you don\u2019t see a stream here, then the upstream block may have unselected the stream in its stream settings."]})]}),(0,S.jsx)(C.Z,{mr:3})]})),null===s||void 0===s?void 0:s.map((function(e){var n=null===r||void 0===r?void 0:r.includes(e);return(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(y.ZP,gt(gt({},y.A0),{},{children:[(0,S.jsx)(Z.Z,{children:(0,S.jsx)(O.ZP,{default:!0,monospace:!0,small:!0,children:e})}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(x.Z,{checked:n,onClick:function(){return we((function(t){return gt(gt({},t),{},(0,l.Z)({},i,gt(gt({},null===t||void 0===t?void 0:t[i]),{},{streams:n?(0,L.Od)(r,(function(n){return n===e})):r.concat(e)})))}))},small:!0})]}))},e)}))]}),(0,S.jsx)(Sn.g,{noBorder:!0,children:(0,S.jsxs)(y.ZP,gt(gt({},y.A0),{},{children:[(0,S.jsxs)(Z.Z,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{bold:!0,default:!0,children:"Only use this block\u2019s output data as an input"}),(0,S.jsxs)(O.ZP,{muted:!0,small:!0,children:["If checked, then this block\u2019s output data is only used as inputs.",b.tf.DATA_EXPORTER===oe&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("br",{}),"The block\u2019s output data won\u2019t be ingested when running a sync, regardless if it\u2019s enabled in the settings."]})]})]}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(x.Z,{checked:!(null===o||void 0===o||!o.input_only),onClick:function(){return we((function(e){var n;return gt(gt({},e),{},(0,l.Z)({},i,gt(gt({},null===e||void 0===e?void 0:e[i]),{},{input_only:!(null!==e&&void 0!==e&&null!==(n=e[i])&&void 0!==n&&n.input_only)})))}))}})]}))})]})})]}),(0,S.jsx)(k.Z,{light:!0})]},i)}));return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsx)(A.Z,{children:"Inputs"}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["Choose which upstream block to use as inputs when interpolating data into ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:re}),"\u2019s (current block) credentials (aka config) and decorated functions."]})}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["If ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:re})," (current block) doesn\u2019t require the data from an upstream block to interpolate or as arguments for decorated functions, don\u2019t toggle them on because it\u2019ll save time and data by not loading unnecessary data as inputs."]})}),vn.O.DESTINATIONS===le&&(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["Upstream blocks can still be selected to have its data ingested. This is toggled and configured in the ",(0,S.jsx)(P.Z,{bold:!0,onClick:function(){return In((function(){return{selectedMainNavigationTab:yn.uK.STREAMS}}))},preventDefault:!0,primary:!0,children:"Streams"})," section."]})})]}),(0,S.jsx)(k.Z,{light:!0}),e]})}}else{if(yn.uK.STREAMS===hn&&Nn)return(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsxs)(C.Z,{mb:w.cd,children:[(0,S.jsx)(A.Z,{children:"Fetch streams to start set up"}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["Add streams and configure them by first fetching the available streams from ",je,"."]})})]}),(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.CubeWithArrowDown,{size:2*w.iI}),large:!0,loading:Hn,onClick:function(){return Wn()},primary:!0,children:"Fetch streams"})]});if(yn.uK.SYNC===hn)return(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(O.ZP,{children:"Coming soon"})});if(yn.uK.OVERVIEW===hn)return(0,S.jsx)(ht,{block:ce,blocksMapping:Ie,onChangeBlock:v,selectedStreamMapping:G,setSelectedMainNavigationTab:function(e){return In((function(n){return{selectedMainNavigationTab:e}}))},setSelectedStreamMapping:K,streamMapping:He,updateStreamsInCatalog:_e})}}),[ce,oe,re,Me,Ie,Ce,le,je,Wn,Hn,Nn,v,hn,G,gn,we,In,K,He,_e]),It=(0,p.useMemo)((function(){return mt?(0,S.jsx)(O.ZP,{bold:!0,children:"Documentation"}):ft?(0,S.jsx)(O.ZP,{bold:!0,children:"Bulk edit stream properties"}):xt?(0,S.jsx)(O.ZP,{bold:!0,children:"Bulk edit streams"}):void 0}),[mt,ft,xt]),Et=(0,p.useMemo)((function(){if(ft||xt)return(0,S.jsx)(Ne,{ref:D,children:(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsx)(x.Z,{checked:q,label:"Clear selection and values after applying changes",onClick:function(){return V((function(e){return!e}))}})}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(be.ZP,{fullWidth:!0,onClick:function(){var e={noParents:{},parents:{}};ft?e=(0,Pn.Kq)(G,an,U):xt&&(e=(0,Pn.bX)(G,U)),_e((0,Pn.eH)(e),(function(e){return null===v||void 0===v?void 0:v(e)})),q&&(H({}),dn({}),K(null))},primary:!0,children:"Apply bulk changes"}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(be.ZP,{fullWidth:!0,onClick:function(){H({}),dn({}),K(null)},secondary:!0,children:"Clear"})]})]})})}),[U,q,an,ft,xt,v,D,G,H,dn,K,_e]),Tt=(0,p.useMemo)((function(){if(mt)return(0,S.jsx)(Re,{children:(0,S.jsxs)(C.Z,{p:w.cd,children:[!ye&&(0,S.jsx)(ke.Z,{}),Be&&(0,S.jsx)(_n.Z,{children:Be.replace(/\<br \/\>/g,"\n\n")})]})});if(ft){var e=(0,Pn.zB)({parent_stream:mn,stream:hn,tap_stream_id:hn},He);return(0,S.jsx)(dt,{attributesMapping:U,block:ce,blocksMapping:Ie,highlightedColumnsMapping:an,selectedStreamMapping:G,setAttributesMapping:H,setHighlightedColumnsMapping:dn,setSelectedStreamMapping:K,stream:e,streamMapping:He,updateStreamsInCatalog:_e})}return xt?(0,S.jsx)(ct,{attributesMapping:U,selectedStreamMapping:G,setAttributesMapping:H,setSelectedStreamMapping:K,streamMapping:He}):void 0}),[U,ce,Ie,ye,Be,an,mt,ft,xt,hn,mn,G,He,_e]),Mt=(0,p.useMemo)((function(){var e=[{label:function(){return re}}];return ge&&e.push({bold:!hn,label:function(){return ge}}),hn&&e.push({bold:!0,label:function(){return yn.TD[hn]||hn}}),(0,S.jsx)(bn.Z,{breadcrumbs:e,noMarginLeft:!0})}),[re,ge,hn]),Bt=(0,p.useMemo)((function(){return(Q-Vn-bt)/2}),[Vn,Q]),Dt=(0,p.useMemo)((function(){return(0,S.jsx)(it,{block:ce,blocksMapping:Ie,height:Vn-Qn,onChangeBlock:v,searchText:Kn,setSelectedMainNavigationTab:In,setSelectedSubTab:function(e){return In((function(n){return gt(gt({},n),{},{selectedSubTab:e})}))},setStreamsMappingConflicts:Zn,streamsFetched:Dn,updateStreamsInCatalog:_e,width:Yn-(on+(jt?0:Xe))})}),[jt,Xe,on,ce,Ie,Qn,Vn,v,Kn,In,Zn,Dn,_e,Yn]);return(0,S.jsxs)(Le,{maxWidth:Yn,children:[(0,S.jsx)(Fe,{children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(Z.Z,{children:Mt}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(P.Z,{href:"https://docs.mage.ai",inline:!0,noOutline:!0,openNewWindow:!0,children:(0,S.jsx)(N.DocumentIcon,{default:!0,size:2*w.iI})}),(0,S.jsx)(C.Z,{mr:2}),m&&(0,S.jsx)(be.ZP,{iconOnly:!0,noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){null===m||void 0===m||m()},children:(0,S.jsx)(N.Close,{default:!0,size:2*w.iI})})]})]})}),(0,S.jsxs)(Te.Z,{after:Tt,afterFooter:Et,afterFooterBottomOffset:Bt,afterHeader:(0,S.jsx)(C.Z,{px:1,ref:B,children:It}),afterHeaderOffset:0,afterHeightOffset:0,afterHidden:jt,afterInnerHeightMinus:48+(Et&&nt||0),afterMousedownActive:en,afterWidth:Xe,before:Tn,beforeHeightOffset:0,beforeMousedownActive:un,beforeWidth:on,contained:!0,headerOffset:Qn,height:Vn,hideAfterCompletely:!Tt||xt&&!(null!==De&&void 0!==De&&De.length),inline:!0,mainContainerHeader:qn,mainContainerRef:M,setAfterHidden:st,setAfterMousedownActive:nn,setAfterWidth:Qe,setBeforeMousedownActive:cn,setBeforeWidth:rn,uuid:We,children:[pt&&kt,!pt&&St,yn.uK.CONFIGURATION===hn&&yn.tw.CREDENTIALS===gn&&_t,yn.uK.STREAMS===hn&&!Nn&&Dt]})]})},jt=t(50724),kt=t(70374),Zt=t(72098),yt=t(38907),Pt=t(77417),Ct=t(26419),Ot=t(58325);function wt(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 _t(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?wt(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):wt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var St=1.5*w.iI;var It=function(e){var n=e.cancelPipeline,t=e.children,i=e.createPipeline,o=e.executePipeline,r=e.interruptKernel,u=e.isPipelineExecuting,c=e.pipeline,s=e.restartKernel,a=e.savePipelineContent,d=e.scrollTogether,v=(e.setActiveSidekickView,e.setMessages),f=e.setScrollTogether,h=e.setSideBySideEnabled,m=e.sideBySideEnabled,g=e.updatePipelineMetadata,b=(0,p.useState)(null),x=b[0],j=b[1],k=(0,p.useRef)(null),Z=(0,p.useRef)(null),P=(0,p.useRef)(null),w=(0,p.useRef)(null),_=(0,p.useRef)(null),I=(0,yt.Z)({pipelineType:null===c||void 0===c?void 0:c.type}).kernel,E=(0,Pt.Z)(),T=E.featureEnabled,M=E.featureUUIDs,B=[{label:function(){return"New standard pipeline"},onClick:function(){return i({pipeline:{name:(0,G.Y6)()}})},uuid:"new_standard_pipeline"},{label:function(){return"New streaming pipeline"},onClick:function(){return i({pipeline:{name:(0,G.Y6)(),type:sn.qL.STREAMING}})},uuid:"new_streaming_pipeline"},{keyTextGroups:[[(0,Ot.V5)()?qe.RJ:qe.hE,qe.SS]],label:function(){return"Save pipeline"},onClick:function(){return a()},uuid:"save_pipeline"}],D=(0,p.useMemo)((function(){var e=[{label:function(){return"Interrupt kernel"},keyTextGroups:[[qe.kA],[qe.kA]],onClick:function(){return r()},uuid:"Interrupt kernel"},{label:function(){return"Restart kernel"},keyTextGroups:[[qe.t_[qe.OC]],[qe.t_[qe.OC]]],onClick:function(){return s()},uuid:"Restart kernel"},{label:function(){return"Clear all outputs"},onClick:function(){return v((function(e){return Object.keys(e).reduce((function(e,n){return _t(_t({},e),{},(0,l.Z)({},n,[]))}),{})}))},uuid:"Clear all outputs"}];return u?e.push({label:function(){return"Cancel pipeline"},onClick:function(){return n()},uuid:"Cancel pipeline"}):(null===c||void 0===c?void 0:c.type)===sn.qL.STREAMING&&e.push({label:function(){return"Execute pipeline"},onClick:function(){return o()},uuid:"Execute pipeline"}),e}),[n,o,r,u,null===c||void 0===c?void 0:c.type,s,v]),A=(0,p.useMemo)((function(){return[{label:function(){return"Pipeline settings"},linkProps:{as:"/pipelines/".concat(null===c||void 0===c?void 0:c.uuid,"/settings"),href:"/pipelines/[pipeline]/settings"},uuid:"Pipeline settings"},{label:function(){return"Browse custom templates"},linkProps:{href:"/templates"},uuid:"browse_custom_templates"},{label:function(){return"Create custom templates"},linkProps:{href:"/templates?new=1"},uuid:"create_custom_templates"}]}),[c]),R=(0,p.useMemo)((function(){return[{label:function(){return(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(N.LayoutStacked,{success:!m}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{noWrapping:!0,children:"Show output below block"})]})},onClick:function(){h(!1)},uuid:"Show output below block"},{label:function(){return(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(N.LayoutSplit,{success:m}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{noWrapping:!0,children:"Show output next to code (beta)"})]})},onClick:function(){h(!0)},uuid:"Show output next to code"},{disabled:!m,label:function(){return(0,S.jsxs)(y.ZP,{alignItems:"center",children:[d?(0,S.jsx)(N.Check,{}):(0,S.jsx)("div",{style:{width:St}}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{disabled:!m,noWrapping:!0,children:"Scroll output alongside code (beta)"})]})},onClick:function(){return f(!d)},uuid:"Scroll output alongside code"}]}),[d,f,h,m]),L=(0,p.useMemo)((function(){var e=[{label:function(){return"Open compute management"},linkProps:{href:"/compute"},uuid:"Open compute management"}];return Zt.U.PYTHON3===(null===I||void 0===I?void 0:I.name)?e.push({label:function(){return"Switch to PySpark kernel"},onClick:function(){return null===g||void 0===g?void 0:g(null===c||void 0===c?void 0:c.name,sn.fj[Zt.U.PYSPARK])},uuid:"Switch to PySpark kernel"}):Zt.U.PYSPARK===(null===I||void 0===I?void 0:I.name)&&e.push({label:function(){return"Switch to Python kernel"},onClick:function(){return null===g||void 0===g?void 0:g(null===c||void 0===c?void 0:c.name,sn.fj[Zt.U.PYTHON3])},uuid:"Switch to Python kernel"}),e}),[I,c,g]),F="FileHeaderMenu/index",U=(0,Qe.y)(),H=U.registerOnKeyDown,W=U.unregisterOnKeyDown;return(0,p.useEffect)((function(){return function(){W(F)}}),[W,F]),H(F,(function(e,n,t){null!==x&&(n[qe.QK]?j((function(e){return 0===e?2:e-1})):n[qe.DY]&&j((function(e){return 2===e?0:e+1})))}),[x,j]),(0,S.jsx)(jt.Z,{onClickOutside:function(){return j(null)},open:!0,style:{position:"relative"},children:(0,S.jsxs)(y.ZP,{children:[(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(be.ZP,_t(_t({},Ct.a),{},{noBackground:0!==x,onClick:function(){return j((function(e){return 0===e?null:0}))},onMouseEnter:function(){return j((function(e){return null!==e?0:null}))},ref:k,children:(0,S.jsx)(O.ZP,{children:"File"})})),(0,S.jsx)(kt.Z,{items:B,onClickCallback:function(){return j(null)},open:0===x,parentRef:k,uuid:"FileHeaderMenu/file_items"})]}),(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(be.ZP,_t(_t({},Ct.a),{},{noBackground:2!==x,onClick:function(){return j((function(e){return 2===e?null:2}))},onMouseEnter:function(){return j((function(e){return null!==e?2:null}))},ref:P,children:(0,S.jsx)(O.ZP,{children:"Edit"})})),(0,S.jsx)(kt.Z,{items:A,onClickCallback:function(){return j(null)},open:2===x,parentRef:P,uuid:"FileHeaderMenu/edit_items"})]}),(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(be.ZP,_t(_t({},Ct.a),{},{noBackground:1!==x,onClick:function(){return j((function(e){return 1===e?null:1}))},onMouseEnter:function(){return j((function(e){return null!==e?1:null}))},ref:Z,children:(0,S.jsx)(O.ZP,{children:"Run"})})),(0,S.jsx)(kt.Z,{items:D,onClickCallback:function(){return j(null)},open:1===x,parentRef:Z,uuid:"FileHeaderMenu/run_items"})]}),sn.qL.INTEGRATION!==(null===c||void 0===c?void 0:c.type)&&(null===T||void 0===T?void 0:T(M.NOTEBOOK_BLOCK_OUTPUT_SPLIT_VIEW))&&(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(be.ZP,_t(_t({},Ct.a),{},{noBackground:3!==x,onClick:function(){return j((function(e){return 3===e?null:3}))},onMouseEnter:function(){return j((function(e){return null!==e?3:null}))},ref:w,children:(0,S.jsx)(O.ZP,{children:"View"})})),(0,S.jsx)(kt.Z,{items:R,onClickCallback:function(){return j(null)},open:3===x,parentRef:w,uuid:"FileHeaderMenu/viewItems"})]}),(null===T||void 0===T?void 0:T(M.COMPUTE_MANAGEMENT))&&(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(be.ZP,_t(_t({},Ct.a),{},{noBackground:4!==x,onClick:function(){return j((function(e){return 4===e?null:4}))},onMouseEnter:function(){return j((function(e){return null!==e?4:null}))},ref:_,children:(0,S.jsx)(O.ZP,{children:"Compute"})})),(0,S.jsx)(kt.Z,{items:L,onClickCallback:function(){return j(null)},open:4===x,parentRef:_,uuid:"FileHeaderMenu/viewItems"})]}),t]})})},Et=t(69616),Tt=t(67355),Mt=t(70613),Bt=t(21764),Dt=t(28071),At=t(65956),Rt=t(23657),Nt=t(8970),Lt=v.default.div.withConfig({displayName:"indexstyle__MenuStyle",componentId:"sc-1bixraz-0"})(["",";border-radius:","px;max-height:","px;min-width:","px;overflow:auto;position:absolute;right:0;",""],Be.w5,Me.n_,60*w.iI,70*w.iI,(function(e){return"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n border: 1px solid ").concat((e.theme.interactive||U.Z.interactive).defaultBorder,";\n ")}));function Ft(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ut(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ft(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ft(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ht=2*w.iI,Wt={default:!0,monospace:!0,small:!0};var Gt,Kt,zt=function(){var e=(0,p.useRef)(null),n=(0,ae.VI)(null,{},[],{uuid:"ClusterSelection"}),t=(0,r.Z)(n,1)[0],i=(0,p.useState)(!1),o=i[0],l=i[1],u=(0,Rt.Z)({clustersRefreshInterval:5e3,includeAllStates:o}),c=(u.activeCluster,u.clusters),s=u.clustersLoading,a=u.computeService,d=u.fetchComputeClusters,v=(0,p.useState)(null),h=v[0],m=v[1],g=(0,f.Db)(Y.ZP.compute_clusters.compute_services.useCreate(null===a||void 0===a?void 0:a.uuid),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){d()},onErrorCallback:function(e,n){return t({errors:n,response:e})}})}}),b=(0,r.Z)(g,2),x=b[0],j=b[1].isLoading,Z=(0,f.Db)((function(e){return Y.ZP.compute_clusters.compute_services.useUpdate(null===a||void 0===a?void 0:a.uuid,null===e||void 0===e?void 0:e.id)({compute_cluster:(0,Mn.GL)(e,["active"])})}),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){d(),m(null)},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.exception,o=n.message,r=n.type;Bt.Am.error((null===t||void 0===t?void 0:t.error)||i||o,{position:Bt.Am.POSITION.BOTTOM_RIGHT,toastId:r})}})}}),P=(0,r.Z)(Z,2),_=P[0],I=P[1].isLoading,E=(0,p.useMemo)((function(){return(null===c||void 0===c?void 0:c.length)||0}),[c]),T=(0,p.useMemo)((function(){return(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.WorkspacesUsersIcon,{size:Ht}),compact:E>=1,loading:j,onClick:function(){return x()},primary:!0,small:E>=1,children:"Launch cluster"})}),[E,x,j]),M=(0,p.useMemo)((function(){var n,t,i,o,r=h||{message:null,x:0,y:0},l=r.message,u=r.x,c=r.y,s=(0,S.jsx)(O.ZP,{default:!0,small:!0,children:l});return(0,S.jsx)("div",{ref:e,style:{hidden:!h,left:u-((null===e||void 0===e||null===(n=e.current)||void 0===n||null===(t=n.getBoundingClientRect())||void 0===t?void 0:t.width)||0),maxWidth:30*w.iI,position:"fixed",top:c-((null===e||void 0===e||null===(i=e.current)||void 0===i||null===(o=i.getBoundingClientRect())||void 0===o?void 0:o.height)||0),zIndex:9999},children:(0,S.jsx)(At.Z,{dark:!0,noPadding:!0,children:(0,S.jsxs)(C.Z,{p:1,children:[I&&(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(ke.Z,{inverted:!0,small:!0}),(0,S.jsx)(C.Z,{mr:1}),s]}),!I&&s]})})})}),[I,h,m]);return(0,S.jsxs)(S.Fragment,{children:[M,(0,S.jsxs)(Lt,{children:[(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"flex-start",justifyContent:"space-between",children:[(0,S.jsxs)(y.ZP,{flexDirection:"column",children:[(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:s?"Clusters":(0,G._6)("cluster",E,!0)}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(An.Z,{checked:o,compact:!0,onCheck:function(e){return l(e(o))}}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{default:o,muted:!o,small:!0,children:"Include terminated clusters"})]})]}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,small:!0,children:[E>=1&&"Click a cluster to activate and use it for compute.",!E&&"Launch a new cluster to use for compute."]})}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(y.ZP,{alignItems:"center",children:(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.ExpandOpenUpRight,{default:!0}),default:!0,linkProps:{href:"/compute",as:"/compute?tab=".concat(Nt.uK.CLUSTERS)},noBackground:!0,noBold:!0,noBorder:!0,target:"_blank",noPadding:!0,openNewWindow:!0,small:!0,children:"Open compute mangement"})})})]}),(0,S.jsx)(C.Z,{mr:w.cd}),E>=1&&(0,S.jsx)(y.ZP,{flexDirection:"column",children:T})]})}),(0,S.jsx)(k.Z,{light:!0}),(0,S.jsx)(jt.Z,{onClickOutside:function(){I||m(null)},open:!0,children:(0,S.jsx)(R.Z,{columnFlex:[null,null,null],columns:[{uuid:"ID"},{uuid:"State"},{label:function(){return""},rightAligned:!0,uuid:"Active"}],onClickRow:function(e,n){var t;if(!I){var i,o=null===c||void 0===c?void 0:c[e],r=null===o||void 0===o||null===(t=o.status)||void 0===t?void 0:t.state;null!==o&&void 0!==o&&o.active?i="Cluster ".concat(null===o||void 0===o?void 0:o.id," is already active."):[Dt.X.RUNNING,Dt.X.WAITING].includes(r)?(i="Activating cluster ".concat(null===o||void 0===o?void 0:o.id,"."),_(Ut(Ut({},o),{},{active:!0}))):i="\n Cluster ".concat(null===o||void 0===o?void 0:o.id," must be in a\n ").concat((0,G.vg)(Dt.X.WAITING)," or\n ").concat((0,G.vg)(Dt.X.RUNNING),"\n state to be activated and used for compute.\n "),m({message:i,x:n.clientX,y:n.clientY})}},rows:null===c||void 0===c?void 0:c.map((function(e){var n=e.active,t=e.id,i=e.status,o=null===i||void 0===i?void 0:i.state;return[(0,p.createElement)(O.ZP,Ut(Ut({},Wt),{},{key:"id"}),t),(0,S.jsx)(O.ZP,Ut(Ut({},Wt),{},{danger:[Dt.X.TERMINATED_WITH_ERRORS].includes(o),default:[Dt.X.STARTING].includes(o),muted:[Dt.X.TERMINATED].includes(o),success:[Dt.X.RUNNING,Dt.X.WAITING].includes(o),warning:[Dt.X.TERMINATING].includes(o),children:null!==i&&void 0!==i&&i.state?(0,G.vg)(null===i||void 0===i?void 0:i.state):null===i||void 0===i?void 0:i.state})),(0,S.jsx)(y.ZP,{justifyContent:"flex-end",children:(0,S.jsx)(N.PowerOnOffButton,{muted:!n,size:Ht,success:n})},"active")]})),stickyHeader:!0,uuid:"ClusterSelection"})}),!s&&0===E&&(0,S.jsx)(C.Z,{p:w.cd,children:T}),s&&(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(ke.Z,{inverted:!0,small:!0})})]})]})};!function(e){e.CREATE_NEW_CLUSTER="create_new_cluster",e.SET_ACTIVE_CLUSTER="set_active_cluster"}(Gt||(Gt={})),function(e){e.BOOTSTRAPPING="BOOTSTRAPPING",e.STARTING="STARTING",e.WAITING="WAITING"}(Kt||(Kt={}));var qt,Vt=t(89308),Yt=t(89515),Xt=t(78688);!function(e){e.EMR="emr"}(qt||(qt={}));var Qt=t(26032),Jt=t(74260),$t=t(89538);function ei(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ni(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ei(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ei(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ti=function(e){var n=e.children,t=e.isBusy,i=e.pipeline,l=(e.restartKernel,e.savePipelineContent,e.setErrors),u=e.setRunningBlocks,c=e.updatePipelineMetadata,s=(0,h.useRouter)(),a=(0,yt.Z)({pipelineType:null===i||void 0===i?void 0:i.type}).kernel,d=(0,Pt.Z)(),m=(d.featureEnabled,d.featureUUIDs,d.sparkEnabled),g=(0,Rt.Z)({clustersRefreshInterval:5e3,computeServiceRefreshInterval:5e3,connectionsRefreshInterval:5e3,pauseFetch:!m}),b=g.activeCluster,x=g.clusters,k=(g.clustersLoading,g.computeService),_=g.computeServiceUUIDs,I=g.connections,E=g.connectionsLoading,T=g.fetchAll,M=g.fetchComputeClusters,B=(g.setupComplete,(0,p.useContext)(v.ThemeContext)),D=a||{},A=D.alive,R=D.usage,F=(0,p.useState)(qt.EMR),H=F[0],W=(F[1],(0,p.useState)(!1)),K=W[0],z=W[1],q=(0,p.useState)(!1),V=q[0],X=q[1],Q=(0,p.useState)(!1),J=Q[0],$=Q[1],ee=(0,p.useState)(!1),ne=ee[0],te=ee[1],ie=(0,p.useRef)(null),oe=Y.ZP.clusters.detail(m?H:null,{},{revalidateOnFocus:!1}),re=oe.data,le=oe.mutate,ue=(0,p.useMemo)((function(){var e;return(null===re||void 0===re||null===(e=re.cluster)||void 0===e?void 0:e.clusters)||[]}),[re]),ce=(0,p.useMemo)((function(){return(0,L.sE)(ue,(function(e){return e.is_active}))}),[ue]),se=(0,f.Db)(Y.ZP.clusters.useUpdate(H),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){le()},onErrorCallback:function(e,n){return l({errors:n,response:e})}})}}),ae=(0,r.Z)(se,1)[0],de=Y.ZP.spark_applications.list({},{},{pauseFetch:!m}).data,ve=(0,p.useMemo)((function(){return null===de||void 0===de?void 0:de.spark_applications}),[de]),pe="KernelStatus",fe=(0,Qe.y)(),he=(fe.registerOnKeyDown,fe.unregisterOnKeyDown);(0,p.useEffect)((function(){return function(){he(pe)}}),[he,pe]);var me=(0,p.useMemo)((function(){return null===R||void 0===R?void 0:R.pid}),[null===R||void 0===R?void 0:R.pid]),ge=(0,kn.Z)(me),be=(0,$t.dd)((function(){return(0,S.jsx)(Yt.Z,{cancelText:"Close",centerOnScreen:!0,confirmText:"Don't show again",neutral:!0,onCancel:Ze,onClick:function(){(0,Ye.t8)(Ye.DU,1),Ze()},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*w.iI})}),{},[],{background:!0,uuid:"restart_kernel_warning"}),xe=(0,r.Z)(be,2),je=xe[0],Ze=xe[1];(0,p.useEffect)((function(){var e=(0,Ye.U2)(Ye.DU,0);me!==ge&&t&&!e&&(je(),u([]))}),[t,me,ge,u,je]);var ye=(0,p.useMemo)((function(){return[sn.qL.PYTHON,sn.qL.PYSPARK].includes(null===i||void 0===i?void 0:i.type)}),[i]),Ce=(0,p.useMemo)((function(){return(0,S.jsx)(j.Z,{color:t?(B||U.Z).borders.info:A?(B||U.Z).borders.success:(B||U.Z).borders.danger,size:w.iI})}),[A,t,B]),we=(0,f.Db)((function(e){return Y.ZP.compute_clusters.compute_services.useUpdate(null===k||void 0===k?void 0:k.uuid,null===e||void 0===e?void 0:e.id)({compute_cluster:(0,Mn.GL)(e,["active"])})}),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){M()},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.exception,o=n.message,r=n.type;Bt.Am.error((null===t||void 0===t?void 0:t.error)||i||o,{position:Bt.Am.POSITION.BOTTOM_RIGHT,toastId:r})}})}}),_e=(0,r.Z)(we,2),Se=_e[0],Ie=(_e[1].isLoading,(0,p.useMemo)((function(){if(!m||!ye||_.AWS_EMR!==(null===k||void 0===k?void 0:k.uuid)||sn.qL.PYSPARK!==(null===i||void 0===i?void 0:i.type))return null;var e=null===I||void 0===I?void 0:I.find((function(e){var n=e.uuid;return Jt.IK.OBSERVABILITY===n}));if(!e)return null;var n=e.name,t=e.state,o=e.status_calculated,r=e.uuid,l=[Qt.i.ACTIVE].includes(t),u=([Qt.i.INACTIVE].includes(t),[Jt.br.COMPLETED].includes(o)),c={muted:!0,warning:!1},a=n||r;u&&(l?(a="Observability enabled",c.muted=!1):a="SSH tunnel not connected");var d=(0,S.jsx)(jt.Z,{onClickOutside:function(e){(0,Oe.j)(e),te(!1)},open:ne,children:(0,S.jsx)(Lt,{children:(0,S.jsx)(Vt.Z,{actionsOnly:u,computeService:k,computeConnections:[e],contained:!1,hideDetails:!0,fetchAll:T,onClickStep:function(e){s.push("/compute?tab=".concat(e))},small:!0})})}),v=(0,S.jsx)(N.PowerOnOffButton,{danger:[Jt.br.ERROR].includes(o),muted:[Jt.br.INCOMPLETE].includes(o),success:u&&l});return(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(un.ZP,ni(ni({beforeElement:v,blackBorder:!0,compact:!0,inline:!0,noHover:E,onClick:function(e){(0,Oe.j)(e),ne||te(!0),$(!1)},uuid:"Pipeline/ComputeConnectionStatus"},c),{},{children:a})),d]})}),[ne,k,I,E,T,i,$,te,ye])),Ee=(0,p.useMemo)((function(){if(!m||!ye)return null;var e,n,t,o;if(_.AWS_EMR===(null===k||void 0===k?void 0:k.uuid)){var r,l=null===k||void 0===k||null===(r=k.setup_steps)||void 0===r?void 0:r.find((function(e){var n=e.uuid;return Jt.IK.SETUP===n})),u=null===l||void 0===l?void 0:l.status_calculated;if(sn.qL.PYSPARK!==(null===i||void 0===i?void 0:i.type))return null;if(b){var c,a=null===b||void 0===b||null===(c=b.status)||void 0===c?void 0:c.state;t=(0,S.jsxs)(O.ZP,{monospace:!0,children:[null===b||void 0===b?void 0:b.id," ",a&&![Dt.X.RUNNING,Dt.X.WAITING].includes(a)&&(0,G.J3)(a)]}),o=(0,S.jsx)(N.PowerOnOffButton,{danger:[Dt.X.TERMINATED_WITH_ERRORS].includes(a),default:[Dt.X.STARTING].includes(a),muted:[Dt.X.TERMINATED].includes(a),success:[Dt.X.RUNNING,Dt.X.WAITING].includes(a),warning:[Dt.X.TERMINATING].includes(a)})}else u?(t=null!==x&&void 0!==x&&x.length?"Select a compute cluster":"Launch a new cluster",o=(0,S.jsx)(N.PowerOnOffButton,{warning:!0})):(e=(0,S.jsx)(jt.Z,{onClickOutside:function(e){(0,Oe.j)(e),$(!1)},open:J,children:(0,S.jsx)(Lt,{children:(0,S.jsx)(Xt.Z,{contained:!1,onClickStep:function(e){s.push("/compute?tab=".concat(e))},setupSteps:null===k||void 0===k?void 0:k.setup_steps,small:!0})})}),n=function(e){(0,Oe.j)(e),J||$(!0),te(!1)},t="Compute setup incomplete",o=(0,S.jsx)(N.AlertTriangle,{danger:!0}));(b||u)&&(e=(0,S.jsx)(jt.Z,{onClickOutside:function(e){(0,Oe.j)(e),$(!1)},open:J,children:(0,S.jsx)(zt,{})}),n=function(e){(0,Oe.j)(e),J||$(!0),te(!1),te(!1)})}else if(_.STANDALONE_CLUSTER===(null===k||void 0===k?void 0:k.uuid))if(de)if(null!==ve&&void 0!==ve&&ve.length){if((null===ve||void 0===ve?void 0:ve.length)>=1){var d,v,p=null===ve||void 0===ve?void 0:ve[0];t=[null===p||void 0===p?void 0:p.name,null===p||void 0===p||null===(d=p.attempts)||void 0===d||null===(v=d[0])||void 0===v?void 0:v.app_spark_version].filter((function(e){return e})).join(" "),o=(0,S.jsx)(N.PowerOnOffButton,{success:!0})}}else n=function(){return s.push("/compute")},t="Compute unavailable",o=(0,S.jsx)(N.PowerOnOffButton,{danger:!0});else t="Loading compute",o=(0,S.jsx)(ke.Z,{inverted:!0,small:!0});return(0,S.jsxs)("div",{style:{position:"relative"},children:[(0,S.jsx)(un.ZP,ni(ni({beforeElement:o,blackBorder:!0,compact:!0,inline:!0,noHover:!de||(null===ve||void 0===ve?void 0:ve.length)>=1,onClick:n,uuid:"Pipeline/ComputeStatus"},{muted:!1,warning:!1}),{},{children:t})),e]})}),[b,J,x,k,_,de,i,s,$,te,ve,m,ye]),Te=(0,p.useMemo)((function(){return(0,S.jsx)("div",{ref:ie,style:{position:"relative"},children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(null===i||void 0===i?void 0:i.type)===sn.qL.PYSPARK&&!m&&(0,S.jsxs)(C.Z,{mr:w.cd,children:[(0,S.jsxs)(P.Z,{muted:!!ce,onClick:function(){return z(!0)},preventDefault:!0,sameColorAsText:!ce,underline:!ce,children:[ce&&ce.id,!ce&&"Select cluster"]}),(0,S.jsx)(jt.Z,{disableEscape:!0,onClickOutside:function(){return z(!1)},open:K,children:(0,S.jsx)(kt.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select cluster"},uuid:"select_cluster"}].concat((0,o.Z)(ue.map((function(e){var n=e.id,t=e.is_active,i=e.status;return{label:function(){return(0,S.jsxs)(y.ZP,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,S.jsx)(Z.Z,{flex:1,children:(0,S.jsx)(O.ZP,{muted:!t&&Kt.WAITING!==i,children:n})}),t&&(0,S.jsx)(N.Check,{size:2*w.iI,success:!0}),!t&&(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,children:i})]})},onClick:t||Kt.WAITING!==i?null:function(){return ae({cluster:{id:n}})},uuid:n}})))),onClickCallback:function(){return z(!1)},open:K,parentRef:ie,uuid:"KernelStatus/select_cluster",width:40*w.iI})})]}),(0,S.jsx)(un.ZP,{beforeElement:Ce,blackBorder:!0,compact:!0,inline:!0,onClick:function(){return X(!0)},uuid:"Pipeline/KernelStatus/kernel",children:sn.RH[(null===i||void 0===i?void 0:i.type)||sn.qL.PYTHON]}),(0,S.jsx)(jt.Z,{disableEscape:!0,onClickOutside:function(){return X(!1)},open:V,children:(0,S.jsx)(kt.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select kernel"},uuid:"select_kernel"}].concat((0,o.Z)(Object.keys(sn.a_).filter((function(e){return(null===i||void 0===i?void 0:i.type)!=e})).map((function(e){return{label:function(){return sn.RH[e]||e},onClick:function(){return c(null===i||void 0===i?void 0:i.name,e)},uuid:e}})))),onClickCallback:function(){return X(!1)},open:V,parentRef:ie,rightOffset:0,uuid:"KernelStatus/select_kernel",width:25*w.iI})})]})})}),[A,ue,t,i,ce,z,X,K,V,Ce,B,Se,ae,c]);return(0,S.jsxs)(y.ZP,{alignItems:"center",fullHeight:!0,justifyContent:"space-between",children:[(0,S.jsx)(y.ZP,{alignItems:"center",fullHeight:!0,justifyContent:"flex-start",children:n}),(0,S.jsx)(C.Z,{px:w.cd,children:(0,S.jsx)(Z.Z,{alignItems:"center",children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[Te,Ie&&(0,S.jsx)(C.Z,{ml:1,children:Ie}),Ee&&(0,S.jsx)(C.Z,{ml:1,children:Ee})]})})})]})},ii=t(48339),oi=t(12691),ri=t.n(oi),li=t(65976),ui=t(46510),ci=t(92709),si=v.default.div.withConfig({displayName:"indexstyle__ScrollbarContainerStyle",componentId:"sc-174iy66-0"})(["position:fixed;"," "," "," ",""],(function(e){return"\n border-radius: ".concat(Me.n_,"px;\n background: ").concat((e.theme.background||U.Z.background).scrollbarTrack,";\n ")}),(function(e){return!e.invisible&&"\n width: ".concat(Be.nn,"px;\n ")}),(function(e){return"undefined"!==typeof e.height&&"\n height: ".concat(e.height,"px;\n ")}),(function(e){return"undefined"!==typeof e.left&&"\n left: ".concat(e.left,"px;\n ")})),ai=v.default.div.withConfig({displayName:"indexstyle__ScrollCursorStyle",componentId:"sc-174iy66-1"})(["position:fixed;z-index:3;"," "," "," "," ",""],(function(e){return"\n border-radius: ".concat(Me.TR,"px;\n background: ").concat((e.theme.background||U.Z.background).scrollbarThumb,";\n\n &:hover {\n background: ").concat((e.theme.background||U.Z.background).scrollbarThumbHover,";\n }\n ")}),(function(e){return!e.invisible&&"\n width: ".concat(Be.nn,"px;\n ")}),(function(e){return(null===e||void 0===e?void 0:e.selected)&&"\n background: ".concat((e.theme.background||U.Z.background).scrollbarThumbHover,";\n ")}),(function(e){return"undefined"!==typeof e.height&&"\n height: ".concat(e.height,"px;\n ")}),(function(e){return"undefined"!==typeof e.top&&"\n top: ".concat(e.top,"px;\n ")})),di=t(74052),vi=t(61709);function pi(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 fi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?pi(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var hi,mi,gi,bi=function(e){var n,t,i=e.blocks,r=e.columnIndex,l=e.columns,u=e.disabled,c=e.eventNameRefsMapping,s=e.invisible,a=e.mainContainerRect,d=e.rightAligned,v=e.scrollTogether,f=e.setCursorHeight,h=(0,p.useRef)(null),m=(0,p.useRef)(null),g=((0,p.useMemo)((function(){return null===i||void 0===i?void 0:i.map((function(e){return e.uuid}))}),[i]),(0,p.useState)(null)),b=g[0],x=g[1],j=(0,p.useState)(null),k=j[0],Z=j[1],y=(0,p.useState)(null),P=(y[0],y[1]),C=(0,p.useState)(null),O=C[0],w=C[1],_=a||{},I=_.height,E=_.width,T=_.x,M=_.y,B=(0,p.useMemo)((function(){return(0,L.Sm)(b||[])}),[b]),D=(0,p.useCallback)((function(){return B>I?I*(I/B):0}),[I,B]),A=(0,p.useMemo)((function(){return D()}),[D]);(0,p.useMemo)((function(){f(A)}),[A,f]);var R=(0,p.useCallback)((function(e){if(A){var n,t,i=null===m||void 0===m||null===(n=m.current)||void 0===n||null===(t=n.getBoundingClientRect())||void 0===t?void 0:t.y;e<=i?e=i:e+A>=M+I&&(e=M+I-A),null!==h&&void 0!==h&&h.current&&(h.current.style.top="".concat(e,"px"))}}),[A,I,h,M]),N=(0,p.useCallback)((function(){if(!u){var e=new CustomEvent(ci.m$,{detail:{columnScrolling:r,refCursor:h,refCursorContainer:m,refsMappings:Object.values(c||{})}});window.dispatchEvent(e)}}),[r,u,c]);(0,p.useEffect)((function(){P(!0)}),[]);var F=(0,p.useCallback)((function(e){var n,t,i=e.blockIndex,o=e.heights,r=e.y,l=null===m||void 0===m||null===(n=m.current)||void 0===n?void 0:n.getBoundingClientRect(),u=null===h||void 0===h||null===(t=h.current)||void 0===t?void 0:t.getBoundingClientRect(),c=(0,L.Sm)((null===o||void 0===o?void 0:o.slice(0,i))||[]),s=(0,L.Sm)(o||[])||0,a=(0,vi.IT)(o,s,I);return(c-(r-(null===l||void 0===l?void 0:l.y)))/s/(1-a)*((null===l||void 0===l?void 0:l.height)-(null===u||void 0===u?void 0:u.height))+(null===l||void 0===l?void 0:l.y)}),[]),U=(0,p.useCallback)((function(){var e=Object.values(c||{}),n=null===i||void 0===i?void 0:i.map((function(n){var t=(0,di.zv)(n);return Math.max.apply(Math,(0,o.Z)(e.map((function(e){var n,i,o,r=null===e||void 0===e||null===(n=e.current)||void 0===n?void 0:n[t];return(null===r||void 0===r||null===(i=r.current)||void 0===i||null===(o=i.getBoundingClientRect())||void 0===o?void 0:o.height)||0}))))}));if(null!==n&&void 0!==n&&n.every((function(e){return"undefined"!==typeof e&&!isNaN(e)}))){if(x(n),k){var t=F(fi(fi({},k),{},{heights:n}));R(t)}N()}}),[i,F,r,N,c,k,x]);(0,p.useEffect)((function(){var e;return null===(e=Object.keys(c||{}))||void 0===e||e.forEach((function(e){window.addEventListener(e,U)})),function(){var e;null===(e=Object.keys(c||{}))||void 0===e||e.forEach((function(e){window.removeEventListener(e,U)}))}}),[c,U]);var H=(0,p.useCallback)((function(){N(),U()}),[N,U]);(0,p.useEffect)((function(){return window.addEventListener(ci.Qj,H),function(){window.removeEventListener(ci.Qj,H)}}),[H]),(0,p.useEffect)((function(){var e=function(e){var n,t,o=e.detail.block,r=null===i||void 0===i?void 0:i.findIndex((function(e){return e.uuid===(null===o||void 0===o?void 0:o.uuid)})),l=F({blockIndex:r,heights:b,y:null===m||void 0===m||null===(n=m.current)||void 0===n||null===(t=n.getBoundingClientRect())||void 0===t?void 0:t.y});R(l),N()};return window.addEventListener(ci.Em,e),function(){window.removeEventListener(ci.Em,e)}}),[i,F,N,b,R]),(0,p.useEffect)((function(){u||U()}),[u,v,U]),(0,p.useEffect)((function(){var e=function(e){var n=e.detail;if(r===(null===n||void 0===n?void 0:n.columnIndex)){var t=F(fi(fi({},n),{},{heights:b}));R(t),N(),null!==n&&void 0!==n&&n.lockScroll&&Z(n)}};return window.addEventListener(ci.Wf,e),function(){window.removeEventListener(ci.Wf,e)}}),[r,I,b,Z,R,F,M]);var W=(0,p.useCallback)((function(e){var n=e.pageX,t=e.pageY;if(n>=T&&n<=T+E&&t>=M&&t<=M+I){var i=E/l;if(v||n>=T+i*r&&n<T+i*(r+1)){var o,u=null===h||void 0===h||null===(o=h.current)||void 0===o?void 0:o.getBoundingClientRect(),c=((null===u||void 0===u?void 0:u.y)||0)+((null===e||void 0===e?void 0:e.deltaY)||0);R(c),N(),Z(null)}}}),[r,l,N,I,v,R,E,T,M]),G=(0,p.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(O||null!=n){var t;e&&(null===e||void 0===e||e.preventDefault());if(null===n){var i,o=null===O||void 0===O?void 0:O.scrollTop,r=null===O||void 0===O||null===(i=O.event)||void 0===i?void 0:i.clientY;t=o+((null===e||void 0===e?void 0:e.clientY)-r)}else t=n;R(t),N(),Z(null)}}),[N,O,R]);return(0,p.useEffect)((function(){var e,n;R(null===h||void 0===h||null===(e=h.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.y)}),[I,R]),(0,p.useEffect)((function(){var e=function(){w(null)};return A&&(window.addEventListener("mousemove",G),window.addEventListener("wheel",W),window.addEventListener("mouseup",e)),function(){window.removeEventListener("mousemove",G),window.removeEventListener("wheel",W),window.removeEventListener("mouseup",e)}}),[A,G,W]),(0,S.jsx)(si,{height:I,invisible:s,left:d?T+E-Be.nn:void 0,ref:m,children:(0,S.jsx)(ai,{height:A,invisible:s,onMouseDown:function(e){var n,t;return w({event:e,scrollTop:null===h||void 0===h||null===(n=h.current)||void 0===n||null===(t=n.getBoundingClientRect())||void 0===t?void 0:t.y})},ref:h,selected:!!O,top:null===m||void 0===m||null===(n=m.current)||void 0===n||null===(t=n.getBoundingClientRect())||void 0===t?void 0:t.y})})};!function(e){e.DBT="dbt"}(hi||(hi={})),function(e){e.PROFILES="profiles",e.PROJECTS="projects",e.TARGETS="targets"}(mi||(mi={})),function(e){e.Block="Block"}(gi||(gi={}));var xi=t(93528),ji=t(53779);var ki=function(e){var n=e.onClose,t=e.onOpenFile,i=e.onSelectBlockFile,o=(0,xi.ZP)({disableContextMenu:!0,onOpenFile:t,onSelectBlockFile:i,query:{pattern:encodeURIComponent("\\.sql$")},uuid:"FileSelectorPopup/dbt"}).browser;return(0,S.jsxs)(ji.eD,{children:[(0,S.jsxs)(ji.X$,{children:[(0,S.jsx)(Z.Z,{alignItems:"center",children:(0,S.jsx)(O.ZP,{disableWordBreak:!0,monospace:!0,children:"Select dbt model or snapshot file"})}),(0,S.jsx)(be.ZP,{iconOnly:!0,onClick:n,children:(0,S.jsx)(N.Close,{muted:!0})})]}),(0,S.jsx)(ji.C,{children:o})]})},Zi=t(39457);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 Pi(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,l.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 Ci="4px",Oi={lightBackground:!0,muted:!0,relativePosition:!0},wi=[Nn.Zj.BIGQUERY,Nn.Zj.DELTA_LAKE_S3];var _i=function(e){var n=e.bookmarkValues,t=e.destination,i=e.isLoadingLoadSampleData,o=e.isLoadingUpdateDestinationBlockState,u=e.loadSampleData,c=e.source,s=e.stream,a=e.streams,d=e.updateAllStreams,v=e.updateDestinationBlockState,f=e.updateMetadataForColumns,h=e.updateSchemaProperty,m=e.updateStream,g=(0,p.useRef)(null),b=s.bookmark_properties,j=s.destination_table,k=void 0===j?"":j,P=s.key_properties,_=s.metadata,I=s.partition_keys,E=s.replication_method,T=s.run_in_parallel,M=s.schema.properties,B=s.tap_stream_id,D=s.unique_constraints,N=s.unique_conflict_method,F=(0,p.useState)(k),U=F[0],H=F[1],W=(0,p.useState)(!1),K=W[0],z=W[1],q=(0,p.useState)(null),V=q[0],Y=q[1],X=(0,p.useState)(!!t),Q=X[0],J=X[1],$=(0,p.useState)((0,l.Z)({},B,n||{})),ee=$[0],ne=$[1],te=(0,kn.Z)(B);(0,p.useEffect)((function(){te!==B&&(H(k),Y(null))}),[k,E,B,te,N]),(0,p.useEffect)((function(){var e=null===ee||void 0===ee?void 0:ee[B];(null===b||void 0===b?void 0:b.length)>0&&((0,Mn.Qr)(e)||!(0,Mn.Xy)(n,e))&&ne((function(e){return Pi(Pi({},e),{},(0,l.Z)({},B,n))}))}),[null===b||void 0===b?void 0:b.length,n,B]);var ie=(0,p.useMemo)((function(){return(0,L.HK)(_,(function(e){return e.breadcrumb.join("/")}))}),[_]),oe=(0,p.useMemo)((function(){var e;return null===(e=(0,L.sE)(_,(function(e){return 0===e.breadcrumb.length})))||void 0===e?void 0:e.metadata}),[_]),re=(0,p.useMemo)((function(){return oe[Nn.fe.KEY_PROPERTIES]||[]}),[oe]),le=(0,p.useMemo)((function(){return oe[Nn.fe.REPLICATION_KEYS]||[]}),[oe]),ue=wi.includes(t),ce=a.length>1,se=(0,p.useCallback)((function(e){var n=Pi({},null===ee||void 0===ee?void 0:ee[B]);n.hasOwnProperty(e)&&delete n[e],ne((function(e){return Pi(Pi({},e),{},(0,l.Z)({},B,Pi({},n)))})),v({block:{bookmark_values:n,destination_table:U,tap_stream_id:B}})}),[ee,U,B,v]),ae=(0,p.useMemo)((function(){var e=[],n=[],i=(0,L.mr)(Object.entries(M)).map((function(i,o){var l=(0,r.Z)(i,2),u=l[0],c=l[1],s=c.anyOf,a=void 0===s?[]:s,v=c.format,p=c.type,g=void 0===p?[]:p,j=new Set(Array.isArray(g)?g:[g]),k=new Set(j);a.forEach((function(e){var n=e.format,t=(e.items,e.type);Array.isArray(t)?t.forEach((function(e){j.add(e),k.add(e)})):(j.add(t),k.add(t),n&&k.add(n))}));var _=Array.from(j);v&&k.add(v);var E=(ie["properties/".concat(u)]||{}).metadata,T=(E.inclusion,E.selected);e.push(T),n.push(u);var M=Nn.D5.reduce((function(e,n){return _.indexOf(n)>=0||Nn.Xv===String(n)&&Nn.zS.DATE_TIME===v||Nn.zS.UUID===String(n)&&Nn.zS.UUID===v?e:e.concat((0,S.jsx)("option",{value:n,children:n},n))}),[]),A=_.findIndex((function(e){return e===Nn.RL.STRING})),R=[(0,S.jsx)(x.Z,{checked:T,onClick:function(){f(B,[u],{selected:!T})}},"".concat(B,"/").concat(u,"/selected")),(0,S.jsx)(O.ZP,{children:u},"".concat(B,"/").concat(u,"/name")),(0,S.jsxs)(y.ZP,{children:[(0,S.jsx)(Z.Z,{flex:1,children:(0,S.jsx)(y.ZP,{alignItems:"center",flexWrap:"wrap",fullWidth:!0,children:_.map((function(e,n){return(0,S.jsx)(C.Z,{mb:1,mr:1,children:(0,S.jsx)(Dn.Z,{border:!0,label:v&&Nn.RL.STRING===e&&A===n?Nn.eL[v]:e,onClick:function(){var n={format:v,type:_.filter((function(n){return n!==e}))};Nn.zS.DATE_TIME!==v&&Nn.zS.UUID!==v||Nn.RL.STRING!==e||(n.format=null),h(B,u,n)},small:!0})},"".concat(B,"/").concat(u,"/").concat(e,"/").concat(n,"/chip"))}))})}),M.length>=1&&(0,S.jsxs)(an.Z,{compact:!0,onChange:function(e){var n=e.target.value,t={format:v,type:_};Nn.Xv===String(n)?(t.format=Nn.zS.DATE_TIME,t.type.push(Nn.RL.STRING)):Nn.zS.UUID===String(n)?(t.format=Nn.zS.UUID,t.type.push(Nn.RL.STRING)):t.type.push(n),h(B,u,t)},primary:!0,small:!0,value:"",width:10*w.iI,children:[(0,S.jsx)("option",{value:""}),M]})]},"".concat(B,"/").concat(u,"/type")),(0,S.jsx)(x.Z,{checked:!(null===D||void 0===D||!D.includes(u)),disabled:re.length>=1&&!re.includes(u),onClick:re.length>=1&&!re.includes(u)?null:function(){return m(B,(function(e){var n;return null!==(n=e.unique_constraints)&&void 0!==n&&n.includes(u)?e.unique_constraints=(0,L.Od)(e.unique_constraints,(function(e){return u===e})):e.unique_constraints=[u].concat(e.unique_constraints||[]),e}))}},"".concat(B,"/").concat(u,"/unique")),(0,S.jsx)(x.Z,{checked:!(null===b||void 0===b||!b.includes(u)),disabled:le.length>=1&&!le.includes(u),onClick:le.length>=1&&!le.includes(u)?null:function(){return m(B,(function(e){var n;return null!==(n=e.bookmark_properties)&&void 0!==n&&n.includes(u)?(se(u),e.bookmark_properties=(0,L.Od)(e.bookmark_properties,(function(e){return u===e}))):e.bookmark_properties=[u].concat(e.bookmark_properties||[]),e}))}},"".concat(B,"/").concat(u,"/bookmark")),(0,S.jsx)(x.Z,{checked:!(null===P||void 0===P||!P.includes(u)),onClick:function(){return m(B,(function(e){var n;return null!==(n=e.key_properties)&&void 0!==n&&n.includes(u)?e.key_properties=(0,L.Od)(e.key_properties,(function(e){return u===e})):e.key_properties=[u].concat(e.key_properties||[]),e}))}},"".concat(B,"/").concat(u,"/key_property"))];if(ue){var N=t!==Nn.Zj.DELTA_LAKE_S3,F=N&&(re.includes(u)||!k.has(Nn.zS.DATE_TIME));R.push((0,S.jsx)(x.Z,{checked:!(null===I||void 0===I||!I.includes(u)),disabled:F,onClick:F?null:function(){return m(B,(function(e){var n,t;null!==(n=e.partition_keys)&&void 0!==n&&n.includes(u)?e.partition_keys=(0,L.Od)(e.partition_keys,(function(e){return u===e})):N&&1===(null===(t=e.partition_keys)||void 0===t?void 0:t.length)?e.partition_keys=[u]:e.partition_keys=[u].concat(e.partition_keys||[]);return e}))}},"".concat(B,"/").concat(u,"/partition_key")))}if(ce){var U=V===o;R.push((0,S.jsx)(be.ZP,{compact:!0,disabled:U,onClick:function(){Y(o),setTimeout((function(){return Y(null)}),2e3),d((function(e){var n,t;if((null===e||void 0===e?void 0:e.tap_stream_id)!==B&&null!==e&&void 0!==e&&null!==(n=e.schema)&&void 0!==n&&null!==(t=n.properties)&&void 0!==t&&t[u]){var i,o,r,l,c,s,a,d,p;e.schema.properties[u]={format:v||null,type:_};var f=null===(i=(0,L.sE)((null===e||void 0===e?void 0:e.metadata)||[],(function(e){return 0===e.breadcrumb.length})))||void 0===i?void 0:i.metadata,h=f[Nn.fe.REPLICATION_KEYS]||[],m=f[Nn.fe.KEY_PROPERTIES]||[];null===D||void 0===D||!D.includes(u)||null!==e&&void 0!==e&&null!==(o=e.unique_constraints)&&void 0!==o&&o.includes(u)||!m.includes(u)?null!==D&&void 0!==D&&D.includes(u)||null===e||void 0===e||null===(r=e.unique_constraints)||void 0===r||!r.includes(u)||(e.unique_constraints=(0,L.Od)(e.unique_constraints,(function(e){return u===e}))):e.unique_constraints=[u].concat(e.unique_constraints||[]),null===b||void 0===b||!b.includes(u)||null!==e&&void 0!==e&&null!==(l=e.bookmark_properties)&&void 0!==l&&l.includes(u)||!h.includes(u)&&0!==h.length?null!==b&&void 0!==b&&b.includes(u)||null===e||void 0===e||null===(c=e.bookmark_properties)||void 0===c||!c.includes(u)||(e.bookmark_properties=(0,L.Od)(e.bookmark_properties,(function(e){return u===e}))):e.bookmark_properties=[u].concat(e.bookmark_properties||[]),null===P||void 0===P||!P.includes(u)||null!==e&&void 0!==e&&null!==(s=e.key_properties)&&void 0!==s&&s.includes(u)?null!==P&&void 0!==P&&P.includes(u)||null===e||void 0===e||null===(a=e.key_properties)||void 0===a||!a.includes(u)||(e.key_properties=(0,L.Od)(e.key_properties,(function(e){return u===e}))):e.key_properties=[u].concat(e.key_properties||[]),null===I||void 0===I||!I.includes(u)||null!==e&&void 0!==e&&null!==(d=e.partition_keys)&&void 0!==d&&d.includes(u)?null!==I&&void 0!==I&&I.includes(u)||null===e||void 0===e||null===(p=e.partition_keys)||void 0===p||!p.includes(u)||(e.partition_keys=(0,L.Od)(e.partition_keys,(function(e){return u===e}))):e.partition_keys=[u].concat(e.partition_keys||[])}return Pi({},e)}))},pill:!0,secondary:!0,children:(0,S.jsx)(O.ZP,{success:U,children:U?"Applied!":"Apply"})}))}return R})),o=e.every((function(e){return e})),l=[null,2,1,null,null,null],u=[{label:function(){return(0,S.jsx)(x.Z,{checked:o,onClick:function(){f(B,n,{selected:!o})}})},uuid:"Selected"},{uuid:"Name"},{uuid:"Type"},{fitTooltipContentWidth:!0,tooltipMessage:"Used to avoid adding duplicate records",uuid:"Unique"},{tooltipMessage:"Used to keep track of sync progress and incrementally sync new records (e.g. a column indicating when a record was last updated)",tooltipWidth:305,uuid:"Bookmark"},{fitTooltipContentWidth:!0,tooltipMessage:"Used to create primary key for destination table",uuid:"Key prop"}];return ue&&(l.push(null),u.push({uuid:"Partition key"})),ce&&(l.push(null),u.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)(Zn.cl,{children:(0,S.jsx)(R.Z,{alignTop:!0,columnFlex:l,columns:u,rows:i,stickyHeader:!0})})}),[b,t,ce,V,P,ie,I,M,se,ue,B,D,d,f,h,m,re,le]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(A.Z,{condensed:!0,level:4,spacingBelow:!0,children:[(0,S.jsx)(A.Z,{condensed:!0,inline:!0,level:4,monospace:!0,children:B})," schema"]}),(0,S.jsx)(C.Z,{mb:3,children:(0,S.jsx)(At.Z,{headerTitle:"Output",overflowVisible:!0,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{children:"Destination table name"}),(0,S.jsx)(C.Z,{ml:Ci}),(0,S.jsx)(Rn.Z,Pi(Pi({},Oi),{},{label:(0,S.jsxs)(O.ZP,{children:["By default, this stream will be saved to your destination under the table named ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:B}),". To change the table name, enter in a different value."]})})),(0,S.jsx)(C.Z,{ml:1}),(0,S.jsx)(Ee.Z,{compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;H(n),clearTimeout(g.current),g.current=setTimeout((function(){m(B,(function(e){return Pi(Pi({},e),{},{destination_table:n})}))}),300)},value:U||"",width:45*w.iI})]})})}),(0,S.jsx)(C.Z,{mb:3,children:(0,S.jsx)(At.Z,{headerTitle:"Usage",overflowVisible:!0,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{children:"Replication method"}),(0,S.jsx)(C.Z,{ml:Ci}),(0,S.jsx)(Rn.Z,Pi(Pi({},Oi),{},{label:(0,S.jsxs)(O.ZP,{children:["Do you want to synchronize the entire stream (",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Nn._B.FULL_TABLE}),") on each integration pipeline run or only new records (",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Nn._B.INCREMENTAL}),")?",c===Nn.th.POSTGRESQL&&(0,S.jsxs)(O.ZP,{children:["Log-based incremental replication (",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Nn._B.LOG_BASED}),") is also available for PostgreSQL sources."]})]})})),(0,S.jsx)(C.Z,{ml:1}),(0,S.jsxs)(an.Z,{compact:!0,onChange:function(e){m(B,(function(n){return Pi(Pi({},n),{},{replication_method:e.target.value})}))},primary:!0,value:E,children:[(0,S.jsx)("option",{value:""}),Object.values(Nn._B).filter((function(e){return c===Nn.th.POSTGRESQL||e!==Nn._B.LOG_BASED})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))]}),(0,S.jsx)(C.Z,{ml:3}),(0,S.jsx)(O.ZP,{children:"Unique conflict method"}),(0,S.jsx)(C.Z,{ml:Ci}),(0,S.jsx)(Rn.Z,Pi(Pi({},Oi),{},{label:(0,S.jsxs)(O.ZP,{wordBreak:!0,children:["If a new record has the same value as an existing record in the ",(0,G._6)("unique column",null===D||void 0===D?void 0:D.length),(null===D||void 0===D?void 0:D.length)>0&&(0,S.jsx)(S.Fragment,{children:"\xa0"}),null===D||void 0===D?void 0:D.sort().map((function(e,n){return(0,S.jsxs)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:[1!==(null===D||void 0===D?void 0:D.length)&&n===(null===D||void 0===D?void 0:D.length)-1?(0,S.jsx)(O.ZP,{inline:!0,children:" and "},e):n>=1&&(0,S.jsx)(S.Fragment,{children:",\xa0"}),e]},e)})),", how do you want to resolve the conflict? The conflict method ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Nn.MU.IGNORE})," will skip the new record if it\u2019s a duplicate of an existing record. The conflict method ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:Nn.MU.UPDATE})," will not save the new record and instead update the existing record with the new record\u2019s properties."]})})),(0,S.jsx)(C.Z,{ml:1}),(0,S.jsxs)(an.Z,{compact:!0,inputWidth:11*w.iI,onChange:function(e){m(B,(function(n){return Pi(Pi({},n),{},{unique_conflict_method:e.target.value})}))},primary:!0,value:N,children:[(0,S.jsx)("option",{value:""}),(0,S.jsx)("option",{value:Nn.MU.IGNORE,children:Nn.MU.IGNORE}),(0,S.jsx)("option",{value:Nn.MU.UPDATE,children:Nn.MU.UPDATE})]})]}),ce&&(0,S.jsxs)(Z.Z,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{default:!0,children:"All streams"}),(0,S.jsx)(C.Z,{ml:Ci}),(0,S.jsx)(Rn.Z,Pi(Pi({},Oi),{},{appearBefore:!0,label:(0,S.jsx)(O.ZP,{children:"This will apply this stream's replication method and unique conflict method settings to all selected streams."})})),(0,S.jsx)(C.Z,{ml:1}),(0,S.jsx)(be.ZP,{compact:!0,disabled:K,onClick:function(){z(!0),setTimeout((function(){return z(!1)}),2e3),d((function(e){return Pi(Pi({},e),{},{replication_method:E,unique_conflict_method:N})}))},pill:!0,secondary:!0,children:(0,S.jsx)(O.ZP,{bold:!K,success:K,children:K?"Applied!":"Apply"})})]})]})})}),(0,S.jsx)(At.Z,{headerTitle:"Features",noPadding:!0,children:ae}),(0,S.jsx)(C.Z,{mt:2,children:(0,S.jsx)(be.ZP,{loading:i,onClick:function(){return u(B)},primary:!0,small:!0,children:"Load sample data"})}),(0,S.jsxs)(C.Z,{mt:5,children:[(0,S.jsx)(A.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Settings"}),(0,S.jsx)(C.Z,{mb:5,children:(0,S.jsxs)(C.Z,{mb:1,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Run stream in parallel"}),(0,S.jsx)(O.ZP,{default:!0,children:"Parallel streams will be run at the same time, so make sure there are no dependencies between them."}),(0,S.jsx)(C.Z,{mb:1}),(0,S.jsx)(An.Z,{checked:T,onCheck:function(){return m(B,(function(e){return e.run_in_parallel=!T,e}))}},"".concat(B,"/run_in_parallel"))]})}),Nn._B.INCREMENTAL===E&&(0,S.jsxs)(C.Z,{mb:5,children:[(0,S.jsxs)(C.Z,{mb:1,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Bookmark properties"}),(0,S.jsx)(O.ZP,{default:!0,children:"After each integration pipeline run, the last record that was successfully synchronized will be used as the bookmark. The properties listed below will be extracted from the last record and used as the bookmark. On the next run, the synchronization will start from the bookmarked record."})]}),(0,S.jsxs)(y.ZP,{alignItems:"center",flexWrap:"wrap",children:[!(null!==b&&void 0!==b&&b.length)&&(0,S.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Bookmark"})," to use a specific column as a bookmark property."]}),null===b||void 0===b?void 0:b.sort().map((function(e){return(0,S.jsx)(C.Z,{mb:1,mr:1,children:(0,S.jsx)(Dn.Z,{label:e,onClick:function(){se(e),m(B,(function(n){return Pi(Pi({},n),{},{bookmark_properties:(0,L.Od)(n.bookmark_properties||[],(function(n){return n===e}))})}))},primary:!0})},"bookmark_properties/".concat(e))}))]}),(null===b||void 0===b?void 0:b.length)>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{my:2,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(C.Z,{mr:2,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Manually edit bookmark property values"}),!t&&(0,S.jsx)(O.ZP,{default:!0,children:'In order to overwrite the bookmark values for the next sync, you must first select a destination. Then you will be able to edit the bookmark property values in the table below. Click the "Save" button to save your changes.'}),t&&(0,S.jsx)(O.ZP,{default:!0,children:'This will temporarily overwrite the bookmark value for the next pipeline run. After editing any bookmark values below, you must click the "Save" button in the table header in order to persist and save your changes.'})]}),(0,S.jsx)(An.Z,{checked:Q,disabled:!t,onCheck:function(){return J((function(e){return!e}))}})]})}),Q&&!!t&&(0,S.jsx)(At.Z,{header:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(O.ZP,{bold:!0,default:!0,children:"Bookmark property values"}),(0,S.jsx)(be.ZP,{compact:!0,loading:o,onClick:function(){v({block:{bookmark_values:(null===ee||void 0===ee?void 0:ee[B])||{},destination_table:U,tap_stream_id:B}})},pill:!0,primary:!0,children:"Save"})]}),headerPaddingVertical:w.iI,noPadding:!0,overflowVisible:!0,children:(0,S.jsx)(R.Z,{columnBorders:!0,columnFlex:[null,1],columns:[{uuid:"Feature"},{uuid:"Current bookmark value"}],rows:b.map((function(e){var n;return[(0,S.jsx)(O.ZP,{default:!0,monospace:!0,children:e},e),(0,S.jsx)(Ee.Z,{borderless:!0,monospace:!0,onChange:function(n){n.preventDefault(),ne((function(t){return Pi(Pi({},t),{},(0,l.Z)({},B,Pi(Pi({},t[B]),{},(0,l.Z)({},e,n.target.value||null))))}))},paddingHorizontal:0,placeholder:"Enter value (optional)",value:null===ee||void 0===ee||null===(n=ee[B])||void 0===n?void 0:n[e]},"".concat(e,"_value"))]}))})})]})]}),ce&&(null===b||void 0===b?void 0:b.length)>0&&(0,S.jsxs)(C.Z,{mb:5,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Valid replication keys"}),(0,S.jsx)(O.ZP,{default:!0,inline:!0,children:"If a stream's schema specifies its valid replication keys and a feature is not a valid replication key, that feature will not be set as a bookmark property when applying the feature (from a different stream) as a bookmark to all streams.\xa0"}),le.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.ZP,{default:!0,inline:!0,children:"These are the valid replication keys for this stream:"}),"\xa0",(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,small:!0,children:[le.join(", "),"."]})]}),0===le.length&&(0,S.jsx)(O.ZP,{default:!0,inline:!0,children:"This stream did not specify any valid replication keys, so all features can be used as bookmark properties."})]}),(0,S.jsxs)(C.Z,{mb:5,children:[(0,S.jsxs)(C.Z,{mb:1,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Unique constraints"}),(0,S.jsx)(O.ZP,{default:!0,children:"Multiple records (e.g. 2 or more) with the same values in the columns listed below will be considered duplicates."})]}),(0,S.jsxs)(y.ZP,{alignItems:"center",flexWrap:"wrap",children:[!(null!==D&&void 0!==D&&D.length)&&(0,S.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Unique"})," to use a specific column as a unique constraint."]}),null===D||void 0===D?void 0:D.sort().map((function(e){return(0,S.jsx)(C.Z,{mb:1,mr:1,children:(0,S.jsx)(Dn.Z,{label:e,onClick:function(){m(B,(function(n){return Pi(Pi({},n),{},{unique_constraints:(0,L.Od)(n.unique_constraints||[],(function(n){return n===e}))})}))},primary:!0})},"unique_constraints/".concat(e))}))]})]}),(0,S.jsxs)(C.Z,{mb:5,children:[(0,S.jsxs)(C.Z,{mb:1,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Key properties"}),(0,S.jsx)(O.ZP,{default:!0,children:"Key properties are used as the primary key for the destination table."})]}),(0,S.jsxs)(y.ZP,{alignItems:"center",flexWrap:"wrap",children:[!(null!==P&&void 0!==P&&P.length)&&(0,S.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Key prop"})," to use a specific column as a key property."]}),null===P||void 0===P?void 0:P.sort().map((function(e){return(0,S.jsx)(C.Z,{mb:1,mr:1,children:(0,S.jsx)(Dn.Z,{label:e,onClick:function(){m(B,(function(n){return Pi(Pi({},n),{},{key_properties:(0,L.Od)(n.key_properties||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]}),ue&&(0,S.jsxs)(C.Z,{mb:3,children:[(0,S.jsxs)(C.Z,{mb:1,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Partition keys"}),(0,S.jsx)(O.ZP,{default:!0,children:"One datetime column can be used to partition the table. (Note: Partition keys currently only work with BigQuery destinations. Support for other destinations is WIP.)"})]}),(0,S.jsxs)(y.ZP,{alignItems:"center",flexWrap:"wrap",children:[!(null!==I&&void 0!==I&&I.length)&&(0,S.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Partition key"})," to use a specific column as a partition key."]}),null===I||void 0===I?void 0:I.sort().map((function(e){return(0,S.jsx)(C.Z,{mb:1,mr:1,children:(0,S.jsx)(Dn.Z,{label:e,onClick:function(){m(B,(function(n){return Pi(Pi({},n),{},{partition_keys:(0,L.Od)(n.partition_keys||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]})]})]})},Si=["catalog","pipeline","setErrors","setSelectedStream"];function Ii(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 Ei(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ii(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ii(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ti,Mi=function(e){var n,t=e.catalog,i=e.pipeline,o=e.setErrors,l=e.setSelectedStream,u=(0,In.Z)(e,Si),c=(0,p.useState)(null),s=c[0],a=c[1],d=(0,p.useMemo)((function(){return(null===t||void 0===t?void 0:t.streams)||[]}),[t]),v=(0,p.useMemo)((function(){return(0,L.YC)(d,"stream").map((function(e){return{uuid:e.stream}}))}),[d]),h=(0,p.useMemo)((function(){return(0,L.HK)(d,(function(e){return e.stream}))}),[d]),m=(0,p.useMemo)((function(){return h[null===s||void 0===s?void 0:s.uuid]}),[s,h]),g=(0,p.useMemo)((function(){return(0,L.sE)((null===i||void 0===i?void 0:i.blocks)||[],(function(e){var n=e.type;return b.tf.DATA_EXPORTER===n}))}),[null===i||void 0===i?void 0:i.blocks]),x=m||{},j=x.destination_table,k=x.tap_stream_id,Z=!(!k||!j),y=Y.ZP.blocks.pipelines.detail(Z?null===i||void 0===i?void 0:i.uuid:null,Z?null===g||void 0===g?void 0:g.uuid:null,{destination_table:j,state_stream:k}),P=y.data,w=y.mutate,_=null===P||void 0===P||null===(n=P.block)||void 0===n?void 0:n.bookmarks,I=(0,f.Db)(Y.ZP.blocks.pipelines.useUpdate(encodeURIComponent(null===i||void 0===i?void 0:i.uuid),encodeURIComponent(null===g||void 0===g?void 0:g.uuid),{query:{update_state:!0}}),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){null===w||void 0===w||w()},onErrorCallback:function(e,n){return null===o||void 0===o?void 0:o({errors:n,response:e})}})}}),E=(0,r.Z)(I,2),T=E[0],M=E[1].isLoading;(0,p.useEffect)((function(){v.length>0&&(s&&(0,L.sE)(v,(function(e){var n=e.uuid;return s.uuid===n}))||a(v[0]))}),[s,a,v]);var B=(0,p.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)(Zn.cl,{children:(0,S.jsx)(R.Z,{alignTop:!0,columnBorders:!0,columnFlex:e.map((function(e){return 1})),columns:e,rows:d.map((function(e){var n=e.replication_method,t=e.destination_table,i=e.bookmark_properties,o=e.key_properties,r=e.metadata,l=e.unique_constraints,u=e.unique_conflict_method,c=e.partition_keys,s=e.tap_stream_id,a=r.reduce((function(e,n){var t=n.breadcrumb,i=n.metadata.selected,o=(null===t||void 0===t?void 0:t.length)>0,r=i&&o?1:0,l=o?1:0;return{selectedCount:e.selectedCount+r,totalCount:e.totalCount+l}}),{selectedCount:0,totalCount:0}),d=(0,S.jsx)(O.ZP,{children:"".concat(a.selectedCount," of ").concat(a.totalCount," total")},"".concat(s,"_col_selected")),v=[s,n,t,i,o,l,u,c].map((function(e,n){return(0,S.jsx)(O.ZP,{bold:0===n,children:Array.isArray(e)?e.sort().join(", "):e},"".concat(s,"_cell_").concat(n))}));return v.slice(0,1).concat(d).concat(v.slice(1))})),stickyFirstColumn:!0,stickyHeader:!0,wrapColumns:!0})})}),[d]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(ve.Z,{allowScroll:!0,noPadding:!0,onClickTab:function(e){a(e),l(e.uuid)},selectedTabUUID:null===s||void 0===s?void 0:s.uuid,showScrollbar:!0,tabs:v}),m&&(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(Zn.dE,{children:(0,S.jsx)(_i,Ei(Ei({},u),{},{bookmarkValues:_,isLoadingUpdateDestinationBlockState:M,stream:m,streams:d,updateDestinationBlockState:T}))})}),d.length>=1&&(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(Zn.dE,{children:[(0,S.jsx)(A.Z,{level:4,children:"Streams Summary"}),(0,S.jsx)(C.Z,{mt:1}),B]})})]})},Bi=t(46732);function Di(e){return Object.values(e).filter((function(e){return null!==e})).map((function(e){return e.tap_stream_id}))}function Ai(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ri(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ai(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ai(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}!function(e){e.ALL="All",e.SELECTED="Selected",e.NOT_SELECTED="Not selected"}(Ti||(Ti={}));var Ni=45*w.iI,Li=Ni-4*w.iI;var Fi=function(e){var n=e.catalog,t=e.isLoading,i=e.onActionCallback,o=e.streams,r=(0,L.HK)((null===n||void 0===n?void 0:n.streams)||[],(function(e){return e.stream})),u=(0,p.useMemo)((function(){var e=new Set(o.map((function(e){return e.stream})));return Object.values(r).filter((function(n){var t=n.stream;return!e.has(t)})).map((function(e){return Ri(Ri({},e),{},{isMissingStream:!0})}))}),[r,o]),c=Ri({},r);u.forEach((function(e){var n=e.stream;delete c[n]}));var s=(0,p.useState)(c),a=s[0],d=s[1],v=(0,p.useState)(null),f=v[0],h=v[1],m=(0,p.useState)(!1),g=m[0],b=m[1],j=(0,p.useState)(Ti.ALL),Z=j[0],P=j[1],_=(0,p.useRef)(null),I=Di(a),E=(0,p.useMemo)((function(){var e=o;return e=e.filter((function(e){var n=e.tap_stream_id;return Z===Ti.SELECTED?I.includes(n):Z!==Ti.NOT_SELECTED||!I.includes(n)})),f?e.filter((function(e){var n=e.tap_stream_id;return null===n||void 0===n?void 0:n.toLowerCase().includes(null===f||void 0===f?void 0:f.toLowerCase())})):e}),[Z,f,I,o]),T=(0,p.useMemo)((function(){return o.every((function(e){var n=e.stream;return!!a[n]}))}),[a,o]);return(0,S.jsxs)(Gn.Z,{children:[(0,S.jsx)(Zn.cv,{rounded:!0,children:(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Select streams to sync"})}),(0,S.jsx)(Zn.cv,{padding:1.25*w.iI,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(Ee.Z,{beforeIcon:(0,S.jsx)(N.Search,{}),compact:!0,noBackground:!0,noBorder:!0,onChange:function(e){return h(e.target.value)},placeholder:"Search",value:f}),(0,S.jsx)(C.Z,{pr:1,children:(0,S.jsx)(Bi.Z,{items:[{label:function(){return Ti.ALL},onClick:function(){return P(Ti.ALL)},uuid:"all_streams"},{label:function(){return Ti.SELECTED},onClick:function(){return P(Ti.SELECTED)},uuid:"selected"},{label:function(){return Ti.NOT_SELECTED},onClick:function(){return P(Ti.NOT_SELECTED)},uuid:"unselected"}],onClickCallback:function(){return b(!1)},onClickOutside:function(){return b(!1)},open:g,parentRef:_,uuid:"SelectStreams/filter",children:(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.Filter,{}),noBackground:!0,onClick:function(){return b((function(e){return!e}))},ref:_,children:(0,S.jsx)(O.ZP,{children:Z})})})})]})}),(0,S.jsx)(Zn.cl,{height:"55vh",hideHorizontalScrollbar:!0,width:"".concat(Ni,"px"),children:(0,S.jsx)(R.Z,{borderCollapseSeparate:!0,columnFlex:[1,6],columns:[{label:function(){return(0,S.jsx)(x.Z,{checked:T,onClick:function(){var e=(0,L.HK)(o||[],(function(e){return e.stream}));d(T?{}:e)}})},uuid:"Selected"},{uuid:"Stream name"}],rows:E.concat(u).map((function(e){var n=e.isMissingStream,t=e.stream,i=!!a[t];return[(0,S.jsx)(x.Z,{checked:i,disabled:!i&&n,onClick:function(){d((function(n){return Ri(Ri({},n),{},(0,l.Z)({},t,i?null:e))}))}},"selected-".concat(t)),(0,S.jsxs)(O.ZP,{danger:n,title:t,width:Ni-48-32,children:[t,n?" (no longer available)":""]},"stream-".concat(t))]})),stickyHeader:!0})}),(0,S.jsx)(k.Z,{medium:!0}),(0,S.jsxs)(C.Z,{p:2,children:[(null===I||void 0===I?void 0:I.length)>50&&(0,S.jsx)(C.Z,{pb:2,children:(0,S.jsxs)(O.ZP,{danger:!0,maxWidth:Li,rightAligned:!0,whiteSpaceNormal:!0,children:["WARNING: Selecting too many streams (e.g. >50)",(0,S.jsx)("br",{}),"may cause app performance issues."]})}),0===(null===o||void 0===o?void 0:o.length)&&(0,S.jsx)(C.Z,{pb:2,children:(0,S.jsx)(O.ZP,{bold:!0,maxWidth:Li,warning:!0,whiteSpaceNormal:!0,children:"If you can successfully connect to the data source but no streams are displayed, check if the user has proper database/schema permissions."})}),(0,S.jsx)(y.ZP,{justifyContent:"flex-end",children:(0,S.jsx)(be.ZP,{loading:t,onClick:function(){return i(a)},primary:!0,children:"Confirm ".concat(Di(a).length," streams")})})]})]})};function Ui(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 Hi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ui(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ui(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Wi=function(e){var n=e.api,t=e.block,i=e.blockContent,o=e.onChangeCodeBlock,u=e.pipeline,c=(0,p.useState)(null),s=c[0],a=c[1],d=(0,kn.Z)(s);(0,p.useEffect)((function(){!i||s||d||a((0,xn.Pz)(null===i||void 0===i?void 0:i.config))}),[s,d,i]);var v=(0,p.useState)(null),h=v[0],m=v[1],g=(0,p.useState)(),x=g[0],j=g[1],k=(0,f.Db)(Y.ZP[n].useCreate(),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var t,i,o=(0,G.C5)(n);m(null===e||void 0===e||null===(t=e[o])||void 0===t?void 0:t.success),j(null===e||void 0===e||null===(i=e[o])||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)}})}}),Z=(0,r.Z)(k,2),P=Z[0],w=Z[1].isLoading;return t?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Zn.$W,{children:(0,S.jsx)(xe.Z,{autoHeight:!0,language:b.t6.YAML,onChange:function(e){a(e),o(t.type,t.uuid,(0,xn.Pz)(Hi(Hi({},i),{},{config:(0,xn.Qc)(e)})))},tabSize:2,value:s||void 0,width:"100%"})}),(0,S.jsxs)(C.Z,{mt:1,children:[(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(be.ZP,{onClick:function(){P((0,l.Z)({},(0,G.C5)(n),{action_type:"test_connection",config:s,pipeline_uuid:u.uuid})),j(null)},small:!0,success:!0,children:"Test connection"}),(0,S.jsx)(C.Z,{ml:1,children:w?(0,S.jsx)(ke.Z,{color:"white",small:!0}):(0,S.jsxs)(S.Fragment,{children:[h&&(0,S.jsx)(O.ZP,{small:!0,success:!0,children:"Connected successfully!"}),!1===h&&(0,S.jsx)(O.ZP,{small:!0,warning:!0,children:"Failed to connect, see error below."})]})})]}),x&&(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(O.ZP,{small:!0,warning:!0,children:x})})]})]}):null},Gi=t(85385);function Ki(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function zi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ki(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ki(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var qi=function(e){var n,t,i,o=e.addNewBlockAtIndex,l=e.blocks,u=e.codeBlocks,c=e.fetchFileTree,s=e.fetchPipeline,a=e.fetchSampleData,d=e.globalVariables,v=e.onChangeCodeBlock,h=e.openSidekickView,m=e.pipeline,g=e.savePipelineContent,x=e.setErrors,j=e.setIntegrationStreams,k=e.setOutputBlocks,Z=e.setSelectedBlock,_=e.setSelectedOutputBlock,I=e.setSelectedStream,E=(0,p.useState)(!0),T=E[0],M=E[1],B=(0,p.useState)(!0),D=B[0],F=B[1],U=(0,p.useState)(!0),H=U[0],W=U[1],G=(0,p.useState)(""),K=G[0],z=G[1],q=Y.ZP.integration_sources.list({},{revalidateOnFocus:!1}).data,V=(0,p.useMemo)((function(){return(null===q||void 0===q?void 0:q.integration_sources)||[]}),[q]),X=(0,p.useMemo)((function(){return(0,L.HK)(V,(function(e){return e.uuid}))}),[V]),Q=Y.ZP.integration_destinations.list({},{revalidateOnFocus:!1}).data,J=(0,p.useMemo)((function(){return(null===Q||void 0===Q?void 0:Q.integration_destinations)||[]}),[Q]),$=(0,p.useMemo)((function(){return(0,L.HK)(J,(function(e){return e.uuid}))}),[J]),ee=(0,p.useMemo)((function(){return(0,L.sE)(l,(function(e){var n=e.type;return b.tf.DATA_LOADER===n}))}),[l]),ne=(0,p.useMemo)((function(){return ee?(0,xn.Qc)(ee.content):{}}),[ee]);(0,p.useEffect)((function(){var e;null!==ne&&void 0!==ne&&ne.source&&z(null===(e=X[ne.source])||void 0===e?void 0:e.docs)}),[X,ne]);var te=(0,p.useMemo)((function(){return(0,S.jsx)(Wi,{api:"integration_sources",block:ee,blockContent:ne,onChangeCodeBlock:v,pipeline:m})}),[ee,ne,v,m]),ie=(0,p.useMemo)((function(){return(0,L.sE)(l,(function(e){var n=e.type;return b.tf.DATA_EXPORTER===n}))}),[l]),oe=(0,p.useMemo)((function(){return ie?(0,xn.Qc)(ie.content):{}}),[ie]),re=(0,p.useMemo)((function(){return(0,S.jsx)(Wi,{api:"integration_destinations",block:ie,blockContent:oe,onChangeCodeBlock:v,pipeline:m})}),[ie,oe,v,m]),le=(0,p.useMemo)((function(){return(0,L.sE)(l,(function(e){var n=e.type;return b.tf.TRANSFORMER===n}))}),[l]),ue=(0,p.useMemo)((function(){var e;return(0,Mn.Qr)(null===ne||void 0===ne?void 0:ne.catalog)?null===m||void 0===m||null===(e=m.data_integration)||void 0===e?void 0:e.catalog:null===ne||void 0===ne?void 0:ne.catalog}),[ne,null===m||void 0===m||null===(n=m.data_integration)||void 0===n?void 0:n.catalog]),ce=((null===ue||void 0===ue?void 0:ue.streams)||[]).every((function(e){return e.auto_add_new_fields})),se=((null===ue||void 0===ue?void 0:ue.streams)||[]).every((function(e){return e.disable_column_type_check})),ae=(0,kn.Z)(ue);(0,p.useEffect)((function(){!ae&&ue&&(k((function(){return _(ee),[ee]})),j((function(e){var n;return e||(null===ue||void 0===ue||null===(n=ue.streams)||void 0===n?void 0:n.map((function(e){return e.tap_stream_id})))})))}),[ue]);var de=(0,p.useState)(),ve=de[0],pe=de[1],fe=(0,f.Db)(Y.ZP.integration_sources.useCreate(),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var n=e.integration_source;if(n.success){var t=(null===n||void 0===n?void 0:n.streams)||[];k((function(){return _(ee),[ee]})),t.length>0&&I(t[0]),j((function(e){var n=(e||[]).concat(t);return Array.from(new Set(n)).sort()})),h(Gi.cH.DATA),a()}else pe(null===n||void 0===n?void 0:n.error_message)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),he=(0,r.Z)(fe,2),xe=he[0],je=he[1].isLoading,Ze=(0,f.Db)(Y.ZP.integration_sources.useUpdate(null===m||void 0===m?void 0:m.uuid),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var n=e.integration_source,t=n.selected_streams,i=n.streams,o=((null===ue||void 0===ue?void 0:ue.streams)||[]).filter((function(e){var n=e.tap_stream_id;return t.includes(n)})),r=o.map((function(e){return e.tap_stream_id})),l=i.filter((function(e){var n=e.tap_stream_id;return t.includes(n)&&!r.includes(n)}));l.forEach((function(e){e.metadata.forEach((function(n,t){var i=n.metadata;if(Nn.ks.UNSUPPORTED!==i.inclusion){var o;if(e.replication_method||(e.replication_method=Nn._B.FULL_TABLE),e.unique_conflict_method||(e.unique_conflict_method=Nn.MU.UPDATE),!e.destination_table)e.destination_table=null===e||void 0===e||null===(o=e.tap_stream_id)||void 0===o?void 0:o.replace(/\W+/g,"_");e.metadata[t]=zi(zi({},n),{},{metadata:zi(zi({},i),{},{selected:!0})})}}))}));var u={streams:o.concat(l)};j(He.map((function(e){return e.tap_stream_id})));var a=null===ne||void 0===ne?void 0:ne.catalog;(0,Mn.Qr)(a)||v(ee.type,ee.uuid,(0,xn.Pz)(zi(zi({},ne),{},{catalog:{}})));var d={pipeline:zi(zi({},m),{},{data_integration:zi(zi({},(null===m||void 0===m?void 0:m.data_integration)||{}),{},{catalog:u})})};g(d).then((function(){s(),null===c||void 0===c||c()}))},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),ye=(0,r.Z)(Ze,2),Ce=ye[0],Oe=ye[1].isLoading,we=(0,p.useState)(null),_e=we[0],Se=we[1],Ie=(0,f.Db)(Y.ZP.integration_source_streams.useUpdate(null===m||void 0===m?void 0:m.uuid),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){Se(e.integration_source_stream)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),Ee=(0,r.Z)(Ie,2),Te=Ee[0],Me=Ee[1].isLoading,Be=(0,p.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}}(ue,e),i=t.stream,o=t.streams,r=zi(zi({},ue),{},{streams:o.concat(n(i))}),l=null===ne||void 0===ne?void 0:ne.catalog;(0,Mn.Qr)(l)||v(ee.type,ee.uuid,(0,xn.Pz)(zi(zi({},ne),{},{catalog:{}})));var u={pipeline:zi(zi({},m),{},{data_integration:zi(zi({},(null===m||void 0===m?void 0:m.data_integration)||{}),{},{catalog:r})})};g(u).then((function(){return s()}))}),[ue,ee,ne,s,v,m,g]),De=(0,p.useCallback)((function(e){if(null!==ue&&void 0!==ue&&ue.streams){var n=zi(zi({},ue),{},{streams:ue.streams.map((function(n){return e(n)}))}),t=null===ne||void 0===ne?void 0:ne.catalog;(0,Mn.Qr)(t)||v(ee.type,ee.uuid,(0,xn.Pz)(zi(zi({},ne),{},{catalog:{}})));var i={pipeline:zi(zi({},m),{},{data_integration:zi(zi({},(null===m||void 0===m?void 0:m.data_integration)||{}),{},{catalog:n})})};g(i).then((function(){return s()}))}}),[ue,ee,ne,s,v,m,g]),Ae=(0,p.useCallback)((function(e,n,t){Be(e,(function(e){return e.schema.properties[n]=t,e}))}),[Be]),Re=(0,p.useCallback)((function(e,n,t){Be(e,(function(e){var i=e.metadata;return n.forEach((function(n){var o=i.findIndex((function(e){var t=e.breadcrumb,i=void 0===t?[]:t;return 2===i.length&&"properties"===i[0]&&i[1]===n}));if(o>=0){var r=i[o].metadata;e.metadata[o].metadata=zi(zi({},r),t)}})),e}))}),[Be]),Ne=(0,f.Db)(Y.ZP.blocks.pipelines.useUpdate(encodeURIComponent(null===m||void 0===m?void 0:m.uuid),encodeURIComponent(null===ie||void 0===ie?void 0:ie.uuid)),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){null===s||void 0===s||s()},onErrorCallback:function(e,n){return null===x||void 0===x?void 0:x({errors:n,response:e})}})}}),Le=(0,r.Z)(Ne,1)[0],Fe=(0,p.useMemo)((function(){var e=[];return null===d||void 0===d||d.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,o="\"{{ variables('".concat(t,"') }}\"");if(!t.startsWith("output"))return e.push([(0,S.jsx)(O.ZP,{monospace:!0,children:t},"variable-uuid-".concat(t)),(0,S.jsx)(O.ZP,{monospace:!0,children:i},"variable-uuid-".concat(t,"-{value}")),(0,S.jsx)(O.ZP,{monospace:!0,children:o},"variable-uuid-".concat(t,"-{value}-code")),(0,S.jsx)(Zi.Z,{copiedText:o,monospace:!0,withCopyIcon:!0},"variable-uuid-".concat(t,"-{value}-code-copy"))])}))})),(0,S.jsx)(R.Z,{alignTop:!0,columnFlex:[null,null,1],columns:[{uuid:"Key"},{uuid:"Value"},{uuid:"Code"}],rows:e})}),[d]),Ue=(0,p.useCallback)((function(e){return(0,S.jsxs)(C.Z,{mt:2,children:[(0,S.jsxs)(O.ZP,{default:!0,children:["Use the following variables to interpolate sensitive or dynamic information into the configuration.",(0,S.jsx)("br",{}),"You can also access values from your environment variables by using the following syntax: ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:"\"{{ env_var('MY_ENV_VARIABLE_NAME') }}\""}),(0,S.jsx)("br",{}),"For more information, check out the ",(0,S.jsx)(P.Z,{href:e,openNewWindow:!0,primary:!0,children:"documentation"}),"."]}),(0,S.jsx)(C.Z,{mt:1,children:Fe})]})}),[Fe]),He=(0,p.useMemo)((function(){return(null===_e||void 0===_e?void 0:_e.streams)||[]}),[_e]),We=(0,$t.dd)((function(){return(0,S.jsx)(Fi,{catalog:ue,isLoading:Oe,onActionCallback:function(e){var n=Object.entries(e).reduce((function(e,n){var t=(0,r.Z)(n,2),i=t[0];return t[1]?e.concat(i):e}),[]);if(n.length>0)Ce({integration_source:{streams:n}}),ze();else{var t=null===ne||void 0===ne?void 0:ne.catalog;(0,Mn.Qr)(t)||v(ee.type,ee.uuid,(0,xn.Pz)(zi(zi({},ne),{},{catalog:{}}))),g({pipeline:zi(zi({},m),{},{data_integration:zi(zi({},(null===m||void 0===m?void 0:m.data_integration)||{}),{},{catalog:null})})}).then((function(){return s()})),ze()}},streams:He})}),{},[ue,ee,ne,s,Oe,v,g,He],{background:!0,uuid:"select_streams"}),Ge=(0,r.Z)(We,2),Ke=Ge[0],ze=Ge[1];return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mb:1,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(be.ZP,{iconOnly:!0,onClick:function(){return F((function(e){return!e}))},children:(0,S.jsxs)(S.Fragment,{children:[D&&(0,S.jsx)(N.ChevronUp,{size:1.5*w.iI}),!D&&(0,S.jsx)(N.ChevronDown,{size:1.5*w.iI})]})}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(A.Z,{children:"Source"}),!D&&(0,S.jsxs)(A.Z,{default:!0,inline:!0,children:["\xa0",null===(t=X[null===ne||void 0===ne?void 0:ne.source])||void 0===t?void 0:t.name]})]})]})}),D&&(0,S.jsxs)(C.Z,{mb:5,children:[(0,S.jsxs)(Zn.dE,{children:[(0,S.jsxs)(C.Z,{mb:5,children:[(0,S.jsx)(A.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select source"}),(null===V||void 0===V?void 0:V.length)>0?(0,S.jsxs)(an.Z,{onChange:function(e){var n,t,i,r=e.target.value;if(r){z(null===(n=X[r])||void 0===n?void 0:n.docs);var l=null===(t=X[r])||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})),ee?v(ee.type,ee.uuid,(0,xn.Pz)(zi(zi({},ne),{},{catalog:{},config:l,source:r}))):o({content:(0,xn.Pz)({config:l,source:r}),language:b.t6.YAML,type:b.tf.DATA_LOADER},0,Z),Se(null),g().then((function(){s()}))}},primary:!0,value:null===ne||void 0===ne?void 0:ne.source,children:[(0,S.jsx)("option",{value:""}),V.map((function(e){var n=e.name,t=e.uuid;return(0,S.jsx)("option",{value:t,children:n},t)}))]}):(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(ke.Z,{inverted:!0}),(0,S.jsx)(C.Z,{ml:1}),(0,S.jsx)(A.Z,{level:5,primary:!0,children:"Loading sources..."})]})]}),ee&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(C.Z,{mb:5,children:[(0,S.jsx)(A.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===ne||void 0===ne?void 0:ne.source)&&K&&(0,S.jsxs)(C.Z,{mb:2,children:[(0,S.jsx)(me.Z,{children:(0,S.jsx)(ge.Z,{title:"Documentation: ".concat(ne.source),children:(0,S.jsx)(Zn.zG,{children:(0,S.jsx)(_n.Z,{children:K.replace(/\<br \/\>/g,"\n\n")})})})}),Ue("https://docs.mage.ai/guides/data-integration-pipeline#configure-source")]}),te]}),(0,S.jsxs)("div",{children:[(0,S.jsx)(A.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select stream"}),(0,S.jsx)(be.ZP,{loading:Me,onClick:function(){g().then((function(){Te().then((function(){return Ke()})),s()}))},primary:!0,small:!0,children:"View and select streams"})]}),ve&&(0,S.jsx)(O.ZP,{warning:!0,children:ve})]})]}),Oe&&(0,S.jsx)(C.Z,{p:2,children:(0,S.jsx)(ke.Z,{})}),!Oe&&(0,S.jsx)(C.Z,{mt:3,children:(0,S.jsx)(Mi,{catalog:ue,destination:null===oe||void 0===oe?void 0:oe.destination,isLoadingLoadSampleData:je,loadSampleData:function(e){return xe({integration_source:{action_type:"sample_data",pipeline_uuid:null===m||void 0===m?void 0:m.uuid,streams:[e]}})},pipeline:m,setErrors:x,setSelectedStream:I,source:null===ne||void 0===ne?void 0:ne.source,updateAllStreams:De,updateMetadataForColumns:Re,updateSchemaProperty:Ae,updateStream:Be})})]}),(0,S.jsx)(C.Z,{mb:1,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(be.ZP,{disabled:!ee,iconOnly:!0,onClick:function(){return W((function(e){return!e}))},children:(0,S.jsxs)(S.Fragment,{children:[H&&ee&&(0,S.jsx)(N.ChevronUp,{size:1.5*w.iI}),(!H||!ee)&&(0,S.jsx)(N.ChevronDown,{disabled:!ee,size:1.5*w.iI})]})}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(y.ZP,{alignItems:"center",children:(0,S.jsx)(A.Z,{children:"Transformers"})})]})}),H&&ee&&(0,S.jsx)(C.Z,{mb:5,children:(0,S.jsxs)(Zn.dE,{children:[u.length>0&&(0,S.jsx)(C.Z,{mb:1,children:u.map((function(e,n){return(0,S.jsx)(C.Z,{mb:1,children:e},n)}))}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(ui.Z,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=[];return ee&&i.push(ee.uuid),o(zi(zi({},e),{},{configuration:t,content:n,upstream_blocks:i}),l.length-1,(function(e){ie&&(Le({block:zi(zi({},ie),{},{upstream_blocks:[e.uuid]})}),Z(e))}))},compact:!0,hideCustom:!0,hideDataExporter:!0,hideDataLoader:!0,hideDbt:!0,hideMarkdown:!0,hideScratchpad:!0,hideSensor:!0,hideTransformer:!!le,hideTransformerDataSources:!0,pipeline:m})})]})}),(0,S.jsx)(C.Z,{mb:1,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(be.ZP,{disabled:!ee,iconOnly:!0,onClick:function(){return M((function(e){return!e}))},children:(0,S.jsxs)(S.Fragment,{children:[T&&ee&&(0,S.jsx)(N.ChevronUp,{size:1.5*w.iI}),(!T||!ee)&&(0,S.jsx)(N.ChevronDown,{disabled:!ee,size:1.5*w.iI})]})}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(A.Z,{children:"Destination"}),!T&&(0,S.jsxs)(A.Z,{default:!0,inline:!0,children:["\xa0",null===(i=$[null===oe||void 0===oe?void 0:oe.destination])||void 0===i?void 0:i.name]})]})]})}),T&&ee&&(0,S.jsxs)(Zn.dE,{children:[(0,S.jsxs)(C.Z,{mb:5,children:[(0,S.jsx)(A.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select destination"}),(null===J||void 0===J?void 0:J.length)>0?(0,S.jsxs)(an.Z,{onChange:function(e){var n=e.target.value;if(n){if(ie)v(ie.type,ie.uuid,(0,xn.Pz)(zi(zi({},oe),{},{destination:n})));else{var t,i,r=null===(t=$[n])||void 0===t||null===(i=t.templates)||void 0===i?void 0:i.config;r&&(Object.keys(r).forEach((function(e){r[e]=r[e]||null})),r.hasOwnProperty("table")&&delete r.table);var u=[];if((null===l||void 0===l?void 0:l.length)>=2){var c=l.find((function(e){var n=e.uuid;return(null===ee||void 0===ee?void 0:ee.uuid)!==n}));c&&u.push(c.uuid)}else ee&&u.push(ee.uuid);o({content:(0,xn.Pz)({config:r,destination:n}),language:b.t6.YAML,type:b.tf.DATA_EXPORTER,upstream_blocks:u},1,Z)}g().then((function(){s()}))}},primary:!0,value:null===oe||void 0===oe?void 0:oe.destination,children:[(0,S.jsx)("option",{value:""}),J.map((function(e){var n=e.name,t=e.uuid;return(0,S.jsx)("option",{value:t,children:n},t)}))]}):(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(ke.Z,{inverted:!0}),(0,S.jsx)(C.Z,{ml:1}),(0,S.jsx)(A.Z,{level:5,primary:!0,children:"Loading destinations..."})]})]}),ie&&(0,S.jsxs)(C.Z,{mb:5,children:[(0,S.jsx)(A.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===oe||void 0===oe?void 0:oe.destination)&&(0,S.jsx)(S.Fragment,{children:(0,S.jsxs)(C.Z,{mb:2,children:[(0,S.jsxs)(O.ZP,{default:!0,children:["For more information on how to configure this destination, read the ",(0,S.jsxs)(P.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/destinations/".concat(oe.destination,"/README.md"),openNewWindow:!0,primary:!0,children:[oe.destination," documentation"]}),".",(0,S.jsx)("br",{}),(0,S.jsx)("br",{}),"If your configuration contains a key named ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:"table"}),", it\u2019s optional.",(0,S.jsx)("br",{}),"The table that\u2019s created in this destination will have a name corresponding to the stream\u2019s unique name (by default) or the value you entered under the input field labeled ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,children:"Table name"})," in a previous section."]}),Ue("https://docs.mage.ai/guides/data-integration-pipeline#configure-destination")]})}),re,(0,S.jsx)(C.Z,{mt:3,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(C.Z,{mr:2,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Automatically add new fields"}),(0,S.jsx)(O.ZP,{default:!0,children:"Turn the toggle on if you want new table columns in each data source stream to be automatically added and synced with the data destination."})]}),(0,S.jsx)(An.Z,{checked:!!ce,disabled:!(null!==ue&&void 0!==ue&&ue.streams),onCheck:function(){return De((function(e){return zi(zi({},e),{},{auto_add_new_fields:!ce})}))}})]})}),(0,S.jsx)(C.Z,{mt:3,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(C.Z,{mr:2,children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Disable column type check"}),(0,S.jsxs)(O.ZP,{default:!0,children:["By default, the value for each column is validated according to the schema property for that column.",(0,S.jsx)("br",{}),"If a value in a column doesn\u2019t match its type, an error will be raised and the process will be stopped.",(0,S.jsx)("br",{}),"Turn this toggle on if you want to disable this strict type checking."]})]}),(0,S.jsx)(An.Z,{checked:!!se,disabled:!(null!==ue&&void 0!==ue&&ue.streams),onCheck:function(){return De((function(e){return zi(zi({},e),{},{disable_column_type_check:!se})}))}})]})})]})]})]})},Vi=t(82359),Yi=t(59457),Xi=t(19698),Qi=t(97133),Ji=t(35058),$i=t(316),eo=t(38399),no=t(33834);function to(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function io(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?to(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):to(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var oo=function(e){var n=e.addNewBlockAtIndex,t=e.addWidget,i=e.afterHidden,u=e.allBlocks,c=e.allowCodeBlockShortcuts,s=e.anyInputFocused,a=e.autocompleteItems,d=e.beforeHidden,v=e.blockInteractionsMapping,h=e.blockRefs,m=e.blocks,g=void 0===m?[]:m,x=e.blocksThatNeedToRefresh,j=e.dataProviders,k=e.deleteBlock,Z=e.disableShortcuts,y=e.fetchFileTree,I=e.fetchPipeline,E=e.fetchSampleData,T=(e.files,e.globalDataProducts),M=e.globalVariables,B=e.hiddenBlocks,D=e.interactionsMapping,A=e.interruptKernel,R=e.mainContainerRef,N=e.mainContainerWidth,F=e.messages,U=e.onChangeCallbackBlock,H=e.onChangeCodeBlock,W=e.openSidekickView,G=e.pipeline,K=e.pipelineContentTouched,z=e.restartKernel,q=e.runBlock,V=e.runningBlocks,X=void 0===V?[]:V,Q=e.savePipelineContent,J=e.scrollTogether,$=e.selectedBlock,ee=e.setAnyInputFocused,ne=e.setDisableShortcuts,te=e.setEditingBlock,ie=e.setErrors,oe=e.setHiddenBlocks,re=e.setIntegrationStreams,le=e.setOutputBlocks,ue=e.setPipelineContentTouched,ce=e.setSelectedBlock,se=e.setSelectedOutputBlock,ae=e.setSelectedStream,de=e.setTextareaFocused,ve=e.setScrollTogether,pe=e.setSideBySideEnabled,fe=e.showBrowseTemplates,he=e.showBlockBrowserModal,me=e.showConfigureProjectModal,ge=e.showDataIntegrationModal,be=e.showGlobalDataProducts,xe=e.showUpdateBlockModal,je=e.sideBySideEnabled,ke=e.textareaFocused,Ze=e.widgets,ye=(0,Pt.Z)(),Ce=ye.featureEnabled,Oe=ye.featureUUIDs,we=ye.project,_e=(0,Xi.Z)().status,Se=(0,p.useRef)(null),Ie=(0,p.useRef)(null),Ee=(0,p.useRef)({}),Te=(0,p.useState)(!1),Me=Te[0],Be=Te[1],De=(0,p.useState)(!1),Ae=De[0],Re=De[1],Ne=(0,p.useState)(!1),Le=Ne[0],Fe=Ne[1],Ue=(0,p.useState)(!0),He=Ue[0],We=Ue[1],Ge=(0,p.useState)(!1),Ke=Ge[0],ze=Ge[1],Ve=(0,p.useState)(null),Ye=Ve[0],$e=Ve[1],en=(0,p.useState)(null),nn=en[0],rn=en[1],un=(0,p.useState)(!1),cn=un[0],an=un[1],dn=(0,p.useState)(""),vn=dn[0],pn=dn[1],fn=(0,p.useState)({height:null,width:null,x:null,y:null}),hn=fn[0],mn=fn[1],gn=(0,p.useMemo)((function(){return sn.qL.INTEGRATION===(null===G||void 0===G?void 0:G.type)}),[G]),bn=(0,p.useMemo)((function(){return sn.qL.STREAMING===(null===G||void 0===G?void 0:G.type)}),[G]),xn=(0,p.useMemo)((function(){return null===g||void 0===g?void 0:g.some((function(e){var n=e.type;return b.tf.DBT===n}))}),[g]),jn=(0,p.useMemo)((function(){return g.filter((function(e){var n=e.type;return!gn||b.tf.TRANSFORMER===n}))}),[g,gn]),Zn=(0,p.useState)({}),yn=(Zn[0],Zn[1]),Pn=(0,Je.i)(),Cn=Pn.height,On=Pn.width;(0,p.useEffect)((function(){var e;null!==R&&void 0!==R&&R.current&&mn(null===R||void 0===R||null===(e=R.current)||void 0===e?void 0:e.getBoundingClientRect())}),[i,d,R,N,mn,Cn,On]);var wn=(0,p.useMemo)((function(){return X.reduce((function(e,n,t){return io(io({},e),{},(0,l.Z)({},n.uuid,io(io({},n),{},{priority:t})))}),{})}),[X]),_n=(0,p.useState)(null),Sn=_n[0],In=_n[1],En=(0,p.useMemo)((function(){return(0,S.jsx)(bi,{blocks:jn,columnIndex:0,columns:2,disabled:J,eventNameRefsMapping:(0,l.Z)({},ci.$e,h),invisible:!(null!==g&&void 0!==g&&g.length)||!Sn||J,mainContainerRect:hn,scrollTogether:J,setCursorHeight:In})}),[h,jn,Sn,hn,J,In]),Tn=(0,p.useState)(null),Bn=Tn[0],Dn=Tn[1],An=(0,p.useMemo)((function(){return(0,S.jsx)(bi,{blocks:jn,columnIndex:1,columns:2,disabled:J,eventNameRefsMapping:(0,l.Z)({},ci.tK,Ee),invisible:!(null!==g&&void 0!==g&&g.length)||!Bn||J,mainContainerRect:hn,rightAligned:!0,scrollTogether:J,setCursorHeight:Dn})}),[Ee,jn,Bn,hn,J,Dn]),Rn=(0,p.useState)(null),Nn=Rn[0],Ln=Rn[1],Fn=(0,p.useMemo)((function(){var e;return(0,S.jsx)(bi,{blocks:jn,columnIndex:2,columns:1,disabled:!J,eventNameRefsMapping:(e={},(0,l.Z)(e,ci.tK,Ee),(0,l.Z)(e,ci.$e,h),e),invisible:!(null!==g&&void 0!==g&&g.length)||!Nn||!J,mainContainerRect:hn,rightAligned:!0,scrollTogether:J,setCursorHeight:Ln})}),[Ee,h,jn,Nn,hn,J,Ln]),Un=(0,kn.Z)($),Hn=(0,p.useMemo)((function(){return g.length}),[g]),Wn=(0,p.useMemo)((function(){return sn.qL.PYTHON===(null===G||void 0===G?void 0:G.type)&&(null===Ce||void 0===Ce?void 0:Ce(null===Oe||void 0===Oe?void 0:Oe.ADD_NEW_BLOCK_V2))}),[Ce,Oe,G]),Gn=(0,Yi.Z)(Y.ZP.block_templates.list,{show_all:!!Wn},{revalidateOnFocus:!1},{delay:3e3}).data,Kn=(0,p.useMemo)((function(){return(null===Gn||void 0===Gn?void 0:Gn.block_templates)||[]}),[Gn]),zn=Y.ZP.configuration_options.pipelines.list(xn?null===G||void 0===G?void 0:G.uuid:null,{configuration_type:hi.DBT,option_type:mi.PROJECTS,resource_type:gi.Block},{revalidateOnFocus:!1}).data,qn=(0,p.useMemo)((function(){return null===zn||void 0===zn?void 0:zn.configuration_options}),[zn]),Vn=(0,p.useCallback)((function(e,t){var i=g[g.length-1],o=null,r=e.configuration||{},l=i?(0,vi.eY)(i,e):[];i&&([b.tf.DATA_LOADER,b.tf.TRANSFORMER].includes(i.type)&&b.tf.SCRATCHPAD===e.type&&(o="from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(G.uuid,"', '").concat(i.uuid,"', 'output_0')\n")),b.t6.SQL===i.language&&(r=io(io({},(0,Mn.GL)(i.configuration,[Ji.cH,Ji.Sv,Ji.sc,Ji.BD,Ji.nq])),r))),b.t6.SQL===e.language&&(o=(0,eo.SF)(o)),o=(0,eo.X7)(e,o);var u=null!==t?t:Hn;n(io(io({},e),{},{configuration:r,content:o,upstream_blocks:l}),u,ce),de(!0)}),[n,g,Hn,G,ce,de]),Yn="PipelineDetail/index",Xn=(0,Qe.y)(),Qn=Xn.disableGlobalKeyboardShortcuts,Jn=Xn.registerOnKeyDown,$n=Xn.unregisterOnKeyDown;(0,p.useEffect)((function(){return function(){$n(Yn)}}),[$n,Yn]),Jn(Yn,(function(e,n,t){if(K&&(0,Xe.y)([qe.zX,qe.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(!ke&&!$&&!gn&&Wn){var i,o;if((0,Xe.y)([qe.zX,qe.A1],n)||(0,Xe.y)([qe.PQ,qe.A1],n))return e.preventDefault(),Re(!0),void(null===Ie||void 0===Ie||null===(i=Ie.current)||void 0===i||i.focus());if(Ae&&(0,Xe.y)([qe.vP],n))return e.preventDefault(),Re(!1),void(null===Ie||void 0===Ie||null===(o=Ie.current)||void 0===o||o.blur())}if(ke||$||!Z&&!Qn)if((0,Xe.y)([qe.zX,qe.Um],n)||(0,Xe.y)([qe.PQ,qe.Um],n))e.preventDefault(),Q();else if((0,Xe.y)([qe.zH],n)||(0,Xe.y)([qe.Fv],n)){if($&&!e.repeat&&!(0,no.cK)(e)){var r=g.findIndex((function(e){var n=e.uuid;return $.uuid===n}));if(-1!==r){var l=(0,Xe.y)([qe.zH],n)?r:r+1;Vn({type:b.tf.SCRATCHPAD},l)}}}else if(ke)n[qe.vP]?de(!1):K||qe.Z1.find((function(e){return n[e]}))||ue(!0);else if(!gn){if($){var u=g.findIndex((function(e){var n=e.uuid;return $.uuid===n}));if(n[qe.vP])ce(null);else if(t[0]===qe.xD&&t[1]===qe.xD)A();else if(t[0]===qe.l1&&t[1]===qe.l1&&-1!==u)k($).then((function(e){null!==e&&void 0!==e&&e.error||setTimeout((function(){u===g.length-1?ce(g[u-1]):g.length>=0?ce(g[u+1]):ce(null)}),100)}));else if(n[qe.Bu]&&u>=1){var c=g[u-1];if(c){var a,d;ce(c);var v="".concat(c.type,"s/").concat(c.uuid,".py");null===(a=h.current[v])||void 0===a||null===(d=a.current)||void 0===d||d.scrollIntoView()}}else if(n[qe.kD]&&u<=Hn-2){var p=g[u+1];if(p){var f,m;ce(p);var x="".concat(p.type,"s/").concat(p.uuid,".py");null===(f=h.current[x])||void 0===f||null===(m=f.current)||void 0===m||m.scrollIntoView()}}else(0,Xe.y)([qe.Uq],n)&&de(!0)}else Un&&n[qe.Uq]&&ce(Un);s||t[0]!==qe.OC||t[1]!==qe.OC||z()}}),[n,s,h.current,g,Ae,A,gn,Hn,K,z,Q,Ie,$,Un,ue,ce,de,ke,Wn]),(0,p.useEffect)((function(){var e=setInterval((function(){K&&Q()}),1e4);return function(){clearInterval(e)}}),[K,Q]),(0,p.useEffect)((function(){setTimeout((function(){return Fe(!0)}),2*Qi.zn)}),[G]);var et=(0,f.Db)(Y.ZP.pipelines.useUpdate(encodeURIComponent(null===G||void 0===G?void 0:G.uuid)),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){null===I||void 0===I||I()},onErrorCallback:function(e,n){return null===ie||void 0===ie?void 0:ie({errors:n,response:e})}})}}),nt=(0,r.Z)(et,2),tt=nt[0],it=(nt[1].isLoading,(0,f.Db)((function(e){var n=e.block,t=e.upstreamBlocks;return Y.ZP.blocks.pipelines.useUpdate(encodeURIComponent(null===G||void 0===G?void 0:G.uuid),encodeURIComponent(null===n||void 0===n?void 0:n.uuid))({block:{upstream_blocks:t}})}),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){I()},onErrorCallback:function(e,n){return null===ie||void 0===ie?void 0:ie({errors:n,response:e})}})}})),ot=(0,r.Z)(it,1)[0],rt=(0,p.useCallback)((function(e){Be(!0),rn(e),ne(!0)}),[Be,ne,rn]),lt=(0,p.useCallback)((function(){Be(!1),an(!1),pn(""),ne(!1)}),[ne]),ut=(0,p.useCallback)((function(e,n){var t,i;g.forEach((function(o,r){var l=o.uuid;t>=0&&i>=0||(l===e.uuid?t=r:l===n.uuid&&(i=r))}));var o=(0,L.oM)(g,i);return o=(0,L.Hk)(n,Math.max(t,0),o),Q({pipeline:{blocks:o,uuid:null===G||void 0===G?void 0:G.uuid}})}),[g,G,Q]),ct=(0,p.useMemo)((function(){return G&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(ui.Z,{addNewBlock:Vn,blockIdx:Hn,blockTemplates:Kn,focusedAddNewBlockSearch:Ae,hideCustom:gn||bn,hideDataExporter:gn,hideDataLoader:gn,hideDbt:gn||bn,hideScratchpad:gn,hideSensor:gn,onClickAddSingleDBTModel:rt,pipeline:G,project:we,searchTextInputRef:Ie,setCreatingNewDBTModel:an,setFocusedAddNewBlockSearch:Re,showBlockBrowserModal:he,showBrowseTemplates:fe,showConfigureProjectModal:me,showGlobalDataProducts:be}),!Wn&&!gn&&!bn&&(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{muted:!0,small:!0,children:["Want to try the new add block UI?",(0,S.jsx)("br",{}),"Turn on the feature named ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,muted:!0,small:!0,children:Vi.d.ADD_NEW_BLOCK_V2})," in your ",(0,S.jsx)(ri(),{href:"/settings/workspace/preferences",passHref:!0,children:(0,S.jsx)(P.Z,{muted:!0,underline:!0,children:(0,S.jsx)(O.ZP,{bold:!0,inline:!0,muted:!0,small:!0,children:"project settings"})})}),"."]})})]})}),[Vn,Kn,Ae,gn,bn,Hn,rt,G,we,Ie,Re,he,fe,me,be,Wn]);(0,p.useEffect)((function(){var e,n=function(){var e,n,t,i=((null===R||void 0===R||null===(e=R.current)||void 0===e||null===(n=e.getBoundingClientRect)||void 0===n?void 0:n.call(e))||{}).y;null===(t=Object.values((null===h||void 0===h?void 0:h.current)||{}))||void 0===t||t.forEach((function(e){var n,t,o,r;((null===e||void 0===e||null===(n=e.current)||void 0===n||null===(t=n.getBoundingClientRect)||void 0===t?void 0:t.call(n))||{}).y<=i?null!==e&&void 0!==e&&e.current&&(e.current.className=(0,$i.bS)((0,$i.xi)((null===e||void 0===e||null===(o=e.current)||void 0===o?void 0:o.className)||"",["enable-border-radius"]),["disable-border-radius"])):null!==e&&void 0!==e&&e.current&&(e.current.className=(0,$i.bS)((0,$i.xi)((null===e||void 0===e||null===(r=e.current)||void 0===r?void 0:r.className)||"",["disable-border-radius"]),["enable-border-radius"]))}))};return null===R||void 0===R||null===(e=R.current)||void 0===e||e.addEventListener("scroll",n),function(){var e;null===R||void 0===R||null===(e=R.current)||void 0===e||e.removeEventListener("scroll",n)}}),[]);var st=(0,p.useRef)({}),at=(0,p.useMemo)((function(){var e=[],i=(null===jn||void 0===jn?void 0:jn.length)||0;return jn.forEach((function(r,s){var d,f,m,P=s===i-1,C=r.type,O=r.uuid,w=(null===$||void 0===$?void 0:$.uuid)===O,E=wn[O],M=E?0===E.priority?ii.uF.BUSY:ii.uF.QUEUED:ii.uF.IDLE,L=(0,di.zv)({type:C,uuid:O});(d=Ee.current)[L]||(d[L]=(0,p.createRef)()),(f=h.current)[L]||(f[L]=(0,p.createRef)());var K,z,V=(0,di.zv)({type:C,uuid:(null===r||void 0===r?void 0:r.replicated_block)||O});null!==r&&void 0!==r&&r.replicated_block&&((K=st.current)[V]||(K[V]=(0,l.Z)({},O,{})),(z=st.current[V])[O]||(z[O]=(0,p.createRef)()));var Y=C===b.tf.MARKDOWN,ne=C===b.tf.TRANSFORMER,re=!(null===B||void 0===B||!B[O]),ue=s===Hn-1||gn,ae=Ee.current[L],ye=h.current[L],Pe=O,Ce=null===x||void 0===x||null===(m=x[C])||void 0===m?void 0:m[O];Ce&&(Pe="".concat(Pe,":").concat(Ce));e.push((0,S.jsx)(ln.Z,{addNewBlock:function(e,t){de(!0);return n(e,je?s:s+1,(function(e){if(1===(null===t||void 0===t?void 0:t.length)){var n,i,r=null===(n=t[0])||void 0===n?void 0:n.uuid,l=(null===(i=t[0])||void 0===i?void 0:i.upstream_blocks)||[];ot({block:{uuid:r},upstreamBlocks:[e.uuid].concat((0,o.Z)(l))})}null===ce||void 0===ce||ce(e)}))},addNewBlockMenuOpenIdx:Ye,addWidget:t,allBlocks:u,allowCodeBlockShortcuts:c,autocompleteItems:a,block:r,blockIdx:s,blockInteractions:null===v||void 0===v?void 0:v[O],blockOutputRef:ae,blockRefs:h,blockTemplates:Kn,blocks:g,codeEditorMappingRef:st,containerRef:Se,cursorHeight1:Sn,cursorHeight2:Bn,cursorHeight3:Nn,dataProviders:j,dbtConfigurationOptions:qn,defaultValue:r.content,deleteBlock:function(e){k(e),ee(!1)},disableShortcuts:Z,executionState:M,fetchFileTree:y,fetchPipeline:I,globalDataProducts:T,hideRunButton:bn||Y||gn&&ne,interactionsMapping:D,interruptKernel:A,isHidden:re,mainContainerRect:hn,mainContainerRef:R,mainContainerWidth:N,messages:F[O],noDivider:ue,onCallbackChange:function(e){return U(C,O,e)},onChange:function(e){return H(C,O,e)},onClickAddSingleDBTModel:rt,onDrop:ut,onMountCallback:function(e){null!==r&&void 0!==r&&r.replicated_block&&(st.current[V][O]=e)},openSidekickView:W,pipeline:G,project:we,ref:ye,runBlock:q,runningBlocks:X,savePipelineContent:Q,scrollTogether:J,selected:w,setAddNewBlockMenuOpenIdx:$e,setAnyInputFocused:ee,setCreatingNewDBTModel:an,setEditingBlock:te,setErrors:ie,setHiddenBlocks:oe,setMountedBlocks:yn,setOutputBlocks:le,setScrollTogether:ve,setSelected:function(e){return ce(!0===e?r:null)},setSelectedBlock:ce,setSelectedOutputBlock:se,setSideBySideEnabled:pe,setTextareaFocused:de,showBlockBrowserModal:he,showBrowseTemplates:fe,showConfigureProjectModal:me,showDataIntegrationModal:ge,showGlobalDataProducts:be,showUpdateBlockModal:xe,sideBySideEnabled:je,textareaFocused:w&&ke,updatePipeline:tt,widgets:Ze,windowWidth:On,children:je&&P&&(0,S.jsx)("div",{style:{paddingBottom:_.WC,paddingTop:_.WC},children:ct})},Pe))})),e}),[n,Ye,ct,t,u,c,a,v,Ee,h,Kn,g,jn,x,Se,Sn,Bn,Nn,j,qn,k,Z,y,I,T,B,D,A,gn,bn,hn,R,N,F,Hn,U,H,rt,ut,W,G,we,q,X,wn,Q,J,$,$e,ee,te,ie,oe,yn,le,ce,se,de,ve,pe,he,fe,me,ge,be,xe,je,ke,ot,tt,Ze,On]),dt=(0,p.useMemo)((function(){return(0,S.jsx)(qi,{addNewBlockAtIndex:n,blocks:g,codeBlocks:at,fetchFileTree:y,fetchPipeline:I,fetchSampleData:E,globalVariables:M,onChangeCodeBlock:H,openSidekickView:W,pipeline:G,savePipelineContent:Q,setErrors:ie,setIntegrationStreams:re,setOutputBlocks:le,setSelectedBlock:ce,setSelectedOutputBlock:se,setSelectedStream:ae})}),[n,g,at,y,I,E,M,H,W,G,Q,ie,re,le,ce,se,ae]),vt=(0,p.useCallback)((function(e){var t="undefined"===typeof nn||null===nn;n((0,di.J8)({blockIndex:nn,blocks:g,filePath:e,isNewBlock:cn,name:vn,repoPathRelativeRoot:null===_e||void 0===_e?void 0:_e.repo_path_relative_root}),(t?Hn:nn+1)-(je?1:0),ce),lt(),de(!0)}),[n,g,lt,cn,vn,nn,Hn,ce,de,je,_e]);(0,p.useEffect)((function(){Ke&&we&&setTimeout((function(){return We(!1)}),Qi.zn)}),[Ke,we]);var pt=(0,p.useCallback)((function(e,n,t){vt(t)}),[vt]);return(0,p.useCallback)((function(e,n){n||vt(e)}),[vt]),(0,S.jsxs)(tn.W,{backend:on.PD,children:[(0,S.jsx)(Qi.lO,{ref:Se,children:He&&(0,S.jsx)(li.Z,{classNames:"pipeline-detail",in:Le,onEntered:function(){return ze(!0)},timeout:1,children:(0,S.jsx)(Qi.fm,{})})}),gn&&(0,S.jsx)(C.Z,{mt:1,px:w.cd,children:dt}),!je&&(0,S.jsx)(C.Z,{mt:1,px:w.cd,children:!gn&&(0,S.jsxs)(S.Fragment,{children:[at,(0,S.jsx)(C.Z,{mt:w.cd,children:ct})]})}),je&&(0,S.jsxs)("div",{style:{position:"relative"},children:[En,at,An,Fn,!(null!==g&&void 0!==g&&g.length)&&(0,S.jsx)(C.Z,{p:w.cd,children:ct})]}),Me&&(0,S.jsx)(jt.Z,{onClickOutside:lt,open:!0,children:(0,S.jsx)(ki,{onClose:lt,onSelectBlockFile:pt})})]})},ro=t(1402),lo=t(31557),uo=t(2842);function co(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function so(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?co(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):co(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ao=function(e){var n=e.after,t=e.afterFooter,i=e.afterHeader,o=e.afterHeightOffset,l=e.afterHidden,u=e.afterInnerHeightMinus,c=e.afterNavigationItems,s=e.afterOverflow,a=e.afterSubheader,d=e.before,v=e.beforeDraggableTopOffset,f=e.beforeHeader,h=e.beforeHeightOffset,m=e.beforeHidden,g=e.beforeNavigationItems,b=e.children,x=e.errors,j=e.footerOffset,k=e.headerOffset,Z=e.mainContainerFooter,y=e.mainContainerHeader,P=e.mainContainerRef,C=e.page,O=e.pipeline,w=e.setAfterHidden,_=e.setAfterWidthForChildren,I=e.setBeforeHidden,E=e.setErrors,T=e.setMainContainerWidth,M=(0,Je.i)().width,B=(0,p.useState)((0,Ye.U2)(Ye.L8,uo.Zt)),D=B[0],A=B[1],R=(0,p.useState)((0,Ye.U2)(Ye.J3,uo.ve)),N=R[0],L=R[1],F=(0,p.useState)(!1),U=F[0],H=F[1],W=(0,p.useState)(!1),K=W[0],z=W[1],q=l,V=w;if(!V){var Y=(0,p.useState)(!!(0,Ye.U2)(Ye.zg)),X=(0,r.Z)(Y,2);q=X[0],V=X[1]}var Q=m,J=I;if(!J){var $=(0,p.useState)(!!(0,Ye.U2)(Ye.Uu)),ee=(0,r.Z)($,2);Q=ee[0],J=ee[1]}(0,p.useEffect)((function(){null===P||void 0===P||!P.current||U||K||null===T||void 0===T||T(P.current.getBoundingClientRect().width)}),[U,K,q,D,Q,N,P,T,M]),(0,p.useEffect)((function(){U||(null===_||void 0===_||_(D),(0,Ye.t8)(Ye.L8,D))}),[U,D,_]),(0,p.useEffect)((function(){K||(0,Ye.t8)(Ye.J3,N)}),[K,N]);var ne=(0,p.useMemo)((function(){var e=[{label:function(){return"Pipelines"},linkProps:{as:"/pipelines",href:"/pipelines"}}];return O&&(e.push.apply(e,[{bold:ci.b7!==C,label:function(){return null===O||void 0===O?void 0:O.uuid},linkProps:{as:"/pipelines/".concat(null===O||void 0===O?void 0:O.uuid),href:"/pipelines/[pipeline]"}}]),ci.b7===C&&e.push.apply(e,[{bold:!0,label:function(){return(0,G.kC)(C)}}])),(0,S.jsx)(lo.Z,{breadcrumbs:e})}),[C,O]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Mt.Z,{title:null===O||void 0===O?void 0:O.name}),(0,S.jsx)(Te.Z,{after:n,afterFooter:t,afterHeader:i,afterHeightOffset:o,afterHidden:q,afterInnerHeightMinus:u,afterMousedownActive:U,afterNavigationItems:c,afterOverflow:s,afterSubheader:a,afterWidth:D,before:d,beforeDraggableTopOffset:v,beforeHeader:f,beforeHeightOffset:h,beforeHidden:Q,beforeMousedownActive:K,beforeNavigationItems:g,beforeWidth:N,footerOffset:j,header:ne,headerOffset:k,mainContainerFooter:Z,mainContainerHeader:y,mainContainerRef:P,navigationShowMore:!0,setAfterHidden:V,setAfterMousedownActive:H,setAfterWidth:A,setBeforeHidden:J,setBeforeMousedownActive:z,setBeforeWidth:L,subtractTopFromBeforeDraggableHeight:!0,children:b}),x&&(0,S.jsx)(jt.Z,{disableClickOutside:!0,isOpen:!0,onClickOutside:function(){return E(null)},children:(0,S.jsx)(ro.Z,so(so({},x),{},{onClose:function(){return E(null)}}))})]})},vo=t(55729),po=t(93808),fo=t(8666),ho=t(72226),mo=t(29644),go=t(46209),bo=t(46568),xo=t(82682),jo=t(4982),ko=t(61896),Zo=(w.iI,jo.O$,w.iI,ko.dN,v.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-cr39lf-0"})(["height:calc(100vh - ","px - ","px);width:fit-content;",""],uo.Wi,Be.nn,(function(e){return e.fullWidth&&"\n width: 100%;\n "})),v.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-cr39lf-1"})(["padding:","px;",""],2*w.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "})),v.default.table.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-cr39lf-2"})(["",""],(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}))),yo=v.default.td.withConfig({displayName:"indexstyle__CellStyle",componentId:"sc-cr39lf-3"})(["display:flex;align-items:center;justify-content:space-between;border:1px solid #1C1C1C;height:100%;",""],(function(e){return!e.noPadding&&"\n padding: 0 ".concat(2*w.iI,"px;\n ")})),Po=t(31748),Co=t(79633);var Oo=function(e){var n=e.copyText,t=e.deleteVariable,i=e.disableKeyEdit,o=e.editStateInit,u=void 0!==o&&o,c=e.fetchVariables,s=e.focusKey,a=e.hideEdit,d=e.obfuscate,v=e.onEnterCallback,h=e.onEscapeCallback,m=e.pipelineUUID,g=e.updateVariable,b=e.variable||{},x=b.uuid,j=b.value,k=(0,p.useRef)(null),y=(0,p.useRef)(null),P=(0,p.useState)(!1),C=P[0],_=P[1],I=(0,p.useState)(x),E=I[0],T=I[1],M=(0,p.useState)(j),B=M[0],D=M[1],A=(0,p.useState)(u),R=A[0],L=A[1],F=(0,f.Db)(Y.ZP.variables.pipelines.useUpdate(m,x),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){L(!1),c()}})}}),U=(0,r.Z)(F,1)[0],H=(0,p.useCallback)((function(e){if("Enter"===e.key){var n=B;try{n=JSON.parse(B)}catch(t){}g?E&&B&&(null===g||void 0===g||g((0,l.Z)({},E,B)),L(!1)):U({variable:{name:E,value:n}}),(0,no.ez)(),null===v||void 0===v||v()}else"Escape"===e.key&&((0,no.ez)(),L(!1),null===h||void 0===h||h())}),[v,h,g,U,E,B]),W=(0,p.useCallback)((function(){(0,no.ez)(),t()}),[t]);(0,p.useEffect)((function(){var e,n;R&&(s?null===k||void 0===k||null===(e=k.current)||void 0===e||e.focus():null===y||void 0===y||null===(n=y.current)||void 0===n||n.focus())}),[R,s]);var G=n||"kwargs['".concat(x,"']");return(0,S.jsx)("div",{onMouseEnter:function(){return _(!0)},onMouseLeave:function(){return _(!1)},children:(0,S.jsxs)(xo.Z,{children:[(0,S.jsx)(bo.Z,{hiddenSmDown:!0,md:1,children:(0,S.jsx)(yo,{noPadding:!0,children:(0,S.jsx)(un.ZP,{backgroundColor:Po.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(G),Bt.Am.success("Successfully copied to clipboard.",{position:Bt.Am.POSITION.BOTTOM_RIGHT,toastId:x})},small:!0,uuid:"Sidekick/GlobalVariables/".concat(x),withIcon:!0,children:(0,S.jsx)(N.Copy,{size:2.5*w.iI})})})}),(0,S.jsx)(bo.Z,{md:4,children:R&&!i?(0,S.jsx)(yo,{children:(0,S.jsx)(Ee.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){T(e.target.value),e.preventDefault()},onKeyDown:H,paddingHorizontal:0,placeholder:"variable",ref:k,small:!0,value:E})}):(0,S.jsx)(yo,{children:(0,S.jsx)(O.ZP,{color:Co.Or,monospace:!0,small:!0,textOverflow:!0,children:x})})}),(0,S.jsx)(bo.Z,{md:7,children:R?(0,S.jsx)(yo,{children:(0,S.jsx)(Ee.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){D(e.target.value),e.preventDefault()},onKeyDown:H,paddingHorizontal:0,placeholder:"enter value",ref:y,small:!0,value:B})}):(0,S.jsxs)(yo,{children:[d?(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:"********"}):(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:j.toString()}),(0,S.jsxs)(Z.Z,{children:[!a&&C&&(0,S.jsx)(un.ZP,{backgroundColor:Po.qJ,borderless:!0,inline:!0,muted:!0,onClick:function(){L(!0)},small:!0,uuid:"Sidekick/GlobalVariables/edit_".concat(x),withIcon:!0,children:(0,S.jsx)(N.Edit,{size:2.5*w.iI})}),t&&C&&(0,S.jsx)(un.ZP,{backgroundColor:Po.qJ,borderless:!0,inline:!0,muted:!0,onClick:W,small:!0,uuid:"Sidekick/GlobalVariables/delete_".concat(x),withIcon:!0,children:(0,S.jsx)(N.Trash,{size:2.5*w.iI})})]})]})})]})})},wo=v.default.div.withConfig({displayName:"indexstyle__BannerStyle",componentId:"sc-1cm3orh-0"})(["border-radius:","px;padding:","px ","px;",""],Me.n_,1.5*w.iI,w.l4,(function(e){return"\n border: ".concat(Me.YF,"px ").concat(Me.M8," ").concat((e.theme||U.Z).interactive.defaultBorder,";\n ")})),_o=t(68781);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 Io(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,l.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}var Eo={borderLess:!0,iconOnly:!0,noBackground:!0,outline:!0,padding:"4px"},To={bold:!0,default:!0,inline:!0,monospace:!0,small:!0},Mo=(0,vi.YW)();var Bo=function(e){e.addNewBlockAtIndex;var n,t,i,o,l=e.block,u=(e.contentByBlockUUID,e.fetchFileTree),c=e.fetchPipeline,s=e.globalDataProducts,a=e.pipeline,d=e.project,v=e.setSelectedBlock,h=(e.showDataIntegrationModal,e.showUpdateBlockModal),m=(0,p.useRef)(null),g=(0,p.useRef)(null),k=(0,p.useMemo)((function(){return null===a||void 0===a?void 0:a.uuid}),[a]),_=(0,p.useMemo)((function(){return(null===a||void 0===a?void 0:a.retry_config)||{}}),[a]),I=(0,p.useMemo)((function(){return!(null!==a&&void 0!==a&&a.run_pipeline_in_one_process)&&[sn.qL.PYSPARK,sn.qL.PYTHON].includes(null===a||void 0===a?void 0:a.type)}),[a]),E=l.color,T=l.configuration,M=l.language,B=l.name,D=l.type,F=l.uuid,U=(0,p.useMemo)((function(){return b.tf.DBT===D}),[D]),H=null===a||void 0===a||null===(n=a.blocks)||void 0===n?void 0:n.findIndex((function(e){return e.uuid===F})),W=(0,p.useMemo)((function(){var e;return null===a||void 0===a||null===(e=a.blocks)||void 0===e?void 0:e[H]}),[H,null===a||void 0===a?void 0:a.blocks]),K=(0,ae.VI)(null,{},[],{uuid:"BlockSettings/index"}),z=(0,r.Z)(K,1)[0],q=(0,p.useMemo)((function(){return(0,L.HK)(s||[],(function(e){return e.uuid}))}),[s]),V=(0,p.useMemo)((function(){var e,n=null===T||void 0===T||null===(e=T.global_data_product)||void 0===e?void 0:e.uuid;if(n&&q)return null===q||void 0===q?void 0:q[n]}),[T,q]),X=Y.ZP.pipelines.detail(fo.b.PIPELINE===(null===V||void 0===V?void 0:V.object_type)&&(null===V||void 0===V?void 0:V.object_uuid),{},{revalidateOnFocus:!1}).data,Q=(0,p.useMemo)((function(){return null===X||void 0===X?void 0:X.pipeline}),[X]),J=(0,p.useState)(null),$=J[0],ee=J[1],ne=(0,p.useState)(!1),te=ne[0],ie=ne[1],oe=(0,p.useState)(!1),re=oe[0],le=oe[1],ue=(0,p.useState)(!1),ce=ue[0],se=ue[1],de=(0,kn.Z)(l);(0,p.useEffect)((function(){(null===de||void 0===de?void 0:de.uuid)!==(null===l||void 0===l?void 0:l.uuid)&&ee(l)}),[l,de]);var ve=(0,p.useMemo)((function(){return(null===$||void 0===$?void 0:$.retry_config)||{}}),[$]),pe=(0,p.useCallback)((function(e){ie(!0),ee(e)}),[]),fe=(0,p.useMemo)((function(){return(0,Mn.gR)((null===$||void 0===$?void 0:$.configuration)||T,["data_integration","file_path","file_source","global_data_product"])}),[null===$||void 0===$?void 0:$.configuration,T]),he=(0,p.useCallback)((function(e){return pe((function(n){return Io(Io({},n),{},{configuration:Io(Io({},null===$||void 0===$?void 0:$.configuration),e)})}))}),[null===$||void 0===$?void 0:$.configuration,pe]),me=(0,p.useMemo)((function(){return null===$||void 0===$?void 0:$.executor_type}),[$]);(0,p.useEffect)((function(){re||!me||_o.R.find((function(e){return e===me}))||le(!0)}),[re,me]);var ge=Y.ZP.blocks.pipelines.detail(k,encodeURIComponent(F),{_format:"with_settings",block_type:D}).data,xe=(0,p.useMemo)((function(){return(null===ge||void 0===ge?void 0:ge.block)||{}}),[ge]),je=(0,p.useMemo)((function(){return null!==xe&&void 0!==xe&&xe.pipelines?null===xe||void 0===xe?void 0:xe.pipelines:[]}),[xe]),Ze=(null===je||void 0===je?void 0:je.length)||1,ye=(0,f.Db)(Y.ZP.blocks.pipelines.useUpdate(k,encodeURIComponent(F)),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){ie(!1),null===u||void 0===u||u(),c(),null!==e&&void 0!==e&&e.block&&v(null===e||void 0===e?void 0:e.block)},onErrorCallback:function(e,n){return z({errors:n,response:e})}})}}),Ce=(0,r.Z)(ye,2),Oe=Ce[0],we=Ce[1].isLoading,_e=((0,p.useCallback)((function(e){return Oe({block:e})}),[Oe]),(0,p.useMemo)((function(){return Ze>=1&&(0,S.jsx)(Zn.cl,{children:(0,S.jsx)(R.Z,{columnFlex:[null,1],columns:[{uuid:"Name"},{uuid:"Project path"}],rows:je.map((function(e){var n,t,i=e.pipeline,o=i.name,r=i.repo_path,l=i.uuid,u=!(null===d||void 0===d||!d.settings),c=(null===a||void 0===a?void 0:a.uuid)===l&&(!u||(null===d||void 0===d||null===(n=d.settings)||void 0===n?void 0:n.path)===r);return[c||u&&(null===d||void 0===d||null===(t=d.settings)||void 0===t?void 0:t.path)!==r?(0,S.jsxs)(O.ZP,{monospace:!0,muted:!0,children:[o||l,c&&" (current)"]},"name"):(0,S.jsx)(P.Z,{href:"/pipelines/".concat(l,"/edit"),monospace:!0,openNewWindow:!0,sameColorAsText:!0,children:o||l},"name"),(0,S.jsx)(O.ZP,{default:!0,monospace:!0,children:r||"-"},"project_path")]})),uuid:"git-branch-blockPipelines"})})}),[je,Ze,a,null===d||void 0===d?void 0:d.settings])),Se=(0,p.useMemo)((function(){return _&&"undefined"!==typeof _&&!(0,Mn.Qr)(_)&&("undefined"!==typeof(null===_||void 0===_?void 0:_.delay)&&"undefined"===typeof(null===ve||void 0===ve?void 0:ve.delay)||"undefined"!==typeof(null===_||void 0===_?void 0:_.exponential_backoff)&&"undefined"===typeof(null===ve||void 0===ve?void 0:ve.exponential_backoff)||"undefined"!==typeof(null===_||void 0===_?void 0:_.max_delay)&&"undefined"===typeof(null===ve||void 0===ve?void 0:ve.max_delay)||"undefined"!==typeof(null===_||void 0===_?void 0:_.retries)&&"undefined"===typeof(null===ve||void 0===ve?void 0:ve.retries))}),[ve,_]),Ie=(0,p.useMemo)((function(){var e;return(null===$||void 0===$||null===(e=$.configuration)||void 0===e?void 0:e.global_data_product)||{}}),[$]),Te=(0,p.useCallback)((function(e){return pe((function(n){var t;return Io(Io({},n),{},{configuration:Io(Io({},null===$||void 0===$?void 0:$.configuration),{},{global_data_product:e(null===$||void 0===$||null===(t=$.configuration)||void 0===t?void 0:t.global_data_product)})})}))}),[$,pe]),Me=(0,p.useMemo)((function(){return(0,Pn.jO)(l,a)}),[l,a]);return(0,p.useMemo)((function(){return Me&&(0,Pn.Uc)(l)}),[l,Me]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(C.Z,{mb:w.HN,pt:w.cd,children:[Ze>1&&(0,S.jsx)(C.Z,{mb:w.Mq,px:w.cd,children:(0,S.jsx)(wo,{children:(0,S.jsxs)(y.ZP,Io(Io({},y.A0),{},{children:[(0,S.jsxs)(Z.Z,{children:[(0,S.jsx)(N.DiamondShared,{fill:Co.$R,size:pn.l2}),(0,S.jsx)(C.Z,{pr:2}),(0,S.jsxs)(O.ZP,{bold:!0,large:!0,lineHeight:3*w.iI,warning:!0,children:["Shared by ",Ze," pipelines"]})]}),!U&&(null===a||void 0===a?void 0:a.type)!==sn.qL.INTEGRATION&&(0,S.jsx)(Rn.Z,{appearBefore:!0,block:!0,label:"Duplicates block so it is no longer shared with any other pipelines (detaches other pipeline associations)",lightBackground:!0,maxWidth:30*w.iI,size:null,children:(0,S.jsx)(be.ZP,Io(Io({},Eo),{},{afterIcon:(0,S.jsx)(N.DiamondDetached,{size:pn.bL}),iconOnly:!1,onClick:function(){return h(Io(Io({},(0,Mn.gR)(W,["all_upstream_blocks_executed","callback_blocks","conditional_blocks","downstream_blocks","executor_config","executor_type","name","outputs","retry_config","status","tags","timeout"])),{},{detach:!0}),"".concat(B,"_copy"),!0)},padding:null,children:"Detach"}))})]}))})}),(0,S.jsx)(C.Z,{mb:w.HN,px:w.cd,children:(0,S.jsxs)(Sn.Z,{noBackground:!0,noBoxShadow:!0,sameColorBorders:!0,children:[(0,S.jsx)(Sn.g,{noBorder:!0,children:(0,S.jsxs)(y.ZP,Io(Io({},y.A0),{},{children:[(0,S.jsx)(Z.Z,{children:(0,S.jsx)(O.ZP,{bold:!0,default:!0,children:"Name"})}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(be.ZP,Io(Io({},Eo),{},{afterIcon:U?null:(0,S.jsx)(N.Edit,{size:pn.bL}),disabled:U,onClick:function(){return h(l,B)},children:(0,S.jsx)(O.ZP,{bold:!0,children:B||""})}))]}))}),b.tf.CUSTOM===(null===l||void 0===l?void 0:l.type)?(0,S.jsx)(Sn.g,{noBorder:!0,children:(0,S.jsxs)(y.ZP,Io(Io({},y.A0),{},{children:[(0,S.jsx)(Z.Z,{children:(0,S.jsx)(O.ZP,{bold:!0,default:!0,children:"Color"})}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(be.ZP,Io(Io({},Eo),{},{afterIcon:(0,S.jsx)(j.Z,{color:E?Mo[E]:null,size:pn.bL,square:!0}),onClick:function(){return h(l,B)},outline:!1,children:(0,S.jsx)(O.ZP,{bold:!0,children:(0,G.kC)(E||"")})}))]}))}):null]})}),(0,S.jsxs)(C.Z,{mb:w.HN,px:w.cd,children:[(0,S.jsx)(A.Z,{level:5,children:"Executor type"}),(0,S.jsxs)(O.ZP,{muted:!0,children:["For more information on this setting, please read the ",(0,S.jsx)(P.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/compute-resource#2-set-executor-type-and-customize-the-compute-resource-of-the-mage-executor",openNewWindow:!0,children:"documentation"}),"."]}),(0,S.jsxs)(C.Z,{mt:1,children:[!re&&(0,S.jsx)(an.Z,{label:"Executor type",onChange:function(e){return pe((function(n){return Io(Io({},n),{},{executor_type:e.target.value})}))},primary:!0,ref:m,value:(null===$||void 0===$?void 0:$.executor_type)||"",children:_o.R.map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))}),re&&(0,S.jsx)(Ee.Z,{label:"Executor type",monospace:!0,onChange:function(e){return pe((function(n){return Io(Io({},n),{},{executor_type:e.target.value})}))},primary:!0,ref:g,setContentOnMount:!0,value:(null===$||void 0===$?void 0:$.executor_type)||""}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(P.Z,{muted:!0,onClick:function(){re?(pe((function(e){return Io(Io({},e),{},{executor_type:null})})),setTimeout((function(){var e;return null===m||void 0===m||null===(e=m.current)||void 0===e?void 0:e.focus()}),1)):setTimeout((function(){var e;return null===g||void 0===g||null===(e=g.current)||void 0===e?void 0:e.focus()}),1),le(!re)},preventDefault:!0,small:!0,children:re?"Select a preset executor type":"Enter a custom executor type"})})]})]}),(0,S.jsxs)(C.Z,{mb:w.HN,px:w.cd,children:[(0,S.jsx)(A.Z,{level:5,children:"Retry configuration"}),(0,S.jsxs)(O.ZP,{muted:!0,children:[Se&&(0,S.jsxs)(S.Fragment,{children:["This block is currently using the retry configuration from the pipeline. You can override the pipeline\u2019s retry configuration for this block.",(0,S.jsx)("br",{})]}),"For more information on this setting, please read the ",(0,S.jsx)(P.Z,{href:"https://docs.mage.ai/orchestration/pipeline-runs/retrying-block-runs",openNewWindow:!0,children:"documentation"}),"."]}),(0,S.jsxs)(C.Z,{mt:1,children:[(0,S.jsxs)(y.ZP,{children:[(0,S.jsx)(Ee.Z,{label:"Retries",monospace:!0,onChange:function(e){return pe((function(n){var t;return Io(Io({},n),{},{retry_config:Io(Io({},null===n||void 0===n?void 0:n.retry_config),{},{retries:"undefined"!==typeof e.target.value&&null!==e.target.value&&(null===(t=e.target.value)||void 0===t?void 0:t.length)>=1?Number(e.target.value):null})})}))},primary:!0,required:"undefined"===typeof(null===_||void 0===_?void 0:_.retries),setContentOnMount:!0,type:"number",value:"undefined"!==typeof(null===ve||void 0===ve?void 0:ve.retries)?null===ve||void 0===ve?void 0:ve.retries:(null===_||void 0===_?void 0:_.retries)||""}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(Ee.Z,{label:"Delay",monospace:!0,onChange:function(e){return pe((function(n){var t;return Io(Io({},n),{},{retry_config:Io(Io({},null===n||void 0===n?void 0:n.retry_config),{},{delay:"undefined"!==typeof e.target.value&&null!==e.target.value&&(null===(t=e.target.value)||void 0===t?void 0:t.length)>=1?Number(e.target.value):null})})}))},primary:!0,required:"undefined"===typeof(null===_||void 0===_?void 0:_.delay),setContentOnMount:!0,type:"number",value:"undefined"!==typeof(null===ve||void 0===ve?void 0:ve.delay)?null===ve||void 0===ve?void 0:ve.delay:(null===_||void 0===_?void 0:_.delay)||""}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(Ee.Z,{label:"Max delay",monospace:!0,onChange:function(e){return pe((function(n){var t;return Io(Io({},n),{},{retry_config:Io(Io({},null===n||void 0===n?void 0:n.retry_config),{},{max_delay:"undefined"!==typeof e.target.value&&null!==e.target.value&&(null===(t=e.target.value)||void 0===t?void 0:t.length)>=1?Number(e.target.value):null})})}))},primary:!0,required:"undefined"===typeof(null===_||void 0===_?void 0:_.max_delay),setContentOnMount:!0,type:"number",value:"undefined"!==typeof(null===ve||void 0===ve?void 0:ve.max_delay)?null===ve||void 0===ve?void 0:ve.max_delay:(null===_||void 0===_?void 0:_.max_delay)||""})]}),(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsx)(x.Z,{checked:"undefined"===typeof(null===ve||void 0===ve?void 0:ve.exponential_backoff)&&"undefined"!==typeof(null===_||void 0===_?void 0:_.exponential_backoff)?!(null===_||void 0===_||!_.exponential_backoff):!(null===ve||void 0===ve||!ve.exponential_backoff),label:"Exponential backoff",onClick:function(){return pe((function(e){var n;return Io(Io({},e),{},{retry_config:Io(Io({},null===e||void 0===e?void 0:e.retry_config),{},{exponential_backoff:"undefined"===typeof(null===ve||void 0===ve?void 0:ve.exponential_backoff)&&"undefined"!==typeof(null===_||void 0===_?void 0:_.exponential_backoff)?!(null!==_&&void 0!==_&&_.exponential_backoff):!(null!==e&&void 0!==e&&null!==(n=e.retry_config)&&void 0!==n&&n.exponential_backoff)})})}))}})})]})]}),I&&(0,S.jsxs)(C.Z,{mb:w.HN,px:w.cd,children:[(0,S.jsx)(A.Z,{level:5,children:"Block run timeout"}),(0,S.jsx)(C.Z,{mb:1}),(0,S.jsx)(Ee.Z,{label:"Time in seconds",monospace:!0,onChange:function(e){return pe((function(n){return Io(Io({},n),{},{timeout:e.target.value})}))},primary:!0,setContentOnMount:!0,type:"number",value:(null===$||void 0===$?void 0:$.timeout)||""}),(0,S.jsx)(C.Z,{mb:1}),(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:"The block timeout will only be applied when the block is run through a trigger. If a block times out, the block run will be set to a failed state."})]}),U&&(0,S.jsxs)(C.Z,{mb:w.HN,px:w.cd,children:[(0,S.jsx)(A.Z,{level:5,children:"dbt settings"}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(x.Z,{checked:!(null===$||void 0===$||null===(t=$.configuration)||void 0===t||null===(i=t.dbt)||void 0===i||!i.disable_tests),label:"Disable automatically running dbt tests",onClick:function(){return pe((function(e){var n,t,i;return Io(Io({},e),{},{configuration:Io(Io({},null===e||void 0===e?void 0:e.configuration),{},{dbt:Io(Io({},null===e||void 0===e||null===(n=e.configuration)||void 0===n?void 0:n.dbt),{},{disable_tests:!(null!==e&&void 0!==e&&null!==(t=e.configuration)&&void 0!==t&&null!==(i=t.dbt)&&void 0!==i&&i.disable_tests)})})})}))}})})]}),b.Lk.includes(D)&&b.t6.PYTHON===M&&(0,S.jsxs)(C.Z,{mb:w.HN,px:w.cd,children:[(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(A.Z,{level:5,children:"Block variables"}),(0,S.jsx)(C.Z,{ml:2}),(0,S.jsx)(un.ZP,{Icon:N.Add,blackBorder:!0,halfPaddingBottom:!0,halfPaddingTop:!0,inline:!0,onClick:function(){return se((function(e){return!e}))},smallIcon:!0,uuid:"Sidekick/BlockSettings/addNewBlockVariable",children:"New"})]}),(0,S.jsxs)(C.Z,{mb:w.cd,mt:1,children:[(0,S.jsxs)(O.ZP,{muted:!0,children:["Press",(0,S.jsx)(O.ZP,Io(Io({},To),{},{children:" Enter"}))," or",(0,S.jsx)(O.ZP,Io(Io({},To),{},{children:" Return"}))," on a row to add or update a variable. These variables are only accessible in this block\xa0",(0,S.jsxs)(O.ZP,Io(Io({},To),{},{bold:!1,children:["(",F,")."]})),(0,S.jsxs)(O.ZP,{inline:!0,muted:!0,children:[" Refer to the",(0,S.jsx)(P.Z,{href:"https://docs.mage.ai/development/variables/block-variables",openNewWindow:!0,children:" documentation"})," for more details."]})]}),(0,S.jsxs)(O.ZP,{muted:!0,children:[(0,S.jsx)(O.ZP,{bold:!0,inline:!0,warning:!0,children:"Note: "}),"Click the",(0,S.jsx)(O.ZP,Io(Io({},To),{},{children:" Update block settings"}))," button below to save changes. If you do not, any new or updated block variables will not be persisted."]})]}),(0,S.jsxs)(C.Z,{mb:w.cd,children:[ce&&(0,S.jsx)(Oo,{editStateInit:!0,focusKey:!0,onEnterCallback:function(){return se(!1)},onEscapeCallback:function(){return se(!1)},updateVariable:he},"new_block_variable"),null===(o=Object.entries(fe))||void 0===o?void 0:o.map((function(e){var n=e[0];return(0,S.jsx)(Oo,{copyText:"kwargs['configuration'].get('".concat(n,"')"),deleteVariable:function(){var e=Io({},null===$||void 0===$?void 0:$.configuration);delete e[n],pe((function(n){return Io(Io({},n),{},{configuration:Io({},e)})}))},disableKeyEdit:!0,updateVariable:he,variable:{uuid:n,value:e[1]}},n)}))]})]}),b.tf.GLOBAL_DATA_PRODUCT===D&&(0,S.jsxs)(C.Z,{mb:w.HN,children:[(0,S.jsx)(C.Z,{px:w.cd,children:(0,S.jsx)(A.Z,{level:5,children:"Override global data product settings"})}),(0,S.jsx)(C.Z,{mt:w.Mq,children:(0,S.jsx)(ho.Z,{objectAttributes:Ie,originalAttributes:V,setObjectAttributes:Te})}),(0,S.jsx)(C.Z,{mt:w.Mq,children:(0,S.jsx)(mo.Z,{objectAttributes:Ie,originalAttributes:V,setObjectAttributes:Te})}),(0,S.jsx)(C.Z,{mt:w.Mq,children:(0,S.jsx)(go.Z,{blocks:null===Q||void 0===Q?void 0:Q.blocks,objectAttributes:Ie,originalAttributes:V,setObjectAttributes:Te})})]}),(0,S.jsx)(C.Z,{px:w.cd,children:(0,S.jsx)(be.ZP,{disabled:!te,loading:we,onClick:function(){return Oe({block:{configuration:null===$||void 0===$?void 0:$.configuration,executor_type:null===$||void 0===$?void 0:$.executor_type,retry_config:ve,timeout:null===$||void 0===$?void 0:$.timeout}})},primary:!0,children:"Update block settings"})})]}),(0,S.jsxs)(C.Z,{mb:w.HN,children:[!ge&&(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(ke.Z,{inverted:!0})}),ge&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsxs)(A.Z,{level:5,children:["Pipelines using this block (",Ze,")"]}),(0,S.jsx)(O.ZP,{default:!0,children:"A shared block is available to and reused by multiple pipelines. It enables you to write code once and have it easily accessible anywhere in the workspace. As a result, any code changes will affect all pipelines sharing the block."})]}),_e]})]})]})},Do=t(4006),Ao=t(20266),Ro=["bold","defaultColor","description","disableWordBreak","fullWidth","inputValue","inputWidth","invertedTheme","label","labelColor","menuOpen","monospace","muted","onClick","notRequired","selectedTextProps","small","stacked","suffixValue","tooltipProps","value"];function No(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?No(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):No(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Fo=v.default.div.withConfig({displayName:"LabelWithValueClicker__LabelStyle",componentId:"sc-1hzpn4h-0"})(["margin-bottom:","px;"],.25*w.iI),Uo=v.default.div.withConfig({displayName:"LabelWithValueClicker__DescriptionStyle",componentId:"sc-1hzpn4h-1"})([""]);var Ho=function(e){var n=e.bold,t=void 0===n||n,i=e.defaultColor,o=e.description,r=e.disableWordBreak,l=e.fullWidth,u=e.inputValue,c=e.inputWidth,s=e.invertedTheme,a=e.label,d=e.labelColor,v=e.menuOpen,f=void 0!==v&&v,h=e.monospace,m=e.muted,g=e.onClick,b=e.notRequired,x=e.selectedTextProps,j=e.small,k=e.stacked,w=e.suffixValue,_=e.tooltipProps,I=e.value,E=(0,In.Z)(e,Ro),T=(0,p.useRef)(null),M=(0,p.useState)(!1),B=M[0],D=M[1],A=(0,p.useState)(!1),R=A[0],N=A[1],L=a&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.ZP,{bold:t,color:d,inverted:s,lineHeight:20,monospace:h,muted:m,small:j,children:a}),_&&(0,S.jsx)(C.Z,{ml:1,children:(0,S.jsx)(Rn.Z,Lo({muted:!0},_))})]}),F=(0,S.jsxs)(Z.Z,{flex:l?"1":"none",children:[I&&(0,S.jsx)(P.Z,{block:!0,danger:null===x||void 0===x?void 0:x.danger,fullWidth:!0,muted:m,onClick:function(){g(),T.current&&T.current.focus(),D(!0)},preventDefault:!0,sameColorAsText:m||!(null!==x&&void 0!==x&&x.primary)&&!(null!==x&&void 0!==x&&x.danger)&&!(null!==x&&void 0!==x&&x.warning),underline:null===x||void 0===x?void 0:x.underline,warning:null===x||void 0===x?void 0:x.warning,children:(0,S.jsx)(O.ZP,Lo(Lo({inverted:s,muted:m},x),{},{disableWordBreak:r,monospace:h,small:j,title:c?I:null,width:c,children:I}))}),(0,S.jsx)(Ee.Z,Lo(Lo({},E),{},{basic:!0,defaultColor:i,fullWidth:l,invertedTheme:s,monospace:h,onBlur:function(e){D(!1),E.onBlur&&E.onBlur(e),R||N(!0)},onFocus:function(e){D(!0),E.onFocus&&E.onFocus(e)},ref:T,small:j,value:u,visible:!I}))]}),U=o&&(0,S.jsx)(Uo,{children:(0,S.jsx)(O.ZP,{dangerouslySetInnerHTML:{__html:o},monospace:h,muted:!0,small:j})}),H=(0,p.useMemo)((function(){return(0,S.jsx)(O.ZP,{default:!0,small:j,children:w})}),[j,w]);return(0,S.jsxs)(S.Fragment,{children:[k&&(0,S.jsxs)(S.Fragment,{children:[L&&(0,S.jsxs)(Fo,{children:[(0,S.jsx)(y.ZP,{alignItems:"center",fullHeight:!1,fullWidth:!0,children:L}),U]}),(0,S.jsxs)(y.ZP,{fullWidth:l,children:[F,w&&H]})]}),!k&&(0,S.jsxs)(y.ZP,{alignItems:"center",fullWidth:!0,children:[L&&(0,S.jsxs)(S.Fragment,{children:[L,(0,S.jsx)(C.Z,{ml:1})]}),F,w&&H]}),R&&!B&&!I&&!f&&!b&&(0,S.jsx)(O.ZP,{danger:!0,small:j,children:"This field is required."})]})},Wo=t(10305),Go=t(84820),Ko=t(85108),zo=t(97301);function qo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Vo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?qo(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):qo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Yo(e,n){var t,i,o,u,c,s,a=e.autocompleteItems,d=e.block,h=e.blockRefs,m=e.blocks,g=e.deleteWidget,x=e.executionState,j=e.fetchPipeline,k=e.fetchFileTree,I=e.messages,E=void 0===I?[]:I,T=e.onChangeContent,M=e.pipeline,B=e.runBlock,D=e.runningBlocks,A=e.savePipelineContent,R=e.selected,F=e.setAnyInputFocused,H=e.setErrors,W=e.setSelectedBlock,K=e.setTextareaFocused,z=e.textareaFocused,q=e.updateWidget,V=e.width,X=(0,p.useRef)(null),Q=(0,p.useContext)(v.ThemeContext),J=Y.ZP.blocks.pipelines.detail(null===M||void 0===M?void 0:M.uuid,null===d||void 0===d?void 0:d.upstream_blocks[0]).data,$=(null===J||void 0===J||null===(t=J.block)||void 0===t?void 0:t.outputs)||(null===d||void 0===d?void 0:d.outputs)||[],ee=(0,p.useState)(null),ne=ee[0],te=ee[1],ie=(0,p.useState)(null===(i=d.configuration)||void 0===i?void 0:i.chart_type),oe=ie[0],re=ie[1],le=(0,p.useState)(d.configuration),ue=le[0],ce=le[1],se=(0,p.useState)(d.content),ae=se[0],de=se[1],ve=(0,p.useState)(!oe||0===$.length),pe=ve[0],fe=ve[1],he=(0,p.useState)(!1),me=he[0],ge=he[1],be=(0,p.useState)(null),je=be[0],Ze=be[1],ye=(0,p.useState)(null===d||void 0===d?void 0:d.upstream_blocks),Ce=ye[0],Oe=ye[1],we=(0,p.useState)((null===$||void 0===$?void 0:$.length)||0),_e=we[0],Se=we[1],Ie=(0,p.useState)(d.uuid),Te=Ie[0],Me=Ie[1],Be=Ko.G8[oe],De=Ko.x8[oe],Ae=(0,p.useMemo)((function(){return null===m||void 0===m?void 0:m.filter((function(e){var n=e.type;return[b.tf.DATA_LOADER,b.tf.TRANSFORMER].includes(n)}))}),[m]),Re=(0,p.useMemo)((function(){return(0,L.HK)(Ae,(function(e){return e.uuid}))}),[Ae]),Ne=!!D.find((function(e){return e.uuid===d.uuid}))||(null===E||void 0===E?void 0:E.length)>=1&&x!==ii.uF.IDLE,Le=(0,p.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]),Fe=!!Le.find((function(e){return e.error})),Ue=Le.length>=1,He=(0,p.useMemo)((function(){return{blockType:d.type,hasError:Fe,selected:R}}),[d.type,Fe,R]);if(null!==Le&&void 0!==Le&&Le.length){var We,Ge,Ke=Le.length-1;s=null===Le||void 0===Le||null===(We=Le[Ke])||void 0===We||null===(Ge=We.data)||void 0===Ge?void 0:Ge[0]}s?(s=(s=s.slice(1,s.length-1)).replaceAll('\\"','"').replaceAll("\\'","'"),(0,G.Pb)(s)&&(c=JSON.parse(s))):(null===$||void 0===$?void 0:$.length)>=1&&(c={},$.forEach((function(e){var n=e||{},t=n.text_data,i=n.type,o=n.variable_uuid;ii.Gi.TEXT===i&&(0,G.Pb)(t)&&(c[o]=JSON.parse(t))})));var ze=(0,p.useCallback)((function(e){var n=Vo(Vo(Vo({},d),e),{},{configuration:Vo(Vo({},d.configuration),e.configuration)});A().then((function(){B({block:n,code:ae,ignoreAlreadyRunning:!0,runUpstream:!!Ce.find((function(e){var n;return![b.DA.EXECUTED,b.DA.UPDATED].includes(null===(n=Re[e])||void 0===n?void 0:n.status)}))})})),Se((function(e){return e+1}))}),[d,Re,ae,B,A,Se,Ce]),Ve=(0,p.useCallback)((function(e){de(e),T(e)}),[T,de]),Ye=(0,p.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.autoRun;ce((function(n){return Vo(Vo({},n),e)}));var i=Vo(Vo({},d),{},{configuration:Vo(Vo(Vo({},ue),e),{},{chart_type:oe})});q(i),_e&&t&&ze(i)}),[d,oe,ue,_e,ze,ce,q]);(0,p.useEffect)((function(){te({python:(0,Go.Z)({autocompleteItems:a,block:d,blocks:m,pipeline:M})})}),[a,d,m,M]);var Xe=(0,p.useMemo)((function(){return(0,S.jsx)(xe.Z,{autoHeight:!0,autocompleteProviders:ne,onChange:Ve,selected:R,setSelected:function(e){return W(!0===e?d:null)},setTextareaFocused:K,showLineNumbers:!1,textareaFocused:z||Ji.oV.TABLE===oe&&!pe,value:ae,width:"100%"})}),[ne,d,oe,ae,pe,R,W,K,z,Ve]),Je=(0,p.useMemo)((function(){return(Fe||Ue)&&(0,S.jsx)(Ao.Z,Vo(Vo({},He),{},{block:d,contained:!1,hideExtraInfo:!0,isInProgress:Ne,messages:Le,selected:R}))}),[d,He,Fe,Ue,Ne,Le,R]),$e=(0,p.useMemo)((function(){return ue[Ji.v8]||1}),[ue]),en=(0,kn.Z)(pe),nn=(0,kn.Z)(V),tn=(0,kn.Z)(null===ue||void 0===ue?void 0:ue[Ji.v8]);(0,p.useEffect)((function(){var e,n=null===X||void 0===X||null===(e=X.current)||void 0===e?void 0:e.getBoundingClientRect();en!==pe||nn!==V||tn!==$e?(Ze(0),setTimeout((function(){var e,n,t=null===X||void 0===X||null===(e=X.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.width;t&&Ze(t)}),100)):n&&Ze(n.width)}),[pe,en,X,Ze,V,nn,$e,tn]);var on=(0,p.useMemo)((function(){var e=[];return Ce.forEach((function(n,t){var i=Re[n],o=(0,_.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)(C.Z,{ml:2,children:[(0,S.jsxs)(O.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:["df_",t+1]})," ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,S.jsx)(P.Z,{color:o,inline:!0,onClick:function(){var e,n,t=null===h||void 0===h||null===(e=h.current)||void 0===e?void 0:e["".concat(null===i||void 0===i?void 0:i.type,"s/").concat(null===i||void 0===i?void 0:i.uuid,".py")];null===t||void 0===t||null===(n=t.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,S.jsx)(O.ZP,{color:o,monospace:!0,small:!0,children:n})})]},n))})),e}),[h,Re,Q,Ce]),rn=(0,p.useMemo)((function(){var e,n=[],t=null===Be||void 0===Be||null===(e=Be.code)||void 0===e?void 0:e.reduce((function(e,n){var t=n.uuid;return Ji.Tv.includes(t)?e.concat(t):e}),[]);return null===t||void 0===t||t.forEach((function(e){var t=ue[e];if(t){var i,o,r=null===(i=Ko.SR[oe])||void 0===i||null===(o=i[e])||void 0===o?void 0:o.call(i);n.push((0,S.jsxs)(C.Z,{ml:2,children:[(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:t})," ",r&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,S.jsx)(O.ZP,{default:!0,inline:!0,small:!0,children:r})]})]},t))}})),n}),[oe,ue,Be]),ln=(0,kn.Z)(oe),cn=(0,kn.Z)(Ce);(0,p.useEffect)((function(){if((!ln&&oe&&null!==Ce&&void 0!==Ce&&Ce.length||(null===cn||void 0===cn||!cn.length)&&(null===Ce||void 0===Ce?void 0:Ce.length)>=1&&oe)&&!ae&&(0,Mn.Qr)(ue)&&De){var e=Vo(Vo({},d),{},{upstream_blocks:Ce});De.configuration&&Ye(De.configuration(e)),De.content&&Ve(De.content(e))}}),[d,oe,ln,ue,ae,De,Ye,Ve,Ce,cn]);var sn=(0,p.useMemo)((function(){return Object.entries(Be||{}).reduce((function(e,n){var t=(0,r.Z)(n,2),i=t[0],o=t[1];return Vo(Vo({},e),{},(0,l.Z)({},i,o.map((function(e){var n,t=e.autoRun,i=e.label,o=e.monospace,r=e.options,u=e.settings,c=void 0===u?{}:u,s=e.type,a=e.uuid,v={fullWidth:!0,key:a,label:(0,G.kC)(i()),monospace:o,onBlur:function(){return W(d)},onChange:function(e){return Ye((0,l.Z)({},a,e.target.value),{autoRun:t})},onFocus:function(){return W(d)},value:(null===ue||void 0===ue?void 0:ue[a])||""},p=(null!==J&&void 0!==J&&J.block?[J.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(Ko.VR.COLUMNS===s){var f=ue[a]||[];n=(0,S.jsxs)(S.Fragment,{children:[(!c.maxValues||f.length<c.maxValues)&&(0,S.jsx)(an.Z,Vo(Vo({},v),{},{onChange:function(e){var n=ue[a]||[],i=e.target.value;n.includes(i)?n=(0,L.Od)(n,(function(e){return e===i})):n.push(i),Ye((0,l.Z)({},a,n),{autoRun:t})},value:null,children:(0,L.YC)(p.filter((function(e){return!f.includes(e)})),(function(e){return e})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))})),f.map((function(e){return(0,S.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,S.jsx)(Dn.Z,{label:e,onClick:function(){Ye((0,l.Z)({},a,(0,L.Od)(f,(function(n){return n===e}))),{autoRun:t})}})},e)}))]})}else if(Ko.VR.METRICS===s){var h=ue[a]||[];n=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O.ZP,{bold:!0,children:"Metrics"}),(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:"Select a column and an aggregation function."}),(0,S.jsxs)(Wo.Z,{onChange:function(e,n){var i=n.resetValues,o=n.setValues;2===e.filter((function(e){return!!e})).length&&(h.find((function(n){var t=n.aggregation;return n.column===e[1]&&t===e[0]}))||(Ye((0,l.Z)({},a,h.concat({aggregation:e[0],column:e[1]})),{autoRun:t}),o([null,null]),i()))},children:[(0,S.jsx)(an.Z,Vo(Vo({},v),{},{label:"aggregation",children:(0,L.YC)(Ji.bn,(function(e){return e})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))})),(0,S.jsx)(an.Z,Vo(Vo({},v),{},{label:"column",children:(0,L.YC)(p,(function(e){return e})).map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))}))]}),h.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)(Dn.Z,{label:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,children:[n,"("]}),i,(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:")"})]}),onClick:function(){Ye((0,l.Z)({},a,(0,L.Od)(h,(function(e){var t=e.aggregation,o=e.column;return n===t&&i===o}))),{autoRun:t})}})},"".concat(n,"(").concat(i,")"))}))]})}else n=r?(0,S.jsx)(an.Z,Vo(Vo({},v),{},{children:r.map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))})):(0,S.jsx)(Ee.Z,Vo(Vo({},v),{},{type:s}));return(0,S.jsx)(C.Z,{mb:1,children:n},a)}))))}),{noCode:[]})}),[d,ue,Be,J,W,Ye]),dn=sn.code,vn=sn.noCode,pn=(0,f.Db)(Y.ZP.widgets.pipelines.useUpdate(null===M||void 0===M?void 0:M.uuid,d.uuid),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){ge(!1),j(),null===k||void 0===k||k()},onErrorCallback:function(e,n){return null===H||void 0===H?void 0:H({errors:n,response:e})}})}}),fn=(0,r.Z)(pn,1)[0],hn="ChartBlock/".concat(d.uuid),mn=(0,Qe.y)(),gn=mn.registerOnKeyDown,bn=mn.unregisterOnKeyDown;return(0,p.useEffect)((function(){return function(){bn(hn)}}),[bn,hn]),gn(hn,(function(e,n,t){me&&String(t[0])===String(qe.Uq)&&String(t[1])!==String(qe.zX)&&fn({widget:Vo(Vo({},d),{},{name:Te})})}),[d,me,Te,fn]),(0,S.jsx)(bo.Z,{md:12*$e,sm:12,children:(0,S.jsxs)(zo.pM,{ref:n,children:[(0,S.jsx)(C.Z,{mt:1,pt:1,px:1,children:(0,S.jsxs)(y.ZP,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{flex:1,style:{position:"relative"},children:[(0,S.jsx)(Ho,{bold:!1,fullWidth:!0,inputValue:Te,inputWidth:(null===n||void 0===n||null===(o=n.current)||void 0===o||null===(u=o.getBoundingClientRect())||void 0===u?void 0:u.width)<265?7*w.iI:null,notRequired:!0,onBlur:function(){return setTimeout((function(){return ge(!1)}),300)},onChange:function(e){Me(e.target.value),e.preventDefault()},onClick:function(){F(!0),ge(!0)},onFocus:function(){F(!0),ge(!0)},small:!0,stacked:!0,value:!me&&d.uuid}),me&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{ml:1}),(0,S.jsx)(P.Z,{noWrapping:!0,onClick:function(){return fn({widget:Vo(Vo({},d),{},{name:Te})})},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update chart name"})]})]}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(an.Z,{compact:!0,onChange:function(e){var n=[e.target.value],t=Vo(Vo({},d),{},{upstream_blocks:n});q(t),ze(t),Oe(n)},placeholder:"Source block",small:!0,value:(null===Ce||void 0===Ce?void 0:Ce[0])||"",children:null===Ae||void 0===Ae?void 0:Ae.map((function(e){var n=e.uuid;return(0,S.jsx)("option",{value:n,children:n},n)}))}),(0,S.jsx)(C.Z,{mr:1}),!Ne&&(0,S.jsx)(Rn.Z,{appearBefore:!0,default:!0,label:"Run chart block",size:null,widthFitContent:!0,children:(0,S.jsx)(un.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return ze(d)},uuid:"ChartBlock/run/".concat(d.uuid),children:(0,S.jsx)(N.PlayButtonFilled,{size:2*w.iI})})}),ii.uF.QUEUED===x&&(0,S.jsx)(ke.Z,{color:(Q||U.Z).content.active,small:!0,type:"cylon"}),ii.uF.BUSY===x&&(0,S.jsx)(ke.Z,{color:(Q||U.Z).content.active,small:!0}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(Rn.Z,{appearBefore:!0,default:!0,label:"Edit chart",size:null,widthFitContent:!0,children:(0,S.jsx)(un.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return fe((function(e){return!e}))},selected:pe,uuid:"ChartBlock/edit/".concat(d.uuid),children:(0,S.jsx)(N.Edit,{size:2*w.iI})})}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(Rn.Z,{appearBefore:!0,default:!0,label:"Delete chart",size:null,widthFitContent:!0,children:(0,S.jsx)(un.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return g(d)},uuid:"ChartBlock/delete/".concat(d.uuid),children:(0,S.jsx)(N.Trash,{size:2*w.iI})})})]})]})}),(0,S.jsx)(C.Z,{mt:1}),(0,S.jsxs)(y.ZP,{fullWidth:!0,justifyContent:"space-between",children:[(0,S.jsx)(Z.Z,{flex:6,ref:X,children:c&&!(0,Mn.Qr)(c)&&(0,S.jsx)(C.Z,{pb:3,children:(0,S.jsx)(Do.Z,{block:Vo(Vo({},d),{},{configuration:Vo(Vo({},d.configuration),ue)}),data:c,width:je})})}),pe&&(0,S.jsx)(zo.Tb,{children:(0,S.jsxs)(y.ZP,{flexDirection:"column",fullWidth:!0,children:[(0,S.jsx)(C.Z,{mb:1,children:(0,S.jsx)(an.Z,{onChange:function(e){var n=e.target.value,t=Vo(Vo({},d),{},{configuration:Vo(Vo({},ue),{},{chart_type:n})});q(t),ze(t),re(n)},placeholder:"Select chart type",value:oe,children:Ji.CK.map((function(e){return(0,S.jsx)("option",{value:e,children:(0,G.kC)(e)},e)}))})}),(0,S.jsx)(C.Z,{mb:1,children:(0,S.jsx)(an.Z,{onChange:function(e){return Ye((0,l.Z)({},Ji.v8,e.target.value))},placeholder:"Chart width",value:(null===ue||void 0===ue?void 0:ue[Ji.v8])||1,children:[["1/2 width",.5],["full width",1]].map((function(e){var n=(0,r.Z)(e,2),t=n[0],i=n[1];return(0,S.jsx)("option",{value:i,children:t},t)}))})}),vn]})})]}),pe&&!(null===dn||void 0===dn||!dn.length)&&b.t6.SQL!==d.language&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(C.Z,{my:1,px:1,children:[(0,S.jsx)(O.ZP,{bold:!0,children:"Custom chart code"}),(0,S.jsxs)(O.ZP,{muted:!0,children:["Write custom logic mapping data to input values for your chart.",(0,S.jsx)("br",{}),"This code is only executed if you don\u2019t have any columns or metrics selected."]})]}),(0,S.jsxs)(zo.T7,{children:[Ce.length>=1&&(0,S.jsxs)(zo.y9,{children:[(0,S.jsxs)(O.ZP,{muted:!0,small:!0,children:["Variables you can use in your code: ",on]}),(0,S.jsxs)(O.ZP,{muted:!0,small:!0,children:["Variables that you must define: ",rn]})]}),Xe]})]}),Je&&(0,S.jsx)(C.Z,{px:1,children:Je})]})})}var Xo=p.forwardRef(Yo),Qo=["blockRefs","blocks","chartRefs","deleteWidget","messages","onChangeChartBlock","runBlock","runningBlocks","savePipelineContent","selectedBlock","setAnyInputFocused","setErrors","setSelectedBlock","setTextareaFocused","textareaFocused","updateWidget","widgets","width"];function Jo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function $o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Jo(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Jo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var er=function(e){var n=e.blockRefs,t=e.blocks,i=e.chartRefs,o=e.deleteWidget,r=e.messages,u=e.onChangeChartBlock,c=e.runBlock,s=e.runningBlocks,a=e.savePipelineContent,d=e.selectedBlock,v=e.setAnyInputFocused,f=e.setErrors,h=e.setSelectedBlock,m=e.setTextareaFocused,g=e.textareaFocused,b=e.updateWidget,x=e.widgets,j=e.width,k=(0,In.Z)(e,Qo),Z=(0,p.useMemo)((function(){return s.reduce((function(e,n,t){return $o($o({},e),{},(0,l.Z)({},n.uuid,$o($o({},n),{},{priority:t})))}),{})}),[s]);return(0,S.jsxs)(y.ZP,{flexDirection:"column",fullWidth:!0,children:[(0,S.jsx)(xo.Z,{fullHeight:!0,style:{marginLeft:.5*w.iI,marginRight:.5*w.iI},children:null===x||void 0===x?void 0:x.map((function(e){var l=e.uuid,x=Z[l],y=x?0===x.priority?ii.uF.BUSY:ii.uF.QUEUED:ii.uF.IDLE;return i.current[l]=(0,p.createRef)(),(0,p.createElement)(Xo,$o($o({},k),{},{block:e,blockRefs:n,blocks:t,chartRefs:i,deleteWidget:o,executionState:y,key:l,messages:r[l],onChangeContent:function(e){return u(l,e)},ref:i.current[l],runBlock:c,runningBlocks:s,savePipelineContent:a,selected:(null===d||void 0===d?void 0:d.uuid)===l,setAnyInputFocused:v,setErrors:f,setSelectedBlock:h,setTextareaFocused:m,textareaFocused:g,updateWidget:b,width:j}))}))}),(0,S.jsx)("div",{style:{height:"80vh"}})]})},nr=v.default.svg.withConfig({displayName:"EmptyCharts__SVGStyle",componentId:"sc-ttsjrp-0"})([""]),tr=function(e){var n=e.size,t=void 0===n?20:n,i=e.viewBox,o=void 0===i?"0 0 358 305":i;return(0,S.jsxs)(nr,{height:t*(305/358),viewBox:o,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 ir,or=function(e){var n=e.blocksInNotebook;return e.extensionOption,(0,p.useMemo)((function(){return(null===n||void 0===n?void 0:n.filter((function(e){var n=e.type;return b.tf.DBT===n})))||[]}),[n]),(0,S.jsx)(S.Fragment,{})};function rr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function lr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?rr(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):rr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}!function(e){e.DBT="dbt",e.GREAT_EXPECTATIONS="great_expectations"}(ir||(ir={}));var ur=function(e){var n,t,i=e.block,o=e.blockActionDescription,r=e.blocks,l=e.inputPlaceholder,u=e.loading,c=e.onClickTag,s=e.runBlockAndTrack,a=e.supportedUpstreamBlockLanguages,d=e.supportedUpstreamBlockTypes,f=e.updateBlock,h=(0,p.useContext)(v.ThemeContext),m=(0,p.useState)(""),g=m[0],b=m[1],P=(0,p.useState)(!1),I=P[0],E=P[1],T=(0,p.useState)(null),M=T[0],B=T[1],D=(0,p.useMemo)((function(){return(0,L.HK)(r,(function(e){return e.uuid}))}),[r]);(0,p.useEffect)((function(){M||B((0,L.HK)((null===i||void 0===i?void 0:i.upstream_blocks)||[],(function(e){return e})))}),[i,M]);var A=(0,p.useMemo)((function(){return(null===r||void 0===r?void 0:r.filter((function(e){var n=e.name,t=e.type,i=e.uuid;return((null===n||void 0===n?void 0:n.toLowerCase().includes(null===g||void 0===g?void 0:g.toLowerCase()))||(null===i||void 0===i?void 0:i.toLowerCase().includes(null===g||void 0===g?void 0:g.toLowerCase())))&&(null===d||void 0===d?void 0:d.includes(t))})))||[]}),[g,r,d]),R=(0,p.useMemo)((function(){var e=[];return null===A||void 0===A||A.forEach((function(n,t){var i=n.color,o=n.language,r=n.type,l=n.uuid,u=(0,_.qn)(r,{blockColor:i,theme:h}).accent;t>=1&&e.push((0,S.jsx)(k.Z,{light:!0},"divider-".concat(l)));var c=!(null===M||void 0===M||!M[l]),s=null!==a&&"undefined"!==typeof a&&!(null!==a&&void 0!==a&&a.includes(o));e.push((0,S.jsx)(C.Z,{px:2,py:1,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{alignItems:"center",children:[(0,S.jsx)(j.Z,{color:u,size:1.5*w.iI,square:!0}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{monospace:!0,muted:s,small:!0,children:l})]}),s&&(0,S.jsxs)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:[o," support coming soon"]}),!s&&(0,S.jsx)(x.Z,{checked:!s&&c,disabled:s,onClick:function(){B((function(e){var n=lr({},e);return c?delete n[l]:n[l]=l,n}))}})]})},"option-".concat(l)))})),e}),[A,h,M]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(jt.Z,{onClickOutside:function(){return E(!1)},open:!0,children:[(0,S.jsx)(Ee.Z,{beforeIcon:(0,S.jsx)(N.Search,{}),borderless:!0,compact:!0,onChange:function(e){return b(e.target.value)},onClick:function(e){(0,Oe.j)(e),E(!0)},onFocus:function(e){(0,Oe.j)(e),E(!0)},placeholder:l,small:!0,value:g}),I&&(0,S.jsxs)(S.Fragment,{children:[R,(0,S.jsx)(C.Z,{p:1,children:(0,S.jsx)(y.ZP,{justifyContent:"flex-end",children:(0,S.jsx)(be.ZP,{compact:!0,loading:u,onClick:function(){return f({block:i,upstream_blocks:Object.keys(M)}).then((function(){return E(!1)}))},small:!0,children:"Save selected blocks"})})})]})]}),!I&&(null===i||void 0===i||null===(n=i.upstream_blocks)||void 0===n?void 0:n.length)>=1&&(0,S.jsxs)(C.Z,{pb:1,pr:1,children:[o&&(0,S.jsx)(C.Z,{mt:1,pl:1,children:(0,S.jsx)(O.ZP,{muted:!0,small:!0,children:o})}),(0,S.jsx)(y.ZP,{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===D||void 0===D?void 0:D[e];if(!n)return(0,S.jsx)("div",{},e);var t=n.color,o=n.type,r=(0,_.qn)(o,{blockColor:t,theme:h}).accentLight;return(0,S.jsx)(C.Z,{ml:1,mt:1,children:(0,S.jsx)(be.ZP,{backgroundColor:r,compact:!0,disabled:!s,onClick:function(e){(0,Oe.j)(e),c?c(n):null===s||void 0===s||s({block:lr(lr({},i),{},{upstream_blocks:[null===n||void 0===n?void 0:n.uuid]})})},small:!0,children:(0,S.jsx)(O.ZP,{monospace:!0,small:!0,children:e})})},e)}))})]})]})},cr=t(75634);function sr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ar(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?sr(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):sr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var dr=function(e){var n=e.addNewBlockAtIndex,t=e.autocompleteItems,i=e.blockRefs,o=e.blocks,u=e.blocksInNotebook,c=e.deleteBlock,s=e.extensionOption,a=e.fetchFileTree,d=e.fetchPipeline,v=e.interruptKernel,h=e.messages,m=e.onChangeCallbackBlock,g=e.onChangeCodeBlock,x=e.pipeline,j=e.runBlock,k=e.runningBlocks,Z=e.savePipelineContent,y=e.selectedBlock,_=e.setAnyInputFocused,I=e.setErrors,E=e.setSelectedBlock,T=e.setTextareaFocused,M=e.showBrowseTemplates,B=e.textareaFocused,D=(0,p.useRef)(null),A=(0,p.useState)(!1),R=A[0],F=A[1],U=(s||{}).uuid,H=(x||{}).extensions,W=(0,p.useMemo)((function(){return(null===s||void 0===s?void 0:s.templates)||[]}),[s]),G=(0,p.useMemo)((function(){return null===H||void 0===H?void 0:H[U]}),[U,H]),K=(0,p.useMemo)((function(){return(null===G||void 0===G?void 0:G.blocks)||[]}),[G]),z=(0,p.useMemo)((function(){return(0,L.HK)(K,(function(e){return e.uuid}))}),[K]),q=(0,p.useMemo)((function(){return U===(null===y||void 0===y?void 0:y.extension_uuid)&&z[null===y||void 0===y?void 0:y.uuid]}),[z,U,y]),V=(0,p.useMemo)((function(){return k.reduce((function(e,n,t){return ar(ar({},e),{},(0,l.Z)({},n.uuid,ar(ar({},n),{},{priority:t})))}),{})}),[k]),X=(0,f.Db)((function(e){var n=e.block,t=e.upstream_blocks;return Y.ZP.blocks.pipelines.useUpdate(encodeURIComponent(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,Pe.wD)(e,{callback:function(){d()},onErrorCallback:function(e,n){return null===I||void 0===I?void 0:I({errors:n,response:e})}})}}),Q=(0,r.Z)(X,2),J=Q[0],$=Q[1].isLoading,ee=(0,p.useMemo)((function(){return K.map((function(e,n){var r=ar(ar({},e),{},{extension_uuid:U}),l=r.type,s=r.uuid,f=(null===y||void 0===y?void 0:y.uuid)===s,P=V[s],O=P?0===P.priority?ii.uF.BUSY:ii.uF.QUEUED:ii.uF.IDLE,M="".concat(l,"s/").concat(s,".py");return i.current[M]=(0,p.createRef)(),(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsx)(ln.Z,{allBlocks:o,autocompleteItems:t,block:r,blockIdx:n,blockRefs:i,blocks:o,defaultValue:r.content,deleteBlock:function(e){c(ar(ar({},e),{},{extension_uuid:U})),_(!1)},executionState:O,extraContent:(0,S.jsx)(ur,{block:r,blockActionDescription:"Click a block name to run expectations on it.",blocks:u,inputPlaceholder:"Select blocks to run expectations on",loading:$,supportedUpstreamBlockLanguages:[b.t6.PYTHON],supportedUpstreamBlockTypes:[b.tf.DATA_EXPORTER,b.tf.DATA_LOADER,b.tf.DBT,b.tf.TRANSFORMER],updateBlock:J}),fetchFileTree:a,fetchPipeline:d,hideRunButton:!0,interruptKernel:v,messages:h[s],noDivider:!0,onCallbackChange:function(e){return m(l,s,e)},onChange:function(e){return g(l,s,e)},pipeline:x,ref:i.current[M],runBlock:j,runningBlocks:k,savePipelineContent:Z,selected:f,setAnyInputFocused:_,setErrors:I,setSelected:function(e){return E(!0===e?r:null)},setTextareaFocused:T,textareaFocused:f&&B})},s)}))}),[t,i,o,u,c,K,U,a,d,v,$,h,m,g,x,j,k,V,Z,y,_,I,E,T,B,J]),ne="Extensions/GreatExpectations/index",te=(0,Qe.y)(),ie=te.disableGlobalKeyboardShortcuts,oe=te.registerOnKeyDown,re=te.unregisterOnKeyDown;return(0,p.useEffect)((function(){return function(){re(ne)}}),[re,ne]),oe(ne,(function(e,n){!ie&&q&&((0,Xe.y)([qe.zX,qe.Um],n)||(0,Xe.y)([qe.PQ,qe.Um],n))&&(e.preventDefault(),Z())}),[q,Z]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(C.Z,{mb:w.cd,children:[(0,S.jsx)(O.ZP,{default:!0,children:"Add an extension block to start writing expectations for blocks in the current pipeline."}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["When a block in your pipeline runs, it\u2019ll run any tests you define in its code. All associated extension blocks will also run during that phase. Learn more about the ",(0,S.jsx)(P.Z,{href:"https://docs.mage.ai/development/testing/great-expectations",openNewWindow:!0,children:"Great Expectation power up"}),"."]})}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["For all available expectations, read Great Expectation\u2019s ",(0,S.jsx)(P.Z,{href:"https://greatexpectations.io/expectations/",openNewWindow:!0,children:"documentation"}),"."]})})]}),ee,(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsx)(jt.Z,{onClickOutside:function(){return F(!1)},open:!0,children:(0,S.jsx)(Bi.Z,{disableKeyboardShortcuts:!0,items:null===W||void 0===W?void 0:W.map((function(e){var t=e.description,i=e.name,o=e.path;return{label:function(){return i},onClick:function(){return n({config:{template_path:o},extension_uuid:U,type:b.tf.EXTENSION},(null===K||void 0===K?void 0:K.length)||0)},tooltip:function(){return t},uuid:e.uuid}})).concat((0,eo.hr)((function(e){return n(ar(ar({},e),{},{extension_uuid:U,type:b.tf.EXTENSION}),(null===K||void 0===K?void 0:K.length)||0)}),b.tf.EXTENSION,null,{onlyCustomTemplate:!0,showBrowseTemplates:M})),onClickCallback:function(){return F(!1)},open:R,parentRef:D,uuid:"Extension",children:(0,S.jsx)(un.ZP,{beforeElement:(0,S.jsx)(cr.Wx,{teal:!0,children:(0,S.jsx)(N.Add,{size:cr.ZG})}),inline:!0,onClick:function(e){e.preventDefault(),F(!0)},uuid:"AddNewBlocks/Extension",children:"Extension block"})})})})]})},vr=t(15610),pr=t(69419),fr=["pipeline"];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,l.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 gr=function(e){var n=e.pipeline,t=(0,In.Z)(e,fr),i=(0,h.useRouter)(),o=Y.ZP.extension_options.list().data,r=(0,p.useMemo)((function(){return(null===o||void 0===o?void 0:o.extension_options)||[]}),[o]),l=(0,p.useMemo)((function(){return(0,L.HK)(r,(function(e){return e.uuid}))}),[r]),u=(0,p.useState)(null),c=u[0],s=u[1],a=(0,p.useMemo)((function(){return l[c]}),[l,c]),d=(0,p.useMemo)((function(){return mr(mr({},t),{},{pipeline:n})}),[n,t]);(0,p.useEffect)((function(){var e;s(null===(e=(0,pr.iV)())||void 0===e?void 0:e.extension)}),[i.asPath]);var v=(0,p.useMemo)((function(){return n?(ir.GREAT_EXPECTATIONS===c?e=dr:ir.DBT===c&&(e=or),e?(0,S.jsx)(e,mr(mr({},d),{},{extensionOption:a})):void 0):null;var e}),[a,n,c,d]);return(0,S.jsx)(tn.W,{backend:on.PD,children:(0,S.jsxs)(C.Z,{p:w.cd,children:[!c&&(0,S.jsxs)(C.Z,{mb:w.cd,children:[(0,S.jsxs)(O.ZP,{default:!0,children:["Power up your pipeline with extensions. Learn more about ",(0,S.jsx)(P.Z,{href:"https://docs.mage.ai/design/blocks/extension",openNewWindow:!0,children:"extension blocks"}),"."]}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["Click on a power up below to add and configure it for the ",(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,children:null===n||void 0===n?void 0:n.uuid})," pipeline."]})})]}),!o&&!c&&(0,S.jsx)(ke.Z,{}),v,!c&&(null===r||void 0===r?void 0:r.map((function(e,n){var t=e.description,o=e.name,r=e.uuid;return(0,S.jsx)(C.Z,{mt:n>=1?w.cd:0,children:(0,S.jsx)(P.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,vr.u)({extension:r},{pushHistory:!0})},preventDefault:!0,children:(0,S.jsx)(At.Z,{dark:!0,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{alignItems:"center",children:[(0,S.jsx)(Gn.Z,{fullWidth:!1,children:(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(y.ZP,{alignItems:"center",children:(0,S.jsx)("img",{alt:o,height:3*w.iI,src:"".concat(i.basePath,"/images/extensions/").concat(r,"/logo.png"),width:3*w.iI})})})}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsxs)(Z.Z,{flexDirection:"column",children:[(0,S.jsx)(O.ZP,{bold:!0,children:o}),(0,S.jsx)(O.ZP,{default:!0,small:!0,children:t})]})]}),(0,S.jsx)(N.ChevronRight,{})]})})})},r)})))]})})},br=t(28385),xr=t(9134),jr=t(83784),kr=t(30229),Zr=t(8916);var yr=function(e){e.blocks;var n=e.fetchVariables,t=e.pipeline,i=e.selectedBlock,o=e.setErrorMessages,l=e.variables,u=e.width,c=(0,p.useState)(!1),s=c[0],a=c[1],d=(0,p.useState)(),v=d[0],h=d[1],m=(0,p.useState)(),g=m[0],x=m[1],j=null===t||void 0===t?void 0:t.uuid,k=(0,f.Db)(Y.ZP.variables.pipelines.useCreate(j),{onSuccess:function(e){return(0,Pe.wD)(e,{onErrorCallback:function(e){var n=e.error,t=n.message,i=n.exception;o((function(e){var n=e||[];return i&&(n=n.concat(i)),t&&(n=n.concat(t)),n}))}})}}),Z=(0,r.Z)(k,1)[0],_=(0,f.Db)((function(e){return Y.ZP.variables.pipelines.useDelete(j,e)()}),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);o((function(e){return e.concat(t)}))}})}}),I=(0,r.Z)(_,1)[0],E=(0,p.useCallback)((function(e){if("Enter"===e.key){var t=g;try{t=JSON.parse(g)}catch(i){}Z({variable:{name:v,value:t}}).then((function(){n(),h(null),x(null)})),(0,no.ez)(),a(!1)}else"Escape"===e.key&&((0,no.ez)(),a(!1))}),[Z,n,v,g]),T=(0,p.useMemo)((function(){return u-4*w.iI}),[u]),M=(0,p.useMemo)((function(){return(0,Zr.wx)(l,(function(e){return e.uuid===jr.C}))}),[l]),B=(0,p.useMemo)((function(){return(0,Zr.wx)(l,(function(e){return e.uuid===(null===i||void 0===i?void 0:i.uuid)}))}),[i,l]),D=(0,p.useMemo)((function(){return(0,S.jsxs)(Zo,{width:T,children:[s&&(0,S.jsxs)(xo.Z,{children:[(0,S.jsx)(bo.Z,{md:1,children:(0,S.jsx)(yo,{noPadding:!0,children:(0,S.jsx)(un.ZP,{backgroundColor:Po.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(v),Bt.Am.success("Successfully copied to clipboard.",{position:Bt.Am.POSITION.BOTTOM_RIGHT,toastId:v})},uuid:"Sidekick/GlobalVariables/".concat(v),withIcon:!0,children:(0,S.jsx)(N.Copy,{size:2.5*w.iI})})})}),(0,S.jsx)(bo.Z,{md:4,children:(0,S.jsx)(yo,{children:(0,S.jsx)(Ee.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){h(e.target.value),e.preventDefault()},onKeyDown:E,paddingHorizontal:0,placeholder:"variable",small:!0,value:v})})}),(0,S.jsx)(bo.Z,{md:7,children:(0,S.jsx)(yo,{children:(0,S.jsx)(Ee.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){x(e.target.value),e.preventDefault()},onKeyDown:E,paddingHorizontal:0,placeholder:"enter value",small:!0,value:g})})})]}),null===M||void 0===M?void 0:M.map((function(e){return(0,S.jsx)(Oo,{deleteVariable:function(){return I(e.uuid)},fetchVariables:n,pipelineUUID:j,variable:e},e.uuid)}))]})}),[I,M,v,g,j,h,x,a,s,T]),R=(0,p.useMemo)((function(){return(0,S.jsx)(Zo,{width:T,children:null===B||void 0===B?void 0:B.map((function(e){return(0,S.jsx)(Oo,{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}))})}),[B,i,T]);return(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(A.Z,{level:4,monospace:!0,children:"Global Variables"}),(0,S.jsx)(C.Z,{ml:2}),(0,S.jsx)(un.ZP,{Icon:N.Add,blackBorder:!0,inline:!0,onClick:function(){return a((function(e){return!e}))},uuid:"Sidekick/GlobalVariables/addNewVariable",children:"New"})]})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(O.ZP,{muted:!0,children:["Press ",(0,S.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,S.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,S.jsx)(C.Z,{mb:w.cd,children:D}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsx)(O.ZP,{children:"Global variables will be passed into all non-scratchpad blocks as keyword arguments (Python), interpolated variables (SQL), or vector elements (R). To load a global variable, use the following syntax:"})}),(0,S.jsxs)(C.Z,{mb:w.cd,children:[(0,S.jsxs)(O.ZP,{bold:!0,large:!0,children:["For Python (",(0,S.jsx)(P.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/runtime-variable",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,S.jsx)(xr.Z,{language:"python",small:!0,source:"\n var = kwargs['variable_name']\n"})]}),(0,S.jsxs)(C.Z,{mb:w.cd,children:[(0,S.jsxs)(O.ZP,{bold:!0,large:!0,children:["For SQL (",(0,S.jsx)(P.Z,{href:"https://docs.mage.ai/guides/sql-blocks#variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,S.jsx)(xr.Z,{language:"sql",small:!0,source:"\n {{ variable_name }}\n"})]}),(0,S.jsxs)(C.Z,{mb:w.cd,children:[(0,S.jsxs)(O.ZP,{bold:!0,large:!0,children:["For R (",(0,S.jsx)(P.Z,{href:"https://docs.mage.ai/guides/r-blocks#runtime-variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,S.jsx)(xr.Z,{language:"r",small:!0,source:"\n var <- global_vars['variable_name']\n"})]}),(0,S.jsxs)(C.Z,{mb:w.cd,children:[(0,S.jsx)(A.Z,{level:4,monospace:!0,children:"Trigger Runtime Variables"}),(0,S.jsx)(C.Z,{mb:w.cd}),(0,S.jsx)(O.ZP,{children:"Depending on what kind of trigger you use for this pipeline, some default runtime variables will be provided."})]}),Object.values(kr.Xm).map((function(e,n){var t;return(0,S.jsxs)(C.Z,{mb:w.cd,children:[(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsx)(O.ZP,{large:!0,monospace:!0,children:(0,G.vg)(null===(t=kr.Z4[e])||void 0===t?void 0:t.call(kr.Z4))})}),(0,Zr.JZ)([],e).map((function(n,t){return(0,S.jsx)(Oo,{hideEdit:!0,pipelineUUID:j,variable:n},"var_".concat(e,"_").concat(t))}))]},"".concat(e,"_").concat(n))})),B&&B.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{my:2,children:(0,S.jsx)(A.Z,{level:4,monospace:!0,children:"Block Output Variables"})}),(0,S.jsx)(C.Z,{mb:2,children:R}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(O.ZP,{children:["Output variables can be used in any ",(0,S.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,warning:!0,children:b.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)(C.Z,{mb:w.cd,children:(0,S.jsx)(O.ZP,{children:"To load the variable in a scratchpad block, use the following syntax:"})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsx)(xr.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"})})]})]})},Pr=t(89565),Cr=t.n(Pr),Or=t(88494),wr=v.default.div.withConfig({displayName:"indexstyle__OutputHeaderStyle",componentId:"sc-wkjnrg-0"})([""," overflow-x:auto;"],(0,Be.y$)()),_r=v.default.div.withConfig({displayName:"indexstyle__OutputContainerStyle",componentId:"sc-wkjnrg-1"})([""," overflow-y:scroll;"," ",""],Be.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 Sr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ir(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Sr(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Sr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Er=function(e){var n=e.cancelPipeline,t=e.checkIfPipelineRunning,i=e.executePipeline,o=e.isPipelineExecuting,r=e.pipelineExecutionHidden,l=e.pipelineMessages,u=e.setPipelineExecutionHidden,c=(0,p.useMemo)((function(){return(null===l||void 0===l?void 0:l.length)||0}),[l]),s=(0,p.useMemo)((function(){return c>100?l.slice(-100):l}),[c,l]),a=(0,p.useCallback)((function(){(0,no.ez)(),i()}),[i]),d=(0,p.useCallback)((function(){(0,no.ez)(),n()}),[n]),v=(0,p.useCallback)((function(){var e=!r;u(e),(0,Ye.t8)(Ye.Q9,e)}),[r,u]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(wr,{children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{children:[(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.PlayButton,{inverted:!0,size:2*w.iI}),compact:o,disabled:o,loading:o,onClick:a,success:!0,children:(0,S.jsx)(O.ZP,{bold:!0,inverted:!0,noWrapping:!0,primary:!1,children:"Execute pipeline"})}),(0,S.jsx)(C.Z,{ml:1}),o&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.Close,{inverted:!0,size:2*w.iI}),onClick:d,success:!0,children:(0,S.jsx)(O.ZP,{bold:!0,inverted:!0,noWrapping:!0,primary:!1,children:"Cancel pipeline"})}),(0,S.jsx)(C.Z,{ml:1})]}),(0,S.jsx)(be.ZP,{onClick:t,secondary:!0,children:(0,S.jsx)(O.ZP,{bold:!0,noWrapping:!0,children:"Running status"})})]}),(0,S.jsxs)(Z.Z,{alignItems:"center",children:[(0,S.jsx)(C.Z,{ml:1}),(0,S.jsx)(O.ZP,{children:"Hide"}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(An.Z,{checked:r,onCheck:v})]})]})}),!r&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mb:1}),(0,S.jsx)(_r,{noScrollbarTrackBackground:!0,children:(0,S.jsx)(Or.Nk,{executedAndIdle:!0,hasError:!1,selected:!0,children:s.map((function(e,n){var t=e.data,i=e.type,o=[],r=(o=(o=Array.isArray(t)?t:[t]).filter((function(e){return e}))).length;return o.map((function(e,t){var o,l={first:0===n&&0===t,last:n===c-1&&t===r-1};return ii.jU.includes(i)?o=(0,S.jsx)(Or.T5,Ir(Ir({},l),{},{children:(0,S.jsx)(O.ZP,{monospace:!0,preWrap:!0,children:(0,S.jsx)(Cr(),{children:e})})})):i===ii.Gi.IMAGE_PNG&&(o=(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:o},"code-output-".concat(n,"-").concat(t))}))}))})})]})]})},Tr=t(81769),Mr=(w.iI,v.default.div.withConfig({displayName:"indexstyle__AfterFooterStyle",componentId:"sc-1qjqori-0"})(["",""],(function(e){return"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n ")})),v.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-1qjqori-1"})([""," border-style:solid;border-width:1px;position:relative;"," "," "," "," "," "," ",""],_.Kf,(function(e){return!e.noBorderRadiusTop&&"\n border-top-left-radius: ".concat(Me.n_,"px;\n border-top-right-radius: ").concat(Me.n_,"px;\n ")}),(function(e){return e.noBorderRadiusTop&&"\n border-top: none !important;\n "}),(function(e){return!e.noBorderRadiusBottom&&"\n border-bottom-left-radius: ".concat(Me.n_,"px;\n border-bottom-right-radius: ").concat(Me.n_,"px;\n ")}),(function(e){return e.noBorderRadiusBottom&&"\n border-bottom: none !important;\n "}),(function(e){return!e.noBackground&&"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n ")}),(function(e){return!e.borderColor&&"\n border-color: ".concat((e.theme.borders||U.Z.borders).light,";\n ")}),(function(e){return e.borderColor&&"\n border-color: ".concat(e.borderColor,";\n ")}))),Br=(v.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-1qjqori-2"})(["padding:","px;",""],w.cd*w.iI,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.borders||U.Z.borders).light,";\n ")})),v.default.div.withConfig({displayName:"indexstyle__NavigationStyle",componentId:"sc-1qjqori-3"})([""," "," ",""],(0,De.eR)(),(function(e){return!e.selected&&"\n &:hover {\n background-color: ".concat((e.theme.interactive||U.Z.interactive).rowHoverBackground,";\n }\n ")}),(function(e){return e.selected&&"\n background-color: ".concat((e.theme.background||U.Z.background).codeTextarea,";\n ")})),v.default.div.withConfig({displayName:"indexstyle__StreamGridGroupStyle",componentId:"sc-1qjqori-4"})(["position:absolute;"]),v.default.div.withConfig({displayName:"indexstyle__StreamGridGroupInnerStyle",componentId:"sc-1qjqori-5"})([""," overflow:auto;position:fixed;",""],Be.w5,(function(e){return e.borderRight&&"\n border-right: 1px solid ".concat((e.theme.borders||U.Z.borders).light,";\n ")})),v.default.div.withConfig({displayName:"indexstyle__StreamGridStyle",componentId:"sc-1qjqori-6"})(["border-radius:","px;padding:","px;margin:","px;"," "," "," "," ",""],Me.n_,w.cd*w.iI,1*w.iI,(function(e){return!e.warning&&"\n &:hover {\n cursor: pointer;\n }\n "}),(function(e){return!e.selected&&!e.warning&&"\n border: 1px solid ".concat((e.theme.borders||U.Z.borders).light,";\n ")}),(function(e){return e.warning&&!e.selected&&"\n border: 1px solid ".concat((e.theme.accent||U.Z.accent).warningTransparent,";\n ")}),(function(e){return e.warning&&e.selected&&"\n border: 1px solid ".concat((e.theme.accent||U.Z.accent).warning,";\n ")}),(function(e){return e.selected&&!e.warning&&"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n border: 1px solid ").concat((e.theme.borders||U.Z.borders).contrast,";\n ")})),v.default.div.withConfig({displayName:"indexstyle__BackgroundStyle",componentId:"sc-1qjqori-7"})(["",""],(function(e){return"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n ")})),v.default.div.withConfig({displayName:"indexstyle__ButtonContainerStyle",componentId:"sc-1qjqori-8"})(["bottom:0;position:fixed;z-index:1;"," ",""],(function(e){return"\n background-color: ".concat((e.theme.background||U.Z.background).panel,";\n border-left: 1px solid ").concat((e.theme.borders||U.Z.borders).light,";\n border-right: 1px solid ").concat((e.theme.borders||U.Z.borders).light,";\n border-top: 1px solid ").concat((e.theme.borders||U.Z.borders).light,";\n ")}),(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}))),Dr=t(19452);function Ar(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Rr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ar(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ar(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Nr=function(e){var n,t,i,o,l=e.index,u=e.permission,c=e.setPermissions,s=e.updatePermission;return(0,S.jsx)(Mr,{children:(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"flex-start",flexDirection:"row",children:[(0,S.jsx)(be.ZP,{iconOnly:!0,onClick:function(){return c((function(e){return(0,L.oM)(e,l)}))},children:(0,S.jsx)(N.Close,{})}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsxs)(y.ZP,{flexDirection:"column",children:[(0,S.jsxs)(y.ZP,{alignItems:"center",flexDirection:"row",children:[(0,S.jsx)(A.Z,{level:5,children:"Triggers"}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(y.ZP,{alignItems:"center",children:(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.Add,{}),compact:!0,onClick:function(e){(0,Oe.j)(e),s(Rr(Rr({},u),{},{triggers:((null===u||void 0===u?void 0:u.triggers)||[]).concat({schedule_interval:"",schedule_type:"",uuid:""})}))},secondary:!0,small:!0,children:"Add trigger"})})]}),(null===u||void 0===u||null===(n=u.triggers)||void 0===n?void 0:n.length)>=1&&(0,S.jsx)(C.Z,{mt:w.cd,children:null===u||void 0===u||null===(t=u.triggers)||void 0===t?void 0:t.map((function(e,n){var t=e.schedule_interval,i=e.schedule_type,o=e.uuid;return(0,S.jsx)(C.Z,{mt:n>=1?1:0,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(be.ZP,{iconOnly:!0,noBackground:!0,noBorder:!0,onClick:function(e){(0,Oe.j)(e);var t=(0,L.oM)((null===u||void 0===u?void 0:u.triggers)||[],n);s(Rr(Rr({},u),{},{triggers:t}))},children:(0,S.jsx)(N.Close,{})}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(an.Z,{compact:!0,onChange:function(e){var t,i=e.target.value,o=Rr({},u),r=Rr({},null===o||void 0===o||null===(t=o.triggers)||void 0===t?void 0:t[n]);r.schedule_type=i,o.triggers[n]=r,s(o)},placeholder:"Type",small:!0,value:i,children:Object.entries(kr.Z4).map((function(e){var n=(0,r.Z)(e,2),t=n[0],i=n[1];return(0,S.jsx)("option",{value:t,children:(0,G.kC)(i())},t)}))}),(kr.Xm.TIME===i||!i)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(an.Z,{compact:!0,monospace:!0,onChange:function(e){var t,i=e.target.value,o=Rr({},u),r=Rr({},null===o||void 0===o||null===(t=o.triggers)||void 0===t?void 0:t[n]);r.schedule_interval=i,o.triggers[n]=r,s(o)},placeholder:"Interval",small:!0,value:t,children:kr.Wb.map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))})]})]})},"permission-trigger-".concat(l,"-").concat(n,"-").concat(o))}))})]}),(0,S.jsx)(C.Z,{mr:w.Mq}),(0,S.jsxs)(y.ZP,{flexDirection:"column",children:[(0,S.jsxs)(y.ZP,{alignItems:"center",flexDirection:"row",children:[(0,S.jsx)(A.Z,{level:5,children:"Roles"}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(y.ZP,{alignItems:"center",children:(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.Add,{}),compact:!0,onClick:function(e){(0,Oe.j)(e),s(Rr(Rr({},u),{},{roles:((null===u||void 0===u?void 0:u.roles)||[]).concat({role:"",uuid:""})}))},secondary:!0,small:!0,children:"Add role"})})]}),(null===u||void 0===u||null===(i=u.roles)||void 0===i?void 0:i.length)>=1&&(0,S.jsx)(C.Z,{mt:w.cd,children:null===u||void 0===u||null===(o=u.roles)||void 0===o?void 0:o.map((function(e,n){var t=e.role,i=e.uuid;return(0,S.jsx)(C.Z,{mt:n>=1?1:0,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(be.ZP,{iconOnly:!0,noBackground:!0,noBorder:!0,onClick:function(e){(0,Oe.j)(e);var t=(0,L.oM)((null===u||void 0===u?void 0:u.roles)||[],n);s(Rr(Rr({},u),{},{roles:t}))},children:(0,S.jsx)(N.Close,{})}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(an.Z,{compact:!0,monospace:!0,onChange:function(e){var t,i=e.target.value,o=Rr({},u),r=Rr({},null===o||void 0===o||null===(t=o.roles)||void 0===t?void 0:t[n]);r.role=i,o.roles[n]=r,s(o)},placeholder:"Role",small:!0,value:t,children:Dr.Z3.map((function(e){return(0,S.jsx)("option",{value:e,children:e},e)}))})]})},"permission-role-".concat(l,"-").concat(n,"-").concat(i))}))})]})]})})})},Lr=t(35576),Fr=t(3917);function Ur(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Hr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ur(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ur(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Wr=function(e){var n,t,i=e.blockInteractionsMapping,r=e.containerWidth,u=e.createInteraction,c=e.interactions,s=e.interactionsMapping,a=e.isLoadingCreateInteraction,d=e.isLoadingUpdatePipelineInteraction,v=e.permissions,f=e.pipeline,h=e.pipelineInteraction,m=e.refAfterFooter,g=e.savePipelineInteraction,x=e.selectedBlock,j=e.setBlockInteractionsMapping,P=e.setInteractionsMapping,_=e.setPermissions,I=e.setSelectedBlock,E=e.updatePipelineInteraction,T=(0,p.useRef)(null),M=(0,p.useRef)(null),B=(0,p.useRef)(null),D=(0,p.useState)(null),R=D[0],F=D[1],U=(0,p.useState)(null),H=U[0],W=U[1],G=(0,p.useState)(!1),K=G[0],z=G[1],q=(0,p.useState)(null),V=q[0],Y=q[1],X=(0,p.useState)(!1),Q=X[0],J=X[1],$=(0,p.useState)(null),ee=($[0],$[1]),ne=!i,te=(0,p.useState)(null),ie=te[0],oe=te[1],re=(0,p.useState)(null),le=re[0],ue=re[1],ce=(0,p.useMemo)((function(){return"undefined"!==typeof i?i:le}),[i,le]),se=(0,p.useMemo)((function(){return"undefined"!==typeof s?s:ie}),[s,ie]),ae=(0,p.useCallback)((function(e,n){return null!==n&&void 0!==n&&n.initialBootstrap||z(!0),"undefined"!==typeof j?j(e):ue(e)}),[j,ue,z]),de=(0,p.useCallback)((function(e,n){return null!==n&&void 0!==n&&n.initialBootstrap||z(!0),"undefined"!==typeof P?P(e):oe(e)}),[P,oe,z]),ve=(0,p.useState)(null),pe=ve[0],fe=ve[1],he=(0,p.useCallback)((function(e,n,t,i){return ae((function(r){var u=(0,o.Z)((null===r||void 0===r?void 0:r[e])||[]);return null!==i&&void 0!==i&&i.remove?u=(0,L.oM)(u,n):u[n]=Hr(Hr({},u[n]),t),Hr(Hr({},r),{},(0,l.Z)({},e,u))}))}),[ae]),xe=(0,p.useCallback)((function(e,n){W(Number(new Date)),null!==n&&void 0!==n&&n.initialBootstrap||z(!0),"undefined"!==typeof _?_(e):fe(e)}),[W,_,fe,z]),je=(0,p.useMemo)((function(){var e;return null===(e="undefined"!==typeof v?v:pe)||void 0===e?void 0:e.map((function(e,n){var t=e.roles,i=e.triggers;return{roles:null===t||void 0===t?void 0:t.map((function(e,t){return{role:"string"===typeof e?e:null===e||void 0===e?void 0:e.role,uuid:"".concat(n,"-").concat(H,"-").concat(t)}})),triggers:null===i||void 0===i?void 0:i.map((function(e,t){return Hr(Hr({},e),{},{uuid:"".concat(n,"-").concat(H,"-").concat(t)})})),uuid:"".concat(n,"-").concat(H)}}))}),[H,v,pe]),ke=(0,p.useCallback)((function(){F(Number(new Date)),z(!1)}),[F,z]),Ze=(0,p.useCallback)((function(){g?null===g||void 0===g||g().then((function(){return ke()})):null===E||void 0===E||E(Hr(Hr({},h),{},{blocks:ce,interactions:se,permissions:null===je||void 0===je?void 0:je.map((function(e){var n=e.roles,t=e.triggers;return{roles:null===n||void 0===n?void 0:n.map((function(e){return"string"===typeof e?e:null===e||void 0===e?void 0:e.role})),triggers:null===t||void 0===t?void 0:t.map((function(e){return{schedule_interval:e.schedule_interval,schedule_type:e.schedule_type}}))}}))})).then((function(){return ke()}))}),[ce,se,je,h,ke,g,E]),ye=(0,p.useMemo)((function(){return(null===f||void 0===f?void 0:f.blocks)||[]}),[f]),Pe=(0,p.useMemo)((function(){return null===ye||void 0===ye?void 0:ye.reduce((function(e,n,t){return Hr(Hr({},e),{},(0,l.Z)({},String(t),!0))}),{})}),[ye]);(0,p.useEffect)((function(){"undefined"===typeof s&&!se&&(null===c||void 0===c?void 0:c.length)>=1&&de((0,L.HK)(c||[],(function(e){return e.uuid})),{initialBootstrap:!0})}),[c,se,s,de]),(0,p.useEffect)((function(){"undefined"===typeof i&&!ce&&null!==h&&void 0!==h&&h.blocks&&ae(null===h||void 0===h?void 0:h.blocks,{initialBootstrap:!0})}),[ce,i,h,ae]),(0,p.useEffect)((function(){!je&&null!==h&&void 0!==h&&h.permissions&&xe(null===h||void 0===h?void 0:h.permissions,{initialBootstrap:!0})}),[je,h,xe]);var Ce=(0,p.useMemo)((function(){var e=[],n=(null===ye||void 0===ye?void 0:ye.length)||0;return null===ye||void 0===ye||ye.map((function(t,i){var o=(t||{uuid:null}).uuid,l=(null===ce||void 0===ce?void 0:ce[o])||[],u=(null===l||void 0===l?void 0:l.length)>=1,c=(0,S.jsxs)(be.ZP,{beforeIcon:u?(0,S.jsx)(N.Edit,{}):(0,S.jsx)(N.Add,{}),compact:!0,disabled:ne,onClick:function(e){(0,Oe.j)(e),I(t)},primary:!u,secondary:u,small:!0,children:[u&&"Edit interactions",!u&&"Add interactions"]});e.push((0,S.jsx)(ge.Z,{first:0==i,noBorderRadius:i>=1,noPaddingContent:!0,title:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsx)(C.Z,{mr:w.cd,py:1,children:(0,S.jsx)(O.ZP,{large:!0,monospace:!0,children:o})}),u&&(0,S.jsx)(y.ZP,{alignItems:"center",children:c})]}),titleXPadding:w.cd*w.iI,titleYPadding:1.5*w.iI,children:(0,S.jsx)(Mr,{noBackground:!0,noBorderRadiusBottom:i<n-1,noBorderRadiusTop:!0,children:(0,S.jsxs)(C.Z,{p:w.cd,children:[!u&&c,null===l||void 0===l?void 0:l.map((function(e,n){return(0,S.jsx)(C.Z,{mt:n>=1?w.HN:0,children:(0,S.jsx)(Tr.Z,{blockInteraction:e,containerRef:T,containerWidth:r,interaction:null===se||void 0===se?void 0:se[null===e||void 0===e?void 0:e.uuid],setInteractionsMapping:de,showVariableUUID:!0})},"".concat(null===e||void 0===e?void 0:e.uuid,"-").concat(n))}))]})})},o))})),e}),[ce,ye,T,r,se,ne,de,I]),we=(0,p.useMemo)((function(){return(null===ye||void 0===ye?void 0:ye.length)>=1&&(0,S.jsx)(me.Z,{noBackground:!0,noBorder:!0,noBoxShadow:!0,visibleMapping:Pe,children:Ce})}),[ye,Ce,Pe]),_e=(0,p.useMemo)((function(){return(null===ce||void 0===ce?void 0:ce[null===x||void 0===x?void 0:x.uuid])||[]}),[ce,x]),Se=(0,p.useMemo)((function(){var e=[],n={};return null===_e||void 0===_e||_e.forEach((function(t){var i=t.uuid,o=null===se||void 0===se?void 0:se[i],r=null===o||void 0===o?void 0:o.variables;Object.keys(r||{}).forEach((function(t){null!==n&&void 0!==n&&n[t]||(e.push(t),n[t]=!0)}))})),e}),[se,_e]),Ie=(0,p.useMemo)((function(){var e=(null===_e||void 0===_e?void 0:_e.length)>=1;return(0,S.jsxs)(y.ZP,{alignItems:"center",children:[!Q&&(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.Add,{}),compact:e,onClick:function(e){(0,Oe.j)(e),J(!0),setTimeout((function(){var e;return null===M||void 0===M||null===(e=M.current)||void 0===e?void 0:e.focus()}),1)},primary:!0,small:e,children:"Create new set of interactions"})}),Q&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Ee.Z,{compact:!0,monospace:!0,onChange:function(e){(0,Oe.j)(e),Y(e.target.value)},onClick:function(e){return(0,Oe.j)(e)},ref:M,small:!0,value:V||""}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(be.ZP,{compact:e,loading:a,onClick:function(e){(0,Oe.j)(e),u({block_uuid:null===x||void 0===x?void 0:x.uuid,inputs:{},layout:[],uuid:"".concat(V,".").concat(b.t6.YAML),variables:{}}).then((function(e){var n=e.data;if(null===n||void 0===n||!n.error){var t=null===n||void 0===n?void 0:n.interaction,i=null===t||void 0===t?void 0:t.uuid;he(null===x||void 0===x?void 0:x.uuid,(null===_e||void 0===_e?void 0:_e.length)||0,{uuid:i}),de((function(e){return Hr(Hr({},e),{},(0,l.Z)({},i,t))})),setTimeout((function(){var e;null===B||void 0===B||null===(e=B.current)||void 0===e||e.scrollIntoView()}),ge.e+100)}})),J(!1),ee(V),Y(null)},primary:!0,small:e,children:"Save interaction"}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(be.ZP,{compact:e,onClick:function(e){(0,Oe.j)(e),J(!1),Y(null)},secondary:!0,small:e,children:"Cancel"})]})]})}),[u,x,_e,Q,a,V,de,J,ee,Y,he]);return(0,S.jsxs)(C.Z,{p:w.cd,style:{position:"relative"},children:[(0,S.jsxs)(C.Z,{pb:w.cd,ref:T,children:[!x&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsx)(A.Z,{children:"Blocks with interactions"})}),we,(0,S.jsxs)(C.Z,{mb:w.cd,mt:w.HN,children:[(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(A.Z,{children:"Permissions"}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(y.ZP,{alignItems:"center",children:(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.Add,{}),compact:!0,disabled:ne,onClick:function(){return xe((function(e){return null===e||void 0===e?void 0:e.concat([{roles:[],triggers:[]}])}))},secondary:!0,small:!0,children:"Add permission"})})]}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsx)(O.ZP,{default:!0,children:"Add permissions to allow specific user roles the ability to trigger this pipeline using the interactions for this pipeline."})})]}),null===je||void 0===je?void 0:je.map((function(e,n){return(0,S.jsx)(C.Z,{mt:n>=1?w.cd:0,children:(0,S.jsx)(Nr,{index:n,permission:e,setPermissions:xe,updatePermission:function(e){var t=(0,o.Z)(je);t[n]=e,xe(t)}})},"permission-".concat(n))}))]}),x&&(0,S.jsxs)(C.Z,{mb:w.Mq,children:[(0,S.jsxs)(C.Z,{mb:w.Mq,children:[(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(C.Z,{mr:w.cd,py:1,children:(0,S.jsx)(A.Z,{children:"Block interactions"})}),(null===_e||void 0===_e?void 0:_e.length)>=1&&Ie]}),(0,S.jsx)(O.ZP,{default:!0,children:"A block can have multiple sets of interactions associated with it."})]}),!(null!==_e&&void 0!==_e&&_e.length)&&Ie,(null===Se||void 0===Se?void 0:Se.length)>=1&&(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Variables"}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(Z.Z,{alignItems:"center",flex:1,children:null===Se||void 0===Se?void 0:Se.map((function(e,n){return(0,S.jsx)(C.Z,{mr:1,children:(0,S.jsxs)(O.ZP,{default:!0,monospace:!0,children:[e,(null===Se||void 0===Se?void 0:Se.length)>=2&&n<(null===Se||void 0===Se?void 0:Se.length)-1&&(0,S.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,children:","})]})},e)}))})]})]}),null===_e||void 0===_e?void 0:_e.map((function(e,n){var t,i=e||{description:null,name:null},o=i.description,l=i.name,u=null===x||void 0===x?void 0:x.uuid,c=null===e||void 0===e?void 0:e.uuid,s=null===se||void 0===se?void 0:se[c];return(0,S.jsxs)("div",{children:[n>=1&&(0,S.jsx)(C.Z,{my:w.HN,children:(0,S.jsx)(k.Z,{light:!0})}),(0,S.jsx)(Tr.Z,{blockInteraction:e,containerRef:T,containerWidth:r,interaction:s,isEditing:!0,removeBlockInteraction:function(){return he(u,n,e,{remove:!0})},setInteractionsMapping:de,children:(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsxs)(y.ZP,{alignItems:"flex-start",children:[(0,S.jsxs)(C.Z,{mb:1,style:{width:20*w.iI},children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Label"}),(0,S.jsxs)(O.ZP,{muted:!0,children:["Add a label for this",(0,S.jsx)("br",{}),"set of interactions."]})]}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(Z.Z,{flex:1,children:(0,S.jsx)(Ee.Z,{fullWidth:!0,onChange:function(e){return he(u,n,{name:e.target.value})},value:l||""})})]}),(0,S.jsx)(C.Z,{mb:w.cd}),(0,S.jsxs)(y.ZP,{alignItems:"flex-start",children:[(0,S.jsxs)(C.Z,{mb:1,style:{width:20*w.iI},children:[(0,S.jsx)(O.ZP,{bold:!0,large:!0,children:"Description"}),(0,S.jsxs)(O.ZP,{muted:!0,children:["Describe how these",(0,S.jsx)("br",{}),"interactions are used."]})]}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(Z.Z,{flex:1,children:(0,S.jsx)(Lr.Z,{fullWidth:!0,onChange:function(e){return he(u,n,{description:e.target.value})},rows:Math.max(3,Math.min(12,null===o||void 0===o||null===(t=o.split("\n"))||void 0===t?void 0:t.length)),value:o||""})})]})]})}),(0,S.jsx)("div",{ref:n===(null===_e||void 0===_e?void 0:_e.length)-1?B:null})]},"".concat(null===e||void 0===e?void 0:e.uuid,"-").concat(n))}))]}),(0,S.jsx)(Br,{ref:m,width:(null===T||void 0===T||null===(n=T.current)||void 0===n||null===(t=n.getBoundingClientRect())||void 0===t?void 0:t.width)||null,children:(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(be.ZP,{beforeIcon:(0,S.jsx)(N.Save,{}),disabled:ne,loading:d||ne,onClick:function(){return Ze()},primary:K,secondary:!K,children:"Save changes for all interactions"}),(0,S.jsx)(C.Z,{mr:w.cd}),K&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(N.AlertTriangle,{warning:!0}),(0,S.jsx)(C.Z,{mr:1}),(0,S.jsx)(O.ZP,{warning:!0,children:"You have unsaved interaction changes"})]}),!K&&R&&(0,S.jsxs)(O.ZP,{muted:!0,children:["Interactions last saved at ",(0,Fr.JX)(Number(R)/1e3)]})]})})})]})};var Gr=function(e){var n=e.fetchSecrets,t=e.pipelineUUID,i=e.secrets,o=e.setErrorMessages,l=e.width,u=(0,p.useState)(!1),c=u[0],s=u[1],a=(0,p.useState)(),d=a[0],v=a[1],h=(0,p.useState)(),m=h[0],g=h[1],b=(0,p.useMemo)((function(){return l-w.cd*w.iI*2}),[l]),x=(0,f.Db)(Y.ZP.secrets.useCreate(),{onSuccess:function(e){return(0,Pe.wD)(e,{onErrorCallback:function(e){var n=e.error,t=n.message,i=n.exception;o((function(e){var n=e||[];return i&&(n=n.concat(i)),t&&(n=n.concat(t)),n}))}})}}),j=(0,r.Z)(x,1)[0],k=(0,f.Db)((function(e){return Y.ZP.secrets.useDelete(e)()}),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);o((function(e){return e.concat(t)}))}})}}),Z=(0,r.Z)(k,1)[0],P=(0,p.useCallback)((function(e){"Enter"===e.key?(j({secret:{name:d,value:m}}).then((function(){n(),v(null),g(null)})),(0,no.ez)(),s(!1)):"Escape"===e.key&&((0,no.ez)(),s(!1))}),[j,n,d,m]),_=(0,p.useCallback)((function(e){(0,no.ez)(),Z(e)}),[Z]);return(0,S.jsxs)(C.Z,{p:w.cd,children:[(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(y.ZP,{alignItems:"center",children:[(0,S.jsx)(A.Z,{level:4,monospace:!0,children:"Secrets"}),(0,S.jsx)(C.Z,{ml:2}),(0,S.jsx)(un.ZP,{Icon:N.Add,blackBorder:!0,inline:!0,onClick:function(){return s((function(e){return!e}))},uuid:"Sidekick/Secrets/addNewSecret",children:"New"})]})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(O.ZP,{children:[(0,S.jsx)(O.ZP,{inline:!0,warning:!0,children:"WARNING:"})," the encryption key is stored in a file on your machine. If you need more secure encryption, we recommend using a secrets manager."]})}),c&&(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(O.ZP,{muted:!0,children:["Press ",(0,S.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,S.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsxs)(Zo,{width:b,children:[c&&(0,S.jsxs)(xo.Z,{children:[(0,S.jsx)(bo.Z,{md:1,children:(0,S.jsx)(yo,{noPadding:!0,children:(0,S.jsx)(un.ZP,{backgroundColor:Po.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText("{{ mage_secret_var(".concat(d,") }}")),Bt.Am.success("Successfully copied to clipboard.",{position:Bt.Am.POSITION.BOTTOM_RIGHT,toastId:d})},uuid:"Sidekick/Secrets/".concat(d),withIcon:!0,children:(0,S.jsx)(N.Copy,{size:2.5*w.iI})})})}),(0,S.jsx)(bo.Z,{md:4,children:(0,S.jsx)(yo,{children:(0,S.jsx)(Ee.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){v(e.target.value),e.preventDefault()},onKeyDown:P,paddingHorizontal:0,placeholder:"secret name",small:!0,value:d})})}),(0,S.jsx)(bo.Z,{md:7,children:(0,S.jsx)(yo,{children:(0,S.jsx)(Ee.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){g(e.target.value),e.preventDefault()},onKeyDown:P,paddingHorizontal:0,placeholder:"secret value",small:!0,value:m})})})]}),null===i||void 0===i?void 0:i.map((function(e){return(0,S.jsx)(Oo,{copyText:e.name,deleteVariable:function(){return _(e.name)},fetchVariables:n,hideEdit:!0,obfuscate:!0,pipelineUUID:t,variable:{uuid:e.name,value:e.value}},e.name)}))]})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsx)(O.ZP,{children:"Secrets are not editable, they can only be created and deleted. Secrets are shared across the project, and can be used in configuration fields. To reference a secret, use the following templating syntax:"})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsx)(xr.Z,{language:"yaml",maxWidth:b,small:!0,source:"\n \"{{ mage_secret_var('<secret_name>') }}\"\n "})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsx)(O.ZP,{children:"To reference a secret in code, you can import the `get_secret_value` helper method:"})}),(0,S.jsx)(C.Z,{mb:w.cd,children:(0,S.jsx)(xr.Z,{language:"python",maxWidth:b,small:!0,source:"\n from mage_ai.data_preparation.shared.secrets import get_secret_value\n\n get_secret_value('<secret_name>')\n "})})]})},Kr=t(28026),zr=t(68899),qr=t(15752),Vr=t(91835);function Yr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Xr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Yr(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Yr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Qr=function(e){var n=e.addNewBlockAtIndex,t=e.addOnBlocks,i=e.addOnBlockType,o=e.autocompleteItems,u=e.blockRefs,c=e.blocks,s=e.blocksInNotebook,a=e.deleteBlock,d=e.description,v=e.displayBlockName,h=e.fetchFileTree,m=e.fetchPipeline,g=e.interruptKernel,x=e.messages,j=(e.onChangeCallbackBlock,e.onChangeCodeBlock),k=e.onSelectBlockFile,Z=e.pipeline,y=e.runBlock,_=e.runningBlocks,I=e.savePipelineContent,E=e.selectedBlock,T=e.setAnyInputFocused,M=e.setErrors,B=e.setHiddenBlocks,D=e.setSelectedBlock,A=e.setTextareaFocused,R=e.showBrowseTemplates,F=e.showUpdateBlockModal,U=e.textareaFocused,H=(0,p.useRef)(null),W=(0,p.useState)(!1),K=W[0],z=W[1],q=(0,pr.iV)().block_uuid;(0,p.useEffect)((function(){var e=c.find((function(e){var n,t=e.uuid;return(null===q||void 0===q||null===(n=q.split(":"))||void 0===n?void 0:n[0])===t}));e&&(E&&(null===e||void 0===e?void 0:e.uuid)===(null===E||void 0===E?void 0:E.uuid)||(B((function(n){return Xr(Xr({},n),{},(0,l.Z)({},e.uuid,!1))})),k(e.uuid,e.type,null)))}),[q,c,k,E,B]);var V=(Z||{}).type,X=(0,p.useMemo)((function(){return(0,L.HK)(t||[],(function(e){return e.uuid}))}),[t]),Q=Y.ZP.block_templates.list({},{revalidateOnFocus:!1}).data,J=(0,p.useMemo)((function(){return(null===Q||void 0===Q?void 0:Q.block_templates)||[]}),[Q]),$=(0,p.useCallback)((function(e){return n(e,(null===X||void 0===X?void 0:X.length)||0)}),[n,X]),ee=(0,p.useMemo)((function(){return(0,eo.oM)(J,$)}),[$,J]),ne=(0,p.useMemo)((function(){return(0,eo.hr)($,i,V,{blockTemplatesByBlockType:ee,languages:[b.t6.PYTHON],showBrowseTemplates:R})}),[$,i,ee,V]),te=(0,p.useMemo)((function(){return null===X||void 0===X?void 0:X[null===E||void 0===E?void 0:E.uuid]}),[X,E]),ie=(0,p.useMemo)((function(){return _.reduce((function(e,n,t){return Xr(Xr({},e),{},(0,l.Z)({},n.uuid,Xr(Xr({},n),{},{priority:t})))}),{})}),[_]),oe=(0,f.Db)((function(e){var n=e.block,t=e.upstream_blocks;return Y.ZP.blocks.pipelines.useUpdate(encodeURIComponent(null===Z||void 0===Z?void 0:Z.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,Pe.wD)(e,{callback:function(){m()},onErrorCallback:function(e,n){return null===M||void 0===M?void 0:M({errors:n,response:e})}})}}),re=(0,r.Z)(oe,2),le=re[0],ue=re[1].isLoading,ce=(0,p.useMemo)((function(){return null===t||void 0===t?void 0:t.map((function(e,n){var t=e.type,i=e.uuid,r=(null===E||void 0===E?void 0:E.uuid)===i,d=ie[i],f=d?0===d.priority?ii.uF.BUSY:ii.uF.QUEUED:ii.uF.IDLE,P="".concat(t,"s/").concat(i,".py");return u.current[P]=(0,p.createRef)(),(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsx)(ln.Z,{allBlocks:c,autocompleteItems:o,block:e,blockIdx:n,blockRefs:u,blocks:c,defaultValue:e.content,deleteBlock:function(e){a(Xr({},e)),T(!1)},executionState:f,extraContent:(0,S.jsx)(ur,{block:e,blocks:s,inputPlaceholder:"Select blocks to add ".concat((0,G._6)(v,null)," to"),loading:ue,onClickTag:function(e){B((function(n){return Xr(Xr({},n),{},(0,l.Z)({},e.uuid,!1))})),k(e.uuid,e.type,null)},supportedUpstreamBlockTypes:[b.tf.CUSTOM,b.tf.DATA_EXPORTER,b.tf.DATA_LOADER,b.tf.DBT,b.tf.SCRATCHPAD,b.tf.SENSOR,b.tf.TRANSFORMER],updateBlock:le}),fetchFileTree:h,fetchPipeline:m,hideRunButton:!0,interruptKernel:g,messages:x[i],noDivider:!0,onChange:function(e){return j(t,i,e)},pipeline:Z,ref:u.current[P],runBlock:y,runningBlocks:_,savePipelineContent:I,showUpdateBlockModal:F,selected:r,setAnyInputFocused:T,setErrors:M,setSelected:function(n){return D(!0===n?e:null)},setTextareaFocused:A,textareaFocused:r&&U})},i)}))}),[t,o,u,c,s,a,v,h,m,g,ue,x,j,k,Z,y,_,ie,I,E,T,M,B,D,A,F,U,le]),se="".concat(v,"/index"),ae=(0,Qe.y)(),de=ae.disableGlobalKeyboardShortcuts,ve=ae.registerOnKeyDown,pe=ae.unregisterOnKeyDown;return(0,p.useEffect)((function(){return function(){pe(se)}}),[pe,se]),ve(se,(function(e,n){!de&&te&&((0,Xe.y)([qe.zX,qe.Um],n)||(0,Xe.y)([qe.PQ,qe.Um],n))&&(e.preventDefault(),I())}),[te,I]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(C.Z,{mb:w.cd,children:[(0,S.jsx)(O.ZP,{default:!0,children:d}),(0,S.jsx)(C.Z,{mt:1,children:(0,S.jsxs)(O.ZP,{default:!0,children:["Learn more about ",(0,S.jsx)(P.Z,{href:"https://docs.mage.ai/development/blocks/".concat((0,G.wX)((0,G._6)(v,null)),"/overview"),openNewWindow:!0,children:(0,G.wX)((0,G._6)(v,null))}),"."]})})]}),ce,(0,S.jsx)(C.Z,{mt:w.cd,children:(0,S.jsx)(jt.Z,{onClickOutside:function(){return z(!1)},open:!0,children:(0,S.jsx)(Bi.Z,{disableKeyboardShortcuts:!0,items:ne,onClickCallback:function(){return z(!1)},open:K,parentRef:H,uuid:v,children:(0,S.jsxs)(un.ZP,{beforeElement:(0,S.jsx)(cr.Wx,{rose:i===b.tf.CALLBACK,children:(0,S.jsx)(N.Add,{size:cr.ZG})}),inline:!0,onClick:function(e){e.preventDefault(),z(!0)},uuid:"AddNewBlocks/".concat(v),children:[(0,G.kC)(v)," block"]})})})})]})},Jr=t(26084);function $r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function el(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?$r(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$r(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var nl=[{Icon:N.Callback,name:"Callbacks",uuid:Jr.Q.CALLBACK},{Icon:N.Conditional,name:"Conditionals",uuid:Jr.Q.CONDITIONAL}];var tl=function(e){var n=(0,Vr.Z)({},e),t=(0,h.useRouter)(),i=(0,p.useState)(null),o=i[0],r=i[1];(0,p.useEffect)((function(){var e;r(null===(e=(0,pr.iV)())||void 0===e?void 0:e.addon)}),[t.asPath]);var l=(0,p.useMemo)((function(){var e,t;if(Jr.Q.CALLBACK===o)e={addOnBlockType:b.tf.CALLBACK,addOnBlocks:null===(t=n.pipeline)||void 0===t?void 0:t.callbacks,description:"Run 1 or more callback blocks whenever the main block succeeds or fails.",displayBlockName:"callback"};else if(Jr.Q.CONDITIONAL===o){var i;e={addOnBlockType:b.tf.CONDITIONAL,addOnBlocks:null===(i=n.pipeline)||void 0===i?void 0:i.conditionals,description:"Run 1 or more conditional blocks to determine whether or not the main block should be run.",displayBlockName:"conditional"}}if(e)return(0,S.jsx)(Qr,el(el({},e),n))}),[n,o]);return(0,S.jsx)(tn.W,{backend:on.PD,children:(0,S.jsxs)(C.Z,{p:w.cd,children:[l,!o&&(null===nl||void 0===nl?void 0:nl.map((function(e,n){var t=e.name,i=e.uuid,o=e.Icon;return(0,S.jsx)(C.Z,{mt:n>=1?w.cd:0,children:(0,S.jsx)(P.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,vr.u)({addon:i},{pushHistory:!0})},preventDefault:!0,children:(0,S.jsx)(At.Z,{dark:!0,children:(0,S.jsxs)(y.ZP,{alignItems:"center",justifyContent:"space-between",children:[(0,S.jsxs)(Z.Z,{alignItems:"center",children:[(0,S.jsx)(Gn.Z,{fullWidth:!1,children:(0,S.jsx)(C.Z,{p:w.cd,children:(0,S.jsx)(y.ZP,{alignItems:"center",children:(0,S.jsx)(o,{fill:"#885EFF",size:2*w.iI})})})}),(0,S.jsx)(C.Z,{mr:w.cd}),(0,S.jsx)(Z.Z,{flexDirection:"column",children:(0,S.jsx)(O.ZP,{bold:!0,children:t})})]}),(0,S.jsx)(N.ChevronRight,{})]})})})},i)})))]})})};function il(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ol(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?il(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):il(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var rl=function(e){var n=e.activeView,t=e.addNewBlockAtIndex,i=e.afterWidth,o=e.autocompleteItems,r=e.blockInteractionsMapping,u=e.blockRefs,c=e.blocks,s=e.blocksInNotebook,a=e.cancelPipeline,d=e.chartRefs,v=e.checkIfPipelineRunning,f=e.containerHeightOffset,h=e.contentByBlockUUID,g=e.createInteraction,b=e.deleteBlock,x=e.deleteWidget,j=e.editingBlock,k=e.executePipeline,Z=e.fetchFileTree,P=e.fetchPipeline,_=e.fetchSecrets,I=e.fetchVariables,E=e.globalDataProducts,T=e.globalVariables,M=e.insights,B=e.interactions,D=e.interactionsMapping,A=e.interruptKernel,R=e.isLoadingCreateInteraction,F=e.isLoadingUpdatePipelineInteraction,U=e.isPipelineExecuting,H=e.lastTerminalMessage,W=e.messages,G=e.metadata,K=e.onChangeCallbackBlock,z=e.onChangeChartBlock,q=e.onChangeCodeBlock,V=e.onSelectBlockFile,Y=e.onUpdateFileSuccess,X=e.permissions,Q=e.pipeline,J=e.pipelineInteraction,$=e.pipelineMessages,ee=e.project,ne=e.refAfterFooter,te=e.runBlock,ie=e.runningBlocks,oe=e.sampleData,re=e.savePipelineContent,le=e.savePipelineInteraction,ue=e.secrets,ce=e.selectedBlock,se=e.selectedFilePath,ae=e.sendTerminalMessage,de=e.setActiveSidekickView,ve=e.setAllowCodeBlockShortcuts,pe=e.setAnyInputFocused,fe=e.setBlockInteractionsMapping,he=e.setDisableShortcuts,me=e.setEditingBlock,ge=e.setErrors,xe=e.setHiddenBlocks,ke=e.setInteractionsMapping,Ze=e.setPermissions,ye=e.setSelectedBlock,Pe=e.setTextareaFocused,Ce=e.showBrowseTemplates,Oe=e.showDataIntegrationModal,we=e.showUpdateBlockModal,_e=e.sideBySideEnabled,Se=e.statistics,Ie=e.textareaFocused,Ee=e.treeRef,Te=e.updatePipelineInteraction,Me=e.updateWidget,De=e.widgets,Ae=(0,Je.i)().height,Re=uo.uX,Ne=(0,p.useState)([]),Le=Ne[0],Fe=Ne[1],Ue=(0,p.useState)(!!(0,Ye.U2)(Ye.Q9)),He=Ue[0],We=Ue[1],Ge=(0,p.useMemo)((function(){return i-(zr.k1+1)}),[i]),Ke=(0,p.useMemo)((function(){var e;return!(null===ee||void 0===ee||null===(e=ee.features)||void 0===e||!e[Vi.d.INTERACTIONS])}),[null===ee||void 0===ee?void 0:ee.features]),ze=((null===j||void 0===j?void 0:j.upstreamBlocks)||{}).block,qe=((null===oe||void 0===oe?void 0:oe.columns)||[]).slice(0,100),Ve=(0,p.useMemo)((function(){return(null===oe||void 0===oe?void 0:oe.rows)||[]}),[oe]),Xe=(0,p.useMemo)((function(){return(null===G||void 0===G?void 0:G.column_types)||{}}),[G]),Qe=(0,p.useMemo)((function(){return(null===M||void 0===M?void 0:M[1])||{}}),[M]),$e=(0,p.useMemo)((function(){return(0,L.HK)((null===M||void 0===M?void 0:M[0])||[],(function(e){return e.feature.uuid}))}),[M]),en=!!oe,nn=(0,p.useMemo)((function(){return sn.qL.INTEGRATION===(null===Q||void 0===Q?void 0:Q.type)}),[Q]),tn=sn.qL.STREAMING!==(null===Q||void 0===Q?void 0:Q.type)?-70:He?-16:300,on=(0,p.useCallback)((0,jo.Fk)({columnTypes:Xe,columns:qe,insightsByFeatureUUID:$e,insightsOverview:Qe,noColumnLinks:!0,statistics:Se}),[Xe,qe,$e,Qe,Se]),rn=(0,p.useMemo)((function(){return(0,S.jsx)(yr,{blocks:c,fetchVariables:I,pipeline:Q,selectedBlock:ce,setErrorMessages:Fe,variables:T,width:Ge})}),[Ge,c,I,T,Q,ce]),ln=(0,p.useMemo)((function(){return(0,S.jsx)(br.Z,{onActionCallback:Y,pipeline:Q,selectedBlock:ce,selectedFilePath:se,setErrors:ge,width:Ge>Be.nn?Ge-Be.nn:Ge})}),[Ge,Y,Q,ce,se,ge]),un=(0,p.useMemo)((function(){return(0,S.jsx)(Gr,{fetchSecrets:_,pipelineUUID:null===Q||void 0===Q?void 0:Q.uuid,secrets:ue,setErrorMessages:Fe,width:Ge})}),[Ge,_,Q,ue]),cn=(0,p.useMemo)((function(){return{addNewBlockAtIndex:t,autocompleteItems:o,blockRefs:u,blocks:c,blocksInNotebook:s,deleteBlock:b,fetchFileTree:Z,fetchPipeline:P,interruptKernel:A,messages:W,onChangeCallbackBlock:K,onChangeCodeBlock:q,onSelectBlockFile:V,pipeline:Q,runBlock:te,runningBlocks:ie,savePipelineContent:re,selectedBlock:ce,setAnyInputFocused:pe,setErrors:ge,setHiddenBlocks:xe,setSelectedBlock:ye,setTextareaFocused:Pe,showBrowseTemplates:Ce,showUpdateBlockModal:we,textareaFocused:Ie}}),[t,o,u,c,s,b,Z,P,A,W,K,q,V,Q,te,ie,re,ce,pe,ge,xe,ye,Pe,Ce,we,Ie]),an=(0,p.useMemo)((function(){return qe.length>0&&(0,S.jsx)(En.Z,{columnHeaderHeight:(0,Mn.Qr)(Xe)&&(0,Mn.Qr)($e)&&(0,Mn.Qr)(Qe)?0:Tn.Eh,columns:qe,height:Ae-Re-uo.OM,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,renderColumnHeader:on,rows:Ve,width:Ge})}),[Ge,Xe,qe,Re,Ae,$e,Qe,on,Ve]),dn=(0,p.useMemo)((function(){return De.length>0&&(0,S.jsx)(er,{autocompleteItems:o,blockRefs:u,blocks:c,chartRefs:d,deleteWidget:x,fetchFileTree:Z,fetchPipeline:P,messages:W,onChangeChartBlock:z,pipeline:Q,runBlock:te,runningBlocks:ie,savePipelineContent:re,selectedBlock:ce,setAnyInputFocused:pe,setErrors:ge,setSelectedBlock:ye,setTextareaFocused:Pe,textareaFocused:Ie,updateWidget:Me,widgets:De,width:Ge})}),[Ge,o,u,c,d,x,Z,P,W,z,Q,te,ie,re,ce,pe,ge,ye,Pe,Ie,Me,De]),vn=(0,p.useMemo)((function(){return(0,S.jsx)("div",{style:{height:"100%",position:"relative",width:Ge},children:(0,S.jsx)(Kr.Z,{lastMessage:H,onFocus:function(){return ye(null)},sendMessage:ae,width:Ge})})}),[Ge,H,ae,ye]),pn=(0,p.useMemo)((function(){return(0,S.jsx)(gr,ol({},cn))}),[cn]),fn=(0,p.useMemo)((function(){return(0,S.jsx)(tl,ol({},cn))}),[cn]),hn=(0,p.useMemo)((function(){return Q&&ce&&(0,S.jsx)(Bo,{addNewBlockAtIndex:t,block:ce,contentByBlockUUID:h,fetchFileTree:Z,fetchPipeline:P,globalDataProducts:E,pipeline:Q,project:ee,setSelectedBlock:ye,showDataIntegrationModal:Oe,showUpdateBlockModal:we})}),[t,h,Z,P,E,Q,ee,ce,ye,Oe,we]);return(0,S.jsxs)(S.Fragment,{children:[(null===Le||void 0===Le?void 0:Le.length)>=1&&(0,S.jsxs)(C.Z,{mb:3,mt:2,mx:2,children:[(0,S.jsxs)(y.ZP,{justifyContent:"space-between",children:[(0,S.jsx)(O.ZP,{bold:!0,danger:!0,children:"Errors"}),(0,S.jsx)(be.ZP,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return Fe([])},transparent:!0,children:(0,S.jsx)(N.Close,{muted:!0})})]}),null===Le||void 0===Le?void 0:Le.map((function(e){return(0,S.jsx)(C.Z,{pb:1,children:(0,S.jsx)(O.ZP,{monospace:!0,xsmall:!0,children:e})},e)}))]}),(0,S.jsxs)(Tn.t0,{fullWidth:!0,heightOffset:Gi.cH.TERMINAL===n||n===Gi.cH.TREE?0:f||Be.nn,onBlur:function(){se||he(!1),null===ve||void 0===ve||ve(!1)},onFocus:function(){he(!0),n===Gi.cH.TREE&&(null===ve||void 0===ve||ve(!0))},overflowHidden:n===Gi.cH.TREE,tabIndex:0,children:[n===Gi.cH.TREE&&(0,S.jsx)(m.Z,{uuid:"PipelineDetail/".concat(null===Q||void 0===Q?void 0:Q.uuid),children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(je.ZP,{addNewBlockAtIndex:t,blockRefs:u,blocks:c,contentByBlockUUID:h,contextMenuEnabled:!0,deleteBlock:b,dragEnabled:!0,editingBlock:j,enablePorts:!nn,fetchPipeline:P,height:Ae-(Re-Be.nn)-tn,messages:W,onClickNode:function(e){var n=e.block.uuid;return xe((function(e){var t=!(null===e||void 0===e||!e[n]);return t?ol(ol({},e),{},(0,l.Z)({},n,!t)):e}))},pipeline:Q,runBlock:te,runningBlocks:ie,selectedBlock:ce,setActiveSidekickView:de,setEditingBlock:me,setErrors:ge,setSelectedBlock:function(e){ye(e),_e&&(0,qr.F)(e)},showUpdateBlockModal:we,treeRef:Ee}),!ze&&sn.qL.STREAMING===(null===Q||void 0===Q?void 0:Q.type)&&(0,S.jsx)(C.Z,{p:1,children:(0,S.jsx)(Er,{cancelPipeline:a,checkIfPipelineRunning:v,executePipeline:k,isPipelineExecuting:U,pipelineExecutionHidden:He,pipelineMessages:$,setPipelineExecutionHidden:We})})]})}),n===Gi.cH.DATA&&an,Gi.cH.SECRETS===n&&un,Gi.cH.VARIABLES===n&&rn,Gi.cH.FILE_VERSIONS===n&&(0,S.jsx)(m.Z,{uuid:"FileVersions/".concat(se?decodeURIComponent(se):""),children:ln}),nn||ce&&en||!ce&&en&&n===Gi.cH.DATA?null:Gi.du.includes(n)&&(0,S.jsx)(y.ZP,{alignItems:"center",justifyContent:"center",verticalHeight:Gi.fp,verticalHeightOffset:Re,width:Ge,children:(0,S.jsx)(O.ZP,{center:!0,default:!0,disableWordBreak:!0,large:!0,monospace:!0,children:ce?!en&&"No data or insights available":"Select a block for insights"})}),Gi.cH.CHARTS===n&&(De.length>0?dn:(0,S.jsxs)(y.ZP,{alignItems:"center",flexDirection:"column",justifyContent:"center",verticalHeight:Gi.fp,verticalHeightOffset:Re,width:Ge,children:[(0,S.jsx)(C.Z,{px:1,children:(0,S.jsx)(y.ZP,{flexDirection:"row",children:(0,S.jsxs)(O.ZP,{center:!0,default:!0,children:["Add a chart by clicking the chart icon \xa0",(0,S.jsx)(N.Charts,{size:1.5*w.iI}),"\xa0in",(0,S.jsx)("br",{}),"the top right corner of a block (if applicable)."]})})}),(0,S.jsx)(C.Z,{mt:w.cd,px:1,children:(0,S.jsx)(tr,{size:40*w.iI})})]})),Gi.cH.TERMINAL===n&&vn,Gi.cH.EXTENSIONS===n&&pn,Gi.cH.ADDON_BLOCKS===n&&fn,Gi.cH.BLOCK_SETTINGS===n&&(ce?hn:(0,S.jsx)(y.ZP,{alignItems:"center",flexDirection:"column",justifyContent:"center",verticalHeight:Gi.fp,verticalHeightOffset:Re,width:Ge,children:(0,S.jsx)(C.Z,{px:1,children:(0,S.jsx)(y.ZP,{flexDirection:"row",children:(0,S.jsxs)(O.ZP,{center:!0,default:!0,children:["Please select a block and then click the settings icon \xa0",(0,S.jsx)(N.SettingsWithKnobs,{size:1.5*w.iI}),"\xa0",(0,S.jsx)("br",{}),"in the top right corner of a block (if applicable)."]})})})})),Gi.cH.INTERACTIONS===n&&Ke&&(0,S.jsx)(Wr,{blockInteractionsMapping:r,containerWidth:Ge,createInteraction:function(e){return g({interaction:e})},interactions:B,interactionsMapping:D,isLoadingCreateInteraction:R,isLoadingUpdatePipelineInteraction:F,permissions:X,pipeline:Q,pipelineInteraction:J,refAfterFooter:ne,savePipelineInteraction:le,selectedBlock:ce,setBlockInteractionsMapping:fe,setInteractionsMapping:ke,setPermissions:Ze,setSelectedBlock:ye,updatePipelineInteraction:function(e){return Te({pipeline_interaction:e})}})]})]})};var ll=function(e){var n,t=e.activeView,i=e.pipeline,o=e.project,r=e.secrets,l=e.selectedBlock,u=e.setSelectedBlock,c=e.variables,s=null===i||void 0===i?void 0:i.uuid,a=(0,pr.iV)(),d=(0,Zr.wx)(c,(function(e){return e.uuid===jr.C})),v=(0,Gi.Qq)({project:o})[t],f=(null===v||void 0===v||null===(n=v.buildLabel)||void 0===n?void 0:n.call(v,{pipeline:i,secrets:r,variables:d}))||(null===v||void 0===v?void 0:v.label);Gi.cH.BLOCK_SETTINGS===t&&null!==l&&void 0!==l&&l.uuid&&(f=(0,S.jsxs)(S.Fragment,{children:["Block settings for ",(0,S.jsx)(O.ZP,{bold:!0,color:(0,_.qn)(null===l||void 0===l?void 0:l.type).accent,inline:!0,monospace:!0,children:null===l||void 0===l?void 0:l.uuid})]}));var h=(0,S.jsx)(O.ZP,{bold:!0,children:f}),m=Gi.cH.EXTENSIONS===t&&(null===a||void 0===a?void 0:a.extension),g=Y.ZP.extension_options.list({},{},{pauseFetch:!m}).data,b=(0,p.useMemo)((function(){return(null===g||void 0===g?void 0:g.extension_options)||[]}),[g]),x=(0,p.useMemo)((function(){return(0,L.HK)(b,(function(e){return e.uuid}))}),[b]),j=Gi.cH.ADDON_BLOCKS===t&&(null===a||void 0===a?void 0:a.addon);if(Gi.cH.INTERACTIONS===t){var k=[];null!==l&&void 0!==l&&l.uuid?k.push.apply(k,[{label:function(){return"All interactions"},monospace:!1,onClick:function(){return u(null)}},{bold:!0,label:function(){return null===l||void 0===l?void 0:l.uuid},monospace:!0}]):k.push({bold:!0,label:function(){return"Interactions"},monospace:!1}),h=(0,S.jsx)(bn.Z,{breadcrumbs:k,noMarginLeft:!0})}else{if(!t)return(0,S.jsx)("div",{});if(m){var Z=x[null===a||void 0===a?void 0:a.extension];h=(0,S.jsxs)(y.ZP,{children:[(0,S.jsx)(ri(),{as:"/pipelines/".concat(s,"/edit?").concat(Gi.uM,"=").concat(Gi.cH.EXTENSIONS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,S.jsx)(P.Z,{default:!0,children:f})}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,S.jsx)(O.ZP,{bold:!0,children:null===Z||void 0===Z?void 0:Z.name})]})}else j&&(h=(0,S.jsxs)(y.ZP,{children:[(0,S.jsx)(ri(),{as:"/pipelines/".concat(s,"/edit?").concat(Gi.uM,"=").concat(Gi.cH.ADDON_BLOCKS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,S.jsx)(P.Z,{default:!0,children:f})}),(0,S.jsx)(O.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,S.jsx)(O.ZP,{bold:!0,children:(0,G.vg)(null===a||void 0===a?void 0:a.addon)})]}))}return(0,S.jsx)(uo.ym,{children:h})},ul=t(27597),cl=t(38325),sl=t(16682),al=t(87432),dl=t(65044),vl=t(78419),pl=t(11498),fl=t(28795),hl=t(85010);function ml(e){var n=e.activeView,t=e.pipeline,i=e.project,o=e.secrets,r=e.setActiveSidekickView,l=e.variables,u=(0,Zr.wx)(l,(function(e){return e.uuid===jr.C}));return(0,Gi.j5)({pipeline:t,project:i}).map((function(e){var i=e.buildLabel,l=e.key,c=e.label;return{Icon:Gi.Z7[l],id:l,isSelected:function(){return n===l},label:function(){return(null===i||void 0===i?void 0:i({pipeline:t,secrets:o,variables:u}))||c},onClick:function(){return r(l,!0)}}}))}var gl=t(53005),bl=t(4383),xl=t(70320);function jl(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 kl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?jl(Object(t),!0).forEach((function(n){(0,l.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):jl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Zl(e){var n,t,i,u,c,s,x,j,k,Z,P,O,_,I,E,B,D,A,R,F,W=e.page,K=e.pipeline,z=(0,p.useRef)(null),q=(0,p.useRef)(null),V=(0,d.ZP)((0,bl.Ib)("terminal"),{shouldReconnect:function(){return!0}}),X=V.lastMessage,Q=V.sendMessage,J=(0,yt.Z)({refreshInterval:null,revalidateOnFocus:!1}).fetch,$=(0,Pt.Z)(),ne=$.featureEnabled,te=$.featureUUIDs,ie=$.fetchProjects,oe=$.project,re=$.sparkEnabled,le=(0,Xi.Z)().status,ue=(0,p.useContext)(v.ThemeContext),ce=(0,h.useRouter)(),se=(0,Je.i)().height,de=ce.query.pipeline,pe=K.uuid||de,fe=(0,p.useState)(!0),he=fe[0],me=fe[1],xe=(0,p.useState)(!1),je=xe[0],ke=xe[1],ye=(0,p.useState)(null),Ce=ye[0],Oe=ye[1],we=(0,p.useState)(null),_e=we[0],Se=we[1],Ie=(0,p.useState)(null),Ee=Ie[0],Te=Ie[1],Me=(0,p.useState)(null),Be=Me[0],De=Me[1],Ae=(0,p.useState)(!1),Re=Ae[0],Ne=Ae[1],Le=(0,p.useState)(!1),Fe=Le[0],Ue=Le[1],He=(0,p.useState)(!1),We=He[0],Ge=He[1],Ke=(0,p.useState)(!1),ze=Ke[0],qe=Ke[1],Ve=(0,p.useState)(!0),Xe=Ve[0],Qe=Ve[1],$e=(0,p.useState)(!1),en=$e[0],tn=$e[1],on=(0,p.useState)({upstreamBlocks:null}),rn=on[0],ln=on[1],cn=(0,p.useState)([]),an=cn[0],dn=cn[1],vn=(0,p.useState)(null),pn=vn[0],hn=vn[1],mn=(0,p.useState)(null),bn=mn[0],xn=mn[1],jn=(0,pr.iV)(),Zn=jn[Gi.uM],yn=jn.block_uuid,Pn=(0,p.useCallback)((function(e){var n;hn(e),e&&We&&Ge(!1),xn(null),yn&&(null===yn||void 0===yn||null===(n=yn.split(":"))||void 0===n?void 0:n[0])!==(null===e||void 0===e?void 0:e.uuid)&&(0,vr.u)({block_uuid:null})}),[yn,We]),Cn=(0,p.useState)(!!(0,Ye.U2)(Ye.zg)),On=Cn[0],wn=Cn[1],_n=(0,p.useState)(!!(0,Ye.U2)(Ye.Uu)),Sn=_n[0],In=_n[1],En=((0,p.useMemo)((function(){var e;return(0,xl.hY)(null===oe||void 0===oe||null===(e=oe.features)||void 0===e?void 0:e[Vi.d.LOCAL_TIMEZONE])}),[null===oe||void 0===oe?void 0:oe.features]),(0,p.useMemo)((function(){var e;return!(null===oe||void 0===oe||null===(e=oe.features)||void 0===e||!e[Vi.d.INTERACTIONS])}),[null===oe||void 0===oe?void 0:oe.features])),Tn="".concat(vl.H8,"_").concat(pe),Bn=(0,Ye.U2)(Tn),Dn=(0,p.useState)((0,L.sE)(ci.NR,(function(e){return e.uuid===Bn}))||ci.NR[0]),An=Dn[0],Rn=Dn[1],Nn=(0,p.useCallback)((function(e){Rn(e),(0,Ye.t8)(Tn,null===e||void 0===e?void 0:e.uuid)}),[Tn,Rn]),Ln="".concat(vl.g6,"_").concat(pe),Fn=(0,p.useState)({}),Un=Fn[0],Hn=Fn[1],Wn=(0,p.useRef)(null),Gn=(0,p.useMemo)((function(){return null===le||void 0===le?void 0:le.disable_pipeline_edit_access}),[le]),Kn=(0,p.useMemo)((function(){return null===le||void 0===le?void 0:le.max_print_output_lines}),[le]),zn=(0,p.useState)({}),qn=zn[0],Vn=zn[1],Yn=(0,p.useState)([]),Xn=Yn[0],Qn=Yn[1],Jn=(0,kn.Z)(pe),$n=Y.ZP.pipelines.detail(pe,kl({include_block_pipelines:!0,includes_outputs:(0,Mn.Qr)(qn)||"undefined"===typeof F||null===F||"undefined"===typeof(null===(n=F)||void 0===n?void 0:n.blocks)||null===(null===(t=F)||void 0===t?void 0:t.blocks)||!(null===(i=F)||void 0===i||null===(u=i.blocks)||void 0===u||!u.find((function(e){return"undefined"===typeof e.ouputs})))},Xe?{includes_outputs_spark:!0}:{}),{refreshInterval:null,revalidateOnFocus:!1},{key:"/pipelines/".concat(pe,"/edit")}),et=$n.data,nt=$n.mutate,tt=(0,Yi.Z)(Y.ZP.pipeline_interactions.detail,pe,{},{revalidateOnFocus:!1},{condition:function(){return En},delay:3e3}),it=tt.data,ot=tt.mutate,rt=(0,Yi.Z)(Y.ZP.interactions.pipeline_interactions.list,pe,{},{revalidateOnFocus:!1},{condition:function(){return En},delay:3e3}),lt=rt.data,ut=rt.mutate,ct=(0,p.useMemo)((function(){return(null===it||void 0===it?void 0:it.pipeline_interaction)||{}}),[it]),st=(0,p.useMemo)((function(){return(null===lt||void 0===lt?void 0:lt.interactions)||[]}),[lt]),at=(0,f.Db)(Y.ZP.pipeline_interactions.useUpdate(pe),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){ot()},onErrorCallback:function(e,n){return Se({errors:n,response:e})}})}}),dt=(0,r.Z)(at,2),vt=dt[0],pt=dt[1].isLoading,ft=(0,f.Db)(Y.ZP.interactions.pipeline_interactions.useCreate(pe),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){ut(),ot()},onErrorCallback:function(e,n){return Se({errors:n,response:e})}})}}),ht=(0,r.Z)(ft,2),mt=ht[0],gt=ht[1].isLoading;F=(0,p.useMemo)((function(){return null===et||void 0===et?void 0:et.pipeline}),[et]);var bt=(0,p.useMemo)((function(){var e;return sn.qL.INTEGRATION===(null===(e=F)||void 0===e?void 0:e.type)}),[F]);(0,p.useEffect)((function(){F&&Xe&&re&&Qe(!1)}),[Xe,F,Qe,re]);var jt=(0,p.useState)((0,Ye.U2)(vl.iL,!1)),kt=jt[0],Zt=jt[1],Ct=(0,p.useMemo)((function(){return!bt&&(null===ne||void 0===ne?void 0:ne(null===te||void 0===te?void 0:te.NOTEBOOK_BLOCK_OUTPUT_SPLIT_VIEW))&&kt}),[ne,te,bt,kt]),Ot=(0,p.useState)((0,Ye.U2)(vl.qj,!1)),wt=Ot[0],_t=Ot[1],St=(0,p.useMemo)((function(){return(null===ne||void 0===ne?void 0:ne(null===te||void 0===te?void 0:te.NOTEBOOK_BLOCK_OUTPUT_SPLIT_VIEW))&&wt}),[ne,te,wt]),Bt=(0,p.useCallback)((function(e){_t(e),(0,Ye.t8)(vl.qj,"function"===typeof e?e():e)}),[_t]),Dt=(0,p.useCallback)((function(e){var n="function"===typeof e?e():e;Zt(e),(0,Ye.t8)(vl.iL,n),n||Bt(e)}),[Bt,Zt]),Rt=(0,p.useCallback)((function(){var e=new CustomEvent(ci.$e,{detail:{}});window.dispatchEvent(e)}),[]),Nt=(0,p.useCallback)((function(){var e=new CustomEvent(ci.tK,{detail:{}});window.dispatchEvent(e)}),[]),Lt=(0,p.useCallback)((function(e){Hn((function(n){var t=e(n);return(0,Ye.t8)(Ln,JSON.stringify(t)),t})),Ct&&(clearTimeout(q.current),q.current=setTimeout((function(){Nt(),Rt()}),ge.e+1))}),[Rt,Nt,Ln,Hn,Ct]);(0,p.useEffect)((function(){var e=(0,Ye.U2)(Ln);e&&(0,G.Pb)(e)&&Hn(JSON.parse(e))}),[Ln,Hn]);var Ft=(0,p.useState)(null),Ut=Ft[0],Ht=Ft[1],Wt=(0,p.useState)(!1),Gt=Wt[0],Kt=Wt[1],zt=(0,p.useState)(!1),qt=zt[0],Vt=zt[1],Xt=(0,$t.dd)((function(){return(0,S.jsx)(Yt.Z,{centerOnScreen:!0,neutral:!0,onClick:ei,subtitle:"This pipeline may be open on another tab. Saving changes here could overwrite any changes made to this pipeline on a separate tab. Proceed with caution.",title:"Your pipeline may be stale.",width:34*w.iI})}),{},[],{background:!0,uuid:"stale_pipeline_message"}),Qt=(0,r.Z)(Xt,2),Jt=Qt[0],ei=Qt[1];function ni(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=arguments.length>2?arguments[2]:void 0,i=(0,l.Z)({},Gi.uM,e);null!==t&&void 0!==t&&t.addon&&(i.addon=null===t||void 0===t?void 0:t.addon),null!==t&&void 0!==t&&t.blockUUID&&(i.block_uuid=null===t||void 0===t?void 0:t.blockUUID),null!==t&&void 0!==t&&t.extension&&(i.extension=null===t||void 0===t?void 0:t.extension),me(!0),(0,vr.u)(i,{preserveParams:["addon","block_uuid","file_path","file_paths[]"],pushHistory:n,replaceParams:!0})}(0,p.useEffect)((function(){var e=new BroadcastChannel("".concat(pe,"_pipeline_editor_tabs"));return e.addEventListener("message",(function(e){"new_tab_same_page_opened"===e.data&&Vt(!0)})),e.postMessage("new_tab_same_page_opened"),function(){e.close()}}),[]),(0,p.useEffect)((function(){qt&&(Jt(),Vt(!1))}),[qt,Jt]),(0,p.useEffect)((function(){var e;null!==et&&void 0!==et&&null!==(e=et.pipeline)&&void 0!==e&&e.updated_at&&Ut!==a()().utc().unix()&&Ht(a()(et.pipeline.updated_at).unix())}),[null===et||void 0===et||null===(c=et.pipeline)||void 0===c?void 0:c.updated_at,Ut]),(0,p.useEffect)((function(){Zn||ni(Gi.cH.TREE,!1)}),[Zn]);var oi=(0,p.useCallback)((function(e,n,t){wn(!1),setTimeout((function(){return ni(e,n,t)}),1)}),[]),ri=(0,p.useRef)({}),li=(0,p.useRef)({}),ui=(0,p.useRef)(null),si=(0,p.useRef)({}),ai=(0,p.useRef)({}),vi=(0,p.useRef)({}),pi=(0,p.useState)({}),fi=pi[0],hi=pi[1],mi=(0,p.useCallback)((function(e,n,t){var i=si.current||{};si.current=kl(kl({},i),{},(0,l.Z)({},e,kl(kl({},i[e]||{}),{},(0,l.Z)({},n,t))))}),[si]),gi=(0,p.useCallback)((function(e,n,t){var i=ai.current||{};ai.current=kl(kl({},i),{},(0,l.Z)({},e,kl(kl({},i[e]||{}),{},(0,l.Z)({},n,t))))}),[]),bi=(0,p.useCallback)((function(e,n,t){mi(e,n,t),Kt(!0)}),[mi,Kt]),ji=(0,p.useCallback)((function(e,n,t){gi(e,n,t),Gt||Kt(!0)}),[Gt,gi,Kt]),ki=(0,p.useCallback)((function(e){vi.current=kl(kl({},vi.current),e)}),[vi]),Zi=(0,p.useCallback)((function(e,n){ki((0,l.Z)({},e,n)),Kt(!0)}),[ki,Kt]),yi=(0,p.useState)(null),Pi=yi[0],Ci=yi[1],Oi=(0,p.useState)([]),wi=Oi[0],_i=Oi[1],Si=(0,p.useState)([]),Ii=Si[0],Ei=Si[1],Ti=(0,Yi.Z)(Y.ZP.data_providers.list,{},{revalidateOnFocus:!1},{delay:1e3,condition:(null===wi||void 0===wi?void 0:wi.length)>=1}).data,Mi=null===Ti||void 0===Ti?void 0:Ti.data_providers,Bi=(0,Yi.Z)(Y.ZP.variables.pipelines.list,pe,{global_only:!0},{revalidateOnFocus:!1},{delay:Gi.cH.VARIABLES===Zn?0:1e4}),Di=Bi.data,Ai=Bi.mutate,Ri=null===Di||void 0===Di?void 0:Di.variables,Ni=(0,Yi.Z)(Y.ZP.secrets.list,{},{revalidateOnFocus:!1},{delay:Gi.cH.SECRETS===Zn?0:1e4}),Li=Ni.data,Fi=Ni.mutate,Ui=null===Li||void 0===Li?void 0:Li.secrets,Hi=(0,p.useRef)({}),Wi=(0,p.useCallback)((function(e){var n;Kt(!0);var t=Hi.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),Hi.current[e.uuid]=kl(kl(kl({},t),e),{},{configuration:kl(kl({},t.configuration),e.configuration),upstream_blocks:i})}),[Kt,Hi]),Ki=(0,p.useCallback)((function(e,n,t){xn({block:{type:n,uuid:e},file:{path:t}})}),[]),zi=(0,di.Dp)(pe),qi=(0,di.Q9)(zi,wi),Ji=(0,p.useState)(qi),$i=Ji[0],eo=Ji[1],no=(0,p.useState)(),to=no[0],io=no[1],ro=(0,p.useState)(),lo=ro[0],co=ro[1],so=(0,p.useState)(null),po=so[0],fo=so[1],ho=(0,kn.Z)($i);(0,p.useCallback)((function(){ln({upstreamBlocks:{block:null,values:[]}}),Vn({}),Kt(!1),dn([]),Pn(null)}),[]);(0,p.useEffect)((function(){pe!==Jn&&(si.current={},ai.current={})}),[pe,Jn]);var mo=Y.ZP.block_outputs.detail(!On&&(null===po||void 0===po?void 0:po.type)!==b.tf.SCRATCHPAD&&(null===po||void 0===po?void 0:po.type)!==b.tf.CHART&&null!==po&&void 0!==po&&po.uuid?encodeURIComponent(null===po||void 0===po?void 0:po.uuid):null,{pipeline_uuid:pe}),go=mo.data,bo=mo.mutate,xo=(0,p.useMemo)((function(){return null===go||void 0===go?void 0:go.block_output}),[go]),jo=(0,p.useMemo)((function(){var e,n,t;return bt?null===(e=(0,L.sE)(null===xo||void 0===xo?void 0:xo.outputs,(function(e){return e.variable_uuid==="output_sample_data_".concat((0,G.kE)(lo))})))||void 0===e?void 0:e.sample_data:null===xo||void 0===xo||null===(n=xo.outputs)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.sample_data}),[xo,bt,lo]),ko=Y.ZP.blocks.pipelines.analyses.detail(On?null:pe,(null===po||void 0===po?void 0:po.type)!==b.tf.SCRATCHPAD&&(null===po||void 0===po?void 0:po.type)!==b.tf.CHART&&(null===po||void 0===po?void 0:po.uuid)&&encodeURIComponent(null===po||void 0===po?void 0:po.uuid)),Zo=ko.data,yo=ko.mutate,Po=(null===Zo||void 0===Zo||null===(s=Zo.analyses)||void 0===s?void 0:s[0])||{},Co=Po.insights,Oo=void 0===Co?{}:Co,wo=Po.metadata,_o=void 0===wo?{}:wo,So=Po.statistics,Io=void 0===So?{}:So;(0,p.useEffect)((function(){0===an.length&&(yo(),bo(),Ai())}),[yo,bo,Ai,an]),(0,p.useEffect)((function(){if(0===$i.length)fo(null);else if((null===ho||void 0===ho?void 0:ho.length)!==(null===$i||void 0===$i?void 0:$i.length)&&(null===$i||void 0===$i?void 0:$i.length)<(null===ho||void 0===ho?void 0:ho.length)){var e=ho.findIndex((function(e){return e.uuid===(null===po||void 0===po?void 0:po.uuid)})),n=ho.length-1===e?e-1:e+1;fo(ho[Math.max(0,n)])}}),[$i,ho,null===po||void 0===po?void 0:po.uuid]),(0,p.useEffect)((function(){var e;null!==(e=rn.upstreamBlocks)&&void 0!==e&&e.block&&(wn(!1),ni(Gi.cH.TREE))}),[rn.upstreamBlocks]);var Eo,To=(0,Yi.Z)(Y.ZP.autocomplete_items.list,{},{refreshInterval:!1,revalidateOnFocus:!1},{condition:(null===wi||void 0===wi?void 0:wi.length)>=1,delay:1e3}),Mo=To.data,Bo=To.mutate,Do=null===Mo||void 0===Mo?void 0:Mo.autocomplete_items,Ao=(0,f.Db)((function(e){var n=e.uuid;return Y.ZP.widgets.pipelines.useDelete(pe,n)()}),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var n=e.widget.uuid;Ei((function(e){return(0,L.oM)(e,e.findIndex((function(e){var t=e.uuid;return n===t})))})),nt(),qo()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;Se({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&Vn((function(e){return kl(kl({},e),{},(0,l.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:ii.Gi.TEXT_PLAIN}}))))}))}})}}),Ro=(0,r.Z)(Ao,1)[0],No=(0,p.useCallback)((function(e,n){var t,i=e||{},o=i.content,r=i.path;if(t=null!==n&&void 0!==n&&n.blockUUID?null===wi||void 0===wi?void 0:wi.find((function(e){return e.uuid===(null===n||void 0===n?void 0:n.blockUUID)})):(0,gl.IO)(r,wi)){var u=t,c=u.type,s=u.uuid;ji(c,s,o),_i((function(e){var n=null===e||void 0===e?void 0:e.findIndex((function(e){var n=e.type,t=e.uuid;return n===c&&t===s}));return n>=0&&(e[n].content=o),e})),hi((function(e){return kl(kl({},e),{},(0,l.Z)({},c,kl(kl({},null===e||void 0===e?void 0:e[c]),{},(0,l.Z)({},s,Number(new Date)))))})),nt()}}),[wi,nt,ji]),Lo=(0,p.useCallback)((function(e,n,t){Eo(e,wi.length,n,e.name,t)}),[Eo,wi.length]),Fo=(0,cl.Z)(),Uo=Fo.renderApplications,Ho=Fo.startApplication,Wo=(0,p.useCallback)((function(e,n){n||(Ho(null,null,sl.X9.ArcaneLibrary),Pn(null))}),[]),Go=(0,p.useCallback)((function(){Pn(null)}),[]),Ko=(0,xi.ZP)({addNewBlock:Lo,blocks:wi,delayFetch:Sn?7e3:1e3,deleteWidget:Ro,fetchAutocompleteItems:Bo,fetchPipeline:nt,fetchVariables:Ai,onOpenFile:Wo,onSelectBlockFile:Ki,onSelectFile:Go,onUpdateFileSuccess:No,openSidekickView:oi,pipeline:F,query:{include_pipeline_count:!0},sendTerminalMessage:Q,setDisableShortcuts:Ge,setSelectedBlock:Pn,showHiddenFilesSetting:!0,uuid:pe,widgets:Ii}),zo=Ko.browser,qo=(Ko.controller,Ko.fetchFiles),Vo=(Ko.filePaths,Ko.files),Yo=(Ko.filesTouched,Ko.menu,Ko.openFile),Xo=Ko.search,Qo=Ko.selectedFilePath,Jo=Ko.tabs,$o=(Ko.versions,Ko.versionsVisible,(0,f.Db)(Y.ZP.pipelines.useCreate(),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var n=e.pipeline.uuid;ce.push("/pipelines/[pipeline]/edit","/pipelines/".concat(n,"/edit")),qo()},onErrorCallback:function(e,n){return Se({errors:n,response:e})}})}})),er=(0,r.Z)($o,1)[0],nr=(0,f.Db)(Y.ZP.pipelines.useUpdate(pe,{update_content:!0}),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){Kt(!1),nt().then((function(e){var n,t,i,o=e.pipeline,r=null===(n=F)||void 0===n||null===(t=n.blocks)||void 0===t?void 0:t.map((function(e){return e.uuid})),l=null===o||void 0===o||null===(i=o.blocks)||void 0===i?void 0:i.map((function(e){return e.uuid}));!(0,L.fS)(r||[],l||[])&&Ct&&setTimeout((function(){(0,qr.h)()}),1)}))},onErrorCallback:function(e,n){return Se({errors:n,response:e})}})}}),tr=(0,r.Z)(nr,2),ir=tr[0],or=tr[1].isLoading,rr=(0,p.useState)({}),lr=rr[0],ur=rr[1],cr=(0,p.useCallback)((function(e,n){var t,i=e||{},o=i.block,l=i.pipeline,u=void 0===l?{extensions:{}}:l,c=(n||{}).contentOnly,s={},a={},d={},v={};((null===u||void 0===u?void 0:u.blocks)||wi).forEach((function(e){var n,t,i,l=e.extension_uuid,u=e.type,p=e.uuid,f=null===(n=ai.current[u])||void 0===n?void 0:n[p];"undefined"===typeof f&&(f=e.content);var h=null===(t=si.current[u])||void 0===t?void 0:t[p];"undefined"===typeof h&&(h=e.callback_content);var m=null,g=null===(i=qn[p])||void 0===i?void 0:i.filter((function(e){return!!e})),x=null===g||void 0===g?void 0:g.find((function(e){return e.error}));if(g&&(!re||null===an||void 0===an||!an.length)){var j=[],k=0;g.forEach((function(n){var t=n.data,i=n.type;(b.tf.SCRATCHPAD===e.type||x||"table"!==i&&null!==lr&&void 0!==lr&&lr[null===e||void 0===e?void 0:e.uuid])&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(dl.Lz)?e:e.concat(n)}),[]),i===ii.Gi.TEXT_PLAIN&&(k+=(null===t||void 0===t?void 0:t.length)||0)),(!Kn||k<Kn+5)&&j.push(n))})),m=j.map((function(e,n){return{text_data:JSON.stringify(e),variable_uuid:"output_".concat(n)}}))}var Z=kl(kl({},e),{},{callback_content:h,content:f});null===m?delete Z.outputs:Z.outputs=m,(null===o||void 0===o?void 0:o.uuid)===p&&Object.entries(o).forEach((function(e){var n=(0,r.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,r.Z)(e,2),i=n[0],o=n[1];Z[t]||(Z[t]={}),Z[t][i]=o})):Z[t]=i})),c?a[Z.uuid]={callback_content:Z.callback_content,content:Z.content,outputs:Z.outputs,uuid:Z.uuid}:[b.tf.EXTENSION].includes(u)?(s[l]||(s[l]=[]),s[l].push(Z)):b.tf.CALLBACK===u?d[Z.uuid]=Z:b.tf.CONDITIONAL===u?v[Z.uuid]=Z:a[Z.uuid]=Z}));var p=kl(kl({},null===(t=F)||void 0===t?void 0:t.extensions),null===u||void 0===u?void 0:u.extensions);Object.entries(s).forEach((function(e){var n=(0,r.Z)(e,2),t=n[0],i=n[1];p[t]||(p[t]={}),p[t].blocks=i}));var f=[],h=[],m=[];((null===u||void 0===u?void 0:u.blocks)||wi).forEach((function(e){var n=e.uuid,t=a[n],i=d[n],o=v[n];"undefined"!==typeof t?f.push(t):"undefined"!==typeof i?h.push(i):"undefined"!==typeof o&&m.push(o)})),ur({});var g=kl(kl(kl({},F),u),{},{blocks:f,callbacks:h,conditionals:m,extensions:p,widgets:Ii.map((function(e){var n,t,i=vi.current[e.uuid],o=Hi.current[e.uuid]||{};"undefined"===typeof i&&(i=e.content);var r=null===(n=qn[e.uuid])||void 0===n?void 0:n.filter((function(e){return!!e})),l=null===r||void 0===r?void 0:r.find((function(e){return e.error}));if(r){var u=[];r.forEach((function(n){var t=n.data,i=n.type;(b.tf.SCRATCHPAD===e.type||l||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(dl.Lz)?e:e.concat(n)}),[])),u.push(n))})),t=u.map((function(n,t){return{text_data:JSON.stringify(n),variable_uuid:"".concat(e.uuid,"_").concat(t)}}))}return kl(kl(kl({},e),o),{},{configuration:kl(kl({},e.configuration),o.configuration),content:i,outputs:t})}))});return delete g.updated_at,ir({pipeline:g})}),[wi,Kn,qn,lr,F,an,re,ir,Ii]),sr=(0,p.useMemo)((function(){return(0,di.Rz)(F,{displayRelative:!0,isPipelineUpdating:or,pipelineContentTouched:Gt,pipelineLastSaved:Ut})}),[or,F,Gt,Ut]),ar=(0,$t.dd)((function(e){var n,t,i=e||{block:null,contentByBlockUUID:null},o=i.block,r=i.contentByBlockUUID,l=o||{type:null,uuid:null},u=l.type,c=l.uuid,s=kl({},o);r&&(s.content=null===r||void 0===r||null===(n=r.current)||void 0===n||null===(t=n[u])||void 0===t?void 0:t[c]);return(0,S.jsx)(ae.BC,{children:(0,S.jsx)(xt,kl(kl({},e),{},{block:s,onChangeCodeBlock:ji,onClose:hr,pipeline:F,savePipelineContent:cr}))})}),{},[ji,F,cr],{background:!0,disableClickOutside:!0,disableCloseButton:!0,disableEscape:!0,uuid:"DataIntegrationModal/".concat(pe)}),dr=(0,r.Z)(ar,2),fr=dr[0],hr=dr[1];(0,p.useEffect)((function(){if(bn){var e,n=(null===bn||void 0===bn?void 0:bn.block)||{type:null,uuid:null},t=n.type,i=n.uuid,o=wi.find((function(e){var n=e.type,o=e.uuid;return n===t&&o===i}));if(o){if(Pn(o),null!==ri&&void 0!==ri&&ri.current){var r,l=ri.current[(0,di.zv)(o)];null===l||void 0===l||null===(r=l.current)||void 0===r||r.scrollIntoView()}}else if(t===b.tf.CHART){var u=Ii.find((function(e){return e.uuid===i}));if(u&&(Pn(u),null!==li&&void 0!==li&&li.current)){var c,s=li.current[u.uuid];null===s||void 0===s||null===(c=s.current)||void 0===c||c.scrollIntoView()}}else if(null!==bn&&void 0!==bn&&null!==(e=bn.file)&&void 0!==e&&e.path){var a;Yo(null===bn||void 0===bn||null===(a=bn.file)||void 0===a?void 0:a.path)}}}),[wi,Yo,bn,Pn,Ii]),(0,p.useEffect)((function(){var e,n,t=et,i=[],o=null===(e=F)||void 0===e?void 0:e.variables_dir,r=null===(n=F)||void 0===n?void 0:n.remote_variables_dir;null!==et&&void 0!==et&&et.hasOwnProperty("error")?"undefined"!==pe?i=[{label:"Check pipeline configuration file for any issues",onClick:function(){Yo("pipelines/".concat(pe,"/").concat(Ze.dT.METADATA_YAML)),Se(null)}}]:t.error.displayMessage="There may be an issue with your pipeline\u2019s configuration file. Please check to make sure it is valid. It can be found at /pipelines/[pipeline_uuid]/metadata.yaml.":null!==Ti&&void 0!==Ti&&Ti.hasOwnProperty("error")?t=Ti:(null!==o&&void 0!==o&&o.includes("None")||null!==r&&void 0!==r&&r.includes("None"))&&(t={error:{displayMessage:"The variables_dir (".concat(o,") or remote_variables_dir (").concat(r,")")+" might be configured incorrectly. Please make sure those properties have values interpolated correctly in your project\u2019s metadata.yaml config file."}},i=[{label:"Check project configuration",onClick:function(){Yo("".concat(Ze.dT.METADATA_YAML)),Te(null)}}]),(0,Pe.bB)(t,Te,i)}),[et,Ti,Yo,null===(x=F)||void 0===x?void 0:x.remote_variables_dir,null===(j=F)||void 0===j?void 0:j.variables_dir,pe]);var mr=(0,p.useMemo)((function(){var e=[],n=[];return wi.forEach((function(t){b.M5.includes(t.type)?n.push(t):e.push(t)})),{blocksInNotebook:e,blocksInSidekick:n}}),[wi]),gr=mr.blocksInNotebook,br=mr.blocksInSidekick,xr=(0,p.useCallback)((function(e,n){return cr({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 o,r=e.data.pipeline.uuid;if(pe!==r)window.location.href="".concat(ce.basePath,"/pipelines/").concat(r,"/edit");else qo(),n!==(null===(o=F)||void 0===o?void 0:o.type)&&nt(),(0,di.k1)(gr,pe,r),(0,di.k1)(br,pe,r)}else null!==e&&void 0!==e&&null!==(i=e.data)&&void 0!==i&&i.error&&Se((function(e){return kl(kl({},e),{},{links:[{label:"Check pipeline configuration",onClick:function(){Yo("pipelines/".concat(pe,"/").concat(Ze.dT.METADATA_YAML)),Se(null)}}]})}))}))}),[gr,br,qo,nt,Yo,null===(k=F)||void 0===k?void 0:k.type,pe,ce,cr]),jr=(0,p.useState)(null),kr=jr[0],Zr=jr[1],yr=(0,p.useState)(null),Pr=yr[0],Cr=yr[1],Or=(0,p.useState)(null),wr=Or[0],_r=Or[1],Sr=(0,p.useCallback)((function(e){return vt({pipeline_interaction:kl(kl({},ct),{},{blocks:null!==e&&void 0!==e&&e.blockInteractionsMapping?null===e||void 0===e?void 0:e.blockInteractionsMapping:Pr,interactions:kr,permissions:null===wr||void 0===wr?void 0:wr.map((function(e){var n=e.roles,t=e.triggers;return{roles:null===n||void 0===n?void 0:n.map((function(e){return"string"===typeof e?e:null===e||void 0===e?void 0:e.role})),triggers:null===t||void 0===t?void 0:t.map((function(e){return{schedule_interval:e.schedule_interval,schedule_type:e.schedule_type}}))}}))})})}),[Pr,kr,wr,ct,vt]),Ir=(0,f.Db)((function(e){var n=e.extension_uuid,t=e.force,i=e.type,o=e.uuid,r={};return i&&(r.block_type=i),n&&(r.extension_uuid=n),"undefined"!==typeof t&&(r.force=t),Y.ZP.blocks.pipelines.useDelete(pe,encodeURIComponent(o),r)()}),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(e){var n=e.block,t=n.type,i=n.uuid;if(_i((function(e){return(0,L.oM)(e,e.findIndex((function(e){var n=e.type,o=e.uuid;return t===n&&i===o})))})),nt(),Pn(null),En){var o=kl({},Pr);delete o[i],Sr({blockInteractionsMapping:o}).then((function(e){var n=e.pipeline_interaction;return Cr(null===n||void 0===n?void 0:n.blocks)}))}},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;Se({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&Vn((function(e){return kl(kl({},e),{},(0,l.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:ii.Gi.TEXT_PLAIN}}))))}))}})}}),Er=(0,r.Z)(Ir,1)[0],Tr=(0,$t.dd)((function(e){return(0,S.jsx)(Yt.Z,{centerOnScreen:!0,neutral:!0,onCancel:Dr,onClick:function(){return Rr(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*w.iI})})),Mr=(0,r.Z)(Tr,2),Br=Mr[0],Dr=Mr[1],Ar=(0,f.Db)((function(e){var n=e.language,t=e.type,i=e.uuid,o="".concat(t,"/").concat(i);return n&&Ze.JD[n]&&(o="".concat(o,".").concat(Ze.JD[n].toLowerCase())),Y.ZP.blocks.useDelete(encodeURIComponent(o))()}),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){Bo(),nt()},onErrorCallback:function(e,n){Br(),Se({displayMessage:e.exception,errors:n,response:e})}})}}),Rr=(0,r.Z)(Ar,1)[0],Nr=(0,f.Db)(Y.ZP.kernels.useUpdate("__auto_detect"),{onSuccess:function(e){return(0,Pe.wD)(e,{callback:function(){return J()},onErrorCallback:function(e,n){return Se({errors:n,response:e})}})}}),Lr=(0,r.Z)(Nr,1)[0],Fr=(0,p.useCallback)((function(){return Lr({kernel:{action_type:"restart"}})}),[Lr]),Ur=(0,p.useCallback)((function(){Lr({kernel:{action_type:"interrupt"}}),dn([])}),[Lr]),Hr=(0,f.Db)(Y.ZP.blocks.pipelines.useCreate(pe)),Wr=(0,r.Z)(Hr,1)[0];Eo=(0,p.useCallback)((function(e,n,t){var i,l,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,G.Y6)(),c=arguments.length>4?arguments[4]:void 0;e.converted_from_type&&e.converted_from_uuid&&(i=null===(l=ai.current[e.converted_from_type])||void 0===l?void 0:l[e.converted_from_uuid]);var s=e.language,a=e.type;if(bt){var d,v=(0,L.HK)((null===(d=F)||void 0===d?void 0:d.blocks)||[],(function(e){return e.type})),p=v[b.tf.DATA_EXPORTER],f=v[b.tf.DATA_LOADER],h=v[b.tf.TRANSFORMER];if(b.tf.DATA_LOADER===a){if(b.t6.YAML!==s)return void Se({displayMessage:"The source you\u2019re trying to add must contain the language ".concat(b.t6.YAML," and not ").concat(s,".")});var m;if(f)return void Se({displayMessage:"Pipeline ".concat(null===(m=F)||void 0===m?void 0:m.uuid," already has a source: ").concat(null===f||void 0===f?void 0:f.uuid,".")})}else if(b.tf.TRANSFORMER===a){var g;if(h)return void Se({displayMessage:"Pipeline ".concat(null===(g=F)||void 0===g?void 0:g.uuid," already has a transformer: ").concat(null===h||void 0===h?void 0:h.uuid,".")})}else if(b.tf.DATA_EXPORTER===a){if(b.t6.YAML!==s)return void Se({displayMessage:"The destination you\u2019re trying to add must contain the language ".concat(b.t6.YAML," and not ").concat(s,".")});var x;if(p)return void Se({displayMessage:"Pipeline ".concat(null===(x=F)||void 0===x?void 0:x.uuid," already has a destination: ").concat(null===p||void 0===p?void 0:p.uuid,".")})}}var j=function(){return Wr({block:kl({content:i,name:u,priority:n,require_unique_name:!0},e)}).then((function(n){(0,Pe.wD)(n,{callback:function(){var e,i,l=n.data.block;(null===t||void 0===t||t(l),Ct&&null!==ne&&void 0!==ne&&ne(null===te||void 0===te?void 0:te.NOTEBOOK_BLOCK_OUTPUT_SPLIT_VIEW)&&(0,al.eM)())?null===(e=window)||void 0===e||null===(i=e.location)||void 0===i||i.reload():(null!==c&&void 0!==c&&c.disableFetchingFiles||qo(),nt().then((function(e){var n=e.pipeline,t=n.blocks,i=n.extensions;_i((function(e){var n=(0,o.Z)(t);Object.entries(i||{}).forEach((function(e){var t=(0,r.Z)(e,2),i=t[0],l=t[1].blocks;l&&n.push.apply(n,(0,o.Z)(l.map((function(e){return kl(kl({},e),{},{extension_uuid:i})}))))}));var l=(0,L.HK)(e,(function(e){return e.uuid})),u=[];return n.forEach((function(e){var n=l[e.uuid];n?u.push(n):u.push(e)})),u}))})))},onErrorCallback:function(n,t){var i,o=null===n||void 0===n||null===(i=n.error)||void 0===i?void 0:i.exception,r=(0,gl.u$)(kl(kl({},e),{},{name:u}));o&&r&&o.startsWith(ci.LR)?Se((function(){return{errors:t,links:[{label:"View existing block file contents.",onClick:function(){Yo(r),Se(null)}}],response:n}})):Se({errors:t,response:n})}})}))};return Ct&&null!==ne&&void 0!==ne&&ne(null===te||void 0===te?void 0:te.NOTEBOOK_BLOCK_OUTPUT_SPLIT_VIEW)?cr().then((function(){return j()})):j()}),[Wr,ne,null===te||void 0===te?void 0:te.NOTEBOOK_BLOCK_OUTPUT_SPLIT_VIEW,qo,nt,bt,Yo,F,cr,Ct]);var Gr=(0,$t.dd)((function(e){var n=e.block,t=e.idx,i=e.isReplacingBlock,o=void 0!==i&&i,r=e.isUpdatingBlock,l=void 0!==r&&r,u=e.name,c=void 0===u?(0,G.Y6)():u,s=e.onCreateCallback;return(0,S.jsx)(ae.BC,{children:(0,S.jsx)(gn,{block:n,defaultName:c,isReplacingBlock:o,isUpdatingBlock:l,onClose:Vr,onSave:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(l||o){var i,r=n.detach||!1;cr({block:{color:(null===e||void 0===e?void 0:e.color)||null,detach:r,name:null===e||void 0===e?void 0:e.name,uuid:n.uuid},pipeline:{blocks:(null===(i=F)||void 0===i?void 0:i.blocks)||[]}}).then((function(){Pn(null),Vr()}))}else Eo(kl(kl({},n),(0,Mn.gR)(e,["name"])),t,s,null===e||void 0===e?void 0:e.name).then((function(){return Vr()}))},pipeline:F})})}),{},[Eo,F],{background:!0,disableEscape:!0,uuid:"configure_block_name_and_create"}),Kr=(0,r.Z)(Gr,2),zr=Kr[0],Vr=Kr[1],Yr=(0,$t.dd)((function(e){var n=e.cancelButtonText,t=e.header,i=e.onCancel,o=e.onSaveSuccess;return(0,S.jsx)(ae.BC,{children:(0,S.jsx)(vo.Z,{cancelButtonText:n,contained:!0,header:t,onCancel:function(){null===i||void 0===i||i(),Jr()},onSaveSuccess:function(e){ie(),Jr(),null===o||void 0===o||o(e)}})})}),{},[ie],{background:!0,uuid:"configure_project"}),Xr=(0,r.Z)(Yr,2),Qr=Xr[0],Jr=Xr[1],$r=(0,f.Db)(Y.ZP.widgets.pipelines.useCreate(pe)),el=(0,r.Z)($r,1)[0],nl=(0,p.useCallback)((function(e,n,t){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,G.Y6)();return el({widget:kl({name:i,priority:n,type:b.tf.CHART},e)}).then((function(e){return(0,Pe.wD)(e,{callback:function(){var n=e.data.widget;null===t||void 0===t||t(n),qo(),nt(),ni(Gi.cH.CHARTS),De(n)},onErrorCallback:function(e,n){return Se({errors:n,response:e})}})}))}),[qo,nt,el]);(0,p.useEffect)((function(){if(Be){var e,n=null===(e=li.current[Be.uuid])||void 0===e?void 0:e.current;n&&(n.scrollIntoView(),De(null))}}),[Be,De]),(0,p.useEffect)((function(){Jn!==pe&&(_i([]),Ei([]),eo([]),Qn([]))}),[pe,Jn]),(0,p.useEffect)((function(){var e,n;if("undefined"!==typeof(null===(e=F)||void 0===e?void 0:e.blocks)||"undefined"!==typeof(null===(n=F)||void 0===n?void 0:n.extensions)){var t,i,l,u,c,s,a,d,v=[];if("undefined"!==typeof(null===(t=F)||void 0===t?void 0:t.blocks))v.push.apply(v,(0,o.Z)(null===(c=F)||void 0===c?void 0:c.blocks));if("undefined"!==typeof(null===(i=F)||void 0===i?void 0:i.callbacks))v.push.apply(v,(0,o.Z)(null===(s=F)||void 0===s?void 0:s.callbacks));if("undefined"!==typeof(null===(l=F)||void 0===l?void 0:l.conditionals))v.push.apply(v,(0,o.Z)(null===(a=F)||void 0===a?void 0:a.conditionals));if("undefined"!==typeof(null===(u=F)||void 0===u?void 0:u.extensions))Object.entries((null===(d=F)||void 0===d?void 0:d.extensions)||{}).forEach((function(e){var n=(0,r.Z)(e,2),t=n[0],i=n[1].blocks;i&&v.push.apply(v,(0,o.Z)(i.map((function(e){return kl(kl({},e),{},{extension_uuid:t})}))))}));_i(v)}}),[null===(Z=F)||void 0===Z?void 0:Z.blocks,null===(P=F)||void 0===P?void 0:P.callbacks,null===(O=F)||void 0===O?void 0:O.conditionals,null===(_=F)||void 0===_?void 0:_.extensions]),(0,p.useEffect)((function(){var e;"undefined"!==typeof(null===(e=F)||void 0===e?void 0:e.widgets)&&Ei(F.widgets)}),[null===(I=F)||void 0===I?void 0:I.widgets]),(0,p.useEffect)((function(){(null===qi||void 0===qi?void 0:qi.length)>0&&0===(null===$i||void 0===$i?void 0:$i.length)&&(eo(qi),fo(qi[0]))}),[$i,qi]);var tl=(0,kn.Z)(wi);(0,p.useEffect)((function(){var e;if(!je&&("undefined"!==typeof(null===(e=F)||void 0===e?void 0:e.blocks)&&(!wi.length||!(0,L.fS)(null===tl||void 0===tl?void 0:tl.map((function(e){return e.uuid})).sort(),null===wi||void 0===wi?void 0:wi.map((function(e){return e.uuid})).sort())||(0,Mn.Qr)(qn)))){var n=(0,di.Rt)(F.blocks),t=n.content,i=n.messages;ai.current=t,(0,Mn.Qr)(i)||Vn((function(e){return kl(kl({},i),e)})),ke(!0)}}),[wi,tl,je,qn,null===(E=F)||void 0===E?void 0:E.blocks,ke,Vn]),(0,p.useEffect)((function(){var e;if(!Ii.length&&"undefined"!==typeof(null===(e=F)||void 0===e?void 0:e.widgets)){var n=(0,di.Rt)(F.widgets),t=n.content,i=n.messages;vi.current=t,Vn((function(e){return kl(kl({},i),e)}))}}),[null===(B=F)||void 0===B?void 0:B.widgets,Vn,Ii]),(0,p.useEffect)((function(){if(yn&&!pn){var e=wi.find((function(e){var n,t=e.uuid;return(null===yn||void 0===yn||null===(n=yn.split(":"))||void 0===n?void 0:n[0])===t}));e&&(Lt((function(n){return kl(kl({},n),{},(0,l.Z)({},e.uuid,!1))})),Ki(e.uuid,e.type,null))}else(null===tl||void 0===tl?void 0:tl.length)!==(null===wi||void 0===wi?void 0:wi.length)&&pn&&(Lt((function(e){return kl(kl({},e),{},(0,l.Z)({},pn.uuid,!1))})),Ki(pn.uuid,pn.type,null))}),[yn,wi,null===tl||void 0===tl?void 0:tl.length,Ki,pn,Lt]);var il=(0,p.useMemo)((function(){return new g.Z}),[]),ol=(0,p.useMemo)((function(){return{api_key:pl.lG,token:il.decodedToken.token}}),[il]),jl=(0,d.ZP)((0,bl.Ib)(),{onClose:function(){return(0,al.eM)((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,r=n.msg_type,u=n.pipeline_uuid,c=n.uuid;if(!c&&!u)return;var s=wi.find((function(e){var n=e.type,i=e.uuid;return t===n&&c===i}));"stream_pipeline"!==r?Vn((function(e){var t=e[c]||[];return kl(kl({},e),{},(0,l.Z)({},c,t.concat(n)))})):(Qn((function(e){return[].concat((0,o.Z)(e),[n])})),ii.uF.IDLE===i&&(dn([]),nt(),c||tn(!1))),ii.uF.BUSY===i?dn((function(e){return e.find((function(e){var n=e.uuid;return c===n}))||!s?e:e.concat(s)})):ii.uF.IDLE===i&&dn((function(e){return e.filter((function(e){var n=e.uuid;return c!==n}))})),Gn||Kt(!0)}},onOpen:function(){return(0,al.eM)((function(){return console.log("socketUrlPublish opened")}))},reconnectAttempts:10,reconnectInterval:3e3,shouldReconnect:function(){return(0,al.eM)((function(){return console.log("Attempting to reconnect...")})),!0}}).sendMessage,Zl=(0,p.useCallback)((function(){cr().then((function(){tn(!0),Qn([]),jl(JSON.stringify(kl(kl({},ol),{},{execute_pipeline:!0,pipeline_uuid:pe})))}))}),[pe,cr,jl,ol]),yl=(0,p.useCallback)((function(){jl(JSON.stringify(kl(kl({},ol),{},{cancel_pipeline:!0,pipeline_uuid:pe})))}),[pe,jl,ol]),Pl=(0,p.useCallback)((function(){jl(JSON.stringify(kl(kl({},ol),{},{cancel_pipeline:!0,pipeline_uuid:pe,skip_publish_message:!0})))}),[pe,jl,ol]),Cl=(0,p.useCallback)((function(){jl(JSON.stringify(kl(kl({},ol),{},{check_if_pipeline_running:!0,pipeline_uuid:pe})))}),[pe,jl,ol]);(0,p.useEffect)((function(){var e;return window.addEventListener("pagehide",Pl),null===ce||void 0===ce||null===(e=ce.events)||void 0===e||e.on("routeChangeStart",Pl),function(){var e;null===ce||void 0===ce||null===(e=ce.events)||void 0===e||e.off("routeChangeStart",Pl),window.removeEventListener("pagehide",Pl)}}),[Pl,null===ce||void 0===ce?void 0:ce.events]);var Ol=(0,p.useCallback)((function(e,n){var t=e.block,i=e.code,o=e.ignoreAlreadyRunning,r=e.runDownstream,u=void 0!==r&&r,c=e.runIncompleteUpstream,s=void 0!==c&&c,a=e.runSettings,d=void 0===a?{}:a,v=e.runTests,p=void 0!==v&&v,f=e.runUpstream,h=e.variables,m=t.extension_uuid,g=t.upstream_blocks,b=t.uuid;if(!an.find((function(e){var n=e.uuid;return b===n}))||o){var x,j,k="".concat(vl.vF,"_").concat(null===(x=F)||void 0===x?void 0:x.uuid);jl(JSON.stringify(kl(kl({},ol),{},{code:i,extension_uuid:m,output_messages_to_logs:!!(0,Ye.U2)(k),pipeline_uuid:null===(j=F)||void 0===j?void 0:j.uuid,run_downstream:u,run_incomplete_upstream:s,run_settings:d,run_tests:p,run_upstream:f,type:t.type,upstream_blocks:g,uuid:b,variables:h}))),Vn((function(e){return delete e[b],e})),Ne(!1),dn((function(e){return e.find((function(e){var n=e.uuid;return b===n}))?e:e.concat(t)})),ur((function(e){return kl(kl({},e),{},(0,l.Z)({},null===t||void 0===t?void 0:t.uuid,!0))}))}null!==n&&void 0!==n&&n.skipUpdating||nt()}),[nt,F,an,jl,Vn,dn,Ne,ol]),wl=(0,p.useCallback)((function(e,n){var t,i=e.block;return Gn||null!==n&&void 0!==n&&n.skipUpdating?Ol(e,n):null===(t=cr({block:{outputs:[],uuid:i.uuid}},{contentOnly:!0}))||void 0===t?void 0:t.then((function(){return Ol(e)}))}),[Gn,Ol,cr]),_l=(0,$t.dd)((function(e){var n=e.addNew,t=e.addNewBlock,i=e.blockType;return(0,S.jsx)(ae.BC,{children:(0,S.jsx)(M.Z,{contained:!0,defaultLinkUUID:i,onClickCustomTemplate:function(e){t({config:{custom_template:e,custom_template_uuid:null===e||void 0===e?void 0:e.template_uuid}}),El()},showAddingNewTemplates:!!n,showBreadcrumbs:!0,tabs:[ee.n9]})})}),{},[],{background:!0,uuid:"browse_templates"}),Sl=(0,r.Z)(_l,2),Il=Sl[0],El=Sl[1],Tl=(0,Yi.Z)(Y.ZP.global_data_products.list,{},{revalidateOnFocus:!1},{delay:(null===wi||void 0===wi?void 0:wi.length)>=1?3e3:1e4}).data,Ml=(0,p.useMemo)((function(){return(null===Tl||void 0===Tl?void 0:Tl.global_data_products)||[]}),[Tl]),Bl=(0,$t.dd)((function(e){var n=e.addNewBlock;return(0,S.jsx)(ae.BC,{children:(0,S.jsx)(At.Z,{children:(0,S.jsx)(Tt.Z,{globalDataProducts:Ml,onClickRow:function(e){n({configuration:{global_data_product:{uuid:null===e||void 0===e?void 0:e.uuid}},type:b.tf.GLOBAL_DATA_PRODUCT}),Rl()}})})})}),{},[Ml],{background:!0,uuid:"global_data_products"}),Dl=(0,r.Z)(Bl,2),Al=Dl[0],Rl=Dl[1],Nl=(0,p.useRef)(null),Ll=(0,p.useState)(null),Fl=Ll[0],Ul=Ll[1],Hl=(0,p.useMemo)((function(){return Gi.cH.INTERACTIONS===Zn}),[Zn]);(0,p.useEffect)((function(){var e,n;Zn&&null!==Nl&&void 0!==Nl&&Nl.current&&Ul(null===Nl||void 0===Nl||null===(e=Nl.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.height)}),[Zn,On,se,En,Nl]),(0,p.useEffect)((function(){!kr&&(null===st||void 0===st?void 0:st.length)>=1&&Zr((0,L.HK)(st||[],(function(e){return e.uuid})))}),[st,kr,Zr]),(0,p.useEffect)((function(){!Pr&&null!==ct&&void 0!==ct&&ct.blocks&&Cr(null===ct||void 0===ct?void 0:ct.blocks)}),[Pr,ct,Cr]);var Wl=(0,p.useMemo)((function(){return(0,S.jsx)(rl,{activeView:Zn,addNewBlockAtIndex:function(e,n,t,i){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return new Promise((function(){return zr({block:e,idx:n,isReplacingBlock:o,name:i,onCreateCallback:t})}))},afterWidth:Ce,autocompleteItems:Do,blockInteractionsMapping:Pr,blockRefs:ri,blocks:wi,blocksInNotebook:gr,cancelPipeline:yl,chartRefs:li,checkIfPipelineRunning:Cl,containerHeightOffset:Hl?Fl+1:null,contentByBlockUUID:ai,createInteraction:mt,deleteBlock:Er,deleteWidget:Ro,editingBlock:rn,executePipeline:Zl,fetchFileTree:qo,fetchPipeline:nt,fetchSecrets:Fi,fetchVariables:Ai,globalDataProducts:Ml,globalVariables:Ri,insights:Oo,interactions:st,interactionsMapping:kr,interruptKernel:Ur,isLoadingCreateInteraction:gt,isLoadingUpdatePipelineInteraction:pt,isPipelineExecuting:en,isPipelineUpdating:or,lastTerminalMessage:X,messages:qn,metadata:_o,onChangeCallbackBlock:bi,onChangeChartBlock:Zi,onChangeCodeBlock:ji,onSelectBlockFile:Ki,onUpdateFileSuccess:No,permissions:wr,pipeline:F,pipelineInteraction:ct,pipelineMessages:Xn,project:oe,refAfterFooter:Nl,runBlock:wl,runningBlocks:an,sampleData:jo,savePipelineContent:cr,savePipelineInteraction:Sr,secrets:Ui,selectedBlock:pn,selectedFilePath:Qo,sendTerminalMessage:Q,setActiveSidekickView:ni,setAllowCodeBlockShortcuts:qe,setAnyInputFocused:Ue,setBlockInteractionsMapping:Cr,setDisableShortcuts:Ge,setEditingBlock:ln,setErrors:Se,setHiddenBlocks:Lt,setInteractionsMapping:Zr,setPermissions:_r,setSelectedBlock:Pn,setTextareaFocused:Ne,showBrowseTemplates:Il,showDataIntegrationModal:fr,showUpdateBlockModal:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,G.Y6)(),t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise((function(){return zr({block:e,isReplacingBlock:t,isUpdatingBlock:!t,name:n})}))},sideBySideEnabled:Ct,statistics:Io,textareaFocused:Re,treeRef:ui,updatePipelineInteraction:vt,updatePipelineMetadata:xr,updateWidget:Wi,widgets:Ii})}),[Zn,Fl,Ce,Do,Pr,ri,wi,gr,yl,Cl,ai,mt,Er,Ro,rn,Zl,qo,nt,Fi,Ai,Ml,Ri,Oo,st,kr,Ur,gt,pt,en,or,Hl,X,qn,_o,bi,Zi,ji,Ki,No,wr,F,ct,Xn,oe,Nl,wl,an,jo,cr,Sr,Ui,pn,Qo,Q,Ue,Cr,ln,Se,Lt,Zr,_r,Pn,Ne,zr,Il,fr,Ct,Io,Re,vt,xr,Wi,Ii]),Gl=(0,p.useMemo)((function(){return he?(0,S.jsx)(ll,{activeView:Zn,pipeline:F,project:oe,secrets:Ui,selectedBlock:pn,setSelectedBlock:Pn,variables:Ri}):(0,S.jsx)(Et.Z,{children:Jo})}),[Zn,Jo,Ri,he,F,oe,Ui,pn,Pn]),Kl=(0,$t.dd)((function(e){var n=e.blockIndex;return(0,S.jsx)(ae.BC,{children:(0,S.jsx)(nn,{contained:!0,defaultBlockType:b.tf.DBT,onClickAction:function(e){var t;Eo((0,di.J8)({blockIndex:n,blocks:wi,filePath:null===e||void 0===e||null===(t=e.row)||void 0===t?void 0:t.fullPath,repoPathRelativeRoot:null===le||void 0===le?void 0:le.repo_path_relative_root}),("undefined"===typeof n||null===n?null===wi||void 0===wi?void 0:wi.length:n+1)-(Ct?1:0),(function(e){Pn(e),Vl()}))}})})}),{},[Eo,Ct,le],{background:!0,disableClickOutside:!1,disableCloseButton:!1,disableEscape:!0,uuid:"BlockBrowser/".concat(pe)}),zl=(0,r.Z)(Kl,2),ql=zl[0],Vl=zl[1],Yl=(0,p.useCallback)((function(e,n,t,i){return new Promise((function(){var o;fn.L.BLOCK_FILE!==(null===e||void 0===e||null===(o=e.block_action_object)||void 0===o?void 0:o.object_type)&&(b.tf.DBT!==(null===e||void 0===e?void 0:e.type)||b.t6.SQL!==(null===e||void 0===e?void 0:e.language)||null!==e&&void 0!==e&&e.block_action_object)?zr({block:e,idx:n,name:i,onCreateCallback:t}):Eo(e,n,t,i)}))}),[Eo,zr]),Xl=(0,p.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,G.Y6)();return new Promise((function(){return zr({block:e,isUpdatingBlock:!0,name:n})}))}),[zr]),Ql=(0,p.useCallback)((function(e,n){var t=n.onCreateCallback;return nl(e,Ii.length,t)}),[nl,Ii]),Jl=(0,p.useMemo)((function(){return(0,S.jsx)(oo,{addNewBlockAtIndex:Yl,addWidget:Ql,afterHidden:On,allBlocks:wi,allowCodeBlockShortcuts:ze,anyInputFocused:Fe,autocompleteItems:Do,beforeHidden:Sn,blockInteractionsMapping:Pr,blockRefs:ri,blocks:gr,blocksThatNeedToRefresh:fi,dataProviders:Mi,deleteBlock:Er,disableShortcuts:We,fetchFileTree:qo,fetchPipeline:nt,fetchSampleData:bo,files:Vo,globalDataProducts:Ml,globalVariables:Ri,hiddenBlocks:Un,interactionsMapping:kr,interruptKernel:Ur,mainContainerRef:Wn,mainContainerWidth:Pi,messages:qn,onChangeCallbackBlock:bi,onChangeCodeBlock:ji,openSidekickView:oi,pipeline:F,pipelineContentTouched:Gt,restartKernel:Fr,runBlock:wl,runningBlocks:an,savePipelineContent:cr,scrollTogether:St,selectedBlock:pn,setAnyInputFocused:Ue,setDisableShortcuts:Ge,setEditingBlock:ln,setErrors:Se,setHiddenBlocks:Lt,setIntegrationStreams:io,setOutputBlocks:eo,setPipelineContentTouched:Kt,setScrollTogether:Bt,setSelectedBlock:Pn,setSelectedOutputBlock:fo,setSelectedStream:co,setSideBySideEnabled:Dt,setTextareaFocused:Ne,showBlockBrowserModal:ql,showBrowseTemplates:Il,showConfigureProjectModal:Qr,showDataIntegrationModal:fr,showGlobalDataProducts:Al,showUpdateBlockModal:Xl,sideBySideEnabled:Ct,textareaFocused:Re,widgets:Ii})}),[Yl,Ql,On,ze,Fe,Do,Sn,ri,Pr,wi,gr,fi,Mi,Er,We,qo,nt,bo,Vo,Ml,Ri,Un,kr,Ur,Wn,Pi,qn,bi,ji,oi,F,Gt,Fr,wl,an,cr,St,pn,Ue,ln,Se,Lt,Kt,Pn,Ne,Dt,Bt,ql,Il,Qr,fr,Al,Xl,Ct,Re,Ii]),$l=(0,p.useMemo)((function(){if(W===ci.b7)return(0,S.jsx)(It,{cancelPipeline:yl,createPipeline:er,executePipeline:Zl,interruptKernel:Ur,isPipelineExecuting:en,pipeline:F,restartKernel:Fr,savePipelineContent:cr,scrollTogether:St,setActiveSidekickView:ni,setMessages:Vn,setScrollTogether:Bt,setSideBySideEnabled:Dt,sideBySideEnabled:Ct,updatePipelineMetadata:xr})}),[yl,er,Zl,Ur,en,W,F,Fr,cr,St,Vn,Bt,Dt,Ct,xr]),eu=(0,p.useCallback)((function(e){e.widthOffset;if(W===ci.b7)return(0,S.jsx)(Qi.rK,{relativePosition:!0,children:(0,S.jsxs)(ti,{isBusy:an.length>=1,pipeline:F,restartKernel:Fr,savePipelineContent:cr,setErrors:Se,setRunningBlocks:dn,updatePipelineMetadata:xr,children:[(0,S.jsx)(C.Z,{pr:1}),$l]})})}),[$l,W,F,Fr,an,cr,Se,xr]),nu=(0,p.useMemo)((function(){var e;if(W===ci.b7)return(0,S.jsx)(ul.Z,{pipelineContentTouched:Gt,pipelineLastSaved:Ut,pipelineType:null===(e=F)||void 0===e?void 0:e.type,ref:z,saveStatus:sr,width:Pi})}),[Pi,W,F,Gt,Ut,sr]),tu=(0,p.useMemo)((function(){var e;return null===to||void 0===to||null===(e=to.filter((function(e){return(0,L.sE)(null===xo||void 0===xo?void 0:xo.outputs,(function(n){return n.variable_uuid==="output_sample_data_".concat((0,G.kE)(e))}))})))||void 0===e?void 0:e.map((function(e){return(0,S.jsx)(C.Z,{pl:1,children:(0,S.jsx)(un.ZP,{blackBorder:!0,compact:!0,muted:!0,onClick:function(){return co(e)},selected:lo===e,uuid:e,children:e})},e)}))}),[xo,to,lo]),iu=(0,p.useMemo)((function(){return(0,S.jsx)(T,{blockRefs:ri,hiddenBlocks:Un,pipeline:F,setHiddenBlocks:Lt})}),[ri,Un,F,Lt]),ou=(0,p.useMemo)((function(){return ci.Jf.uuid===(null===An||void 0===An?void 0:An.uuid)?(0,S.jsxs)(S.Fragment,{children:[Xo,zo]}):ci.IY.uuid===(null===An||void 0===An?void 0:An.uuid)?iu:null}),[iu,zo,Xo,An]),ru=(0,p.useMemo)((function(){return(0,S.jsx)(C.Z,{px:1,children:(0,S.jsx)(ve.Z,{noPadding:!0,onClickTab:function(e){Nn(e)},selectedTabUUID:null===An||void 0===An?void 0:An.uuid,tabs:ci.NR,underlineColor:(ue||U.Z).accent.purple,underlineStyle:!0})})}),[Nn,An,ue]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Mt.Z,{title:null===(D=F)||void 0===D?void 0:D.name}),(0,S.jsxs)(ao,{after:Wl,afterHeader:Gl,afterHeightOffset:H.Mz-1,afterHidden:On,afterInnerHeightMinus:Gi.cH.INTERACTIONS===Zn?Fl:null,afterNavigationItems:ml({activeView:Zn,pipeline:F,project:oe,secrets:Ui,setActiveSidekickView:ni,variables:Ri}),afterOverflow:Gi.cH.DATA===Zn?"hidden":null,afterSubheader:(null===$i||void 0===$i?void 0:$i.length)>0&&Zn===Gi.cH.DATA&&(0,S.jsxs)(y.ZP,{alignItems:"center",fullHeight:!0,fullWidth:!0,children:[!bt&&$i.map((function(e){var n=e.uuid,t=(null===po||void 0===po?void 0:po.uuid)===n;return(0,S.jsx)(C.Z,{pl:1,children:(0,S.jsx)(un.ZP,{afterElement:t?(0,S.jsx)(be.ZP,{basic:!0,highlightOnHover:!0,onClick:function(){(0,di.h8)(pe,e.uuid),eo((function(e){return e.filter((function(e){return e.uuid!==n}))}))},padding:"2px",transparent:!0,children:(0,S.jsx)(N.Close,{muted:!0,size:1.25*w.iI})}):null,blackBorder:!0,compact:!0,muted:!0,onClick:function(){return fo(e)},selected:t,uuid:n,children:n})},n)})),bt&&tu]}),before:ou,beforeDraggableTopOffset:H.Mz+uo.Wi,beforeHeader:ru,beforeHeightOffset:H.Mz,beforeHidden:Sn,beforeNavigationItems:(0,hl.H)(fl.M.EDIT,F),errors:Ee||_e,footerOffset:null===z||void 0===z||null===(A=z.current)||void 0===A||null===(R=A.getBoundingClientRect())||void 0===R?void 0:R.height,mainContainerFooter:nu,mainContainerHeader:eu,mainContainerRef:Wn,page:W,pipeline:F,setAfterHidden:wn,setAfterWidthForChildren:Oe,setBeforeHidden:In,setErrors:Ee?Te:Se,setMainContainerWidth:Ci,children:[(0,S.jsx)(m.Z,{uuid:"PipelineDetail/".concat(pe),children:Jl}),(0,S.jsx)(C.Z,{pb:Ct?0:Math.max(Math.floor(se*(2/3)/w.iI),0)})]}),!oe||null!==ne&&void 0!==ne&&ne(null===te||void 0===te?void 0:te.COMMAND_CENTER)?null:Uo()]})}Zl.getInitialProps=function(){var e=(0,i.Z)(c().mark((function e(n){var t,i,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.query.pipeline,i=ci.b7,o={page:i,pipeline:{uuid:t}},e.abrupt("return",o);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();var yl=(0,po.Z)(Zl)},76419:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/pipelines/[pipeline]/edit",function(){return t(58268)}])}},function(e){e.O(0,[9774,3662,125,2714,9161,2631,4783,1557,4241,8095,635,523,3548,9265,3366,2888,179],(function(){return n=76419,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
|