import{n as e,t}from"./objectSpread2.C2EWlzLj.js";import{t as n}from"./_plugin-vue_export-helper.dOX-z6IG.js";import{cloneVNode as r,createBlock as i,createElementBlock as a,createElementVNode as o,createVNode as s,defineComponent as c,getCurrentInstance as l,markRaw as u,onBeforeUnmount as d,onMounted as f,openBlock as p,ref as m,render as h,unref as g,watch as _}from"/vue.js";e();function v(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>`u`)){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}v(`.dv-scrollable {
  position: relative;
  overflow: hidden;
}
.dv-scrollable .dv-scrollbar {
  position: absolute;
  border-radius: 2px;
  background-color: transparent;
  /* GPU optimizations */
  will-change: background-color, transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  transition-property: background-color;
  transition-timing-function: ease-in-out;
  transition-duration: 1s;
  transition-delay: 0s;
}
.dv-scrollable .dv-scrollbar-horizontal {
  bottom: 0px;
  left: 0px;
  height: 4px;
}
.dv-scrollable .dv-scrollbar-vertical {
  right: 0px;
  top: 0px;
  width: 4px;
}
.dv-scrollable:hover .dv-scrollbar, .dv-scrollable.dv-scrollable-resizing .dv-scrollbar, .dv-scrollable.dv-scrollable-scrolling .dv-scrollbar {
  background-color: var(--dv-scrollbar-background-color, rgba(255, 255, 255, 0.25));
}
.dv-svg {
  display: inline-block;
  fill: currentcolor;
  line-height: 1;
  stroke: currentcolor;
  stroke-width: 0;
}
.dockview-theme-dark {
  --dv-paneview-active-outline-color: dodgerblue;
  --dv-tabs-and-actions-container-font-size: 13px;
  --dv-tabs-and-actions-container-height: 35px;
  --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);
  --dv-drag-over-border-color: transparent;
  --dv-tabs-container-scrollbar-color: #888;
  --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);
  --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);
  --dv-overlay-z-index: 999;
  --dv-tab-font-size: inherit;
  --dv-border-radius: 0px;
  --dv-tab-margin: 0;
  --dv-sash-color: transparent;
  --dv-active-sash-color: transparent;
  --dv-active-sash-transition-duration: 0.1s;
  --dv-active-sash-transition-delay: 0.5s;
  --dv-group-view-background-color: #1e1e1e;
  --dv-tabs-and-actions-container-background-color: #252526;
  --dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;
  --dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;
  --dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;
  --dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;
  --dv-tab-divider-color: #1e1e1e;
  --dv-activegroup-visiblepanel-tab-color: white;
  --dv-activegroup-hiddenpanel-tab-color: #969696;
  --dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;
  --dv-inactivegroup-hiddenpanel-tab-color: #626262;
  --dv-separator-border: rgb(68, 68, 68);
  --dv-paneview-header-border-color: rgba(204, 204, 204, 0.2);
}
.dockview-theme-dark .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {
  opacity: 0;
  transition: none;
}

.dockview-theme-light {
  --dv-paneview-active-outline-color: dodgerblue;
  --dv-tabs-and-actions-container-font-size: 13px;
  --dv-tabs-and-actions-container-height: 35px;
  --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);
  --dv-drag-over-border-color: transparent;
  --dv-tabs-container-scrollbar-color: #888;
  --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);
  --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);
  --dv-overlay-z-index: 999;
  --dv-tab-font-size: inherit;
  --dv-border-radius: 0px;
  --dv-tab-margin: 0;
  --dv-sash-color: transparent;
  --dv-active-sash-color: transparent;
  --dv-active-sash-transition-duration: 0.1s;
  --dv-active-sash-transition-delay: 0.5s;
  --dv-group-view-background-color: white;
  --dv-tabs-and-actions-container-background-color: #f3f3f3;
  --dv-activegroup-visiblepanel-tab-background-color: white;
  --dv-activegroup-hiddenpanel-tab-background-color: #ececec;
  --dv-inactivegroup-visiblepanel-tab-background-color: white;
  --dv-inactivegroup-hiddenpanel-tab-background-color: #ececec;
  --dv-tab-divider-color: white;
  --dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);
  --dv-activegroup-hiddenpanel-tab-color: rgba(51, 51, 51, 0.7);
  --dv-inactivegroup-visiblepanel-tab-color: rgba(51, 51, 51, 0.7);
  --dv-inactivegroup-hiddenpanel-tab-color: rgba(51, 51, 51, 0.35);
  --dv-separator-border: rgba(128, 128, 128, 0.35);
  --dv-paneview-header-border-color: rgb(51, 51, 51);
  --dv-scrollbar-background-color: rgba(0, 0, 0, 0.25);
}
.dockview-theme-light .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {
  opacity: 0;
  transition: none;
}

.dockview-theme-vs {
  --dv-paneview-active-outline-color: dodgerblue;
  --dv-tabs-and-actions-container-font-size: 13px;
  --dv-tabs-and-actions-container-height: 35px;
  --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);
  --dv-drag-over-border-color: transparent;
  --dv-tabs-container-scrollbar-color: #888;
  --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);
  --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);
  --dv-overlay-z-index: 999;
  --dv-tab-font-size: inherit;
  --dv-border-radius: 0px;
  --dv-tab-margin: 0;
  --dv-sash-color: transparent;
  --dv-active-sash-color: transparent;
  --dv-active-sash-transition-duration: 0.1s;
  --dv-active-sash-transition-delay: 0.5s;
  --dv-group-view-background-color: #1e1e1e;
  --dv-tabs-and-actions-container-background-color: #252526;
  --dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;
  --dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;
  --dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;
  --dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;
  --dv-tab-divider-color: #1e1e1e;
  --dv-activegroup-visiblepanel-tab-color: white;
  --dv-activegroup-hiddenpanel-tab-color: #969696;
  --dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;
  --dv-inactivegroup-hiddenpanel-tab-color: #626262;
  --dv-separator-border: rgb(68, 68, 68);
  --dv-paneview-header-border-color: rgba(204, 204, 204, 0.2);
  --dv-tabs-and-actions-container-background-color: #2d2d30;
  --dv-tabs-and-actions-container-height: 20px;
  --dv-tabs-and-actions-container-font-size: 11px;
  --dv-activegroup-visiblepanel-tab-background-color: #007acc;
  --dv-inactivegroup-visiblepanel-tab-background-color: #3f3f46;
  --dv-activegroup-visiblepanel-tab-color: white;
  --dv-activegroup-hiddenpanel-tab-color: white;
  --dv-inactivegroup-visiblepanel-tab-color: white;
  --dv-inactivegroup-hiddenpanel-tab-color: white;
}
.dockview-theme-vs .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {
  opacity: 0;
  transition: none;
}
.dockview-theme-vs .dv-groupview.dv-active-group > .dv-tabs-and-actions-container {
  box-sizing: content-box;
  border-bottom: 2px solid var(--dv-activegroup-visiblepanel-tab-background-color);
}
.dockview-theme-vs .dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tab.dv-active-tab {
  border-top: 2px solid var(--dv-activegroup-visiblepanel-tab-background-color);
}
.dockview-theme-vs .dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tab.dv-inactive-tab {
  border-top: 2px solid var(--dv-activegroup-hiddenpanel-tab-background-color);
}
.dockview-theme-vs .dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container {
  box-sizing: content-box;
  border-bottom: 2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color);
}
.dockview-theme-vs .dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tab.dv-active-tab {
  border-top: 2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color);
}
.dockview-theme-vs .dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tab.dv-inactive-tab {
  border-top: 2px solid var(--dv-inactivegroup-hiddenpanel-tab-background-color);
}

.dockview-theme-abyss {
  --dv-paneview-active-outline-color: dodgerblue;
  --dv-tabs-and-actions-container-font-size: 13px;
  --dv-tabs-and-actions-container-height: 35px;
  --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);
  --dv-drag-over-border-color: transparent;
  --dv-tabs-container-scrollbar-color: #888;
  --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);
  --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);
  --dv-overlay-z-index: 999;
  --dv-tab-font-size: inherit;
  --dv-border-radius: 0px;
  --dv-tab-margin: 0;
  --dv-sash-color: transparent;
  --dv-active-sash-color: transparent;
  --dv-active-sash-transition-duration: 0.1s;
  --dv-active-sash-transition-delay: 0.5s;
  --dv-color-abyss-dark: #000c18;
  --dv-color-abyss: #10192c;
  --dv-color-abyss-light: #1c1c2a;
  --dv-color-abyss-lighter: #2b2b4a;
  --dv-color-abyss-accent: rgb(91, 30, 207);
  --dv-color-abyss-primary-text: white;
  --dv-color-abyss-secondary-text: rgb(148, 151, 169);
  --dv-group-view-background-color: var(--dv-color-abyss-dark);
  --dv-tabs-and-actions-container-background-color: var(
      --dv-color-abyss-light
  );
  --dv-activegroup-visiblepanel-tab-background-color: var(
      --dv-color-abyss-dark
  );
  --dv-activegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);
  --dv-inactivegroup-visiblepanel-tab-background-color: var(
      --dv-color-abyss-dark
  );
  --dv-inactivegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);
  --dv-tab-divider-color: var(--dv-color-abyss-lighter);
  --dv-activegroup-visiblepanel-tab-color: white;
  --dv-activegroup-hiddenpanel-tab-color: rgba(255, 255, 255, 0.5);
  --dv-inactivegroup-visiblepanel-tab-color: rgba(255, 255, 255, 0.5);
  --dv-inactivegroup-hiddenpanel-tab-color: rgba(255, 255, 255, 0.25);
  --dv-separator-border: var(--dv-color-abyss-lighter);
  --dv-paneview-header-border-color: var(--dv-color-abyss-lighter);
  --dv-paneview-active-outline-color: #596f99;
}
.dockview-theme-abyss .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {
  opacity: 0;
  transition: none;
}

.dockview-theme-dracula {
  --dv-paneview-active-outline-color: dodgerblue;
  --dv-tabs-and-actions-container-font-size: 13px;
  --dv-tabs-and-actions-container-height: 35px;
  --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);
  --dv-drag-over-border-color: transparent;
  --dv-tabs-container-scrollbar-color: #888;
  --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);
  --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);
  --dv-overlay-z-index: 999;
  --dv-tab-font-size: inherit;
  --dv-border-radius: 0px;
  --dv-tab-margin: 0;
  --dv-sash-color: transparent;
  --dv-active-sash-color: transparent;
  --dv-active-sash-transition-duration: 0.1s;
  --dv-active-sash-transition-delay: 0.5s;
  --dv-group-view-background-color: #282a36;
  --dv-tabs-and-actions-container-background-color: #191a21;
  --dv-activegroup-visiblepanel-tab-background-color: #282a36;
  --dv-activegroup-hiddenpanel-tab-background-color: #21222c;
  --dv-inactivegroup-visiblepanel-tab-background-color: #282a36;
  --dv-inactivegroup-hiddenpanel-tab-background-color: #21222c;
  --dv-tab-divider-color: #191a21;
  --dv-activegroup-visiblepanel-tab-color: rgb(248, 248, 242);
  --dv-activegroup-hiddenpanel-tab-color: rgb(98, 114, 164);
  --dv-inactivegroup-visiblepanel-tab-color: rgba(248, 248, 242, 0.5);
  --dv-inactivegroup-hiddenpanel-tab-color: rgba(98, 114, 164, 0.5);
  --dv-separator-border: #bd93f9;
  --dv-paneview-header-border-color: #bd93f9;
  --dv-paneview-active-outline-color: #6272a4;
}
.dockview-theme-dracula .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {
  opacity: 0;
  transition: none;
}
.dockview-theme-dracula .dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab {
  position: relative;
}
.dockview-theme-dracula .dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab::after {
  position: absolute;
  left: 0px;
  top: 0px;
  content: "";
  width: 100%;
  height: 1px;
  background-color: #94527e;
  z-index: 999;
}
.dockview-theme-dracula .dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab {
  position: relative;
}
.dockview-theme-dracula .dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab::after {
  position: absolute;
  left: 0px;
  bottom: 0px;
  content: "";
  width: 100%;
  height: 1px;
  background-color: #5e3d5a;
  z-index: 999;
}

.dockview-theme-replit {
  --dv-paneview-active-outline-color: dodgerblue;
  --dv-tabs-and-actions-container-font-size: 13px;
  --dv-tabs-and-actions-container-height: 35px;
  --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);
  --dv-drag-over-border-color: transparent;
  --dv-tabs-container-scrollbar-color: #888;
  --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);
  --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);
  --dv-overlay-z-index: 999;
  --dv-tab-font-size: inherit;
  --dv-border-radius: 0px;
  --dv-tab-margin: 0;
  --dv-sash-color: transparent;
  --dv-active-sash-color: transparent;
  --dv-active-sash-transition-duration: 0.1s;
  --dv-active-sash-transition-delay: 0.5s;
  box-sizing: border-box;
  padding: 10px;
  background-color: #ebeced;
  --dv-group-view-background-color: #ebeced;
  --dv-tabs-and-actions-container-background-color: #fcfcfc;
  --dv-activegroup-visiblepanel-tab-background-color: #f0f1f2;
  --dv-activegroup-hiddenpanel-tab-background-color: #fcfcfc;
  --dv-inactivegroup-visiblepanel-tab-background-color: #f0f1f2;
  --dv-inactivegroup-hiddenpanel-tab-background-color: #fcfcfc;
  --dv-tab-divider-color: transparent;
  --dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);
  --dv-activegroup-hiddenpanel-tab-color: rgb(51, 51, 51);
  --dv-inactivegroup-visiblepanel-tab-color: rgb(51, 51, 51);
  --dv-inactivegroup-hiddenpanel-tab-color: rgb(51, 51, 51);
  --dv-separator-border: transparent;
  --dv-paneview-header-border-color: rgb(51, 51, 51);
  --dv-sash-color: #cfd1d3;
  --dv-active-sash-color: #babbbb;
}
.dockview-theme-replit .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {
  opacity: 0;
  transition: none;
}
.dockview-theme-replit .dv-resize-container:has(> .dv-groupview) {
  border-radius: 8px;
}
.dockview-theme-replit .dv-resize-container {
  border-radius: 10px !important;
  border: none;
}
.dockview-theme-replit .dv-groupview {
  overflow: hidden;
  border-radius: 10px;
}
.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container {
  border-bottom: 1px solid rgba(128, 128, 128, 0.35);
}
.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab {
  margin: 4px;
  border-radius: 8px;
}
.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab .dv-svg {
  height: 8px;
  width: 8px;
}
.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab:hover {
  background-color: #e4e5e6 !important;
}
.dockview-theme-replit .dv-groupview .dv-content-container {
  background-color: #fcfcfc;
}
.dockview-theme-replit .dv-groupview.dv-active-group {
  border: 1px solid rgba(128, 128, 128, 0.35);
}
.dockview-theme-replit .dv-groupview.dv-inactive-group {
  border: 1px solid transparent;
}
.dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash {
  background-color: transparent;
}
.dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash:not(.disabled)::after {
  content: "";
  height: 4px;
  width: 40px;
  border-radius: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--dv-sash-color);
  position: absolute;
}
.dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash:not(.disabled):hover, .dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash:not(.disabled):active {
  background-color: transparent;
}
.dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash:not(.disabled):hover::after, .dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash:not(.disabled):active::after {
  background-color: var(--dv-active-sash-color);
}
.dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash {
  background-color: transparent;
}
.dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash:not(.disabled)::after {
  content: "";
  height: 40px;
  width: 4px;
  border-radius: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--dv-sash-color);
  position: absolute;
}
.dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash:not(.disabled):hover, .dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash:not(.disabled):active {
  background-color: transparent;
}
.dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash:not(.disabled):hover::after, .dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash:not(.disabled):active::after {
  background-color: var(--dv-active-sash-color);
}

.dockview-theme-abyss-spaced {
  --dv-paneview-active-outline-color: dodgerblue;
  --dv-tabs-and-actions-container-font-size: 13px;
  --dv-tabs-and-actions-container-height: 35px;
  --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);
  --dv-drag-over-border-color: transparent;
  --dv-tabs-container-scrollbar-color: #888;
  --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);
  --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);
  --dv-overlay-z-index: 999;
  --dv-tab-font-size: inherit;
  --dv-border-radius: 0px;
  --dv-tab-margin: 0;
  --dv-sash-color: transparent;
  --dv-active-sash-color: transparent;
  --dv-active-sash-transition-duration: 0.1s;
  --dv-active-sash-transition-delay: 0.5s;
  --dv-tab-font-size: 12px;
  --dv-border-radius: 20px;
  --dv-tab-margin: 0.5rem 0.25rem;
  --dv-tabs-and-actions-container-height: 44px;
  --dv-border-radius: 20px;
  box-sizing: border-box;
  --dv-color-abyss-dark: rgb(11, 6, 17);
  --dv-color-abyss: #16121f;
  --dv-color-abyss-light: #201d2b;
  --dv-color-abyss-lighter: #2a2837;
  --dv-color-abyss-accent: rgb(91, 30, 207);
  --dv-color-abyss-primary-text: white;
  --dv-color-abyss-secondary-text: rgb(148, 151, 169);
  --dv-drag-over-border: 2px solid var(--dv-color-abyss-accent);
  --dv-drag-over-background-color: "";
  --dv-group-view-background-color: var(--dv-color-abyss-dark);
  --dv-tabs-and-actions-container-background-color: var(--dv-color-abyss);
  --dv-activegroup-visiblepanel-tab-background-color: var(
      --dv-color-abyss-lighter
  );
  --dv-activegroup-hiddenpanel-tab-background-color: var(
      --dv-color-abyss-light
  );
  --dv-inactivegroup-visiblepanel-tab-background-color: var(
      --dv-color-abyss-lighter
  );
  --dv-inactivegroup-hiddenpanel-tab-background-color: var(
      --dv-color-abyss-light
  );
  --dv-tab-divider-color: transparent;
  --dv-activegroup-visiblepanel-tab-color: var(--dv-color-abyss-primary-text);
  --dv-activegroup-hiddenpanel-tab-color: var(
      --dv-color-abyss-secondary-text
  );
  --dv-inactivegroup-visiblepanel-tab-color: var(
      --dv-color-abyss-primary-text
  );
  --dv-inactivegroup-hiddenpanel-tab-color: var(
      --dv-color-abyss-secondary-text
  );
  --dv-separator-border: transparent;
  --dv-paneview-header-border-color: rgb(51, 51, 51);
  --dv-active-sash-color: var(--dv-color-abyss-accent);
  --dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, 0.5);
  padding: 10px;
  background-color: var(--dv-color-abyss-dark);
}
.dockview-theme-abyss-spaced .dv-resize-container:has(> .dv-groupview) {
  border-radius: 8px;
}
.dockview-theme-abyss-spaced .dv-sash {
  border-radius: 4px;
}
.dockview-theme-abyss-spaced .dv-drop-target-anchor {
  border-radius: calc(var(--dv-border-radius) / 4);
}
.dockview-theme-abyss-spaced .dv-drop-target-anchor.dv-drop-target-content {
  border-radius: var(--dv-border-radius);
}
.dockview-theme-abyss-spaced .dv-resize-container {
  border-radius: var(--dv-border-radius) !important;
  border: none;
}
.dockview-theme-abyss-spaced .dv-tabs-overflow-container,
.dockview-theme-abyss-spaced .dv-tabs-overflow-dropdown-default {
  border-radius: 8px;
  height: unset !important;
}
.dockview-theme-abyss-spaced .dv-tab {
  border-radius: 8px;
}
.dockview-theme-abyss-spaced .dv-tab .dv-svg {
  height: 8px;
  width: 8px;
}
.dockview-theme-abyss-spaced .dv-groupview {
  border-radius: var(--dv-border-radius);
}
.dockview-theme-abyss-spaced .dv-groupview .dv-tabs-and-actions-container {
  padding: 0px calc(var(--dv-border-radius) / 2);
}
.dockview-theme-abyss-spaced .dv-groupview .dv-content-container {
  background-color: var(--dv-tabs-and-actions-container-background-color);
}
.dockview-theme-abyss-spaced .dv-resize-container .dv-groupview {
  border: 2px solid var(--dv-color-abyss-dark);
}

.dockview-theme-light-spaced {
  --dv-paneview-active-outline-color: dodgerblue;
  --dv-tabs-and-actions-container-font-size: 13px;
  --dv-tabs-and-actions-container-height: 35px;
  --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);
  --dv-drag-over-border-color: transparent;
  --dv-tabs-container-scrollbar-color: #888;
  --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);
  --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);
  --dv-overlay-z-index: 999;
  --dv-tab-font-size: inherit;
  --dv-border-radius: 0px;
  --dv-tab-margin: 0;
  --dv-sash-color: transparent;
  --dv-active-sash-color: transparent;
  --dv-active-sash-transition-duration: 0.1s;
  --dv-active-sash-transition-delay: 0.5s;
  --dv-tab-font-size: 12px;
  --dv-border-radius: 20px;
  --dv-tab-margin: 0.5rem 0.25rem;
  --dv-tabs-and-actions-container-height: 44px;
  --dv-border-radius: 20px;
  box-sizing: border-box;
  --dv-drag-over-border: 2px solid rgb(91, 30, 207);
  --dv-drag-over-background-color: "";
  --dv-group-view-background-color: #f6f5f9;
  --dv-tabs-and-actions-container-background-color: white;
  --dv-activegroup-visiblepanel-tab-background-color: #ededf0;
  --dv-activegroup-hiddenpanel-tab-background-color: #f9f9fa;
  --dv-inactivegroup-visiblepanel-tab-background-color: #ededf0;
  --dv-inactivegroup-hiddenpanel-tab-background-color: #f9f9fa;
  --dv-tab-divider-color: transparent;
  --dv-activegroup-visiblepanel-tab-color: rgb(104, 107, 130);
  --dv-activegroup-hiddenpanel-tab-color: rgb(148, 151, 169);
  --dv-inactivegroup-visiblepanel-tab-color: rgb(104, 107, 130);
  --dv-inactivegroup-hiddenpanel-tab-color: rgb(148, 151, 169);
  --dv-separator-border: transparent;
  --dv-paneview-header-border-color: rgb(51, 51, 51);
  --dv-active-sash-color: rgb(91, 30, 207);
  --dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, 0.1);
  padding: 10px;
  background-color: #f6f5f9;
  --dv-scrollbar-background-color: rgba(0, 0, 0, 0.25);
}
.dockview-theme-light-spaced .dv-resize-container:has(> .dv-groupview) {
  border-radius: 8px;
}
.dockview-theme-light-spaced .dv-sash {
  border-radius: 4px;
}
.dockview-theme-light-spaced .dv-drop-target-anchor {
  border-radius: calc(var(--dv-border-radius) / 4);
}
.dockview-theme-light-spaced .dv-drop-target-anchor.dv-drop-target-content {
  border-radius: var(--dv-border-radius);
}
.dockview-theme-light-spaced .dv-resize-container {
  border-radius: var(--dv-border-radius) !important;
  border: none;
}
.dockview-theme-light-spaced .dv-tabs-overflow-container,
.dockview-theme-light-spaced .dv-tabs-overflow-dropdown-default {
  border-radius: 8px;
  height: unset !important;
}
.dockview-theme-light-spaced .dv-tab {
  border-radius: 8px;
}
.dockview-theme-light-spaced .dv-tab .dv-svg {
  height: 8px;
  width: 8px;
}
.dockview-theme-light-spaced .dv-groupview {
  border-radius: var(--dv-border-radius);
}
.dockview-theme-light-spaced .dv-groupview .dv-tabs-and-actions-container {
  padding: 0px calc(var(--dv-border-radius) / 2);
}
.dockview-theme-light-spaced .dv-groupview .dv-content-container {
  background-color: var(--dv-tabs-and-actions-container-background-color);
}
.dockview-theme-light-spaced .dv-resize-container .dv-groupview {
  border: 2px solid rgba(255, 255, 255, 0.1);
}
.dv-drop-target-container {
  position: absolute;
  z-index: 9999;
  top: 0px;
  left: 0px;
  height: 100%;
  width: 100%;
  pointer-events: none;
  overflow: hidden;
  --dv-transition-duration: 300ms;
}
.dv-drop-target-container .dv-drop-target-anchor {
  position: relative;
  border: var(--dv-drag-over-border);
  background-color: var(--dv-drag-over-background-color);
  opacity: 1;
  /* GPU optimizations */
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  contain: layout paint;
  transition: opacity var(--dv-transition-duration) ease-in, top var(--dv-transition-duration) ease-out, left var(--dv-transition-duration) ease-out, width var(--dv-transition-duration) ease-out, height var(--dv-transition-duration) ease-out;
}
.dv-drop-target {
  position: relative;
  --dv-transition-duration: 70ms;
}
.dv-drop-target > .dv-drop-target-dropzone {
  position: absolute;
  left: 0px;
  top: 0px;
  height: 100%;
  width: 100%;
  z-index: 1000;
  pointer-events: none;
}
.dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection {
  position: relative;
  box-sizing: border-box;
  height: 100%;
  width: 100%;
  border: var(--dv-drag-over-border);
  background-color: var(--dv-drag-over-background-color);
  transition: top var(--dv-transition-duration) ease-out, left var(--dv-transition-duration) ease-out, width var(--dv-transition-duration) ease-out, height var(--dv-transition-duration) ease-out, opacity var(--dv-transition-duration) ease-out;
  will-change: transform;
  pointer-events: none;
}
.dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection.dv-drop-target-top.dv-drop-target-small-vertical {
  border-top: 1px solid var(--dv-drag-over-border-color);
}
.dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection.dv-drop-target-bottom.dv-drop-target-small-vertical {
  border-bottom: 1px solid var(--dv-drag-over-border-color);
}
.dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection.dv-drop-target-left.dv-drop-target-small-horizontal {
  border-left: 1px solid var(--dv-drag-over-border-color);
}
.dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection.dv-drop-target-right.dv-drop-target-small-horizontal {
  border-right: 1px solid var(--dv-drag-over-border-color);
}
.dv-dockview {
  position: relative;
  background-color: var(--dv-group-view-background-color);
  contain: layout;
}
.dv-dockview .dv-watermark-container {
  position: absolute;
  top: 0px;
  left: 0px;
  height: 100%;
  width: 100%;
  z-index: 1;
}
.dv-dockview .dv-overlay-render-container {
  position: relative;
}

.dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab {
  background-color: var(--dv-activegroup-visiblepanel-tab-background-color);
  color: var(--dv-activegroup-visiblepanel-tab-color);
}
.dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-inactive-tab {
  background-color: var(--dv-activegroup-hiddenpanel-tab-background-color);
  color: var(--dv-activegroup-hiddenpanel-tab-color);
}
.dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab {
  background-color: var(--dv-inactivegroup-visiblepanel-tab-background-color);
  color: var(--dv-inactivegroup-visiblepanel-tab-color);
}
.dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-inactive-tab {
  background-color: var(--dv-inactivegroup-hiddenpanel-tab-background-color);
  color: var(--dv-inactivegroup-hiddenpanel-tab-color);
}

/**
 * when a tab is dragged we lose the above stylings because they are conditional on parent elements
 * therefore we also set some stylings for the dragging event
 **/
.dv-tab.dv-tab-dragging {
  background-color: var(--dv-activegroup-visiblepanel-tab-background-color);
  color: var(--dv-activegroup-visiblepanel-tab-color);
}
.dv-groupview {
  display: flex;
  height: 100%;
  background-color: var(--dv-group-view-background-color);
  overflow: hidden;
  flex-direction: column;
}
.dv-groupview:focus {
  outline: none;
}
.dv-groupview > .dv-content-container {
  flex-grow: 1;
  min-height: 0;
  outline: none;
}
.dv-groupview.dv-groupview-header-bottom {
  flex-direction: column-reverse;
}
.dv-groupview.dv-groupview-header-left {
  flex-direction: row;
}
.dv-groupview.dv-groupview-header-right {
  flex-direction: row-reverse;
}
.dv-root-wrapper {
  height: 100%;
  width: 100%;
}
.dv-grid-view,
.dv-branch-node {
  height: 100%;
  width: 100%;
}
.dv-debug .dv-resize-container .dv-resize-handle-top {
  background-color: red;
}
.dv-debug .dv-resize-container .dv-resize-handle-bottom {
  background-color: green;
}
.dv-debug .dv-resize-container .dv-resize-handle-left {
  background-color: yellow;
}
.dv-debug .dv-resize-container .dv-resize-handle-right {
  background-color: blue;
}
.dv-debug .dv-resize-container .dv-resize-handle-topleft,
.dv-debug .dv-resize-container .dv-resize-handle-topright,
.dv-debug .dv-resize-container .dv-resize-handle-bottomleft,
.dv-debug .dv-resize-container .dv-resize-handle-bottomright {
  background-color: cyan;
}

.dv-resize-container {
  --dv-overlay-z-index: var(--dv-overlay-z-index, 999);
  position: absolute;
  z-index: calc(var(--dv-overlay-z-index) - 2);
  border: 1px solid var(--dv-tab-divider-color);
  box-shadow: var(--dv-floating-box-shadow);
  /* GPU optimizations for floating group movement */
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}
.dv-resize-container.dv-hidden {
  display: none;
}
.dv-resize-container.dv-resize-container-dragging {
  opacity: 0.5;
  /* Enhanced GPU acceleration during drag */
  will-change: transform, opacity;
}
.dv-resize-container .dv-resize-handle-top {
  height: 4px;
  width: calc(100% - 8px);
  left: 4px;
  top: -2px;
  z-index: var(--dv-overlay-z-index);
  position: absolute;
  cursor: ns-resize;
}
.dv-resize-container .dv-resize-handle-bottom {
  height: 4px;
  width: calc(100% - 8px);
  left: 4px;
  bottom: -2px;
  z-index: var(--dv-overlay-z-index);
  position: absolute;
  cursor: ns-resize;
}
.dv-resize-container .dv-resize-handle-left {
  height: calc(100% - 8px);
  width: 4px;
  left: -2px;
  top: 4px;
  z-index: var(--dv-overlay-z-index);
  position: absolute;
  cursor: ew-resize;
}
.dv-resize-container .dv-resize-handle-right {
  height: calc(100% - 8px);
  width: 4px;
  right: -2px;
  top: 4px;
  z-index: var(--dv-overlay-z-index);
  position: absolute;
  cursor: ew-resize;
}
.dv-resize-container .dv-resize-handle-topleft {
  height: 4px;
  width: 4px;
  top: -2px;
  left: -2px;
  z-index: var(--dv-overlay-z-index);
  position: absolute;
  cursor: nw-resize;
}
.dv-resize-container .dv-resize-handle-topright {
  height: 4px;
  width: 4px;
  right: -2px;
  top: -2px;
  z-index: var(--dv-overlay-z-index);
  position: absolute;
  cursor: ne-resize;
}
.dv-resize-container .dv-resize-handle-bottomleft {
  height: 4px;
  width: 4px;
  left: -2px;
  bottom: -2px;
  z-index: var(--dv-overlay-z-index);
  position: absolute;
  cursor: sw-resize;
}
.dv-resize-container .dv-resize-handle-bottomright {
  height: 4px;
  width: 4px;
  right: -2px;
  bottom: -2px;
  z-index: var(--dv-overlay-z-index);
  position: absolute;
  cursor: se-resize;
}
.dv-render-overlay {
  --dv-overlay-z-index: var(--dv-overlay-z-index, 999);
  position: absolute;
  z-index: 1;
  width: 100%;
  height: 100%;
  contain: layout paint;
  isolation: isolate;
  /* GPU optimizations */
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}
.dv-render-overlay.dv-render-overlay-float {
  z-index: calc(var(--dv-overlay-z-index) - 1);
}

.dv-debug .dv-render-overlay {
  outline: 1px solid red;
  outline-offset: -1;
}
.dv-pane-container {
  height: 100%;
  width: 100%;
}
.dv-pane-container.dv-animated .dv-view {
  /* GPU optimizations for smooth pane animations */
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  transition: transform 0.15s ease-out;
}
.dv-pane-container .dv-view {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0px !important;
}
.dv-pane-container .dv-view:not(:first-child)::before {
  background-color: transparent !important;
}
.dv-pane-container .dv-view:not(:first-child) .dv-pane > .dv-pane-header {
  border-top: 1px solid var(--dv-paneview-header-border-color);
}
.dv-pane-container .dv-view .dv-default-header {
  background-color: var(--dv-group-view-background-color);
  color: var(--dv-activegroup-visiblepanel-tab-color);
  display: flex;
  padding: 0px 8px;
  cursor: pointer;
}
.dv-pane-container .dv-view .dv-default-header .dv-pane-header-icon {
  display: flex;
  justify-content: center;
  align-items: center;
}
.dv-pane-container .dv-view .dv-default-header > span {
  padding-left: 8px;
  flex-grow: 1;
}
.dv-pane-container:first-of-type > .dv-pane > .dv-pane-header {
  border-top: none !important;
}
.dv-pane-container .dv-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}
.dv-pane-container .dv-pane .dv-pane-header {
  box-sizing: border-box;
  user-select: none;
  position: relative;
  outline: none;
}
.dv-pane-container .dv-pane .dv-pane-header.dv-pane-draggable {
  cursor: pointer;
}
.dv-pane-container .dv-pane .dv-pane-header:focus:before, .dv-pane-container .dv-pane .dv-pane-header:focus-within:before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  content: "";
  pointer-events: none;
  outline: 1px solid;
  outline-width: -1px;
  outline-style: solid;
  outline-offset: -1px;
  outline-color: var(--dv-paneview-active-outline-color);
}
.dv-pane-container .dv-pane .dv-pane-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex-grow: 1;
  position: relative;
  outline: none;
}
.dv-pane-container .dv-pane .dv-pane-body:focus:before, .dv-pane-container .dv-pane .dv-pane-body:focus-within:before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  content: "";
  pointer-events: none;
  outline: 1px solid;
  outline-width: -1px;
  outline-style: solid;
  outline-offset: -1px;
  outline-color: var(--dv-paneview-active-outline-color);
}
.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-enabled {
  background-color: black;
}
.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-disabled {
  background-color: orange;
}
.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-maximum {
  background-color: green;
}
.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-minimum {
  background-color: red;
}

.dv-split-view-container {
  position: relative;
  overflow: hidden;
  height: 100%;
  width: 100%;
}
.dv-split-view-container.dv-splitview-disabled > .dv-sash-container > .dv-sash {
  pointer-events: none;
}
.dv-split-view-container.dv-animation .dv-view,
.dv-split-view-container.dv-animation .dv-sash {
  /* GPU optimizations for smooth animations */
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  transition: transform 0.15s ease-out;
}
.dv-split-view-container.dv-horizontal {
  height: 100%;
}
.dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash {
  height: 100%;
  width: 4px;
}
.dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash.dv-enabled {
  cursor: ew-resize;
}
.dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash.dv-disabled {
  cursor: default;
}
.dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash.dv-maximum {
  cursor: w-resize;
}
.dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash.dv-minimum {
  cursor: e-resize;
}
.dv-split-view-container.dv-horizontal > .dv-view-container > .dv-view:not(:first-child)::before {
  height: 100%;
  width: 1px;
}
.dv-split-view-container.dv-vertical {
  width: 100%;
}
.dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash {
  width: 100%;
  height: 4px;
}
.dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash.dv-enabled {
  cursor: ns-resize;
}
.dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash.dv-disabled {
  cursor: default;
}
.dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash.dv-maximum {
  cursor: n-resize;
}
.dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash.dv-minimum {
  cursor: s-resize;
}
.dv-split-view-container.dv-vertical > .dv-view-container > .dv-view {
  width: 100%;
}
.dv-split-view-container.dv-vertical > .dv-view-container > .dv-view:not(:first-child)::before {
  height: 1px;
  width: 100%;
}
.dv-split-view-container .dv-sash-container {
  height: 100%;
  width: 100%;
  position: absolute;
}
.dv-split-view-container .dv-sash-container .dv-sash {
  position: absolute;
  z-index: 99;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  touch-action: none;
  background-color: var(--dv-sash-color, transparent);
}
.dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):active, .dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):hover {
  background-color: var(--dv-active-sash-color, transparent);
  transition-property: background-color;
  transition-timing-function: ease-in-out;
  transition-duration: var(--dv-active-sash-transition-duration, 0.1s);
  transition-delay: var(--dv-active-sash-transition-delay, 0.5s);
}
.dv-split-view-container .dv-view-container {
  position: relative;
  height: 100%;
  width: 100%;
}
.dv-split-view-container .dv-view-container .dv-view {
  height: 100%;
  box-sizing: border-box;
  overflow: auto;
  position: absolute;
}
.dv-split-view-container.dv-separator-border .dv-view:not(:first-child)::before {
  content: " ";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  pointer-events: none;
  background-color: var(--dv-separator-border);
}
.dv-dragged {
  transform: translate3d(0px, 0px, 0px); /* forces tab to be drawn on a separate layer (see https://github.com/microsoft/vscode/issues/18733) */
}

.dv-tab {
  flex-shrink: 0;
}
.dv-tab:focus-within, .dv-tab:focus {
  position: relative;
}
.dv-tab:focus-within::after, .dv-tab:focus::after {
  position: absolute;
  content: "";
  height: 100%;
  width: 100%;
  top: 0px;
  left: 0px;
  pointer-events: none;
  outline: 1px solid var(--dv-tab-divider-color) !important;
  outline-offset: -1px;
  z-index: 5;
}
.dv-tab.dv-tab-dragging .dv-default-tab-action {
  background-color: var(--dv-activegroup-visiblepanel-tab-color);
}
.dv-tab.dv-active-tab .dv-default-tab .dv-default-tab-action {
  visibility: visible;
}
.dv-tab.dv-inactive-tab .dv-default-tab .dv-default-tab-action {
  visibility: hidden;
}
.dv-tab.dv-inactive-tab .dv-default-tab:hover .dv-default-tab-action {
  visibility: visible;
}
.dv-tab .dv-default-tab {
  position: relative;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.dv-tab .dv-default-tab .dv-default-tab-content {
  flex-grow: 1;
  margin-right: 4px;
}
.dv-tab .dv-default-tab .dv-default-tab-action {
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.dv-tab .dv-default-tab .dv-default-tab-action:hover {
  border-radius: 2px;
  background-color: var(--dv-icon-hover-background-color);
}
.dv-tabs-overflow-dropdown-default {
  height: 100%;
  color: var(--dv-activegroup-hiddenpanel-tab-color);
  margin: var(--dv-tab-margin);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}
.dv-tabs-overflow-dropdown-default > span {
  padding-left: 0.25rem;
}
.dv-tabs-overflow-dropdown-default > svg {
  transform: rotate(90deg);
}
.dv-tabs-overflow-dropdown-default:hover {
  border-radius: 2px;
  background-color: var(--dv-icon-hover-background-color);
}
.dv-tabs-container {
  display: flex;
  height: 100%;
  overflow: auto;
  scrollbar-width: thin;
  /* GPU optimizations for smooth scrolling */
  will-change: scroll-position;
  transform: translate3d(0, 0, 0);
  /* Track */
  /* Handle */
}
.dv-tabs-container.dv-tabs-container-vertical {
  width: 100%;
  height: fit-content;
  max-height: 100%;
  writing-mode: vertical-rl;
}
.dv-tabs-container.dv-horizontal .dv-tab:not(:first-child)::before, .dv-tabs-container.dv-vertical .dv-tab:not(:first-child)::before {
  content: " ";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  pointer-events: none;
  background-color: var(--dv-tab-divider-color);
}
.dv-tabs-container.dv-horizontal .dv-tab:not(:first-child)::before {
  width: 1px;
  height: 100%;
}
.dv-tabs-container.dv-vertical .dv-tab:not(:first-child)::before {
  width: 100%;
  height: 1px;
}
.dv-tabs-container::-webkit-scrollbar {
  height: 3px;
}
.dv-tabs-container::-webkit-scrollbar-track {
  background: transparent;
}
.dv-tabs-container::-webkit-scrollbar-thumb {
  background: var(--dv-tabs-container-scrollbar-color);
}

.dv-scrollable > .dv-tabs-container {
  overflow: hidden;
}

.dv-tab {
  -webkit-user-drag: element;
  outline: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  position: relative;
  box-sizing: border-box;
  font-size: var(--dv-tab-font-size);
  margin: var(--dv-tab-margin);
}
.dv-tab.dv-tab--shifting {
  will-change: margin-left;
  transition: transform var(--dv-transition-duration, 200ms) ease-out, margin-left var(--dv-transition-duration, 200ms) ease-out;
}
.dv-tab.dv-tab--dragging {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: width var(--dv-transition-duration, 200ms) ease-out, padding var(--dv-transition-duration, 200ms) ease-out, margin var(--dv-transition-duration, 200ms) ease-out, opacity var(--dv-transition-duration, 200ms) ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .dv-tab {
    transition: none !important;
  }
}
.dv-tabs-container-vertical .dv-tab {
  padding: 0.5rem 0.25rem;
}

.dv-tabs-overflow-container {
  flex-direction: column;
  height: unset;
  font-size: var(--dv-tabs-and-actions-container-font-size);
  max-height: min(50vh, 400px);
  overflow-y: auto;
  border: 1px solid var(--dv-tab-divider-color);
  background-color: var(--dv-group-view-background-color);
  /* Scrollbar styling for webkit browsers */
  /* Firefox scrollbar */
  scrollbar-width: thin;
}
.dv-tabs-overflow-container::-webkit-scrollbar {
  width: 6px;
}
.dv-tabs-overflow-container::-webkit-scrollbar-track {
  background: transparent;
}
.dv-tabs-overflow-container::-webkit-scrollbar-thumb {
  background: var(--dv-tabs-container-scrollbar-color);
  border-radius: 3px;
}
.dv-tabs-overflow-container .dv-tab:not(:last-child) {
  border-bottom: 1px solid var(--dv-tab-divider-color);
}
.dv-tabs-overflow-container .dv-active-tab {
  background-color: var(--dv-activegroup-visiblepanel-tab-background-color);
  color: var(--dv-activegroup-visiblepanel-tab-color);
}
.dv-tabs-overflow-container .dv-inactive-tab {
  background-color: var(--dv-activegroup-hiddenpanel-tab-background-color);
  color: var(--dv-activegroup-hiddenpanel-tab-color);
}
.dv-tabs-and-actions-container {
  display: flex;
  background-color: var(--dv-tabs-and-actions-container-background-color);
  flex-shrink: 0;
  box-sizing: border-box;
  height: var(--dv-tabs-and-actions-container-height);
  font-size: var(--dv-tabs-and-actions-container-font-size);
}
.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-scrollable {
  flex-grow: 1;
}
.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container {
  flex-grow: 1;
}
.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container .dv-tab {
  flex-grow: 1;
  padding: 0px;
}
.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-void-container {
  flex-grow: 0;
}
.dv-tabs-and-actions-container .dv-void-container {
  display: flex;
  flex-grow: 1;
}
.dv-tabs-and-actions-container .dv-void-container.dv-draggable {
  cursor: grab;
}
.dv-tabs-and-actions-container .dv-right-actions-container {
  display: flex;
}
.dv-tabs-and-actions-container .dv-right-actions-container.dv-right-actions-container-vertical {
  flex-direction: column;
}
.dv-tabs-and-actions-container.dv-groupview-header-vertical {
  flex-direction: column;
  height: auto;
  width: var(--dv-tabs-and-actions-container-height);
}
.dv-watermark {
  display: flex;
  height: 100%;
}`);var y=class{},b=class extends y{constructor(e,t,n){super(),this.viewId=e,this.groupId=t,this.panelId=n}},x=class e{constructor(){}static getInstance(){return e.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,t){t&&(this.data=e,this.proto=t)}};x.INSTANCE=new x;function S(){let e=x.getInstance();if(e.hasData(b.prototype))return e.getData(b.prototype)[0]}var C;(function(e){e.any=(...e)=>t=>{let n=e.map(e=>e(t));return{dispose:()=>{n.forEach(e=>{e.dispose()})}}}})(C||(C={}));var w=class{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}},T=class{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}},ee=class{constructor(){this.events=new Map}get size(){return this.events.size}add(e,t){this.events.set(e,t)}delete(e){this.events.delete(e)}clear(){this.events.clear()}},te=class e{static create(){var t;return new e((t=Error().stack)==null?``:t)}constructor(e){this.value=e}print(){console.warn(`dockview: stacktrace`,this.value)}},ne=class{constructor(e,t){this.callback=e,this.stacktrace=t}},E=class e{static setLeakageMonitorEnabled(t){t!==e.ENABLE_TRACKING&&e.MEMORY_LEAK_WATCHER.clear(),e.ENABLE_TRACKING=t}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=t=>{var n;(n=this.options)!=null&&n.replay&&this._last!==void 0&&t(this._last);let r=new ne(t,e.ENABLE_TRACKING?te.create():void 0);return this._listeners.push(r),{dispose:()=>{let t=this._listeners.indexOf(r);t>-1?this._listeners.splice(t,1):e.ENABLE_TRACKING}}},e.ENABLE_TRACKING&&e.MEMORY_LEAK_WATCHER.add(this._event,te.create())),this._event}fire(e){var t;(t=this.options)!=null&&t.replay&&(this._last=e);for(let t of this._listeners)t.callback(e)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(e.ENABLE_TRACKING&&queueMicrotask(()=>{var e;for(let t of this._listeners)console.warn(`dockview: stacktrace`,(e=t.stacktrace)==null?void 0:e.print())}),this._listeners=[]),e.ENABLE_TRACKING&&this._event&&e.MEMORY_LEAK_WATCHER.delete(this._event))}};E.ENABLE_TRACKING=!1,E.MEMORY_LEAK_WATCHER=new ee;function D(e,t,n,r){return e.addEventListener(t,n,r),{dispose:()=>{e.removeEventListener(t,n,r)}}}var re=class{constructor(){this._onFired=new E,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{let t=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>t&&e()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}},O;(function(e){e.NONE={dispose:()=>{}};function t(e){return{dispose:()=>{e()}}}e.from=t})(O||(O={}));var k=class{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=new Set(e)}addDisposables(...e){e.forEach(e=>this._disposables.add(e))}removeDisposable(e){this._disposables.delete(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables.clear())}},A=class{constructor(){this._disposable=O.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=O.NONE)}},ie=class extends k{constructor(e){super(),this._onDidChange=new E,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,ae(e,e=>{this._value={hasScrollX:e.target.scrollWidth>e.target.clientWidth,hasScrollY:e.target.scrollHeight>e.target.clientHeight},this._onDidChange.fire(this._value)}))}};function ae(e,t){let n=new ResizeObserver(e=>{requestAnimationFrame(()=>{let n=e[0];t(n)})});return n.observe(e),{dispose:()=>{n.unobserve(e),n.disconnect()}}}var j=(e,...t)=>{for(let n of t)e.classList.contains(n)&&e.classList.remove(n)},M=(e,...t)=>{for(let n of t)e.classList.contains(n)||e.classList.add(n)},N=(e,t,n)=>{let r=e.classList.contains(t);n&&!r&&e.classList.add(t),!n&&r&&e.classList.remove(t)};function oe(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function se(e){return new ce(e)}var ce=class extends k{constructor(e){super(),this._onDidFocus=new E,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new E,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let t=oe(document.activeElement,e),n=!1,r=()=>{n=!1,t||(t=!0,this._onDidFocus.fire())},i=()=>{t&&(n=!0,window.setTimeout(()=>{n&&(n=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{oe(document.activeElement,e)!==t&&(t?i():r())},this.addDisposables(D(e,`focus`,r,!0)),this.addDisposables(D(e,`blur`,i,!0))}refreshState(){this._refreshStateHandler()}},le=`dv-quasiPreventDefault`;function ue(e){e[le]=!0}function de(e){return e[le]}function fe(e,t){let n=Array.from(t);for(let t of n){if(t.href){let n=e.createElement(`link`);n.href=t.href,n.type=t.type,n.rel=`stylesheet`,e.head.appendChild(n)}let n=[];try{t.cssRules&&(n=Array.from(t.cssRules).map(e=>e.cssText))}catch(e){}for(let t of n){let n=e.createElement(`style`);n.appendChild(e.createTextNode(t)),e.head.appendChild(n)}}}function pe(e){let{left:t,top:n,width:r,height:i}=e.getBoundingClientRect();return{left:t+window.scrollX,top:n+window.scrollY,width:r,height:i}}function me(e){let t=e;for(;t!=null&&t.parentNode;)if(t.parentNode===document)return!0;else t=t.parentNode instanceof DocumentFragment?t.parentNode.host:t.parentNode;return!1}function he(e,t){e.setAttribute(`data-testid`,t)}function ge(e){let t=[];function n(r){if(r.nodeType===Node.ELEMENT_NODE){e.includes(r.tagName)&&t.push(r),r.shadowRoot&&n(r.shadowRoot);for(let e of r.children)n(e)}}return n(document.documentElement),t}function P(e=document){let t=ge([`IFRAME`,`WEBVIEW`]),n=new WeakMap;for(let e of t)n.set(e,e.style.pointerEvents),e.style.pointerEvents=`none`;return{release:()=>{var e;for(let r of t)r.style.pointerEvents=(e=n.get(r))==null?`auto`:e;t.splice(0,t.length)}}}function _e(e){function t(e){let t=[];for(let n=0;n<e.classList.length;n++)t.push(e.classList.item(n));return t}let n,r=e;for(;r!==null&&(n=t(r).find(e=>e.startsWith(`dockview-theme-`)),typeof n!=`string`);)r=r.parentElement;return n}var ve=class{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(let e of this._classNames)N(this.element,e,!1);this._classNames=e.split(` `).filter(e=>e.trim().length>0);for(let e of this._classNames)N(this.element,e,!0)}},ye=100;function be(e,t){let n=pe(e),r=pe(t);return!(n.left<r.left||n.left+n.width>r.left+r.width||n.top<r.top||n.top+n.height>r.top+r.height)}function xe(e){let t=new E,n=e.screenX,r=e.screenY,i,a=()=>{if(e.closed)return;let o=e.screenX,s=e.screenY;(o!==n||s!==r)&&(clearTimeout(i),i=setTimeout(()=>{t.fire()},ye),n=o,r=s),requestAnimationFrame(a)};return a(),t}function Se(e,t){let n;return new k(D(e,`resize`,()=>{clearTimeout(n),n=setTimeout(()=>{t()},ye)}))}function Ce(e,t,n={buffer:10}){let r=n.buffer,i=e.getBoundingClientRect(),a=t.getBoundingClientRect(),o=0,s=0,c=i.left-a.left,l=i.top-a.top,u=i.bottom-a.bottom,d=i.right-a.right;c<r?o=r-c:d>r&&(o=-r-d),l<r?s=r-l:u>r&&(s=-u-r),(o!==0||s!==0)&&(e.style.transform=`translate(${o}px, ${s}px)`)}function we(e){let t=e;for(;t&&(t.style.zIndex===`auto`||t.style.zIndex===``);)t=t.parentElement;return t}function F(e){if(e.length===0)throw Error(`Invalid tail call`);return[e.slice(0,e.length-1),e[e.length-1]]}function Te(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ee(e,t){let n=e.indexOf(t);n>-1&&(e.splice(n,1),e.unshift(t))}function I(e,t){let n=e.indexOf(t);n>-1&&(e.splice(n,1),e.push(t))}function De(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(t(r))return n}return-1}function Oe(e,t){let n=e.findIndex(e=>e===t);return n>-1?(e.splice(n,1),!0):!1}var L=(e,t,n)=>t>n?t:Math.min(n,Math.max(e,t)),ke=()=>{let e=1;return{next:()=>(e++).toString()}},R=(e,t)=>{let n=[];if(typeof t!=`number`&&(t=e,e=0),e<=t)for(let r=e;r<t;r++)n.push(r);else for(let r=e;r>t;r--)n.push(r);return n},Ae=class{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return this._cachedVisibleSize===void 0}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?``:`none`}constructor(e,t,n,r){this.container=e,this.view=t,this.disposable=r,this._cachedVisibleSize=void 0,typeof n==`number`?(this._size=n,this._cachedVisibleSize=void 0,e.classList.add(`visible`)):(this._size=0,this._cachedVisibleSize=n.cachedVisibleSize)}setVisible(e,t){var n;e!==this.visible&&(e?(this.size=L((n=this._cachedVisibleSize)==null?0:n,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof t==`number`?t:this.size,this.size=0),this.container.classList.toggle(`visible`,e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}},z;(function(e){e.HORIZONTAL=`HORIZONTAL`,e.VERTICAL=`VERTICAL`})(z||(z={}));var B;(function(e){e[e.MAXIMUM=0]=`MAXIMUM`,e[e.MINIMUM=1]=`MINIMUM`,e[e.DISABLED=2]=`DISABLED`,e[e.ENABLED=3]=`ENABLED`})(B||(B={}));var V;(function(e){e.Low=`low`,e.High=`high`,e.Normal=`normal`})(V||(V={}));var H;(function(e){e.Distribute={type:`distribute`};function t(e){return{type:`split`,index:e}}e.Split=t;function n(e){return{type:`invisible`,cachedVisibleSize:e}}e.Invisible=n})(H||(H={}));var je=class{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;let t=this.size;this.size=this.orthogonalSize,this.orthogonalSize=t,j(this.element,`dv-horizontal`,`dv-vertical`),this.element.classList.add(this.orientation==z.HORIZONTAL?`dv-horizontal`:`dv-vertical`)}get minimumSize(){return this.viewItems.reduce((e,t)=>e+t.minimumSize,0)}get maximumSize(){return this.length===0?1/0:this.viewItems.reduce((e,t)=>e+t.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,N(this.element,`dv-splitview-disabled`,e)}get margin(){return this._margin}set margin(e){this._margin=e,N(this.element,`dv-splitview-has-margin`,e!==0)}constructor(e,t){var n,r;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new E,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new E,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new E,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(e,t,n=this.viewItems.map(e=>e.size),r,i,a=-1/0,o=1/0,s,c)=>{if(e<0||e>this.viewItems.length)return 0;let l=R(e,-1),u=R(e+1,this.viewItems.length);if(i)for(let e of i)Ee(l,e),Ee(u,e);if(r)for(let e of r)I(l,e),I(u,e);let d=l.map(e=>this.viewItems[e]),f=l.map(e=>n[e]),p=u.map(e=>this.viewItems[e]),m=u.map(e=>n[e]),h=l.reduce((e,t)=>e+this.viewItems[t].minimumSize-n[t],0),g=l.reduce((e,t)=>e+this.viewItems[t].maximumSize-n[t],0),_=u.length===0?1/0:u.reduce((e,t)=>e+n[t]-this.viewItems[t].minimumSize,0),v=u.length===0?-1/0:u.reduce((e,t)=>e+n[t]-this.viewItems[t].maximumSize,0),y=Math.max(h,v),b=Math.min(_,g),x=!1;if(s){let e=this.viewItems[s.index],n=t>=s.limitDelta;x=n!==e.visible,e.setVisible(n,s.size)}if(!x&&c){let e=this.viewItems[c.index],n=t<c.limitDelta;x=n!==e.visible,e.setVisible(n,c.size)}if(x)return this.resize(e,t,n,r,i,a,o);let S=L(t,y,b),C=0,w=S;for(let e=0;e<d.length;e++){let t=d[e],n=L(f[e]+w,t.minimumSize,t.maximumSize),r=n-f[e];C+=r,w-=r,t.size=n}let T=C;for(let e=0;e<p.length;e++){let t=p[e],n=L(m[e]-T,t.minimumSize,t.maximumSize),r=n-m[e];T+=r,t.size=n}return t},this._orientation=(n=t.orientation)==null?z.VERTICAL:n,this.element=this.createContainer(),this.margin=(r=t.margin)==null?0:r,this.proportionalLayout=t.proportionalLayout===void 0?!0:!!t.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(t.styles),t.descriptor&&(this._size=t.descriptor.size,t.descriptor.views.forEach((e,t)=>{let n=e.visible===void 0||e.visible?e.size:{type:`invisible`,cachedVisibleSize:e.size},r=e.view;this.addView(r,n,t,!0)}),this._contentSize=this.viewItems.reduce((e,t)=>e+t.size,0),this.saveProportions())}style(e){(e==null?void 0:e.separatorBorder)===`transparent`?(j(this.element,`dv-separator-border`),this.element.style.removeProperty(`--dv-separator-border`)):(M(this.element,`dv-separator-border`),e!=null&&e.separatorBorder&&this.element.style.setProperty(`--dv-separator-border`,e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw Error(`Index out of bounds`);return this.viewItems[e].visible}setViewVisible(e,t){if(e<0||e>=this.viewItems.length)throw Error(`Index out of bounds`);let n=this.viewItems[e];n.setVisible(t,n.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,t){if(e<0||e>=this.viewItems.length)return;let n=R(this.viewItems.length).filter(t=>t!==e),r=[...n.filter(e=>this.viewItems[e].priority===V.Low),e],i=n.filter(e=>this.viewItems[e].priority===V.High),a=this.viewItems[e];t=Math.round(t),t=L(t,a.minimumSize,Math.min(a.maximumSize,this._size)),a.size=t,this.relayout(r,i)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,t){let n=this.viewItems.indexOf(e);if(n<0||n>=this.viewItems.length)return;t=typeof t==`number`?t:e.size,t=L(t,e.minimumSize,e.maximumSize),e.size=t;let r=R(this.viewItems.length).filter(e=>e!==n),i=[...r.filter(e=>this.viewItems[e].priority===V.Low),n],a=r.filter(e=>this.viewItems[e].priority===V.High);this.relayout([...i,n],a)}addView(e,t={type:`distribute`},n=this.viewItems.length,r){let i=document.createElement(`div`);i.className=`dv-view`,i.appendChild(e.element);let a;a=typeof t==`number`?t:t.type===`split`?this.getViewSize(t.index)/2:t.type===`invisible`?{cachedVisibleSize:t.cachedVisibleSize}:e.minimumSize;let o=e.onDidChange(e=>this.onDidChange(s,e.size)),s=new Ae(i,e,a,{dispose:()=>{o.dispose(),this.viewContainer.removeChild(i)}});if(n===this.viewItems.length?this.viewContainer.appendChild(i):this.viewContainer.insertBefore(i,this.viewContainer.children.item(n)),this.viewItems.splice(n,0,s),this.viewItems.length>1){let e=document.createElement(`div`);e.className=`dv-sash`;let t=t=>{for(let e of this.viewItems)e.enabled=!1;let n=P(),r=this._orientation===z.HORIZONTAL?t.clientX:t.clientY,i=De(this.sashes,t=>t.container===e),a=this.viewItems.map(e=>e.size),o,s,c=R(i,-1),l=R(i+1,this.viewItems.length),u=c.reduce((e,t)=>e+(this.viewItems[t].minimumSize-a[t]),0),d=c.reduce((e,t)=>e+(this.viewItems[t].viewMaximumSize-a[t]),0),f=l.length===0?1/0:l.reduce((e,t)=>e+(a[t]-this.viewItems[t].minimumSize),0),p=l.length===0?-1/0:l.reduce((e,t)=>e+(a[t]-this.viewItems[t].viewMaximumSize),0),m=Math.max(u,p),h=Math.min(f,d),g=this.findFirstSnapIndex(c),_=this.findFirstSnapIndex(l);if(typeof g==`number`){let e=this.viewItems[g],t=Math.floor(e.viewMinimumSize/2);o={index:g,limitDelta:e.visible?m-t:m+t,size:e.size}}if(typeof _==`number`){let e=this.viewItems[_],t=Math.floor(e.viewMinimumSize/2);s={index:_,limitDelta:e.visible?h+t:h-t,size:e.size}}let v=e=>{let t=(this._orientation===z.HORIZONTAL?e.clientX:e.clientY)-r;this.resize(i,t,a,void 0,void 0,m,h,o,s),this.distributeEmptySpace(),this.layoutViews()},y=()=>{for(let e of this.viewItems)e.enabled=!0;n.release(),this.saveProportions(),document.removeEventListener(`pointermove`,v),document.removeEventListener(`pointerup`,y),document.removeEventListener(`pointercancel`,y),document.removeEventListener(`contextmenu`,y),this._onDidSashEnd.fire(void 0)};document.addEventListener(`pointermove`,v),document.addEventListener(`pointerup`,y),document.addEventListener(`pointercancel`,y),document.addEventListener(`contextmenu`,y)};e.addEventListener(`pointerdown`,t);let n={container:e,disposable:()=>{e.removeEventListener(`pointerdown`,t),this.sashContainer.removeChild(e)}};this.sashContainer.appendChild(e),this.sashes.push(n)}r||this.relayout([n]),!r&&typeof t!=`number`&&t.type===`distribute`&&this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){let e=[],t=0;for(let n of this.viewItems)n.maximumSize-n.minimumSize>0&&(e.push(n),t+=n.size);let n=Math.floor(t/e.length);for(let t of e)t.size=L(n,t.minimumSize,t.maximumSize);let r=R(this.viewItems.length),i=r.filter(e=>this.viewItems[e].priority===V.Low),a=r.filter(e=>this.viewItems[e].priority===V.High);this.relayout(i,a)}removeView(e,t,n=!1){let r=this.viewItems.splice(e,1)[0];if(r.dispose(),this.viewItems.length>=1){let t=Math.max(e-1,0);this.sashes.splice(t,1)[0].disposable()}return n||this.relayout(),t&&t.type===`distribute`&&this.distributeViewSizes(),this._onDidRemoveView.fire(r.view),r.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw Error(`Index out of bounds`);return this.viewItems[e].cachedVisibleSize}moveView(e,t){let n=this.getViewCachedVisibleSize(e),r=n===void 0?this.getViewSize(e):H.Invisible(n),i=this.removeView(e,void 0,!0);this.addView(i,r,t)}layout(e,t){let n=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=t,this.proportions){let t=0;for(let n=0;n<this.viewItems.length;n++){let r=this.viewItems[n],i=this.proportions[n];typeof i==`number`?t+=i:e-=r.size}for(let n=0;n<this.viewItems.length;n++){let r=this.viewItems[n],i=this.proportions[n];typeof i==`number`&&t>0&&(r.size=L(Math.round(i*e/t),r.minimumSize,r.maximumSize))}}else{let t=R(this.viewItems.length),r=t.filter(e=>this.viewItems[e].priority===V.Low),i=t.filter(e=>this.viewItems[e].priority===V.High);this.resize(this.viewItems.length-1,e-n,void 0,r,i)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,t){let n=this.viewItems.reduce((e,t)=>e+t.size,0);this.resize(this.viewItems.length-1,this._size-n,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){let t=this.viewItems.reduce((e,t)=>e+t.size,0),n=this.size-t,r=R(this.viewItems.length-1,-1),i=r.filter(e=>this.viewItems[e].priority===V.Low),a=r.filter(e=>this.viewItems[e].priority===V.High);for(let e of a)Ee(r,e);for(let e of i)I(r,e);typeof e==`number`&&I(r,e);for(let e=0;n!==0&&e<r.length;e++){let t=this.viewItems[r[e]],i=L(t.size+n,t.minimumSize,t.maximumSize),a=i-t.size;n-=a,t.size=i}}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((e,t)=>e+t.size,0),this.updateSashEnablement(),this.viewItems.length===0)return;let e=this.viewItems.filter(e=>e.visible),t=Math.max(0,e.length-1),n=this.margin*t/Math.max(1,e.length),r=0,i=[],a=this.viewItems.reduce((e,t,n)=>{let r=t.visible?1:0;return n===0?e.push(r):e.push(e[n-1]+r),e},[]);this.viewItems.forEach((e,o)=>{r+=this.viewItems[o].size,i.push(r);let s=e.visible?e.size-n:0,c=Math.max(0,a[o]-1),l=o===0||c===0?0:i[o-1]+c/t*n;if(o<this.viewItems.length-1){let t=e.visible?l+s-4/2+this.margin/2:l;this._orientation===z.HORIZONTAL&&(this.sashes[o].container.style.left=`${t}px`,this.sashes[o].container.style.top=`0px`),this._orientation===z.VERTICAL&&(this.sashes[o].container.style.left=`0px`,this.sashes[o].container.style.top=`${t}px`)}this._orientation===z.HORIZONTAL&&(e.container.style.width=`${s}px`,e.container.style.left=`${l}px`,e.container.style.top=``,e.container.style.height=``),this._orientation===z.VERTICAL&&(e.container.style.height=`${s}px`,e.container.style.top=`${l}px`,e.container.style.width=``,e.container.style.left=``),e.view.layout(e.size-n,this._orthogonalSize)})}findFirstSnapIndex(e){for(let t of e){let e=this.viewItems[t];if(e.visible&&e.snap)return t}for(let t of e){let e=this.viewItems[t];if(e.visible&&e.maximumSize-e.minimumSize>0)return;if(!e.visible&&e.snap)return t}}updateSashEnablement(){let e=!1,t=this.viewItems.map(t=>e=t.size-t.minimumSize>0||e);e=!1;let n=this.viewItems.map(t=>e=t.maximumSize-t.size>0||e),r=[...this.viewItems].reverse();e=!1;let i=r.map(t=>e=t.size-t.minimumSize>0||e).reverse();e=!1;let a=r.map(t=>e=t.maximumSize-t.size>0||e).reverse(),o=0;for(let e=0;e<this.sashes.length;e++){let r=this.sashes[e],s=this.viewItems[e];o+=s.size;let c=!(t[e]&&a[e+1]),l=!(n[e]&&i[e+1]);if(c&&l){let n=R(e,-1),a=R(e+1,this.viewItems.length),s=this.findFirstSnapIndex(n),c=this.findFirstSnapIndex(a),l=typeof s==`number`&&!this.viewItems[s].visible,u=typeof c==`number`&&!this.viewItems[c].visible;l&&i[e]&&(o>0||this.startSnappingEnabled)?this.updateSash(r,B.MINIMUM):u&&t[e]&&(o<this._contentSize||this.endSnappingEnabled)?this.updateSash(r,B.MAXIMUM):this.updateSash(r,B.DISABLED)}else c&&!l?this.updateSash(r,B.MINIMUM):!c&&l?this.updateSash(r,B.MAXIMUM):this.updateSash(r,B.ENABLED)}}updateSash(e,t){N(e.container,`dv-disabled`,t===B.DISABLED),N(e.container,`dv-enabled`,t===B.ENABLED),N(e.container,`dv-maximum`,t===B.MAXIMUM),N(e.container,`dv-minimum`,t===B.MINIMUM)}createViewContainer(){let e=document.createElement(`div`);return e.className=`dv-view-container`,e}createSashContainer(){let e=document.createElement(`div`);return e.className=`dv-sash-container`,e}createContainer(){let e=document.createElement(`div`);return e.className=`dv-split-view-container ${this._orientation===z.HORIZONTAL?`dv-horizontal`:`dv-vertical`}`,e}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose();for(let e=0;e<this.element.children.length;e++)if(this.element.children.item(e)===this.element){this.element.removeChild(this.element);break}for(let e of this.viewItems)e.dispose();this.element.remove()}},U=class{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===z.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===z.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===z.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===z.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===z.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===z.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,t,n,r=0){this.view=e,this.orientation=t,this._onDidChange=new E,this.onDidChange=this._onDidChange.event,this._orthogonalSize=n,this._size=r,this._disposable=this.view.onDidChange(e=>{e?this._onDidChange.fire({size:this.orientation===z.VERTICAL?e.width:e.height,orthogonalSize:this.orientation===z.VERTICAL?e.height:e.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,t){this._size=e,this._orthogonalSize=t,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}},W=class e extends k{get width(){return this.orientation===z.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===z.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.maximumOrthogonalSize:1/0))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===z.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===z.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===z.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===z.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(this.children.length===0)return V.Normal;let e=this.children.map(e=>e.priority===void 0?V.Normal:e.priority);return e.some(e=>e===V.High)?V.High:e.some(e=>e===V.Low)?V.Low:V.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(t){this.splitview.margin=t,this.children.forEach(n=>{n instanceof e&&(n.margin=t)})}constructor(e,t,n,r,i,a,o,s){if(super(),this.orientation=e,this.proportionalLayout=t,this.styles=n,this._childrenDisposable=O.NONE,this.children=[],this._onDidChange=new E,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new E,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=i,this._size=r,this.element=document.createElement(`div`),this.element.className=`dv-branch-node`,!s)this.splitview=new je(this.element,{orientation:this.orientation,proportionalLayout:t,styles:n,margin:o}),this.splitview.layout(this.size,this.orthogonalSize);else{let e={views:s.map(e=>({view:e.node,size:e.node.size,visible:e.node instanceof U&&e.visible!==void 0?e.visible:!0})),size:this.orthogonalSize};this.children=s.map(e=>e.node),this.splitview=new je(this.element,{orientation:this.orientation,descriptor:e,proportionalLayout:t,styles:n,margin:o})}this.disabled=a,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw Error(`Invalid index`);return this.splitview.isViewVisible(e)}setChildVisible(e,t){if(e<0||e>=this.children.length)throw Error(`Invalid index`);if(this.splitview.isViewVisible(e)===t)return;let n=this.splitview.contentSize===0;this.splitview.setViewVisible(e,t);let r=this.splitview.contentSize===0;(t&&n||!t&&r)&&this._onDidVisibilityChange.fire({visible:t})}moveChild(e,t){if(e===t)return;if(e<0||e>=this.children.length)throw Error(`Invalid from index`);e<t&&t--,this.splitview.moveView(e,t);let n=this._removeChild(e);this._addChild(n,t)}getChildSize(e){if(e<0||e>=this.children.length)throw Error(`Invalid index`);return this.splitview.getViewSize(e)}resizeChild(e,t){if(e<0||e>=this.children.length)throw Error(`Invalid index`);this.splitview.resizeView(e,t)}layout(e,t){this._size=t,this._orthogonalSize=e,this.splitview.layout(t,e)}addChild(e,t,n,r){if(n<0||n>this.children.length)throw Error(`Invalid index`);this.splitview.addView(e,t,n,r),this._addChild(e,n)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw Error(`Invalid index`);return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,t){if(e<0||e>=this.children.length)throw Error(`Invalid index`);return this.splitview.removeView(e,t),this._removeChild(e)}_addChild(e,t){this.children.splice(t,0,e),this.setupChildrenEvents()}_removeChild(e){let[t]=this.children.splice(e,1);return this.setupChildrenEvents(),t}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new k(C.any(...this.children.map(e=>e.onDidChange))(e=>{this._onDidChange.fire({size:e.orthogonalSize})}),...this.children.map((t,n)=>t instanceof e?t.onDidVisibilityChange(({visible:e})=>{this.setChildVisible(n,e)}):O.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(e=>e.dispose()),super.dispose()}};function Me(e,t){if(e instanceof U)return e;if(e instanceof W)return Me(e.children[t?e.children.length-1:0],t);throw Error(`invalid node`)}function Ne(e,t,n){if(e instanceof W){let r=new W(e.orientation,e.proportionalLayout,e.styles,t,n,e.disabled,e.margin);for(let t=e.children.length-1;t>=0;t--){let n=e.children[t];r.addChild(Ne(n,n.size,n.orthogonalSize),n.size,0,!0)}return r}else return new U(e.view,e.orientation,n)}function Pe(e,t,n){if(e instanceof W){let r=new W(q(e.orientation),e.proportionalLayout,e.styles,t,n,e.disabled,e.margin),i=0;for(let a=e.children.length-1;a>=0;a--){let o=e.children[a],s=o instanceof W?o.orthogonalSize:o.size,c=e.size===0?0:Math.round(t*s/e.size);i+=c,a===0&&(c+=t-i),r.addChild(Pe(o,n,c),c,0,!0)}return r}else return new U(e.view,q(e.orientation),n)}function Fe(e){let t=e.parentElement;if(!t)throw Error(`Invalid grid element`);let n=t.firstElementChild,r=0;for(;n!==e&&n!==t.lastElementChild&&n;)n=n.nextElementSibling,r++;return r}function G(e){let t=e.parentElement;if(!t)throw Error(`Invalid grid element`);if(/\bdv-grid-view\b/.test(t.className))return[];let n=Fe(t),r=t.parentElement.parentElement.parentElement;return[...G(r),n]}function K(e,t,n){if(Le(e,t)===Ie(n)){let[e,r]=F(t),i=r;return(n===`right`||n===`bottom`)&&(i+=1),[...e,i]}else{let e=n===`right`||n===`bottom`?1:0;return[...t,e]}}function Ie(e){return e===`top`||e===`bottom`?z.VERTICAL:z.HORIZONTAL}function Le(e,t){return t.length%2==0?q(e):e}var q=e=>e===z.HORIZONTAL?z.VERTICAL:z.HORIZONTAL;function Re(e){return!!e.children}var ze=(e,t)=>{let n=t===z.VERTICAL?e.box.width:e.box.height;return Re(e)?{type:`branch`,data:e.children.map(e=>ze(e,q(t))),size:n}:typeof e.cachedVisibleSize==`number`?{type:`leaf`,data:e.view.toJSON(),size:e.cachedVisibleSize,visible:!1}:{type:`leaf`,data:e.view.toJSON(),size:n}},Be=class{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;let{size:t,orthogonalSize:n}=this.root;this.root=Pe(this.root,n,t),this.root.layout(t,n)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;let t=[this.root];for(;t.length>0;){let n=t.pop();n instanceof W&&(n.disabled=e,t.push(...n.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return(e=this._maximizedNode)==null?void 0:e.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(e){var t;let n=G(e.element),[r,i]=this.getNode(n);if(!(i instanceof U)||((t=this._maximizedNode)==null?void 0:t.leaf)===i)return;this.hasMaximizedView()&&this.exitMaximizedView(),ze(this.getView(),this.orientation);let a=[];function o(e,t){for(let n=0;n<e.children.length;n++){let r=e.children[n];r instanceof U?r!==t&&(e.isChildVisible(n)?e.setChildVisible(n,!1):a.push(r)):o(r,t)}}o(this.root,i),this._maximizedNode={leaf:i,hiddenOnMaximize:a},this._onDidMaximizedNodeChange.fire({view:i.view,isMaximized:!0})}exitMaximizedView(){if(!this._maximizedNode)return;let e=this._maximizedNode.hiddenOnMaximize;function t(n){for(let r=n.children.length-1;r>=0;r--){let i=n.children[r];i instanceof U?e.includes(i)||n.setChildVisible(r,!0):t(i)}}t(this.root);let n=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:n.view,isMaximized:!1})}serialize(){let e=this.maximizedView(),t;e&&(t=G(e.element)),this.hasMaximizedView()&&this.exitMaximizedView();let n={root:ze(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return t&&(n.maximizedNode={location:t}),e&&this.maximizeView(e),n}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){let e=this.root.orientation;this.root=new W(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,t){let n=e.orientation,r=n===z.VERTICAL?e.height:e.width;if(this._deserialize(e.root,n,t,r),this.layout(e.width,e.height),e.maximizedNode){let t=e.maximizedNode.location,[n,r]=this.getNode(t);if(!(r instanceof U))return;this.maximizeView(r.view)}}_deserialize(e,t,n,r){this.root=this._deserializeNode(e,t,n,r)}_deserializeNode(e,t,n,r){var i;let a;if(e.type===`branch`){let i=e.data.map(r=>({node:this._deserializeNode(r,q(t),n,e.size),visible:r.visible}));a=new W(t,this.proportionalLayout,this.styles,e.size,r,this.locked,this.margin,i)}else{let o=n.fromJSON(e);typeof e.visible==`boolean`&&((i=o.setVisible)==null||i.call(o,e.visible)),a=new U(o,t,r,e.size)}return a}get root(){return this._root}set root(e){let t=this._root;t&&(t.dispose(),this._maximizedNode=void 0,this.element.removeChild(t.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(e=>{this._onDidChange.fire(e)})}normalize(){if(!this._root||this._root.children.length!==1)return;let e=this.root,t=e.children[0];if(t instanceof U)return;e.element.remove();let n=e.removeChild(0);e.dispose(),n.dispose(),this._root=Ne(t,t.size,t.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(e=>{this._onDidChange.fire(e)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;let e=this.root;if(e.element.remove(),this._root=new W(q(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),e.children.length!==0)if(e.children.length===1){let t=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(Pe(t,t.orthogonalSize,t.size),H.Distribute,0)}else this._root.addChild(e,H.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(e=>{this._onDidChange.fire(e)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){let t=e?this.getNode(e)[1]:this.root;return this._getViews(t,this.orientation)}_getViews(e,t,n){let r={height:e.height,width:e.width};if(e instanceof U)return{box:r,view:e.view,cachedVisibleSize:n};let i=[];for(let n=0;n<e.children.length;n++){let r=e.children[n],a=e.getChildCachedVisibleSize(n);i.push(this._getViews(r,q(t),a))}return{box:r,children:i}}progmaticSelect(e,t=!1){let[n,r]=this.getNode(e);if(!(r instanceof U))throw Error(`invalid location`);for(let r=n.length-1;r>-1;r--){let i=n[r],a=e[r]||0;if(t?a-1>-1:a+1<i.children.length)return Me(i.children[t?a-1:a+1],t)}return Me(this.root,t)}constructor(e,t,n,r,i){this.proportionalLayout=e,this.styles=t,this._locked=!1,this._margin=0,this._maximizedNode=void 0,this.disposable=new A,this._onDidChange=new E,this.onDidChange=this._onDidChange.event,this._onDidViewVisibilityChange=new E,this.onDidViewVisibilityChange=this._onDidViewVisibilityChange.event,this._onDidMaximizedNodeChange=new E,this.onDidMaximizedNodeChange=this._onDidMaximizedNodeChange.event,this.element=document.createElement(`div`),this.element.className=`dv-grid-view`,this._locked=r==null?!1:r,this._margin=i==null?0:i,this.root=new W(n,e,t,0,0,this.locked,this.margin)}isViewVisible(e){let[t,n]=F(e),[,r]=this.getNode(t);if(!(r instanceof W))throw Error(`Invalid from location`);return r.isChildVisible(n)}setViewVisible(e,t){this.hasMaximizedView()&&this.exitMaximizedView();let[n,r]=F(e),[,i]=this.getNode(n);if(!(i instanceof W))throw Error(`Invalid from location`);this._onDidViewVisibilityChange.fire(),i.setChildVisible(r,t)}moveView(e,t,n){this.hasMaximizedView()&&this.exitMaximizedView();let[,r]=this.getNode(e);if(!(r instanceof W))throw Error(`Invalid location`);r.moveChild(t,n)}addView(e,t,n){this.hasMaximizedView()&&this.exitMaximizedView();let[r,i]=F(n),[a,o]=this.getNode(r);if(o instanceof W){let n=new U(e,q(o.orientation),o.orthogonalSize);o.addChild(n,t,i)}else{let[n,...s]=[...a].reverse(),[c,...l]=[...r].reverse(),u=0,d=n.getChildCachedVisibleSize(c);typeof d==`number`&&(u=H.Invisible(d)),n.removeChild(c).dispose();let f=new W(o.orientation,this.proportionalLayout,this.styles,o.size,o.orthogonalSize,this.locked,this.margin);n.addChild(f,o.size,c);let p=new U(o.view,n.orientation,o.size);f.addChild(p,u,0),typeof t!=`number`&&t.type===`split`&&(t={type:`split`,index:0});let m=new U(e,n.orientation,o.size);f.addChild(m,t,i)}}remove(e,t){let n=G(e.element);return this.removeView(n,t)}removeView(e,t){this.hasMaximizedView()&&this.exitMaximizedView();let[n,r]=F(e),[i,a]=this.getNode(n);if(!(a instanceof W))throw Error(`Invalid location`);let o=a.children[r];if(!(o instanceof U))throw Error(`Invalid location`);if(a.removeChild(r,t),o.dispose(),a.children.length!==1)return o.view;let s=a.children[0];if(i.length===0)return s instanceof U?o.view:(a.removeChild(0,t),this.root=s,o.view);let[c,...l]=[...i].reverse(),[u,...d]=[...n].reverse(),f=a.isChildVisible(0);a.removeChild(0,t);let p=c.children.map((e,t)=>c.getChildSize(t));if(c.removeChild(u,t).dispose(),s instanceof W){p.splice(u,1,...s.children.map(e=>e.size));for(let e=0;e<s.children.length;e++){let t=s.children[e];c.addChild(t,t.size,u+e)}for(;s.children.length>0;)s.removeChild(0)}else{let e=new U(s.view,q(s.orientation),s.size),t=f?s.orthogonalSize:H.Invisible(s.orthogonalSize);c.addChild(e,t,u)}s.dispose();for(let e=0;e<p.length;e++)c.resizeChild(e,p[e]);return o.view}layout(e,t){let[n,r]=this.root.orientation===z.HORIZONTAL?[t,e]:[e,t];this.root.layout(n,r)}getNode(e,t=this.root,n=[]){if(e.length===0)return[n,t];if(!(t instanceof W))throw Error(`Invalid location`);let[r,...i]=e;if(r<0||r>=t.children.length)throw Error(`Invalid location`);let a=t.children[r];return n.push(t),this.getNode(i,a,n)}},Ve=class extends k{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,t=!1){super(),this._disableResizing=t,this._element=e,this.addDisposables(ae(this._element,e=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!me(this._element))return;let{width:t,height:n}=e.contentRect;this.layout(t,n)}))}},He=ke();function Ue(e){switch(e){case`left`:return`left`;case`right`:return`right`;case`above`:return`top`;case`below`:return`bottom`;default:return`center`}}var We=class extends Ve{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,t){var n;super(document.createElement(`div`),t.disableAutoResizing),this._id=He.next(),this._groups=new Map,this._onDidRemove=new E,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new E,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new E,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new E,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new re,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new re,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height=`100%`,this.element.style.width=`100%`,this._classNames=new ve(this.element),this._classNames.setClassNames((n=t.className)==null?``:n),e.appendChild(this.element),this.gridview=new Be(!!t.proportionalLayout,t.styles,t.orientation,t.locked,t.margin),this.gridview.locked=!!t.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(e=>{this._onDidMaximizedChange.fire({panel:e.view,isMaximized:e.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.layout(this.width,this.height,!0)}),O.from(()=>{var e;(e=this.element.parentElement)==null||e.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),C.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,t){this.gridview.setViewVisible(G(e.element),t),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(G(e.element))}updateOptions(e){var t,n,r,i;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),`disableResizing`in e&&(this.disableResizing=(t=e.disableAutoResizing)==null?!1:t),`locked`in e&&(this.locked=(n=e.locked)==null?!1:n),`margin`in e&&(this.gridview.margin=(r=e.margin)==null?0:r),`className`in e&&this._classNames.setClassNames((i=e.className)==null?``:i)}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,t=[0],n){this.gridview.addView(e,n==null?H.Distribute:n,t),this._onDidAdd.fire(e)}doRemoveGroup(e,t){if(!this._groups.has(e.id))throw Error(`invalid operation`);let n=this._groups.get(e.id),r=this.gridview.remove(e,H.Distribute);if(n&&!(t!=null&&t.skipDispose)&&(n.disposable.dispose(),n.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!(t!=null&&t.skipActive)&&this._activeGroup===e){let e=Array.from(this._groups.values());this.doSetGroupActive(e.length>0?e[0].value:void 0)}return r}getPanel(e){var t;return(t=this._groups.get(e))==null?void 0:t.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}let n=G(e.group.element),r=(t=this.gridview.next(n))==null?void 0:t.view;this.doSetGroupActive(r)}moveToPrevious(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}let n=G(e.group.element),r=(t=this.gridview.previous(n))==null?void 0:t.view;this.doSetGroupActive(r)}layout(e,t,n){(n||e!==this.width||t!==this.height)&&(this.gridview.element.style.height=`${t}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,t))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(let e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}},Ge=class{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,t,n=!1){this.component.layout(e,t,n)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,t){return this.component.addFloatingGroup(e,t)}fromJSON(e,t){this.component.fromJSON(e,t)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,t){return this.component.addPopoutGroup(e,t)}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}},Ke=class extends k{constructor(e,t){super(),this.el=e,this.disabled=t,this.dataDisposable=new A,this.pointerEventsDisposable=new A,this._onDragStart=new E,this.onDragStart=this._onDragStart.event,this.addDisposables(this._onDragStart,this.dataDisposable,this.pointerEventsDisposable),this.configure()}setDisabled(e){this.disabled=e}isCancelled(e){return!1}configure(){this.addDisposables(this._onDragStart,D(this.el,`dragstart`,e=>{if(e.defaultPrevented||this.isCancelled(e)||this.disabled){e.preventDefault();return}let t=P();this.pointerEventsDisposable.value={dispose:()=>{t.release()}},this.el.classList.add(`dv-dragged`),setTimeout(()=>this.el.classList.remove(`dv-dragged`),0),this.dataDisposable.value=this.getData(e),this._onDragStart.fire(e),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.items.length>0||e.dataTransfer.setData(`text/plain`,``))}),D(this.el,`dragend`,()=>{this.pointerEventsDisposable.dispose(),setTimeout(()=>{this.dataDisposable.dispose()},0)}))}},qe=class extends k{constructor(e,t){super(),this.element=e,this.callbacks=t,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(D(this.element,`dragenter`,e=>{this.onDragEnter(e)},!0)),this.addDisposables(D(this.element,`dragover`,e=>{this.onDragOver(e)},!0)),this.addDisposables(D(this.element,`dragleave`,e=>{this.onDragLeave(e)})),this.addDisposables(D(this.element,`dragend`,e=>{this.onDragEnd(e)})),this.addDisposables(D(this.element,`drop`,e=>{this.onDrop(e)}))}};function Je(e,t){let{top:n,left:r,width:i,height:a}=t,o=`${Math.round(n)}px`,s=`${Math.round(r)}px`,c=`${Math.round(i)}px`,l=`${Math.round(a)}px`;e.style.top=o,e.style.left=s,e.style.width=c,e.style.height=l,e.style.visibility=`visible`,(!e.style.transform||e.style.transform===``)&&(e.style.transform=`translate3d(0, 0, 0)`)}function Ye(e,t){let{top:n,left:r,width:i,height:a}=t;e.style.top=n,e.style.left=r,e.style.width=i,e.style.height=a,e.style.visibility=`visible`,(!e.style.transform||e.style.transform===``)&&(e.style.transform=`translate3d(0, 0, 0)`)}function Xe(e,t){let{top:n,left:r,width:i,height:a}=t,o=`${Math.round(n)}px`,s=`${Math.round(r)}px`,c=`${Math.round(i)}px`,l=`${Math.round(a)}px`;return e.style.top!==o||e.style.left!==s||e.style.width!==c||e.style.height!==l}var Ze=class extends w{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}};function Qe(e){switch(e){case`above`:return`top`;case`below`:return`bottom`;case`left`:return`left`;case`right`:return`right`;case`within`:return`center`;default:throw Error(`invalid direction '${e}'`)}}function $e(e){switch(e){case`top`:return`above`;case`bottom`:return`below`;case`left`:return`left`;case`right`:return`right`;case`center`:return`within`;default:throw Error(`invalid position '${e}'`)}}var et={value:20,type:`percentage`},tt={value:50,type:`percentage`},nt=100,rt=100,J=class e extends k{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(t,n){super(),this.element=t,this.options=n,this._onDrop=new E,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new E,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new qe(this.element,{onDragEnter:()=>{var e,t,n;(n=(t=(e=this.options).getOverrideTarget)==null?void 0:t.call(e))==null||n.getElements()},onDragOver:t=>{var n,r,i,a,o,s,c;e.ACTUAL_TARGET=this;let l=(r=(n=this.options).getOverrideTarget)==null?void 0:r.call(n);if(this._acceptedTargetZonesSet.size===0){if(l)return;this.removeDropTarget();return}let u=(o=(a=(i=this.options).getOverlayOutline)==null?void 0:a.call(i))==null?this.element:o,d=u.offsetWidth,f=u.offsetHeight;if(d===0||f===0)return;let p=t.currentTarget.getBoundingClientRect(),m=((s=t.clientX)==null?0:s)-p.left,h=((c=t.clientY)==null?0:c)-p.top,g=this.calculateQuadrant(this._acceptedTargetZonesSet,m,h,d,f);if(this.isAlreadyUsed(t)||g===null){this.removeDropTarget();return}if(!this.options.canDisplayOverlay(t,g)){if(l)return;this.removeDropTarget();return}let _=new Ze({nativeEvent:t,position:g});if(this._onWillShowOverlay.fire(_),_.defaultPrevented){this.removeDropTarget();return}this.markAsUsed(t),l||this.targetElement||(this.targetElement=document.createElement(`div`),this.targetElement.className=`dv-drop-target-dropzone`,this.overlayElement=document.createElement(`div`),this.overlayElement.className=`dv-drop-target-selection`,this._state=`center`,this.targetElement.appendChild(this.overlayElement),u.classList.add(`dv-drop-target`),u.append(this.targetElement)),this.toggleClasses(g,d,f),this._state=g},onDragLeave:()=>{var e,t;(t=(e=this.options).getOverrideTarget)!=null&&t.call(e)||this.removeDropTarget()},onDragEnd:t=>{var n,r;let i=(r=(n=this.options).getOverrideTarget)==null?void 0:r.call(n);i&&e.ACTUAL_TARGET===this&&this._state&&(t.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:t})),this.removeDropTarget(),i==null||i.clear()},onDrop:e=>{var t,n,r;e.preventDefault();let i=this._state;this.removeDropTarget(),(r=(n=(t=this.options).getOverrideTarget)==null?void 0:n.call(t))==null||r.clear(),i&&(e.stopPropagation(),this._onDrop.fire({position:i,nativeEvent:e}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(t){t[e.USED_EVENT_ID]=!0}isAlreadyUsed(t){let n=t[e.USED_EVENT_ID];return typeof n==`boolean`&&n}toggleClasses(e,t,n){var r,i,a,o,s,c,l;let u=(i=(r=this.options).getOverrideTarget)==null?void 0:i.call(r);if(!u&&!this.overlayElement)return;let d=t<nt,f=n<rt,p=e===`left`,m=e===`right`,h=e===`top`,g=e===`bottom`,_=!d&&m,v=!d&&p,y=!f&&h,b=!f&&g,x=1,S=(o=(a=this.options.overlayModel)==null?void 0:a.size)==null?tt:o;if(S.type===`percentage`?x=L(S.value,0,100)/100:((_||v)&&(x=L(0,S.value,t)/t),(y||b)&&(x=L(0,S.value,n)/n)),u){let r=(l=(c=(s=this.options).getOverlayOutline)==null?void 0:c.call(s))==null?this.element:l,i=r.getBoundingClientRect(),a=u.getElements(void 0,r),o=a.root,f=a.overlay,S=o.getBoundingClientRect(),C=i.top-S.top,w=i.left-S.left,T={top:C,left:w,width:t,height:n};if(_?(T.left=w+t*(1-x),T.width=t*x):v?T.width=t*x:y?T.height=n*x:b&&(T.top=C+n*(1-x),T.height=n*x),d&&p&&(T.width=4),d&&m&&(T.left=w+t-4,T.width=4),!Xe(f,T))return;Je(f,T),f.className=`dv-drop-target-anchor${this.options.className?` ${this.options.className}`:``}`,N(f,`dv-drop-target-left`,p),N(f,`dv-drop-target-right`,m),N(f,`dv-drop-target-top`,h),N(f,`dv-drop-target-bottom`,g),N(f,`dv-drop-target-center`,e===`center`),a.changed&&(N(f,`dv-drop-target-anchor-container-changed`,!0),setTimeout(()=>{N(f,`dv-drop-target-anchor-container-changed`,!1)},10));return}if(!this.overlayElement)return;let C={top:`0px`,left:`0px`,width:`100%`,height:`100%`};_?(C.left=`${100*(1-x)}%`,C.width=`${100*x}%`):v?C.width=`${100*x}%`:y?C.height=`${100*x}%`:b&&(C.top=`${100*(1-x)}%`,C.height=`${100*x}%`),Ye(this.overlayElement,C),N(this.overlayElement,`dv-drop-target-small-vertical`,f),N(this.overlayElement,`dv-drop-target-small-horizontal`,d),N(this.overlayElement,`dv-drop-target-left`,p),N(this.overlayElement,`dv-drop-target-right`,m),N(this.overlayElement,`dv-drop-target-top`,h),N(this.overlayElement,`dv-drop-target-bottom`,g),N(this.overlayElement,`dv-drop-target-center`,e===`center`)}calculateQuadrant(e,t,n,r,i){var a,o;let s=(o=(a=this.options.overlayModel)==null?void 0:a.activationSize)==null?et:o;return s.type===`percentage`?it(e,t,n,r,i,s.value):at(e,t,n,r,i,s.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,(e=this.targetElement.parentElement)==null||e.classList.remove(`dv-drop-target`),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}};J.USED_EVENT_ID=`__dockview_droptarget_event_is_used__`;function it(e,t,n,r,i,a){let o=100*t/r,s=100*n/i;return e.has(`left`)&&o<a?`left`:e.has(`right`)&&o>100-a?`right`:e.has(`top`)&&s<a?`top`:e.has(`bottom`)&&s>100-a?`bottom`:e.has(`center`)?`center`:null}function at(e,t,n,r,i,a){return e.has(`left`)&&t<a?`left`:e.has(`right`)&&t>r-a?`right`:e.has(`top`)&&n<a?`top`:e.has(`bottom`)&&n>i-a?`bottom`:e.has(`center`)?`center`:null}var ot=class extends w{constructor(){super()}},st=class extends k{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,t){super(),this.id=e,this.component=t,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new A,this._onDidDimensionChange=new E,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new E,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new E,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new E,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new E,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new E,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new E,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new E,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(e=>{this._isFocused=e.isFocused}),this.onDidActiveChange(e=>{this._isActive=e.isActive}),this.onDidVisibilityChange(e=>{this._isVisible=e.isVisible}),this.onDidDimensionsChange(e=>{this._width=e.width,this._height=e.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(t=>{this._parameters=t,e.update({params:t})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}},ct=class extends k{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return(e=this._params)==null?void 0:e.params}constructor(e,t,n){super(),this.id=e,this.component=t,this.api=n,this._height=0,this._width=0,this._element=document.createElement(`div`),this._element.tabIndex=-1,this._element.style.outline=`none`,this._element.style.height=`100%`,this._element.style.width=`100%`,this._element.style.overflow=`hidden`;let r=se(this._element);this.addDisposables(this.api,r.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),r.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),r)}focus(){let e=new ot;this.api._onWillFocus.fire(e),!e.defaultPrevented&&this._element.focus()}layout(e,t){this._width=e,this._height=t,this.api._onDidDimensionChange.fire({width:e,height:t}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var t,n;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},(t=this._params)==null?void 0:t.params),e.params)});for(let t of Object.keys(e.params))e.params[t]===void 0&&delete this._params.params[t];(n=this.part)==null||n.update({params:this._params.params})}toJSON(){var e,t;let n=(t=(e=this._params)==null?void 0:e.params)==null?{}:t;return{id:this.id,component:this.component,params:Object.keys(n).length>0?n:void 0}}dispose(){var e;this.api.dispose(),(e=this.part)==null||e.dispose(),super.dispose()}},lt=class extends k{get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this.disposable=new A,this._onDidFocus=new E,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new E,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement(`div`),this._element.className=`dv-content-container`,this._element.tabIndex=-1,this.addDisposables(this._onDidFocus,this._onDidBlur);let n=t.dropTargetContainer;this.dropTarget=new J(this.element,{getOverlayOutline:()=>{var t;return((t=e.options.theme)==null?void 0:t.dndPanelOverlay)===`group`?this.element.parentElement:null},className:`dv-drop-target-content`,acceptedTargetZones:[`top`,`bottom`,`left`,`right`,`center`],canDisplayOverlay:(e,t)=>{if(this.group.locked===`no-drop-target`||this.group.locked&&t===`center`)return!1;let n=S();return!n&&e.shiftKey&&this.group.location.type!==`floating`?!1:n&&n.viewId===this.accessor.id?!0:this.group.canDisplayOverlay(e,t,`content`)},getOverrideTarget:n?()=>n.model:void 0}),this.addDisposables(this.dropTarget)}show(){this.element.style.display=``}hide(){this.element.style.display=`none`}renderPanel(e,t={asActive:!0}){let n=t.asActive||this.panel&&this.group.isPanelActive(this.panel);this.panel&&this.panel.view.content.element.parentElement===this._element&&this._element.removeChild(this.panel.view.content.element),this.panel=e;let r;switch(e.api.renderer){case`onlyWhenVisible`:this.group.renderContainer.detatch(e),this.panel&&n&&this._element.appendChild(this.panel.view.content.element),r=this._element;break;case`always`:e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),r=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(n){let e=se(r);this.focusTracker=e;let t=new k;t.addDisposables(e,e.onDidFocus(()=>this._onDidFocus.fire()),e.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=t}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,t){}closePanel(){var e;this.panel&&this.panel.api.renderer===`onlyWhenVisible`&&((e=this.panel.view.content.element.parentElement)==null||e.removeChild(this.panel.view.content.element)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;(e=this.focusTracker)!=null&&e.refreshState&&this.focusTracker.refreshState()}};function ut(e,t,n){var r,i;M(t,`dv-dragged`),t.style.top=`-9999px`,document.body.appendChild(t),e.setDragImage(t,(r=n==null?void 0:n.x)==null?0:r,(i=n==null?void 0:n.y)==null?0:i),setTimeout(()=>{j(t,`dv-dragged`),t.remove()},0)}var dt=class extends Ke{constructor(e,t,n,r,i){super(e,i),this.accessor=t,this.group=n,this.panel=r,this.panelTransfer=x.getInstance()}getData(e){return this.panelTransfer.setData([new b(this.accessor.id,this.group.id,this.panel.id)],b.prototype),{dispose:()=>{this.panelTransfer.clearData(b.prototype)}}}},ft=class extends k{get element(){return this._element}constructor(e,t,n){super(),this.panel=e,this.accessor=t,this.group=n,this.content=void 0,this._onPointDown=new E,this.onPointerDown=this._onPointDown.event,this._onDropped=new E,this.onDrop=this._onDropped.event,this._onDragStart=new E,this.onDragStart=this._onDragStart.event,this._onDragEnd=new E,this.onDragEnd=this._onDragEnd.event,this._element=document.createElement(`div`),this._element.className=`dv-tab`,this._element.tabIndex=0,this._element.draggable=!this.accessor.options.disableDnd,N(this.element,`dv-inactive-tab`,!0),this.dragHandler=new dt(this._element,this.accessor,this.group,this.panel,!!this.accessor.options.disableDnd),this.dropTarget=new J(this._element,{acceptedTargetZones:[`left`,`right`],overlayModel:{activationSize:{value:50,type:`percentage`}},canDisplayOverlay:(e,t)=>{if(this.group.locked)return!1;let n=S();return n&&this.accessor.id===n.viewId?!(this.accessor.options.tabAnimation===`smooth`&&n.groupId===this.group.id):this.group.model.canDisplayOverlay(e,t,`tab`)},getOverrideTarget:()=>{var e;return(e=n.model.dropTargetContainer)==null?void 0:e.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this._onPointDown,this._onDropped,this._onDragStart,this._onDragEnd,this.dragHandler.onDragStart(e=>{if(e.dataTransfer){let t=getComputedStyle(this.element),n=this.element.cloneNode(!0);Array.from(t).forEach(e=>n.style.setProperty(e,t.getPropertyValue(e),t.getPropertyPriority(e))),n.style.position=`absolute`,ut(e.dataTransfer,n,{y:-10,x:30})}this._onDragStart.fire(e),this.accessor.options.tabAnimation===`smooth`&&requestAnimationFrame(()=>{N(this.element,`dv-tab--dragging`,!0)})}),D(this._element,`dragend`,e=>{N(this.element,`dv-tab--dragging`,!1),this._onDragEnd.fire(e)}),this.dragHandler,D(this._element,`pointerdown`,e=>{this._onPointDown.fire(e)}),this.dropTarget.onDrop(e=>{this._onDropped.fire(e)}),this.dropTarget)}setActive(e){N(this.element,`dv-active-tab`,e),N(this.element,`dv-inactive-tab`,!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,this.dragHandler.setDisabled(!!this.accessor.options.disableDnd)}dispose(){super.dispose()}},pt=class{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,t){this.event=e,this.options=t}},mt=class extends Ke{constructor(e,t,n,r){super(e,r),this.accessor=t,this.group=n,this.panelTransfer=x.getInstance(),this.addDisposables(D(e,`pointerdown`,e=>{e.shiftKey&&ue(e)},!0))}isCancelled(e){return this.group.api.location.type===`floating`&&!e.shiftKey}getData(e){let t=e.dataTransfer;this.panelTransfer.setData([new b(this.accessor.id,this.group.id,null)],b.prototype);let n=window.getComputedStyle(this.el),r=n.getPropertyValue(`--dv-activegroup-visiblepanel-tab-background-color`),i=n.getPropertyValue(`--dv-activegroup-visiblepanel-tab-color`);if(t){let e=document.createElement(`div`);e.style.backgroundColor=r,e.style.color=i,e.style.padding=`2px 8px`,e.style.height=`24px`,e.style.fontSize=`11px`,e.style.lineHeight=`20px`,e.style.borderRadius=`12px`,e.style.position=`absolute`,e.style.pointerEvents=`none`,e.style.top=`-9999px`,e.textContent=`Multiple Panels (${this.group.size})`,ut(t,e,{y:-10,x:30})}return{dispose:()=>{this.panelTransfer.clearData(b.prototype)}}}},ht=class extends k{get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this._onDrop=new E,this.onDrop=this._onDrop.event,this._onDragStart=new E,this.onDragStart=this._onDragStart.event,this._element=document.createElement(`div`),this._element.className=`dv-void-container`,this._element.draggable=!this.accessor.options.disableDnd,N(this._element,`dv-draggable`,!this.accessor.options.disableDnd),this.addDisposables(this._onDrop,this._onDragStart,D(this._element,`pointerdown`,()=>{this.accessor.doSetGroupActive(this.group)})),this.handler=new mt(this._element,e,t,!!this.accessor.options.disableDnd),this.dropTarget=new J(this._element,{acceptedTargetZones:[`center`],canDisplayOverlay:(e,n)=>{let r=S();return r&&this.accessor.id===r.viewId?!0:t.model.canDisplayOverlay(e,n,`header_space`)},getOverrideTarget:()=>{var e;return(e=t.model.dropTargetContainer)==null?void 0:e.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this.handler,this.handler.onDragStart(e=>{this._onDragStart.fire(e)}),this.dropTarget.onDrop(e=>{this._onDrop.fire(e)}),this.dropTarget)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,N(this._element,`dv-draggable`,!this.accessor.options.disableDnd),this.handler.setDisabled(!!this.accessor.options.disableDnd)}},gt=class e extends k{get element(){return this._element}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._scrollOffset=0,this._orientation=e,j(this._scrollbar,`dv-scrollbar-vertical`,`dv-scrollbar-horizontal`),e===`vertical`?M(this._scrollbar,`dv-scrollbar-vertical`):M(this._scrollbar,`dv-scrollbar-horizontal`))}constructor(t){super(),this.scrollableElement=t,this._scrollOffset=0,this._orientation=`horizontal`,this._element=document.createElement(`div`),this._element.className=`dv-scrollable`,this._scrollbar=document.createElement(`div`),this._scrollbar.className=`dv-scrollbar dv-scrollbar-horizontal`,this.element.appendChild(t),this.element.appendChild(this._scrollbar),this.addDisposables(D(this.element,`wheel`,t=>{this._scrollOffset+=t.deltaY*e.MouseWheelSpeed,this.calculateScrollbarStyles()}),D(this._scrollbar,`pointerdown`,e=>{e.preventDefault(),N(this.element,`dv-scrollable-scrolling`,!0);let t=this._orientation===`horizontal`?e.clientX:e.clientY,n=this._scrollOffset,r=e=>{this._scrollOffset=n+(this._orientation===`horizontal`?e.clientX-t:e.clientY-t)/((this._orientation===`horizontal`?this.element.clientWidth:this.element.clientHeight)/(this._orientation===`horizontal`?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight)),this.calculateScrollbarStyles()},i=()=>{N(this.element,`dv-scrollable-scrolling`,!1),document.removeEventListener(`pointermove`,r),document.removeEventListener(`pointerup`,i),document.removeEventListener(`pointercancel`,i)};document.addEventListener(`pointermove`,r),document.addEventListener(`pointerup`,i),document.addEventListener(`pointercancel`,i)}),D(this.element,`scroll`,()=>{this.calculateScrollbarStyles()}),D(this.scrollableElement,`scroll`,()=>{this._scrollOffset=this._orientation===`horizontal`?this.scrollableElement.scrollLeft:this.scrollableElement.scrollTop,this.calculateScrollbarStyles()}),ae(this.element,()=>{N(this.element,`dv-scrollable-resizing`,!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),N(this.element,`dv-scrollable-resizing`,!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){let e=this._orientation===`horizontal`?this.element.clientWidth:this.element.clientHeight,t=this._orientation===`horizontal`?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight;if(t>e){let n=e/t*e;this._orientation===`horizontal`?(this._scrollbar.style.width=`${n}px`,this._scrollbar.style.height=``):(this._scrollbar.style.height=`${n}px`,this._scrollbar.style.width=``),this._scrollOffset=L(this._scrollOffset,0,t-e),this._orientation===`horizontal`?this.scrollableElement.scrollLeft=this._scrollOffset:this.scrollableElement.scrollTop=this._scrollOffset;let r=this._scrollOffset/(t-e);this._orientation===`horizontal`?(this._scrollbar.style.left=`${(e-n)*r}px`,this._scrollbar.style.top=``):(this._scrollbar.style.top=`${(e-n)*r}px`,this._scrollbar.style.left=``)}else this._orientation===`horizontal`?(this._scrollbar.style.width=`0px`,this._scrollbar.style.left=`0px`):(this._scrollbar.style.height=`0px`,this._scrollbar.style.top=`0px`),this._scrollOffset=0}};gt.MouseWheelSpeed=1;var _t=class extends k{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){let e=new ie(this._tabsList);this._observerDisposable.value=new k(e,e.onDidChange(e=>{let t=e.hasScrollX||e.hasScrollY;this.toggleDropdown({reset:!t})}),D(this._tabsList,`scroll`,()=>{this.toggleDropdown({reset:!1})}))}}get element(){return this._element}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this._scrollbar&&(this._scrollbar.orientation=e),j(this._tabsList,`dv-horizontal`,`dv-vertical`),e===`vertical`?M(this._tabsList,`dv-tabs-container-vertical`,`dv-vertical`):(j(this._tabsList,`dv-tabs-container-vertical`),M(this._tabsList,`dv-horizontal`)))}constructor(e,t,n){super(),this.group=e,this.accessor=t,this._observerDisposable=new A,this._scrollbar=null,this._tabs=[],this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._direction=`horizontal`,this._animState=null,this._onTabDragStart=new E,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new E,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new E,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new E,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement(`div`),this._tabsList.className=`dv-tabs-container`,this.showTabsOverflowControl=n.showTabsOverflowControl,t.options.scrollbars===`native`?this._element=this._tabsList:(this._scrollbar=new gt(this._tabsList),this._scrollbar.orientation=this.direction,this._element=this._scrollbar.element,this.addDisposables(this._scrollbar)),this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,D(this.element,`pointerdown`,e=>{e.defaultPrevented||e.button===0&&this.accessor.doSetGroupActive(this.group)}),D(this._tabsList,`dragover`,e=>{if(!this._animState){if(this.accessor.options.tabAnimation!==`smooth`||this.accessor.options.disableDnd)return;let e=S();if(e&&e.panelId&&e.groupId!==this.group.id)this._animState={sourceTabId:e.panelId,sourceIndex:-1,tabPositions:this.snapshotTabPositions(),currentInsertionIndex:null};else return}this.handleDragOver(e)},!0),D(this._tabsList,`dragleave`,e=>{this._animState&&(e.relatedTarget&&this._tabsList.contains(e.relatedTarget)||(this.resetTabTransforms(),this._animState&&(this._animState.sourceIndex===-1?this._animState=null:this._animState.currentInsertionIndex=null)))},!0),D(this._tabsList,`dragend`,()=>{this.resetDragAnimation()}),D(this._tabsList,`drop`,e=>{if(this.accessor.options.tabAnimation!==`smooth`||!this._animState||this._animState.currentInsertionIndex===null)return;e.stopPropagation(),e.preventDefault();let t=this._animState;this._animState=null;let n=t.currentInsertionIndex,r=t.sourceIndex,i=n-(r!==-1&&r<n?1:0);if(i===r){this.resetTabTransforms();return}let a=this.snapshotTabPositions();this.resetTabTransforms(),this._onDrop.fire({event:e,index:i}),this.runFlipAnimation(a,t.sourceTabId,t.sourceIndex===-1,{from:Math.min(r,i),to:Math.max(r,i)})},!0),O.from(()=>{this.resetDragAnimation();for(let{value:e,disposable:t}of this._tabs)t.dispose(),e.dispose();this._tabs=[]}))}indexOf(e){return this._tabs.findIndex(t=>t.value.panel.id===e)}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}setActivePanel(e){let t=0;for(let n of this._tabs){let r=e.id===n.value.panel.id;if(n.value.setActive(r),r){let e=n.value.element,r=e.parentElement;(t<r.scrollLeft||t+e.clientWidth>r.scrollLeft+r.clientWidth)&&(r.scrollLeft=t)}t+=n.value.element.clientWidth}}openPanel(e,t=this._tabs.length){if(this._tabs.find(t=>t.value.panel.id===e.id))return;let n=new ft(e,this.accessor,this.group);n.setContent(e.view.tab);let r={value:n,disposable:new k(n.onDragStart(t=>{this._onTabDragStart.fire({nativeEvent:t,panel:e}),this.accessor.options.tabAnimation===`smooth`&&(this._animState={sourceTabId:e.id,sourceIndex:this._tabs.findIndex(e=>e.value===n),tabPositions:this.snapshotTabPositions(),currentInsertionIndex:null})}),n.onPointerDown(t=>{if(t.defaultPrevented)return;let r=!this.accessor.options.disableFloatingGroups,i=this.group.api.location.type===`floating`&&this.size===1;if(r&&!i&&t.shiftKey){t.preventDefault();let e=this.accessor.getGroupPanel(n.panel.id),{top:r,left:i}=n.element.getBoundingClientRect(),{top:a,left:o}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(e,{x:i-o,y:r-a,inDragMode:!0});return}switch(t.button){case 0:this.group.activePanel!==e&&this.group.model.openPanel(e);break}}),n.onDrop(e=>{let t=this._animState;this._animState=null;let r=this._tabs.findIndex(e=>e.value===n);if(t){let n=this.snapshotTabPositions();this.resetTabTransforms(),this._onDrop.fire({event:e.nativeEvent,index:r}),this.runFlipAnimation(n,t.sourceTabId,t.sourceIndex===-1,t.sourceIndex===-1?void 0:{from:Math.min(t.sourceIndex,r),to:Math.max(t.sourceIndex,r)})}else this._onDrop.fire({event:e.nativeEvent,index:r})}),n.onWillShowOverlay(e=>{this._onWillShowOverlay.fire(new pt(e,{kind:`tab`,panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:S}))}))};this.addTab(r,t),this._animState&&(this._animState.tabPositions=this.snapshotTabPositions(),this.applyDragOverTransforms())}delete(e){var t;((t=this._animState)==null?void 0:t.sourceTabId)===e&&(this.resetTabTransforms(),this._animState=null);let n=this.indexOf(e),{value:r,disposable:i}=this._tabs.splice(n,1)[0];i.dispose(),r.dispose(),r.element.remove(),this._animState&&(this._animState.tabPositions=this.snapshotTabPositions(),this.applyDragOverTransforms())}addTab(e,t=this._tabs.length){if(t<0||t>this._tabs.length)throw Error(`invalid location`);this._tabsList.insertBefore(e.value.element,this._tabsList.children[t]),this._tabs=[...this._tabs.slice(0,t),e,...this._tabs.slice(t)],this.selectedIndex<0&&(this.selectedIndex=t)}toggleDropdown(e){let t=e.reset?[]:this._tabs.filter(e=>!be(e.value.element,this._tabsList)).map(e=>e.value.panel.id);this._onOverflowTabsChange.fire({tabs:t,reset:e.reset})}updateDragAndDropState(){for(let e of this._tabs)e.value.updateDragAndDropState()}snapshotTabPositions(){let e=new Map;for(let t of this._tabs)e.set(t.value.panel.id,t.value.element.getBoundingClientRect());return e}getAverageTabWidth(){if(this._tabs.length===0)return 0;let e=0;for(let t of this._tabs)e+=t.value.element.getBoundingClientRect().width;return e/this._tabs.length}handleDragOver(e){if(!this._animState)return;let t=e.clientX,n=null;for(let e=0;e<this._tabs.length;e++){let r=this._tabs[e].value;if(r.panel.id===this._animState.sourceTabId)continue;let i=r.element.getBoundingClientRect();if(t<i.left+i.width/2){n=e;break}n=e+1}n!==this._animState.currentInsertionIndex&&(this._animState.currentInsertionIndex=n,this.applyDragOverTransforms())}applyDragOverTransforms(){if(!this._animState||this._animState.currentInsertionIndex===null){this.resetTabTransforms();return}let e=this._animState.currentInsertionIndex,t=this._animState.tabPositions.get(this._animState.sourceTabId),n=t?t.width:this.getAverageTabWidth(),r=!1;for(let t=0;t<this._tabs.length;t++){let i=this._tabs[t].value;if(i.panel.id!==this._animState.sourceTabId)if(!r&&t>=e)i.element.style.marginLeft=`${n}px`,N(i.element,`dv-tab--shifting`,!0),r=!0;else if(i.element.style.marginLeft){i.element.style.marginLeft=`0px`,N(i.element,`dv-tab--shifting`,!0);let e=()=>{i.element.style.removeProperty(`margin-left`),N(i.element,`dv-tab--shifting`,!1),i.element.removeEventListener(`transitionend`,e)};i.element.addEventListener(`transitionend`,e)}else N(i.element,`dv-tab--shifting`,!1)}}resetTabTransforms(){for(let e of this._tabs)e.value.element.style.removeProperty(`margin-left`),e.value.element.style.removeProperty(`transform`),N(e.value.element,`dv-tab--shifting`,!1)}resetDragAnimation(){this.resetTabTransforms(),this._animState=null;for(let e of this._tabs)N(e.value.element,`dv-tab--dragging`,!1)}runFlipAnimation(e,t,n=!1,r){let i=!1;for(let a=0;a<this._tabs.length;a++){let o=this._tabs[a],s=o.value.panel.id;if(s===t){if(n){let e=o.value.element.getBoundingClientRect();o.value.element.style.transform=`translateX(${e.width}px)`,N(o.value.element,`dv-tab--shifting`,!0),i=!0}continue}if(r!==void 0&&(a<r.from||a>r.to))continue;let c=e.get(s);if(!c)continue;let l=o.value.element.getBoundingClientRect(),u=c.left-l.left;Math.abs(u)<1||(o.value.element.style.transform=`translateX(${u}px)`,N(o.value.element,`dv-tab--shifting`,!0),i=!0)}i&&requestAnimationFrame(()=>{for(let e of this._tabs)e.value.element.style.transform&&(e.value.element.style.transform=``);let e=t=>{if(t.propertyName===`transform`){this._tabsList.removeEventListener(`transitionend`,e);for(let e of this._tabs)N(e.value.element,`dv-tab--shifting`,!1)}};this._tabsList.addEventListener(`transitionend`,e)})}},vt=e=>{let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);t.setAttributeNS(null,`height`,e.height),t.setAttributeNS(null,`width`,e.width),t.setAttributeNS(null,`viewBox`,e.viewbox),t.setAttributeNS(null,`aria-hidden`,`false`),t.setAttributeNS(null,`focusable`,`false`),t.classList.add(`dv-svg`);let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return n.setAttributeNS(null,`d`,e.path),t.appendChild(n),t},yt=()=>vt({width:`11`,height:`11`,viewbox:`0 0 28 28`,path:`M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z`}),bt=()=>vt({width:`11`,height:`11`,viewbox:`0 0 15 25`,path:`M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z`});function xt(){let e=document.createElement(`div`);e.className=`dv-tabs-overflow-dropdown-default`;let t=document.createElement(`span`);t.textContent=``;let n=bt();return e.appendChild(n),e.appendChild(t),{element:e,update:e=>{t.textContent=`${e.tabs}`}}}var St=class extends k{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?`none`:``}get direction(){return this._direction}set direction(e){this._direction=e,e===`vertical`?(M(this._element,`dv-groupview-header-vertical`),M(this.rightActionsContainer,`dv-right-actions-container-vertical`),this.tabs.direction=e):(j(this._element,`dv-groupview-header-vertical`),j(this.rightActionsContainer,`dv-right-actions-container-vertical`),this.tabs.direction=e)}get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this._hidden=!1,this._direction=`horizontal`,this.dropdownPart=null,this._overflowTabs=[],this._dropdownDisposable=new A,this._onDrop=new E,this.onDrop=this._onDrop.event,this._onGroupDragStart=new E,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new E,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement(`div`),this._element.className=`dv-tabs-and-actions-container`,N(this._element,`dv-full-width-single-tab`,this.accessor.options.singleTabMode===`fullwidth`),this.rightActionsContainer=document.createElement(`div`),this.rightActionsContainer.className=`dv-right-actions-container`,this.leftActionsContainer=document.createElement(`div`),this.leftActionsContainer.className=`dv-left-actions-container`,this.preActionsContainer=document.createElement(`div`),this.preActionsContainer.className=`dv-pre-actions-container`,this.tabs=new _t(t,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new ht(this.accessor,this.group),this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.addDisposables(this.tabs.onDrop(e=>this._onDrop.fire(e)),this.tabs.onWillShowOverlay(e=>this._onWillShowOverlay.fire(e)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(e=>{this.toggleDropdown(e)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(e=>{this._onGroupDragStart.fire({nativeEvent:e,group:this.group})}),this.voidContainer.onDrop(e=>{this._onDrop.fire({event:e.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(e=>{this._onWillShowOverlay.fire(new pt(e,{kind:`header_space`,panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:S}))}),D(this.voidContainer.element,`pointerdown`,e=>{if(!e.defaultPrevented&&!this.accessor.options.disableFloatingGroups&&e.shiftKey&&this.group.api.location.type!==`floating`){e.preventDefault();let{top:t,left:n}=this.element.getBoundingClientRect(),{top:r,left:i}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:n-i+20,y:t-r+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display=``)}hide(){this._element.style.display=`none`}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}openPanel(e,t=this.tabs.size){this.tabs.openPanel(e,t),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){N(this._element,`dv-single-tab`,this.size===1)}toggleDropdown(e){let t=e.reset?[]:e.tabs;if(this._overflowTabs=t,this._overflowTabs.length>0&&this.dropdownPart){this.dropdownPart.update({tabs:t.length});return}if(this._overflowTabs.length===0){this._dropdownDisposable.dispose();return}let n=document.createElement(`div`);n.className=`dv-tabs-overflow-dropdown-root`;let r=xt();r.update({tabs:t.length}),this.dropdownPart=r,n.appendChild(r.element),this.rightActionsContainer.prepend(n),this._dropdownDisposable.value=new k(O.from(()=>{var e,t;n.remove(),(t=(e=this.dropdownPart)==null?void 0:e.dispose)==null||t.call(e),this.dropdownPart=null}),D(n,`pointerdown`,e=>{e.preventDefault()},{capture:!0}),D(n,`click`,e=>{let t=document.createElement(`div`);t.style.overflow=`auto`,t.className=`dv-tabs-overflow-container`;for(let e of this.tabs.tabs.filter(e=>this._overflowTabs.includes(e.panel.id))){let n=this.group.panels.find(t=>t===e.panel),r=n.view.createTabRenderer(`headerOverflow`).element,i=document.createElement(`div`);N(i,`dv-tab`,!0),N(i,`dv-active-tab`,n.api.isActive),N(i,`dv-inactive-tab`,!n.api.isActive),i.addEventListener(`click`,t=>{this.accessor.popupService.close(),!t.defaultPrevented&&(e.element.scrollIntoView(),e.panel.api.setActive())}),i.appendChild(r),t.appendChild(i)}let r=we(n);this.accessor.popupService.openPopover(t,{x:e.clientX,y:e.clientY,zIndex:r!=null&&r.style.zIndex?`calc(${r.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}},Ct=class extends T{constructor(e,t,n,r,i){super(),this.nativeEvent=e,this.target=t,this.position=n,this.getData=r,this.group=i}},wt=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,popoutUrl:void 0,defaultRenderer:void 0,defaultHeaderPosition:void 0,debug:void 0,rootOverlayModel:void 0,locked:void 0,disableDnd:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0,tabAnimation:void 0});function Tt(e){return!!e.referencePanel}function Et(e){return!!e.referenceGroup}function Dt(e){return!!e.referencePanel}function Ot(e){return!!e.referenceGroup}var kt=class extends w{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}},At=class extends kt{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}},jt=class extends k{get element(){throw Error(`dockview: not supported`)}get activePanel(){return this._activePanel}get locked(){return this._locked}set locked(e){this._locked=e,N(this.container,`dv-locked-groupview`,e===`no-drop-target`||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return document.activeElement?oe(document.activeElement,this.contentContainer.element):!1}get headerPosition(){var e;return(e=this._headerPosition)==null?`top`:e}set headerPosition(e){var t;this._headerPosition=e,j(this.container,`dv-groupview-header-top`,`dv-groupview-header-bottom`,`dv-groupview-header-left`,`dv-groupview-header-right`),M(this.container,`dv-groupview-header-${e}`);let n=e===`top`||e===`bottom`?`horizontal`:`vertical`;this.tabsContainer.direction=n,this.header.direction=n,(t=this._activePanel)!=null&&t.layout&&this._activePanel.layout(this._width,this._height),(this._leftHeaderActions||this._rightHeaderActions||this._prefixHeaderActions)&&this.updateHeaderActions()}get location(){return this._location}set location(e){switch(this._location=e,N(this.container,`dv-groupview-floating`,!1),N(this.container,`dv-groupview-popout`,!1),e.type){case`grid`:this.contentContainer.dropTarget.setTargetZones([`top`,`bottom`,`left`,`right`,`center`]);break;case`floating`:this.contentContainer.dropTarget.setTargetZones([`center`]),this.contentContainer.dropTarget.setTargetZones(e?[`center`]:[`top`,`bottom`,`left`,`right`,`center`]),N(this.container,`dv-groupview-floating`,!0);break;case`popout`:this.contentContainer.dropTarget.setTargetZones([`center`]),N(this.container,`dv-groupview-popout`,!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,t,n,r,i){var a,o;super(),this.container=e,this.accessor=t,this.id=n,this.options=r,this.groupPanel=i,this._isGroupActive=!1,this._locked=!1,this._rightHeaderActionsDisposable=new A,this._leftHeaderActionsDisposable=new A,this._prefixHeaderActionsDisposable=new A,this._location={type:`grid`},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new E,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._onMove=new E,this.onMove=this._onMove.event,this._onDidDrop=new E,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new E,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new E,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new E,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new E,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new E,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new E,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new E,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new E,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new E,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOverEvent=new E,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,N(this.container,`dv-groupview`,!0),this._api=new Ge(this.accessor),this.tabsContainer=new St(this.accessor,this.groupPanel),this.contentContainer=new lt(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!r.hideHeader,this.locked=(a=r.locked)==null?!1:a,this.headerPosition=(o=r.headerPosition)==null?t.defaultHeaderPosition:o,this.addDisposables(this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this._rightHeaderActionsDisposable,this._leftHeaderActionsDisposable,this._prefixHeaderActionsDisposable,this.tabsContainer.onTabDragStart(e=>{this._onTabDragStart.fire(e)}),this.tabsContainer.onGroupDragStart(e=>{this._onGroupDragStart.fire(e)}),this.tabsContainer.onDrop(e=>{this.handleDropEvent(`header`,e.event,`center`,e.index)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(e=>{this.handleDropEvent(`content`,e.nativeEvent,e.position)}),this.tabsContainer.onWillShowOverlay(e=>{this._onWillShowOverlay.fire(e)}),this.contentContainer.dropTarget.onWillShowOverlay(e=>{this._onWillShowOverlay.fire(new pt(e,{kind:`content`,panel:this.activePanel,api:this._api,group:this.groupPanel,getData:S}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOverEvent,this._onDidPanelTitleChange,this._onDidPanelParametersChange)}focusContent(){this.contentContainer.element.focus()}set renderContainer(e){this.panels.forEach(e=>{this.renderContainer.detatch(e)}),this._overwriteRenderContainer=e,this.panels.forEach(e=>{this.rerender(e)})}get renderContainer(){var e;return(e=this._overwriteRenderContainer)==null?this.accessor.overlayRenderContainer:e}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return(e=this._overwriteDropTargetContainer)==null?this.accessor.rootDropTargetContainer:e}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.updateHeaderActions()}updateHeaderActions(){this.accessor.options.createRightHeaderActionComponent?(this._rightHeaderActions=this.accessor.options.createRightHeaderActionComponent(this.groupPanel),this._rightHeaderActionsDisposable.value=this._rightHeaderActions,this._rightHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element)):(this._rightHeaderActions=void 0,this._rightHeaderActionsDisposable.dispose(),this.tabsContainer.setRightActionsElement(void 0)),this.accessor.options.createLeftHeaderActionComponent?(this._leftHeaderActions=this.accessor.options.createLeftHeaderActionComponent(this.groupPanel),this._leftHeaderActionsDisposable.value=this._leftHeaderActions,this._leftHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element)):(this._leftHeaderActions=void 0,this._leftHeaderActionsDisposable.dispose(),this.tabsContainer.setLeftActionsElement(void 0)),this.accessor.options.createPrefixHeaderActionComponent?(this._prefixHeaderActions=this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel),this._prefixHeaderActionsDisposable.value=this._prefixHeaderActions,this._prefixHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element)):(this._prefixHeaderActions=void 0,this._prefixHeaderActionsDisposable.dispose(),this.tabsContainer.setPrefixActionsElement(void 0))}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;let t={views:this.tabsContainer.panels,activeView:(e=this._activePanel)==null?void 0:e.id,id:this.id};return this.locked!==!1&&(t.locked=this.locked),this.header.hidden&&(t.hideHeader=!0),this.headerPosition!==`top`&&(t.headerPosition=this.headerPosition),t}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);let t=e.panel?this.panels.indexOf(e.panel):-1,n;if(t<this.panels.length-1)n=t+1;else if(!e.suppressRoll)n=0;else return;this.openPanel(this.panels[n])}moveToPrevious(e){if(e||(e={}),e.panel||(e.panel=this.activePanel),!e.panel)return;let t=this.panels.indexOf(e.panel),n;if(t>0)n=t-1;else if(!e.suppressRoll)n=this.panels.length-1;else return;this.openPanel(this.panels[n])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;(e=this._activePanel)==null||e.focus()}openPanel(e,t={}){(typeof t.index!=`number`||t.index>this.panels.length)&&(t.index=this.panels.length);let n=!!t.skipSetActive;if(e.updateParentGroup(this.groupPanel,{skipSetActive:t.skipSetActive}),this.doAddPanel(e,t.index,{skipSetActive:n}),this._activePanel===e){this.contentContainer.renderPanel(e,{asActive:!0});return}n||this.doSetActivePanel(e),t.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),t.skipSetActive||this.updateContainer()}removePanel(e,t={skipSetActive:!1}){let n=typeof e==`string`?e:e.id,r=this._panels.find(e=>e.id===n);if(!r)throw Error(`invalid operation`);return this._removePanel(r,t)}closeAllPanels(){if(this.panels.length>0){let e=[...this.panels];for(let t of e)this.doClose(t)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){let t=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(e,t&&this.accessor.options.noPanelsOverlay===`emptyGroup`?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,t=!1){!t&&this.isActive===e||(this._isGroupActive=e,N(this.container,`dv-active-group`,e),N(this.container,`dv-inactive-group`,!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer())}layout(e,t){var n;this._width=e,this._height=t,this.contentContainer.layout(this._width,this._height),(n=this._activePanel)!=null&&n.layout&&this._activePanel.layout(this._width,this._height)}_removePanel(e,t){let n=this._activePanel===e;if(this.doRemovePanel(e),n&&this.panels.length>0){let e=this.mostRecentlyUsed[0];this.openPanel(e,{skipSetActive:t.skipSetActive,skipSetGroupActive:t.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),t.skipSetActive||this.updateContainer(),e}doRemovePanel(e){let t=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(t,1),this.mostRecentlyUsed.includes(e)){let t=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(t,1)}let n=this._panelDisposables.get(e.id);n&&(n.dispose(),this._panelDisposables.delete(e.id)),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,t=this.panels.length,n={skipSetActive:!1}){let r=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,t),n.skipSetActive?e.api.renderer===`always`&&this.contentContainer.renderPanel(e,{asActive:!1}):this.contentContainer.openPanel(e),!r&&(this.updateMru(e),this.panels.splice(t,0,e),this._panelDisposables.set(e.id,new k(e.api.onDidTitleChange(e=>this._onDidPanelTitleChange.fire(e)),e.api.onDidParametersChange(e=>this._onDidPanelParametersChange.fire(e)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e})))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,t;if(this.panels.forEach(e=>e.runEvents()),this.isEmpty&&!this.watermark){let e=this.accessor.createWatermarkComponent();e.init({containerApi:this._api,group:this.groupPanel}),this.watermark=e,D(this.watermark.element,`pointerdown`,()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),(t=(e=this.watermark).dispose)==null||t.call(e),this.watermark=void 0)}canDisplayOverlay(e,t,n){let r=new Ct(e,n,t,S,this.accessor.getPanel(this.id));return this._onUnhandledDragOverEvent.fire(r),r.isAccepted}handleDropEvent(e,t,n,r){if(this.locked===`no-drop-target`)return;function i(){switch(e){case`header`:return typeof r==`number`?`tab`:`header_space`;case`content`:return`content`}}let a=typeof r==`number`?this.panels[r]:void 0,o=new At({nativeEvent:t,position:n,panel:a,getData:()=>S(),kind:i(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(o),o.defaultPrevented)return;let s=S();if(s&&s.viewId===this.accessor.id){if(e===`content`&&s.groupId===this.id&&(n===`center`||s.panelId===null)||e===`header`&&s.groupId===this.id&&s.panelId===null)return;if(s.panelId===null){let{groupId:e}=s;this._onMove.fire({target:n,groupId:e,index:r});return}if(this.tabsContainer.indexOf(s.panelId)!==-1&&this.tabsContainer.size===1)return;let{groupId:t,panelId:i}=s;if(this.id===t&&!n&&this.tabsContainer.indexOf(i)===r)return;this._onMove.fire({target:n,groupId:s.groupId,itemId:s.panelId,index:r})}else this._onDidDrop.fire(new kt({nativeEvent:t,position:n,panel:a,getData:()=>S(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,t,n;super.dispose(),(e=this.watermark)==null||e.element.remove(),(n=(t=this.watermark)==null?void 0:t.dispose)==null||n.call(t),this.watermark=void 0;for(let e of this.panels)e.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}},Mt=class extends st{constructor(e,t,n){super(e,t),this._onDidConstraintsChangeInternal=new E,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new E,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new E,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),n&&this.initialize(n)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}},Nt=class extends ct{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){let e=typeof this._minimumWidth==`function`?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){let e=typeof this._maximumWidth==`function`?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){let e=typeof this._minimumHeight==`function`?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){let e=typeof this._maximumHeight==`function`?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,t,n,r){super(e,t,r==null?new Mt(e,t):r),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=2**53-1,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=2**53-1,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=2**53-1,this._maximumHeight=2**53-1,this._snap=!1,this._onDidChange=new E,this.onDidChange=this._onDidChange.event,typeof(n==null?void 0:n.minimumWidth)==`number`&&(this._minimumWidth=n.minimumWidth),typeof(n==null?void 0:n.maximumWidth)==`number`&&(this._maximumWidth=n.maximumWidth),typeof(n==null?void 0:n.minimumHeight)==`number`&&(this._minimumHeight=n.minimumHeight),typeof(n==null?void 0:n.maximumHeight)==`number`&&(this._maximumHeight=n.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(e=>{let{isVisible:t}=e,{accessor:n}=this._params;n.setVisible(this,t)}),this.api.onActiveChange(()=>{let{accessor:e}=this._params;e.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(e=>{(typeof e.minimumWidth==`number`||typeof e.minimumWidth==`function`)&&(this._minimumWidth=e.minimumWidth),(typeof e.minimumHeight==`number`||typeof e.minimumHeight==`function`)&&(this._minimumHeight=e.minimumHeight),(typeof e.maximumWidth==`number`||typeof e.maximumWidth==`function`)&&(this._maximumWidth=e.maximumWidth),(typeof e.maximumHeight==`number`||typeof e.maximumHeight==`function`)&&(this._maximumHeight=e.maximumHeight)}),this.api.onDidSizeChange(e=>{this._onDidChange.fire({height:e.height,width:e.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),typeof e.isVisible==`boolean`&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){let e=super.toJSON(),t=e=>e===2**53-1?void 0:e,n=e=>e<=0?void 0:e;return Object.assign(Object.assign({},e),{minimumHeight:n(this.minimumHeight),maximumHeight:t(this.maximumHeight),minimumWidth:n(this.minimumWidth),maximumWidth:t(this.maximumWidth),snap:this.snap,priority:this.priority})}},Y=`dockview: DockviewGroupPanelApiImpl not initialized`,Pt=class extends Mt{get location(){if(!this._group)throw Error(Y);return this._group.model.location}constructor(e,t){super(e,`__dockviewgroup__`),this.accessor=t,this._onDidLocationChange=new E,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new E,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidVisibilityChange.event(e=>{e.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type===`popout`?this.location.getWindow():window}setHeaderPosition(e){if(!this._group)throw Error(Y);this._group.model.headerPosition=e}getHeaderPosition(){if(!this._group)throw Error(Y);return this._group.model.headerPosition}moveTo(e){var t,n,r,i;if(!this._group)throw Error(Y);let a=(t=e.group)==null?this.accessor.addGroup({direction:$e((n=e.position)==null?`right`:n),skipSetActive:(r=e.skipSetActive)==null?!1:r}):t;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:a,position:e.group?(i=e.position)==null?`center`:i:`center`,index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw Error(Y);this.location.type===`grid`&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw Error(Y);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw Error(Y);this.isMaximized()&&this.accessor.exitMaximizedGroup()}initialize(e){this._group=e}},Ft=100,It=100,Lt=class extends Nt{get minimumWidth(){var e;if(typeof this._explicitConstraints.minimumWidth==`number`)return this._explicitConstraints.minimumWidth;let t=(e=this.activePanel)==null?void 0:e.minimumWidth;return typeof t==`number`?t:super.__minimumWidth()}get minimumHeight(){var e;if(typeof this._explicitConstraints.minimumHeight==`number`)return this._explicitConstraints.minimumHeight;let t=(e=this.activePanel)==null?void 0:e.minimumHeight;return typeof t==`number`?t:super.__minimumHeight()}get maximumWidth(){var e;if(typeof this._explicitConstraints.maximumWidth==`number`)return this._explicitConstraints.maximumWidth;let t=(e=this.activePanel)==null?void 0:e.maximumWidth;return typeof t==`number`?t:super.__maximumWidth()}get maximumHeight(){var e;if(typeof this._explicitConstraints.maximumHeight==`number`)return this._explicitConstraints.maximumHeight;let t=(e=this.activePanel)==null?void 0:e.maximumHeight;return typeof t==`number`?t:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,t,n){var r,i,a,o,s,c;super(t,`groupview_default`,{minimumHeight:(i=(r=n.constraints)==null?void 0:r.minimumHeight)==null?It:i,minimumWidth:(o=(a=n.constraints)==null?void 0:a.minimumWidth)==null?Ft:o,maximumHeight:(s=n.constraints)==null?void 0:s.maximumHeight,maximumWidth:(c=n.constraints)==null?void 0:c.maximumWidth},new Pt(t,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new jt(this.element,e,t,n,this),this.addDisposables(this.model.onDidActivePanelChange(e=>{this.api._onDidActivePanelChange.fire(e)}),this.api.onDidConstraintsChangeInternal(e=>{e.minimumWidth!==void 0&&(this._explicitConstraints.minimumWidth=typeof e.minimumWidth==`function`?e.minimumWidth():e.minimumWidth),e.minimumHeight!==void 0&&(this._explicitConstraints.minimumHeight=typeof e.minimumHeight==`function`?e.minimumHeight():e.minimumHeight),e.maximumWidth!==void 0&&(this._explicitConstraints.maximumWidth=typeof e.maximumWidth==`function`?e.maximumWidth():e.maximumWidth),e.maximumHeight!==void 0&&(this._explicitConstraints.maximumHeight=typeof e.maximumHeight==`function`?e.maximumHeight():e.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,t){super.layout(e,t),this.model.layout(e,t)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}},Rt={name:`abyss`,className:`dockview-theme-abyss`},zt=class extends Mt{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){let t=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(t),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,t,n,r,i){super(e.id,r),this.panel=e,this.accessor=n,this._onDidTitleChange=new E,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new E,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new E,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new E,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new E,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new A,this._tabComponent=i,this.initialize(e),this._group=t,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}moveTo(e){var t,n;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(t=e.group)==null?this._group:t,position:e.group?(n=e.position)==null?`center`:n:`center`,index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var t;let n=(t=e==null?void 0:e.isActive)==null?!1:t;this.groupEventsDisposable.value=new k(this.group.api.onDidVisibilityChange(e=>{let t=!e.isVisible&&this.isVisible,n=e.isVisible&&!this.isVisible,r=this.group.model.isPanelActive(this.panel);(t||n&&r)&&this._onDidVisibilityChange.fire(e)}),this.group.api.onDidLocationChange(e=>{this.group===this.panel.group&&this._onDidLocationChange.fire(e)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&n!==this.isGroupActive&&(n=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}},X=class extends k{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return(e=this._renderer)==null?this.accessor.renderer:e}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,t,n,r,i,a,o,s){super(),this.id=e,this.accessor=r,this.containerApi=i,this.view=o,this._renderer=s.renderer,this._group=a,this._minimumWidth=s.minimumWidth,this._minimumHeight=s.minimumHeight,this._maximumWidth=s.maximumWidth,this._maximumHeight=s.maximumHeight,this.api=new zt(this,this._group,r,t,n),this.addDisposables(this.api.onActiveChange(()=>{r.setActivePanel(this)}),this.api.onDidSizeChange(e=>{this.group.api.setSize(e)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){let e=new ot;this.api._onWillFocus.fire(e),!e.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var t;this._params=Object.assign(Object.assign({},(t=this._params)==null?{}:t),e.params);for(let t of Object.keys(e.params))e.params[t]===void 0&&delete this._params[t];this.view.update({params:this._params})}updateFromStateModel(e){var t,n,r;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:(t=e.params)==null?{}:t}),this.setTitle((n=e.title)==null?this.id:n),this.setRenderer((r=e.renderer)==null?this.accessor.renderer:r)}updateParentGroup(e,t){this._group=e,this.api.group=this._group;let n=this._group.model.isPanelActive(this),r=this.group.api.isActive&&n;t!=null&&t.skipSetActive||this.api.isActive!==r&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&n}),this.api.isVisible!==n&&this.api._onDidVisibilityChange.fire({isVisible:n})}runEvents(){let e=this._group.model.isPanelActive(this),t=this.group.api.isActive&&e;this.api.isActive!==t&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,t){this.api._onDidDimensionChange.fire({width:e,height:t}),this.view.layout(e,t)}dispose(){this.api.dispose(),this.view.dispose()}},Bt=class extends k{get element(){return this._element}constructor(){super(),this._element=document.createElement(`div`),this._element.className=`dv-default-tab`,this._content=document.createElement(`div`),this._content.className=`dv-default-tab-content`,this.action=document.createElement(`div`),this.action.className=`dv-default-tab-action`,this.action.appendChild(yt()),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange(e=>{this._title=e.title,this.render()}),D(this.action,`pointerdown`,e=>{e.preventDefault()}),D(this.action,`click`,t=>{t.defaultPrevented||(t.preventDefault(),e.api.close())})),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=(e=this._title)==null?``:e)}},Vt=class{get content(){return this._content}get tab(){return this._tab}constructor(e,t,n,r){this.accessor=e,this.id=t,this.contentComponent=n,this.tabComponent=r,this._content=this.createContentComponent(this.id,n),this._tab=this.createTabComponent(this.id,r)}createTabRenderer(e){var t;let n=this.createTabComponent(this.id,this.tabComponent);return this._params&&n.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&((t=n.update)==null||t.call(n,this._updateEvent)),n}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:`header`}))}layout(e,t){var n,r;(r=(n=this.content).layout)==null||r.call(n,e,t)}update(e){var t,n,r,i;this._updateEvent=e,(n=(t=this.content).update)==null||n.call(t,e),(i=(r=this.tab).update)==null||i.call(r,e)}dispose(){var e,t,n,r;(t=(e=this.content).dispose)==null||t.call(e),(r=(n=this.tab).dispose)==null||r.call(n)}createContentComponent(e,t){return this.accessor.options.createComponent({id:e,name:t})}createTabComponent(e,t){let n=t==null?this.accessor.options.defaultTabComponent:t;if(n){if(this.accessor.options.createTabComponent)return this.accessor.options.createTabComponent({id:e,name:n})||new Bt;console.warn(`dockview: tabComponent '${t}' was not found. falling back to the default tab.`)}return new Bt}},Ht=class{constructor(e){this.accessor=e}fromJSON(e,t){var n,r;let i=e.id,a=e.params,o=e.title,s=e.view,c=s?s.content.id:(n=e.contentComponent)==null?`unknown`:n,l=s?(r=s.tab)==null?void 0:r.id:e.tabComponent,u=new Vt(this.accessor,i,c,l),d=new X(i,c,l,this.accessor,new Ge(this.accessor),t,u,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return d.init({title:o==null?i:o,params:a==null?{}:a}),d}},Ut=class extends k{get element(){return this._element}constructor(){super(),this._element=document.createElement(`div`),this._element.className=`dv-watermark`}init(e){}},Wt=new class{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(t=>t!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(t=>t!==e),this.update()}update(){for(let e=0;e<this._orderedList.length;e++)this._orderedList[e].setAttribute(`aria-level`,`${e}`),this._orderedList[e].style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${e*2})`}},Gt=class e extends k{set minimumInViewportWidth(e){this.options.minimumInViewportWidth=e}set minimumInViewportHeight(e){this.options.minimumInViewportHeight=e}get element(){return this._element}get isVisible(){return this._isVisible}constructor(e){super(),this.options=e,this._element=document.createElement(`div`),this._onDidChange=new E,this.onDidChange=this._onDidChange.event,this._onDidChangeEnd=new E,this.onDidChangeEnd=this._onDidChangeEnd.event,this.addDisposables(this._onDidChange,this._onDidChangeEnd),this._element.className=`dv-resize-container`,this._isVisible=!0,this.setupResize(`top`),this.setupResize(`bottom`),this.setupResize(`left`),this.setupResize(`right`),this.setupResize(`topleft`),this.setupResize(`topright`),this.setupResize(`bottomleft`),this.setupResize(`bottomright`),this._element.appendChild(this.options.content),this.options.container.appendChild(this._element),this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({height:this.options.height,width:this.options.width},`top`in this.options&&{top:this.options.top}),`bottom`in this.options&&{bottom:this.options.bottom}),`left`in this.options&&{left:this.options.left}),`right`in this.options&&{right:this.options.right})),Wt.push(this._element)}setVisible(e){e!==this.isVisible&&(this._isVisible=e,N(this.element,`dv-hidden`,!this.isVisible))}bringToFront(){Wt.push(this._element)}setBounds(e={}){typeof e.height==`number`&&(this._element.style.height=`${e.height}px`),typeof e.width==`number`&&(this._element.style.width=`${e.width}px`),`top`in e&&typeof e.top==`number`&&(this._element.style.top=`${e.top}px`,this._element.style.bottom=`auto`,this.verticalAlignment=`top`),`bottom`in e&&typeof e.bottom==`number`&&(this._element.style.bottom=`${e.bottom}px`,this._element.style.top=`auto`,this.verticalAlignment=`bottom`),`left`in e&&typeof e.left==`number`&&(this._element.style.left=`${e.left}px`,this._element.style.right=`auto`,this.horiziontalAlignment=`left`),`right`in e&&typeof e.right==`number`&&(this._element.style.right=`${e.right}px`,this._element.style.left=`auto`,this.horiziontalAlignment=`right`);let t=this.options.container.getBoundingClientRect(),n=this._element.getBoundingClientRect(),r=Math.max(0,this.getMinimumWidth(n.width)),i=Math.max(0,this.getMinimumHeight(n.height));if(this.verticalAlignment===`top`){let e=L(n.top-t.top,-i,Math.max(0,t.height-n.height+i));this._element.style.top=`${e}px`,this._element.style.bottom=`auto`}if(this.verticalAlignment===`bottom`){let e=L(t.bottom-n.bottom,-i,Math.max(0,t.height-n.height+i));this._element.style.bottom=`${e}px`,this._element.style.top=`auto`}if(this.horiziontalAlignment===`left`){let e=L(n.left-t.left,-r,Math.max(0,t.width-n.width+r));this._element.style.left=`${e}px`,this._element.style.right=`auto`}if(this.horiziontalAlignment===`right`){let e=L(t.right-n.right,-r,Math.max(0,t.width-n.width+r));this._element.style.right=`${e}px`,this._element.style.left=`auto`}this._onDidChange.fire()}toJSON(){let e=this.options.container.getBoundingClientRect(),t=this._element.getBoundingClientRect(),n={};return this.verticalAlignment===`top`?n.top=parseFloat(this._element.style.top):this.verticalAlignment===`bottom`?n.bottom=parseFloat(this._element.style.bottom):n.top=t.top-e.top,this.horiziontalAlignment===`left`?n.left=parseFloat(this._element.style.left):this.horiziontalAlignment===`right`?n.right=parseFloat(this._element.style.right):n.left=t.left-e.left,n.width=t.width,n.height=t.height,n}setupDrag(e,t={inDragMode:!1}){let n=new A,r=()=>{let e=null,t=P();n.value=new k({dispose:()=>{t.release()}},D(window,`pointermove`,t=>{let n=this.options.container.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top;N(this._element,`dv-resize-container-dragging`,!0);let a=this._element.getBoundingClientRect();e===null&&(e={x:t.clientX-a.left,y:t.clientY-a.top});let o=Math.max(0,this.getMinimumWidth(a.width)),s=Math.max(0,this.getMinimumHeight(a.height)),c=L(i-e.y,-s,Math.max(0,n.height-a.height+s)),l=L(e.y-i+n.height-a.height,-s,Math.max(0,n.height-a.height+s)),u=L(r-e.x,-o,Math.max(0,n.width-a.width+o)),d=L(e.x-r+n.width-a.width,-o,Math.max(0,n.width-a.width+o)),f={};c<=l?f.top=c:f.bottom=l,u<=d?f.left=u:f.right=d,this.setBounds(f)}),D(window,`pointerup`,()=>{N(this._element,`dv-resize-container-dragging`,!1),n.dispose(),this._onDidChangeEnd.fire()}))};this.addDisposables(n,D(e,`pointerdown`,e=>{if(e.defaultPrevented){e.preventDefault();return}de(e)||r()}),D(this.options.content,`pointerdown`,e=>{e.defaultPrevented||de(e)||e.shiftKey&&r()}),D(this.options.content,`pointerdown`,()=>{Wt.push(this._element)},!0)),t.inDragMode&&r()}setupResize(t){let n=document.createElement(`div`);n.className=`dv-resize-handle-${t}`,this._element.appendChild(n);let r=new A;this.addDisposables(r,D(n,`pointerdown`,n=>{n.preventDefault();let i=null,a=P();r.value=new k(D(window,`pointermove`,n=>{let r=this.options.container.getBoundingClientRect(),a=this._element.getBoundingClientRect(),o=n.clientY-r.top,s=n.clientX-r.left;i===null&&(i={originalY:o,originalHeight:a.height,originalX:s,originalWidth:a.width});let c,l,u,d,f,p,m=()=>{c=L(o,0,i.originalY+i.originalHeight>r.height?Math.max(0,r.height-e.MINIMUM_HEIGHT):Math.max(0,i.originalY+i.originalHeight-e.MINIMUM_HEIGHT)),u=i.originalY+i.originalHeight-c,l=r.height-c-u},h=()=>{c=i.originalY-i.originalHeight;let t=c<0&&typeof this.options.minimumInViewportHeight==`number`?-c+this.options.minimumInViewportHeight:e.MINIMUM_HEIGHT,n=r.height-Math.max(0,c);u=L(o-c,t,n),l=r.height-c-u},g=()=>{d=L(s,0,i.originalX+i.originalWidth>r.width?Math.max(0,r.width-e.MINIMUM_WIDTH):Math.max(0,i.originalX+i.originalWidth-e.MINIMUM_WIDTH)),p=i.originalX+i.originalWidth-d,f=r.width-d-p},_=()=>{d=i.originalX-i.originalWidth;let t=d<0&&typeof this.options.minimumInViewportWidth==`number`?-d+this.options.minimumInViewportWidth:e.MINIMUM_WIDTH,n=r.width-Math.max(0,d);p=L(s-d,t,n),f=r.width-d-p};switch(t){case`top`:m();break;case`bottom`:h();break;case`left`:g();break;case`right`:_();break;case`topleft`:m(),g();break;case`topright`:m(),_();break;case`bottomleft`:h(),g();break;case`bottomright`:h(),_();break}let v={};c<=l?v.top=c:v.bottom=l,d<=f?v.left=d:v.right=f,v.height=u,v.width=p,this.setBounds(v)}),{dispose:()=>{a.release()}},D(window,`pointerup`,()=>{r.dispose(),this._onDidChangeEnd.fire()}))}))}getMinimumWidth(e){return typeof this.options.minimumInViewportWidth==`number`?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return typeof this.options.minimumInViewportHeight==`number`?e-this.options.minimumInViewportHeight:0}dispose(){Wt.destroy(this._element),this._element.remove(),super.dispose()}};Gt.MINIMUM_HEIGHT=20,Gt.MINIMUM_WIDTH=20;var Kt=class extends k{constructor(e,t){super(),this.group=e,this.overlay=t,this.addDisposables(t)}position(e){this.overlay.setBounds(e)}},qt=100,Z={left:100,top:100,width:300,height:300},Jt=100,Yt=class{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){let t=this.cache.get(e);if(t&&t.frameId===this.currentFrameId)return t.rect;this.scheduleFrameUpdate();let n=pe(e);return this.cache.set(e,{rect:n,frameId:this.currentFrameId}),n}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}};function Xt(){let e=document.createElement(`div`);return e.tabIndex=-1,e}var Zt=class extends k{constructor(e,t){super(),this.element=e,this.accessor=t,this.map={},this._disposed=!1,this.positionCache=new Yt,this.pendingUpdates=new Set,this.addDisposables(O.from(()=>{for(let e of Object.values(this.map))e.disposable.dispose(),e.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(let e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){let{disposable:t,destroy:n}=this.map[e.api.id];return t.dispose(),n.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){let{panel:t,referenceContainer:n}=e;if(!this.map[t.api.id]){let e=Xt();e.className=`dv-render-overlay`,e.style.visibility=`hidden`,this.map[t.api.id]={panel:t,disposable:O.NONE,destroy:O.NONE,element:e}}let r=this.map[t.api.id].element;t.view.content.element.parentElement!==r&&r.appendChild(t.view.content.element),r.parentElement!==this.element&&this.element.appendChild(r);let i=()=>{let e=t.api.id;this.pendingUpdates.has(e)||(this.pendingUpdates.add(e),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(e),this.isDisposed||!this.map[e])return;let i=this.positionCache.getPosition(n.element),a=this.positionCache.getPosition(this.element),o=i.left-a.left,s=i.top-a.top,c=i.width,l=i.height;r.style.left=`${o}px`,r.style.top=`${s}px`,r.style.width=`${c}px`,r.style.height=`${l}px`,r.style.visibility===`hidden`&&(r.style.visibility=``),N(r,`dv-render-overlay-float`,t.group.api.location.type===`floating`)}))},a=()=>{t.api.isVisible&&(this.positionCache.invalidate(),i()),r.style.display=t.api.isVisible?``:`none`},o=new A,s=()=>{t.api.location.type===`floating`?queueMicrotask(()=>{let e=this.accessor.floatingGroups.find(e=>e.group===t.api.group);if(!e)return;let n=e.overlay.element,i=()=>{let e=Number(n.getAttribute(`aria-level`));r.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${e*2+1})`},a=new MutationObserver(()=>{i()});o.value=O.from(()=>a.disconnect()),a.observe(n,{attributeFilter:[`aria-level`],attributes:!0}),i()}):r.style.zIndex=``},c=new k(o,new qe(r,{onDragEnd:e=>{n.dropTarget.dnd.onDragEnd(e)},onDragEnter:e=>{n.dropTarget.dnd.onDragEnter(e)},onDragLeave:e=>{n.dropTarget.dnd.onDragLeave(e)},onDrop:e=>{n.dropTarget.dnd.onDrop(e)},onDragOver:e=>{n.dropTarget.dnd.onDragOver(e)}}),t.api.onDidVisibilityChange(()=>{a()}),t.api.onDidDimensionsChange(()=>{t.api.isVisible&&i()}),t.api.onDidLocationChange(()=>{s()}));return this.map[t.api.id].destroy=O.from(()=>{var e;t.view.content.element.parentElement===r&&r.removeChild(t.view.content.element),(e=r.parentElement)==null||e.removeChild(r)}),s(),queueMicrotask(()=>{this.isDisposed||a()}),this.map[t.api.id].disposable.dispose(),this.map[t.api.id].disposable=c,this.map[t.api.id].resize=i,r}};function Qt(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var $t=class extends k{get window(){var e,t;return(t=(e=this._window)==null?void 0:e.value)==null?null:t}constructor(e,t,n){super(),this.target=e,this.className=t,this.options=n,this._onWillClose=new E,this.onWillClose=this._onWillClose.event,this._onDidClose=new E,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;let e=this._window.value.screenX;return{top:this._window.value.screenY,left:e,width:this._window.value.innerWidth,height:this._window.value.innerHeight}}close(){var e,t;this._window&&(this._onWillClose.fire(),(t=(e=this.options).onWillClose)==null||t.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){var e,t;return Qt(this,void 0,void 0,function*(){if(this._window)throw Error(`instance of popout window is already open`);let n=`${this.options.url}`,r=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([e,t])=>`${e}=${t}`).join(`,`),i=window.open(n,this.target,r);if(!i)return null;let a=new k;this._window={value:i,disposable:a},a.addDisposables(O.from(()=>{i.close()}),D(window,`beforeunload`,()=>{this.close()}));let o=this.createPopoutWindowContainer();return this.className&&o.classList.add(this.className),(t=(e=this.options).onDidOpen)==null||t.call(e,{id:this.target,window:i}),new Promise((e,t)=>{i.addEventListener(`unload`,e=>{}),i.addEventListener(`load`,()=>{try{let t=i.document;t.title=document.title,t.body.appendChild(o),fe(t,window.document.styleSheets),D(i,`beforeunload`,()=>{this.close()}),e(o)}catch(e){t(e)}})})})}createPopoutWindowContainer(){let e=document.createElement(`div`);return e.classList.add(`dv-popout-window`),e.id=`dv-popout-window`,e.style.position=`absolute`,e.style.width=`100%`,e.style.height=`100%`,e.style.top=`0px`,e.style.left=`0px`,e}},en=class extends k{constructor(e){super(),this.accessor=e,this.init()}init(){let e=new Set,t=new Set;this.addDisposables(this.accessor.onDidAddPanel(t=>{if(e.has(t.api.id))throw Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${t.api.id} but panel already exists`);e.add(t.api.id)}),this.accessor.onDidRemovePanel(t=>{if(e.has(t.api.id))e.delete(t.api.id);else throw Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${t.api.id} but panel does not exists`)}),this.accessor.onDidAddGroup(e=>{if(t.has(e.api.id))throw Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${e.api.id} but group already exists`);t.add(e.api.id)}),this.accessor.onDidRemoveGroup(e=>{if(t.has(e.api.id))t.delete(e.api.id);else throw Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${e.api.id} but group does not exists`)}))}},tn=class extends k{constructor(e){super(),this.root=e,this._active=null,this._activeDisposable=new A,this._element=document.createElement(`div`),this._element.className=`dv-popover-anchor`,this._element.style.position=`relative`,this.root.prepend(this._element),this.addDisposables(O.from(()=>{this.close()}),this._activeDisposable)}openPopover(e,t){var n;this.close();let r=document.createElement(`div`);r.style.position=`absolute`,r.style.zIndex=(n=t.zIndex)==null?`var(--dv-overlay-z-index)`:n,r.appendChild(e);let i=this._element.getBoundingClientRect(),a=i.left,o=i.top;r.style.top=`${t.y-o}px`,r.style.left=`${t.x-a}px`,this._element.appendChild(r),this._active=r,this._activeDisposable.value=new k(D(window,`pointerdown`,e=>{var t;let n=e.target;if(!(n instanceof HTMLElement))return;let i=n;for(;i&&i!==r;)i=(t=i==null?void 0:i.parentElement)==null?null:t;i||this.close()}),D(window,`resize`,()=>{this.close()})),requestAnimationFrame(()=>{Ce(r,this.root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}},nn=class extends k{get disabled(){return this._disabled}set disabled(e){var t;this.disabled!==e&&(this._disabled=e,e&&((t=this.model)==null||t.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&((e=this._model.root.parentElement)==null||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,t)=>{let n=this._outline!==t;if(this._outline=t,this._model)return this._model.changed=n,this._model;let r=this.createContainer(),i=this.createAnchor();if(this._model={root:r,overlay:i,changed:n},r.appendChild(i),this.element.appendChild(r),(e==null?void 0:e.target)instanceof HTMLElement){let t=e.target.getBoundingClientRect(),n=this.element.getBoundingClientRect();i.style.left=`${t.left-n.left}px`,i.style.top=`${t.top-n.top}px`}return this._model}}}constructor(e,t){super(),this.element=e,this._disabled=!1,this._disabled=t.disabled,this.addDisposables(O.from(()=>{var e;(e=this.model)==null||e.clear()}))}createContainer(){let e=document.createElement(`div`);return e.className=`dv-drop-target-container`,e}createAnchor(){let e=document.createElement(`div`);return e.className=`dv-drop-target-anchor`,e.style.visibility=`hidden`,e}},rn={activationSize:{type:`pixels`,value:10},size:{type:`pixels`,value:20}};function an(e){let t=e.from.activePanel;[...e.from.panels].map(t=>{let n=e.from.model.removePanel(t);return e.from.model.renderContainer.detatch(t),n}).forEach(n=>{e.to.model.openPanel(n,{skipSetActive:t!==n,skipSetGroupActive:!0})})}var on=class extends We{get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(e=>e.panels)}get options(){return this._options}get activePanel(){let e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return(e=this.options.defaultRenderer)==null?`onlyWhenVisible`:e}get defaultHeaderPosition(){var e;return(e=this.options.defaultHeaderPosition)==null?`top`:e}get api(){return this._api}get floatingGroups(){return this._floatingGroups}get popoutRestorationPromise(){return this._popoutRestorationPromise}constructor(e,t){var n,r,i;super(e,{proportionalLayout:!0,orientation:z.HORIZONTAL,styles:t.hideBorders?{separatorBorder:`transparent`}:void 0,disableAutoResizing:t.disableAutoResizing,locked:t.locked,margin:(r=(n=t.theme)==null?void 0:n.gap)==null?0:r,className:t.className}),this.nextGroupId=ke(),this._deserializer=new Ht(this),this._watermark=null,this._onWillDragPanel=new E,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new E,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new E,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new E,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new E,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOverEvent=new E,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._onDidRemovePanel=new E,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new E,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new E,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new E,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidOpenPopoutWindowFail=new E,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new E,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new E({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new E,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidMaximizedGroupChange=new E,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._floatingGroups=[],this._popoutGroups=[],this._popoutRestorationPromise=Promise.resolve(),this._onDidRemoveGroup=new E,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new E,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new E,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new E,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=t,this.popupService=new tn(this.element),this._themeClassnames=new ve(this.element),this._api=new Ge(this),this.rootDropTargetContainer=new nn(this.element,{disabled:!0}),this.overlayRenderContainer=new Zt(this.gridview.element,this),this._rootDropTarget=new J(this.element,{className:`dv-drop-target-edge`,canDisplayOverlay:(e,t)=>{let n=S();if(n)return n.viewId===this.id?t===`center`?this.gridview.length===0:!0:!1;if(t===`center`&&this.gridview.length!==0)return!1;let r=new Ct(e,`edge`,t,S);return this._onUnhandledDragOverEvent.fire(r),r.isAccepted},acceptedTargetZones:[`top`,`bottom`,`left`,`right`,`center`],overlayModel:(i=t.rootOverlayModel)==null?rn:i,getOverrideTarget:()=>{var e;return(e=this.rootDropTargetContainer)==null?void 0:e.model}}),this.updateDropTargetModel(t),N(this.gridview.element,`dv-dockview`,!0),N(this.element,`dv-debug`,!!t.debug),this.updateTheme(),this.updateWatermark(),t.debug&&this.addDisposables(new en(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onDidMovePanel,this._onDidMovePanel.event(()=>{this.debouncedUpdateAllPositions()}),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOverEvent,this._onDidMaximizedGroupChange,this._onDidOptionsChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidOpenPopoutWindowFail,this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.updateWatermark()}),this.onDidAdd(e=>{this._moving||this._onDidAddGroup.fire(e)}),this.onDidRemove(e=>{this._moving||this._onDidRemoveGroup.fire(e)}),this.onDidActiveChange(e=>{this._moving||this._onDidActiveGroupChange.fire(e)}),this.onDidMaximizedChange(e=>{this._onDidMaximizedGroupChange.fire({group:e.panel,isMaximized:e.isMaximized})}),C.any(this.onDidAdd,this.onDidRemove)(()=>{this.updateWatermark()}),C.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidMovePanel,this.onDidActivePanelChange,this.onDidPopoutGroupPositionChange,this.onDidPopoutGroupSizeChange)(()=>{this._bufferOnDidLayoutChange.fire()}),O.from(()=>{for(let e of[...this._floatingGroups])e.dispose();for(let e of[...this._popoutGroups])e.disposable.dispose()}),this._rootDropTarget,this._rootDropTarget.onWillShowOverlay(e=>{this.gridview.length>0&&e.position===`center`||this._onWillShowOverlay.fire(new pt(e,{kind:`edge`,panel:void 0,api:this._api,group:void 0,getData:S}))}),this._rootDropTarget.onDrop(e=>{var t;let n=new At({nativeEvent:e.nativeEvent,position:e.position,panel:void 0,api:this._api,group:void 0,getData:S,kind:`edge`});if(this._onWillDrop.fire(n),n.defaultPrevented)return;let r=S();r?this.moveGroupOrPanel({from:{groupId:r.groupId,panelId:(t=r.panelId)==null?void 0:t},to:{group:this.orthogonalize(e.position),position:`center`}}):this._onDidDrop.fire(new kt({nativeEvent:e.nativeEvent,position:e.position,panel:void 0,api:this._api,group:void 0,getData:S}))}),this._rootDropTarget)}setVisible(e,t){switch(e.api.location.type){case`grid`:super.setVisible(e,t);break;case`floating`:{let n=this.floatingGroups.find(t=>t.group===e);n&&(n.overlay.setVisible(t),e.api._onDidVisibilityChange.fire({isVisible:t}));break}case`popout`:console.warn(`dockview: You cannot hide a group that is in a popout window`);break}}addPopoutGroup(e,t){var n,r,i,a,o;if(e instanceof X&&e.group.size===1)return this.addPopoutGroup(e.group,t);let s=_e(this.gridview.element),c=this.element;function l(){return t!=null&&t.position?t.position:e instanceof Lt?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():c.getBoundingClientRect()}let u=l(),d=(r=(n=t==null?void 0:t.overridePopoutGroup)==null?void 0:n.id)==null?this.getNextGroupId():r,f=new $t(`${this.id}-${d}`,s==null?``:s,{url:(o=(i=t==null?void 0:t.popoutUrl)==null?(a=this.options)==null?void 0:a.popoutUrl:i)==null?`/popout.html`:o,left:window.screenX+u.left,top:window.screenY+u.top,width:u.width,height:u.height,onDidOpen:t==null?void 0:t.onDidOpen,onWillClose:t==null?void 0:t.onWillClose}),p=new k(f,f.onDidClose(()=>{p.dispose()}));return f.open().then(n=>{var r;if(f.isDisposed)return!1;let i=t!=null&&t.referenceGroup?t.referenceGroup:e instanceof X?e.group:e,a=e.api.location.type,o=i.element.parentElement!==null,s;if(o?t!=null&&t.overridePopoutGroup?s=t.overridePopoutGroup:(s=this.createGroup({id:d}),n&&this._onDidAddGroup.fire(s)):s=i,n===null)return console.error(`dockview: failed to create popout. perhaps you need to allow pop-ups for this website`),p.dispose(),this._onDidOpenPopoutWindowFail.fire(),this.movingLock(()=>an({from:s,to:i})),i.api.isVisible||i.api.setVisible(!0),!1;let c=document.createElement(`div`);c.className=`dv-overlay-render-container`;let l=new Zt(c,this);s.model.renderContainer=l,s.layout(f.window.innerWidth,f.window.innerHeight);let u;if(!(t!=null&&t.overridePopoutGroup)&&o)if(e instanceof X)this.movingLock(()=>{let t=i.model.removePanel(e);s.model.openPanel(t)});else switch(this.movingLock(()=>an({from:i,to:s})),a){case`grid`:i.api.setVisible(!1);break;case`floating`:case`popout`:u=(r=this._floatingGroups.find(t=>t.group.api.id===e.api.id))==null?void 0:r.overlay.toJSON(),this.removeGroup(i);break}n.classList.add(`dv-dockview`),n.style.overflow=`hidden`,n.appendChild(c),n.appendChild(s.element);let m=document.createElement(`div`),h=new nn(m,{disabled:this.rootDropTargetContainer.disabled});n.appendChild(m),s.model.dropTargetContainer=h,s.model.location={type:`popout`,getWindow:()=>f.window,popoutUrl:t==null?void 0:t.popoutUrl},o&&e.api.location.type===`grid`&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(s),p.addDisposables(s.api.onDidActiveChange(e=>{var t;e.isActive&&((t=f.window)==null||t.focus())}),s.api.onWillFocus(()=>{var e;(e=f.window)==null||e.focus()}));let g,_=o&&i&&this.getPanel(i.id),v={window:f,popoutGroup:s,referenceGroup:_?i.id:void 0,disposable:{dispose:()=>(p.dispose(),g)}},y=xe(f.window);return p.addDisposables(y,Se(f.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:f.window.innerWidth,height:f.window.innerHeight,group:s})}),y.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:f.window.screenX,screenY:f.window.screenX,group:s})}),D(f.window,`resize`,()=>{s.layout(f.window.innerWidth,f.window.innerHeight)}),l,O.from(()=>{if(!this.isDisposed){if(o&&this.getPanel(i.id))this.movingLock(()=>an({from:s,to:i})),i.api.isVisible||i.api.setVisible(!0),this.getPanel(s.id)&&this.doRemoveGroup(s,{skipPopoutAssociated:!0});else if(this.getPanel(s.id)){if(s.model.renderContainer=this.overlayRenderContainer,s.model.dropTargetContainer=this.rootDropTargetContainer,g=s,!this._popoutGroups.find(e=>e.popoutGroup===s))return;u?this.addFloatingGroup(s,{height:u.height,width:u.width,position:u}):(this.doRemoveGroup(s,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),s.model.location={type:`grid`},this.movingLock(()=>{this.doAddGroup(s,[0])})),this.doSetGroupAndPanelActive(s)}}})),this._popoutGroups.push(v),this.updateWatermark(),!0}).catch(e=>(console.error(`dockview: failed to create popout.`,e),!1))}addFloatingGroup(e,t){var n,r,i,a,o;let s;if(e instanceof X)s=this.createGroup(),this._onDidAddGroup.fire(s),this.movingLock(()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>s.model.openPanel(e,{skipSetGroupActive:!0}));else{s=e;let r=(n=this._popoutGroups.find(e=>e.popoutGroup===s))==null?void 0:n.referenceGroup,i=r?this.getPanel(r):void 0;typeof(t==null?void 0:t.skipRemoveGroup)==`boolean`&&t.skipRemoveGroup||(i?(this.movingLock(()=>an({from:e,to:i})),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(i,{skipDispose:!0}),s=i):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}function c(){if(t!=null&&t.position){let e={};return`left`in t.position?e.left=Math.max(t.position.left,0):`right`in t.position?e.right=Math.max(t.position.right,0):e.left=Z.left,`top`in t.position?e.top=Math.max(t.position.top,0):`bottom`in t.position?e.bottom=Math.max(t.position.bottom,0):e.top=Z.top,typeof t.width==`number`?e.width=Math.max(t.width,0):e.width=Z.width,typeof t.height==`number`?e.height=Math.max(t.height,0):e.height=Z.height,e}return{left:typeof(t==null?void 0:t.x)==`number`?Math.max(t.x,0):Z.left,top:typeof(t==null?void 0:t.y)==`number`?Math.max(t.y,0):Z.top,width:typeof(t==null?void 0:t.width)==`number`?Math.max(t.width,0):Z.width,height:typeof(t==null?void 0:t.height)==`number`?Math.max(t.height,0):Z.height}}let l=c(),u=new Gt(Object.assign(Object.assign({container:this.gridview.element,content:s.element},l),{minimumInViewportWidth:this.options.floatingGroupBounds===`boundedWithinViewport`?void 0:(i=(r=this.options.floatingGroupBounds)==null?void 0:r.minimumWidthWithinViewport)==null?qt:i,minimumInViewportHeight:this.options.floatingGroupBounds===`boundedWithinViewport`?void 0:(o=(a=this.options.floatingGroupBounds)==null?void 0:a.minimumHeightWithinViewport)==null?qt:o})),d=s.element.querySelector(`.dv-void-container`);if(!d)throw Error(`dockview: failed to find drag handle`);u.setupDrag(d,{inDragMode:typeof(t==null?void 0:t.inDragMode)==`boolean`?t.inDragMode:!1});let f=new Kt(s,u),p=new k(s.api.onDidActiveChange(e=>{e.isActive&&u.bringToFront()}),ae(s.element,e=>{let{width:t,height:n}=e.contentRect;s.layout(t,n)}));f.addDisposables(u.onDidChange(()=>{s.layout(s.width,s.height)}),u.onDidChangeEnd(()=>{this._bufferOnDidLayoutChange.fire()}),s.onDidChange(e=>{u.setBounds({height:e==null?void 0:e.height,width:e==null?void 0:e.width})}),{dispose:()=>{p.dispose(),Oe(this._floatingGroups,f),s.model.location={type:`grid`},this.updateWatermark()}}),this._floatingGroups.push(f),s.model.location={type:`floating`},t!=null&&t.skipActiveGroup||this.doSetGroupAndPanelActive(s),this.updateWatermark()}orthogonalize(e,t){switch(this.gridview.normalize(),e){case`top`:case`bottom`:this.gridview.orientation===z.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case`left`:case`right`:this.gridview.orientation===z.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break}switch(e){case`top`:case`left`:case`center`:return this.createGroupAtLocation([0],void 0,t);case`bottom`:case`right`:return this.createGroupAtLocation([this.gridview.length],void 0,t);default:throw Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var t,n;if(super.updateOptions(e),`floatingGroupBounds`in e)for(let r of this._floatingGroups){switch(e.floatingGroupBounds){case`boundedWithinViewport`:r.overlay.minimumInViewportHeight=void 0,r.overlay.minimumInViewportWidth=void 0;break;case void 0:r.overlay.minimumInViewportHeight=qt,r.overlay.minimumInViewportWidth=qt;break;default:r.overlay.minimumInViewportHeight=(t=e.floatingGroupBounds)==null?void 0:t.minimumHeightWithinViewport,r.overlay.minimumInViewportWidth=(n=e.floatingGroupBounds)==null?void 0:n.minimumWidthWithinViewport}r.overlay.setBounds()}this.updateDropTargetModel(e);let r=this.options.disableDnd;if(this._options=Object.assign(Object.assign({},this.options),e),r!==this.options.disableDnd&&this.updateDragAndDropState(),`theme`in e&&this.updateTheme(),`createRightHeaderActionComponent`in e||`createLeftHeaderActionComponent`in e||`createPrefixHeaderActionComponent`in e)for(let e of this.groups)e.model.updateHeaderActions();this.layout(this.gridview.width,this.gridview.height,!0)}layout(e,t,n){if(super.layout(e,t,n),this._floatingGroups)for(let e of this._floatingGroups)e.overlay.setBounds()}updateDragAndDropState(){for(let e of this.groups)e.model.updateDragAndDropState()}focus(){var e;(e=this.activeGroup)==null||e.focus()}getGroupPanel(e){return this.panels.find(t=>t.id===e)}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1]){e.group.model.moveToNext({suppressRoll:!0});return}let n=G(e.group.element),r=(t=this.gridview.next(n))==null?void 0:t.view;this.doSetGroupAndPanelActive(r)}moveToPrevious(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0]){e.group.model.moveToPrevious({suppressRoll:!0});return}let n=G(e.group.element),r=(t=this.gridview.previous(n))==null?void 0:t.view;r&&this.doSetGroupAndPanelActive(r)}toJSON(){var e;let t=this.gridview.serialize(),n=this.panels.reduce((e,t)=>(e[t.id]=t.toJSON(),e),{}),r=this._floatingGroups.map(e=>({data:e.group.toJSON(),position:e.overlay.toJSON()})),i=this._popoutGroups.map(e=>({data:e.popoutGroup.toJSON(),gridReferenceGroup:e.referenceGroup,position:e.window.dimensions(),url:e.popoutGroup.api.location.type===`popout`?e.popoutGroup.api.location.popoutUrl:void 0})),a={grid:t,panels:n,activeGroup:(e=this.activeGroup)==null?void 0:e.id};return r.length>0&&(a.floatingGroups=r),i.length>0&&(a.popoutGroups=i),a}fromJSON(e,t){var n,r;let i=new Map,a;if(t!=null&&t.reuseExistingPanels){a=this.createGroup(),this._groups.delete(a.api.id);let t=Object.keys(e.panels);for(let e of this.panels)t.includes(e.api.id)&&i.set(e.api.id,e);this.movingLock(()=>{Array.from(i.values()).forEach(e=>{this.moveGroupOrPanel({from:{groupId:e.api.group.api.id,panelId:e.api.id},to:{group:a,position:`center`},keepEmptyGroups:!0})})})}if(this.clear(),typeof e!=`object`||!e)throw Error(`dockview: serialized layout must be a non-null object`);let{grid:o,panels:s,activeGroup:c}=e;if(o.root.type!==`branch`||!Array.isArray(o.root.data))throw Error(`dockview: root must be of type branch`);try{let t=this.width,l=this.height,u=e=>{let{id:t,locked:n,hideHeader:r,headerPosition:o,views:c,activeView:l}=e;if(typeof t!=`string`)throw Error(`dockview: group id must be of type string`);let u=this.createGroup({id:t,locked:!!n,hideHeader:!!r,headerPosition:o});this._onDidAddGroup.fire(u);let d=[];for(let e of c){let t=i.get(e);if(a&&t)this.movingLock(()=>{a.model.removePanel(t)}),d.push(t),t.updateFromStateModel(s[e]);else{let t=this._deserializer.fromJSON(s[e],u);d.push(t)}}for(let e=0;e<c.length;e++){let t=d[e],n=typeof l==`string`&&l===t.id;i.has(t.api.id)?this.movingLock(()=>{u.model.openPanel(t,{skipSetActive:!n,skipSetGroupActive:!0})}):u.model.openPanel(t,{skipSetActive:!n,skipSetGroupActive:!0})}return!u.activePanel&&u.panels.length>0&&u.model.openPanel(u.panels[u.panels.length-1],{skipSetGroupActive:!0}),u};this.gridview.deserialize(o,{fromJSON:e=>u(e.data)}),this.layout(t,l,!0);let d=(n=e.floatingGroups)==null?[]:n;for(let e of d){let{data:t,position:n}=e,r=u(t);this.addFloatingGroup(r,{position:n,width:n.width,height:n.height,skipRemoveGroup:!0,inDragMode:!1})}let f=(r=e.popoutGroups)==null?[]:r,p=[];f.forEach((e,t)=>{let{data:n,position:r,gridReferenceGroup:i,url:a}=e,o=u(n),s=new Promise(e=>{setTimeout(()=>{this.addPopoutGroup(o,{position:r==null?void 0:r,overridePopoutGroup:i?o:void 0,referenceGroup:i?this.getPanel(i):void 0,popoutUrl:a}),e()},t*Jt)});p.push(s)}),this._popoutRestorationPromise=Promise.all(p).then(()=>void 0);for(let e of this._floatingGroups)e.overlay.setBounds();if(typeof c==`string`){let e=this.getPanel(c);e&&this.doSetGroupAndPanelActive(e)}}catch(e){console.error(`dockview: failed to deserialize layout. Reverting changes`,e);for(let e of this.groups)for(let t of e.panels)this.removePanel(t,{removeEmptyGroup:!1,skipDispose:!1});for(let e of this.groups)e.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e);for(let e of[...this._floatingGroups])e.dispose();throw this.clear(),e}this.updateWatermark(),this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}clear(){let e=Array.from(this._groups.values()).map(e=>e.value),t=!!this.activeGroup;for(let t of e)this.removeGroup(t,{skipActive:!0});t&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){for(let e of this._groups.entries()){let[t,n]=e;n.value.model.closeAllPanels()}}addPanel(e){var t,n;if(this.panels.find(t=>t.id===e.id))throw Error(`dockview: panel with id ${e.id} already exists`);let r;if(e.position&&e.floating)throw Error(`dockview: you can only provide one of: position, floating as arguments to .addPanel(...)`);let i={width:e.initialWidth,height:e.initialHeight},a;if(e.position)if(Tt(e.position)){let t=typeof e.position.referencePanel==`string`?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(a=e.position.index,!t)throw Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);r=this.findGroup(t)}else if(Et(e.position)){if(r=typeof e.position.referenceGroup==`string`?(t=this._groups.get(e.position.referenceGroup))==null?void 0:t.value:e.position.referenceGroup,a=e.position.index,!r)throw Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else{let t=this.orthogonalize(Qe(e.position.direction)),n=this.createPanel(e,t);return t.model.openPanel(n,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:a}),e.inactive||this.doSetGroupAndPanelActive(t),t.api.setSize({height:i==null?void 0:i.height,width:i==null?void 0:i.width}),n}else r=this.activeGroup;let o;if(r){let t=Ue(((n=e.position)==null?void 0:n.direction)||`within`);if(e.floating){let t=this.createGroup();this._onDidAddGroup.fire(t);let n=typeof e.floating==`object`&&e.floating!==null?e.floating:{};this.addFloatingGroup(t,Object.assign(Object.assign({},n),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),o=this.createPanel(e,t),t.model.openPanel(o,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:a})}else if(r.api.location.type===`floating`||t===`center`)o=this.createPanel(e,r),r.model.openPanel(o,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:a}),r.api.setSize({width:i==null?void 0:i.width,height:i==null?void 0:i.height}),e.inactive||this.doSetGroupAndPanelActive(r);else{let n=G(r.element),s=K(this.gridview.orientation,n,t),c=this.createGroupAtLocation(s,this.orientationAtLocation(s)===z.VERTICAL?i==null?void 0:i.height:i==null?void 0:i.width);o=this.createPanel(e,c),c.model.openPanel(o,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:a}),e.inactive||this.doSetGroupAndPanelActive(c)}}else if(e.floating){let t=this.createGroup();this._onDidAddGroup.fire(t);let n=typeof e.floating==`object`&&e.floating!==null?e.floating:{};this.addFloatingGroup(t,Object.assign(Object.assign({},n),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),o=this.createPanel(e,t),t.model.openPanel(o,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:a})}else{let t=this.createGroupAtLocation([0],this.gridview.orientation===z.VERTICAL?i==null?void 0:i.height:i==null?void 0:i.width);o=this.createPanel(e,t),t.model.openPanel(o,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:a}),e.inactive||this.doSetGroupAndPanelActive(t)}return o}removePanel(e,t={removeEmptyGroup:!0}){let n=e.group;if(!n)throw Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);n.model.removePanel(e,{skipSetActiveGroup:t.skipSetActiveGroup}),t.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),n.size===0&&t.removeEmptyGroup&&this.removeGroup(n,{skipActive:t.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new Ut}updateWatermark(){var e,t;if(this.groups.filter(e=>e.api.location.type===`grid`&&e.api.isVisible).length===0){if(!this._watermark){this._watermark=this.createWatermarkComponent(),this._watermark.init({containerApi:new Ge(this)});let e=document.createElement(`div`);e.className=`dv-watermark-container`,he(e,`watermark-component`),e.appendChild(this._watermark.element),this.gridview.element.appendChild(e)}}else this._watermark&&(this._watermark.element.parentElement.remove(),(t=(e=this._watermark).dispose)==null||t.call(e),this._watermark=null)}addGroup(e){var t;if(e){let n;if(Dt(e)){let t=typeof e.referencePanel==`string`?this.panels.find(t=>t.id===e.referencePanel):e.referencePanel;if(!t)throw Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(n=this.findGroup(t),!n)throw Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else if(Ot(e)){if(n=typeof e.referenceGroup==`string`?(t=this._groups.get(e.referenceGroup))==null?void 0:t.value:e.referenceGroup,!n)throw Error(`dockview: reference group ${e.referenceGroup} does not exist`)}else{let t=this.orthogonalize(Qe(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(t),t}let r=Ue(e.direction||`within`),i=G(n.element),a=K(this.gridview.orientation,i,r),o=this.createGroup(e),s=this.getLocationOrientation(a)===z.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(o,a,s),e.skipSetActive||this.doSetGroupAndPanelActive(o),o}else{let t=this.createGroup(e);return this.doAddGroup(t),this.doSetGroupAndPanelActive(t),t}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===z.HORIZONTAL?z.HORIZONTAL:z.VERTICAL}removeGroup(e,t){this.doRemoveGroup(e,t)}doRemoveGroup(e,t){var n;let r=[...e.panels];if(!(t!=null&&t.skipDispose))for(let e of r)this.removePanel(e,{removeEmptyGroup:!1,skipDispose:(n=t==null?void 0:t.skipDispose)==null?!1:n});let i=this.activePanel;if(e.api.location.type===`floating`){let n=this._floatingGroups.find(t=>t.group===e);if(n){if(t!=null&&t.skipDispose||(n.group.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)),Oe(this._floatingGroups,n),n.dispose(),!(t!=null&&t.skipActive)&&this._activeGroup===e){let e=Array.from(this._groups.values());this.doSetGroupAndPanelActive(e.length>0?e[0].value:void 0)}return n.group}throw Error(`dockview: failed to find floating group`)}if(e.api.location.type===`popout`){let n=this._popoutGroups.find(t=>t.popoutGroup===e);if(n){if(!(t!=null&&t.skipDispose)){if(!(t!=null&&t.skipPopoutAssociated)){let e=n.referenceGroup?this.getPanel(n.referenceGroup):void 0;e&&e.panels.length===0&&this.removeGroup(e)}n.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}Oe(this._popoutGroups,n);let r=n.disposable.dispose();if(!(t!=null&&t.skipPopoutReturn)&&r&&(this.doAddGroup(r,[0]),this.doSetGroupAndPanelActive(r)),!(t!=null&&t.skipActive)&&this._activeGroup===e){let e=Array.from(this._groups.values());this.doSetGroupAndPanelActive(e.length>0?e[0].value:void 0)}return this.updateWatermark(),n.popoutGroup}throw Error(`dockview: failed to find popout group`)}let a=super.doRemoveGroup(e,t);return t!=null&&t.skipActive||this.activePanel!==i&&this._onDidActivePanelChange.fire(this.activePanel),a}debouncedUpdateAllPositions(){this._updatePositionsFrameId!==void 0&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame(()=>{this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions()})}movingLock(e){let t=this._moving;try{return this._moving=!0,e()}finally{this._moving=t}}moveGroupOrPanel(e){var t;let n=e.to.group,r=e.from.groupId,i=e.from.panelId,a=e.to.position,o=e.to.index,s=r?(t=this._groups.get(r))==null?void 0:t.value:void 0;if(!s)throw Error(`dockview: Failed to find group id ${r}`);if(i===void 0){this.moveGroup({from:{group:s},to:{group:n,position:a},skipSetActive:e.skipSetActive});return}if(!a||a===`center`){let t=this.movingLock(()=>s.model.removePanel(i,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!t)throw Error(`dockview: No panel with id ${i}`);!e.keepEmptyGroups&&s.model.size===0&&this.doRemoveGroup(s,{skipActive:!0});let r=n.model.size===0;this.movingLock(()=>{var i;return n.model.openPanel(t,{index:o,skipSetActive:((i=e.skipSetActive)==null?!1:i)&&!r,skipSetGroupActive:!0})}),e.skipSetActive||this.doSetGroupAndPanelActive(n),this._onDidMovePanel.fire({panel:t,from:s})}else{let e=G(n.element),t=K(this.gridview.orientation,e,a);if(s.size<2){let[e,r]=F(t);if(s.api.location.type===`grid`){let[t,n]=F(G(s.element));if(Te(t,e)){this.gridview.moveView(t,n,r),this._onDidMovePanel.fire({panel:this.getGroupPanel(i),from:s});return}}if(s.api.location.type===`popout`){let e=this._popoutGroups.find(e=>e.popoutGroup===s),n=this.movingLock(()=>e.popoutGroup.model.removePanel(e.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(s,{skipActive:!0});let r=this.createGroupAtLocation(t);this.movingLock(()=>r.model.openPanel(n,{skipSetActive:!0})),this.doSetGroupAndPanelActive(r),this._onDidMovePanel.fire({panel:this.getGroupPanel(i),from:s});return}let o=this.movingLock(()=>this.doRemoveGroup(s,{skipActive:!0,skipDispose:!0})),c=G(n.element),l=K(this.gridview.orientation,c,a);this.movingLock(()=>this.doAddGroup(o,l)),this.doSetGroupAndPanelActive(o),this._onDidMovePanel.fire({panel:this.getGroupPanel(i),from:s})}else{let t=this.movingLock(()=>s.model.removePanel(i,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!t)throw Error(`dockview: No panel with id ${i}`);let n=K(this.gridview.orientation,e,a),r=this.createGroupAtLocation(n);this.movingLock(()=>r.model.openPanel(t,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(r),this._onDidMovePanel.fire({panel:t,from:s})}}}moveGroup(e){let t=e.from.group,n=e.to.group,r=e.to.position;if(r===`center`){let r=t.activePanel,i=this.movingLock(()=>[...t.panels].map(e=>t.model.removePanel(e.id,{skipSetActive:!0})));(t==null?void 0:t.model.size)===0&&this.doRemoveGroup(t,{skipActive:!0}),this.movingLock(()=>{for(let e of i)n.model.openPanel(e,{skipSetActive:e!==r,skipSetGroupActive:!0})}),e.skipSetActive===!0&&this.activePanel||this.doSetGroupAndPanelActive(n)}else{switch(t.api.location.type){case`grid`:this.gridview.removeView(G(t.element));break;case`floating`:{let e=this._floatingGroups.find(e=>e.group===t);if(!e)throw Error(`dockview: failed to find floating group`);e.dispose();break}case`popout`:{let e=this._popoutGroups.find(e=>e.popoutGroup===t);if(!e)throw Error(`dockview: failed to find popout group`);let r=this._popoutGroups.indexOf(e);if(r>=0&&this._popoutGroups.splice(r,1),e.referenceGroup){let t=this.getPanel(e.referenceGroup);t&&!t.api.isVisible&&this.doRemoveGroup(t,{skipActive:!0})}e.window.dispose(),n.api.location.type===`grid`?(t.model.renderContainer=this.overlayRenderContainer,t.model.dropTargetContainer=this.rootDropTargetContainer,t.model.location={type:`grid`}):n.api.location.type===`floating`&&(t.model.renderContainer=this.overlayRenderContainer,t.model.dropTargetContainer=this.rootDropTargetContainer,t.model.location={type:`floating`});break}}if(n.api.location.type===`grid`){let e=G(n.element),i=K(this.gridview.orientation,e,r),a;switch(this.gridview.orientation){case z.VERTICAL:a=e.length%2==0?t.api.width:t.api.height;break;case z.HORIZONTAL:a=e.length%2==0?t.api.height:t.api.width;break}this.gridview.addView(t,a,i)}else if(n.api.location.type===`floating`){let e=this._floatingGroups.find(e=>e.group===n);if(e){let n=e.overlay.toJSON(),r,i;r=`left`in n?n.left+50:`right`in n?Math.max(0,n.right-n.width-50):50,i=`top`in n?n.top+50:`bottom`in n?Math.max(0,n.bottom-n.height-50):50,this.addFloatingGroup(t,{height:n.height,width:n.width,position:{left:r,top:i}})}}}if(t.panels.forEach(e=>{this._onDidMovePanel.fire({panel:e,from:t})}),this.debouncedUpdateAllPositions(),e.skipSetActive===!1){let e=n==null?t:n;this.doSetGroupAndPanelActive(e)}}doSetGroupActive(e){super.doSetGroupActive(e);let t=this.activePanel;!this._moving&&t!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(t)}doSetGroupAndPanelActive(e){super.doSetGroupActive(e);let t=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),!this._moving&&t!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(t)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let t=e==null?void 0:e.id;if(t&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${e==null?void 0:e.id}. reassigning group id to avoid errors`),t=void 0),!t)for(t=this.nextGroupId.next();this._groups.has(t);)t=this.nextGroupId.next();let n=new Lt(this,t,e);if(n.init({params:{},accessor:this}),!this._groups.has(n.id)){let e=new k(n.model.onTabDragStart(e=>{this._onWillDragPanel.fire(e)}),n.model.onGroupDragStart(e=>{this._onWillDragGroup.fire(e)}),n.model.onMove(e=>{let{groupId:t,itemId:r,target:i,index:a}=e;this.moveGroupOrPanel({from:{groupId:t,panelId:r},to:{group:n,position:i,index:a}})}),n.model.onDidDrop(e=>{this._onDidDrop.fire(e)}),n.model.onWillDrop(e=>{this._onWillDrop.fire(e)}),n.model.onWillShowOverlay(e=>{if(this.options.disableDnd){e.preventDefault();return}this._onWillShowOverlay.fire(e)}),n.model.onUnhandledDragOverEvent(e=>{this._onUnhandledDragOverEvent.fire(e)}),n.model.onDidAddPanel(e=>{this._moving||this._onDidAddPanel.fire(e.panel)}),n.model.onDidRemovePanel(e=>{this._moving||this._onDidRemovePanel.fire(e.panel)}),n.model.onDidActivePanelChange(e=>{this._moving||e.panel===this.activePanel&&this._onDidActivePanelChange.value!==e.panel&&this._onDidActivePanelChange.fire(e.panel)}),C.any(n.model.onDidPanelTitleChange,n.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(n.id,{value:n,disposable:e})}return n.initialize(),n}createPanel(e,t){var n,r,i;let a=e.component,o=(n=e.tabComponent)==null?this.options.defaultTabComponent:n,s=new Vt(this,e.id,a,o),c=new X(e.id,a,o,this,this._api,t,s,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return c.init({title:(r=e.title)==null?e.id:r,params:(i=e==null?void 0:e.params)==null?{}:i}),c}createGroupAtLocation(e,t,n){let r=this.createGroup(n);return this.doAddGroup(r,e,t),r}findGroup(e){var t;return(t=Array.from(this._groups.values()).find(t=>t.value.model.containsPanel(e)))==null?void 0:t.value}orientationAtLocation(e){let t=this.gridview.orientation;return e.length%2==1?t:q(t)}updateDropTargetModel(e){`dndEdges`in e&&(this._rootDropTarget.disabled=typeof e.dndEdges==`boolean`&&e.dndEdges===!1,typeof e.dndEdges==`object`&&e.dndEdges!==null?this._rootDropTarget.setOverlayModel(e.dndEdges):this._rootDropTarget.setOverlayModel(rn)),`rootOverlayModel`in e&&this.updateDropTargetModel({dndEdges:e.dndEdges})}updateTheme(){var e,t;let n=(e=this._options.theme)==null?Rt:e;switch(this._themeClassnames.setClassNames(n.className),this.gridview.margin=(t=n.gap)==null?0:t,n.dndOverlayMounting){case`absolute`:this.rootDropTargetContainer.disabled=!1;break;default:this.rootDropTargetContainer.disabled=!0;break}}};function sn(e,t){return new on(e,t).api}var cn=Object.defineProperty,ln=(e,t,n)=>t in e?cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t,n)=>(ln(e,typeof t==`symbol`?t:t+``,n),n);function $(e,t){var n,r;let i=e,a=null;for(;!a&&i;)a=(n=i.components)==null?void 0:n[t],i=i.parent;if(a||(a=(r=e.appContext.components)==null?void 0:r[t]),!a)throw Error(`Failed to find Vue Component '${t}'`);return a}function un(e,n,i,a){let o=s(e,Object.freeze(i));o.appContext=n.appContext,o.appContext.provides=t(t({},o.appContext.provides?o.appContext.provides:{}),n.provides?n.provides:{}),h(o,a);let c=i;return{update:e=>{c=t(t({},i),e),o=r(o,c),h(o,a)},dispose:()=>{h(null,a)}}}var dn=class{constructor(e,t){Q(this,`_element`),this.component=e,this.parent=t,this._element=document.createElement(`div`),this.element.className=`dv-vue-part`,this.element.style.height=`100%`,this.element.style.width=`100%`}get element(){return this._element}},fn=class extends dn{constructor(){super(...arguments),Q(this,`_renderDisposable`),Q(this,`_api`),Q(this,`_containerApi`)}init(e){var t;this._api=e.api,this._containerApi=e.containerApi;let n={params:e.params,api:e.api,containerApi:e.containerApi,tabLocation:e.tabLocation};(t=this._renderDisposable)==null||t.dispose(),this._renderDisposable=un(this.component,this.parent,{params:n},this.element)}update(e){var t;if(!this._api||!this._containerApi)return;let n=e.params;(t=this._renderDisposable)==null||t.update({params:{params:n,api:this._api,containerApi:this._containerApi}})}dispose(){var e;(e=this._renderDisposable)==null||e.dispose()}},pn=class extends dn{constructor(){super(...arguments),Q(this,`_renderDisposable`)}get element(){return this._element}init(e){var t;let n={group:e.group,containerApi:e.containerApi};(t=this._renderDisposable)==null||t.dispose(),this._renderDisposable=un(this.component,this.parent,{params:n},this.element)}update(e){}dispose(){var e;(e=this._renderDisposable)==null||e.dispose()}},mn=class extends dn{constructor(e,t,n){super(e,t),Q(this,`_renderDisposable`),Q(this,`_mutableDisposable`,new A),Q(this,`_baseProps`),this.group=n}get element(){return this._element}init(e){var t;this._baseProps=e,this._mutableDisposable.value=new k(this.group.model.onDidAddPanel(()=>{this.updateProps()}),this.group.model.onDidRemovePanel(()=>{this.updateProps()}),this.group.model.onDidActivePanelChange(()=>{this.updateProps()}),e.api.onDidActiveChange(()=>{this.updateProps()})),(t=this._renderDisposable)==null||t.dispose(),this._renderDisposable=un(this.component,this.parent,{params:this.buildEnrichedProps()},this.element)}dispose(){var e;this._mutableDisposable.dispose(),(e=this._renderDisposable)==null||e.dispose()}buildEnrichedProps(){return t(t({},this._baseProps),{},{panels:this.group.model.panels,activePanel:this.group.model.activePanel,isGroupActive:this.group.api.isActive,group:this.group,headerPosition:this.group.model.headerPosition})}updateProps(){var e;(e=this._renderDisposable)==null||e.update({params:this.buildEnrichedProps()})}},hn=c({__name:`dockview`,props:{disableAutoResizing:{type:Boolean},hideBorders:{type:Boolean},singleTabMode:{},disableFloatingGroups:{type:Boolean},floatingGroupBounds:{},popoutUrl:{},defaultRenderer:{},defaultHeaderPosition:{},debug:{type:Boolean},dndEdges:{type:[Boolean,Object]},rootOverlayModel:{},disableDnd:{type:Boolean},locked:{type:Boolean},className:{},noPanelsOverlay:{},theme:{},disableTabsOverflowList:{type:Boolean},scrollbars:{},tabAnimation:{},watermarkComponent:{},defaultTabComponent:{},rightHeaderActionsComponent:{},leftHeaderActionsComponent:{},prefixHeaderActionsComponent:{}},emits:[`ready`],setup(e,{emit:n}){function r(e){return wt.reduce((t,n)=>(t[n]=e[n],t),{})}let i=n,o=e,s=m(null),c=m(null);return wt.forEach(e=>{_(()=>o[e],(t,n)=>{c.value&&c.value.updateOptions({[e]:t})})}),f(()=>{if(!s.value)throw Error(`dockview-vue: element is not mounted`);let e=l();if(!e)throw Error(`dockview-vue: getCurrentInstance() returned null`);let n={createComponent(t){return new fn($(e,t.name),e)},createTabComponent(t){let n=$(e,t.name);if(!n&&o.defaultTabComponent&&(n=$(e,o.defaultTabComponent)),n)return new fn(n,e)},createWatermarkComponent:o.watermarkComponent?()=>new pn($(e,o.watermarkComponent),e):void 0,createLeftHeaderActionComponent:o.leftHeaderActionsComponent?t=>new mn($(e,o.leftHeaderActionsComponent),e,t):void 0,createPrefixHeaderActionComponent:o.prefixHeaderActionsComponent?t=>new mn($(e,o.prefixHeaderActionsComponent),e,t):void 0,createRightHeaderActionComponent:o.rightHeaderActionsComponent?t=>new mn($(e,o.rightHeaderActionsComponent),e,t):void 0},a=sn(s.value,t(t({},r(o)),n)),{clientWidth:d,clientHeight:f}=s.value;a.layout(d,f),c.value=u(a),i(`ready`,{api:a})}),d(()=>{c.value&&c.value.dispose()}),(e,t)=>(p(),a(`div`,{ref_key:`el`,ref:s},null,512))}}),gn={class:`dockview-custom-window-tab`},_n=n(Object.assign({name:`nc-dockview-window-tab`},{__name:`nc-dockview-window-tab`,props:{title:{type:String,required:!1}},setup(e){return(e,t)=>(p(),a(`div`,gn,[...t[0]||(t[0]=[o(`span`,null,`Window`,-1)])]))}}),[[`__scopeId`,`data-v-78442960`]]),vn={class:`dockview-empty-component`},yn=Object.assign({name:`nc-dockview-empty`},{__name:`nc-dockview-empty`,setup(e){return(e,t)=>(p(),a(`div`,vn))}}),bn=Object.assign({name:`nc-dockview`,components:{DockviewVue:hn,"temp-test-comp":`nc-grid`,"window-tab":_n,empty:yn}},{__name:`nc-dockview`,setup(e){let t=m([]);function n(e){let n=[{id:`window_panel_1`,title:`Window 1`,tabComponent:`window-tab`,component:`empty`,group:{locked:!0},custom:{keepReference:!0}},{id:`window_panel_2`,title:`Window 2`,tabComponent:`window-tab`,component:`empty`,position:{referenceGroup:`window_panel_1`,direction:`right`},group:{locked:!0},custom:{keepReference:!0}},{id:`window_panel_3`,title:`Window 3`,tabComponent:`window-tab`,component:`empty`,position:{referenceGroup:`window_panel_1`,direction:`below`},group:{locked:!0},custom:{keepReference:!0}},{id:`panel_1`,title:`Panel 01`,component:`temp-test-comp`,position:{referenceGroup:`window_panel_1`}},{id:`panel_2`,title:`Panel 02`,component:`temp-test-comp`,position:{referenceGroup:`window_panel_2`}},{id:`panel_3`,title:`Panel 03`,component:`temp-test-comp`},{id:`panel_4`,title:`Panel 04`,component:`temp-test-comp`,position:{referenceGroup:`window_panel_3`}},{id:`panel_5`,title:`Panel 05`,component:`temp-test-comp`},{id:`panel_6`,title:`Panel 06`,component:`temp-test-comp`}],r=e.api;console.debug(` ** Dockview is ready. Here's the API:`,r);for(let r of n){if(t&&r.position){let e=r.position.referenceGroup;r.position.referenceGroup=t.value[e].group}let n=e.api.addPanel(r);r.custom&&r.custom.keepReference&&(t.value[r.id]=n)}}return(e,t)=>(p(),i(g(hn),{class:`dockview-theme-light`,onReady:n,singleTabMode:`fullWidth`}))}});export{bn as default};